AC-MiniTest-1.1.1: A simple test framework.

Safe HaskellSafe-Infered

Test.AC.Class.Ord

Description

Properties for testing that instances of the Ord class perform correctly.

p_symmetric and p_transitive check the basic properties of the ordering. In other words, they test the compare method. p_equal checks that Ord agrees with Eq (that is, compare returns EQ when == returns True). The Test.AC.Class.Eq module already checks that Eq is reflexive, so if Ord agrees with Eq then Ord too is reflexive, and we don't need a seperate test for that. The remaining tests (i.e., p_compare, p_min and p_max) check for the extraordinarily unlikely case that the various Ord methods do not agree with each other. (Usually they are implemented in terms of each other.)

Synopsis

Documentation

p_equal :: (Show x, Ord x) => x -> x -> TestSource

Check that compare agrees with == on equity.

p_symmetric :: (Show x, Ord x) => x -> x -> TestSource

Check that swapping the arguments to compare works correctly.

p_transitive :: (Show x, Ord x) => x -> x -> x -> TestSource

Check that if x < y and y < z then x < z.

p_compare :: (Show x, Ord x) => x -> x -> TestSource

Check that compare agrees with >, <, etc.

p_min :: (Show x, Ord x) => x -> x -> TestSource

Check that min works correctly.

p_max :: (Show x, Ord x) => x -> x -> TestSource

Check that max works correctly.

p_Ord :: (Show x, Ord x) => [x] -> TestSource

Given a list of distinct values, perform all applicable tests on all possible combinations of inputs. (If the inputs are not distinct, some redundant tests are performed.)