Copyright | (C) 2014 Richard Eisenberg |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Richard Eisenberg (eir@cis.upenn.edu) |
Stability | intended to be stable |
Portability | not portable (uses implicit parameters) |
Safe Haskell | Safe |
Language | Haskell2010 |
This module exports combinators to allow approximate equality of floating-point values in HUnit tests.
- assertApproxEqual :: (Ord a, Num a, Show a) => String -> a -> a -> a -> Assertion
- (@~?) :: (Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Assertion
- (@?~) :: (Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Assertion
- (~~?) :: (Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Test
- (~?~) :: (Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Test
Assertions
:: (Ord a, Num a, Show a) | |
=> String | The message prefix |
-> a | Maximum allowable margin of error |
-> a | The expected value |
-> a | The actual value |
-> Assertion |
Asserts that the specified actual value is approximately equal to the expected value. The output message will contain the prefix, the expected value, the actual value, and the maximum margin of error.
If the prefix is the empty string (i.e., ""
), then the prefix is omitted
and only the expected and actual values are output.
Asserts that the specified actual value is approximately equal to the
expected value (with the expected value on the left-hand side). The margin
of error is specified with the implicit parameter epsilon
.
Asserts that the specified actual value is approximately equal to the
expected value (with the expected value on the right-hand side). The margin
of error is specified with the implicit parameter epsilon
.
Tests
Shorthand for a test case that asserts approximate equality (with the expected value on the left-hand side, and the actual value on the right-hand side).