HUnit-approx-1.1.1.1: Approximate equality for floating point numbers with HUnit

Copyright (C) 2014 Richard Eisenberg BSD-style (see LICENSE) Richard Eisenberg (rae@cs.brynmawr.edu) intended to be stable not portable (uses implicit parameters) Safe Haskell2010

Test.HUnit.Approx

Contents

Description

This module exports combinators to allow approximate equality of floating-point values in HUnit tests.

Synopsis

# Assertions

Arguments

 :: (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.

(@~?) infix 1 Source #

Arguments

 :: (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.

(@?~) infix 1 Source #

Arguments

 :: (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

(~~?) infix 1 Source #

Arguments

 :: (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).

(~?~) infix 1 Source #

Arguments

 :: (HasCallStack, Ord a, Num a, Show a, ?epsilon :: a) => a The actual value -> a The expected value -> Test

Shorthand for a test case that asserts approximate equality (with the actual value on the left-hand side, and the expected value on the right-hand side).