Copyright | (C) 2014 Richard Eisenberg |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | Richard Eisenberg (rae@cs.brynmawr.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 :: (HasCallStack, Ord a, Num a, Show a) => String -> a -> a -> a -> Assertion
- (@~?) :: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Assertion
- (@?~) :: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Assertion
- (~~?) :: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Test
- (~?~) :: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) => a -> a -> Test
Assertions
:: (HasCallStack, 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.
:: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) | |
=> a | The expected value |
-> a | The actual value |
-> Assertion |
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
.
:: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) | |
=> a | The actual value |
-> a | The expected value |
-> Assertion |
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
:: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) | |
=> a | The expected value |
-> a | The actual value |
-> Test |
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).