numeric-prelude-0.0.2: test/Test/NumericPrelude/Utility.hs
module Test.NumericPrelude.Utility where
import qualified Data.List as List
import qualified Test.HUnit as HUnit
testUnit :: (String, IO ()) -> HUnit.Test
testUnit (label, check) =
HUnit.TestLabel label (HUnit.TestCase check)
equalLists :: Eq a => [[a]] -> Bool
equalLists xs =
let equalElems ys =
and (zipWith (==) ys (tail ys)) && length xs == length ys
in all equalElems (List.transpose xs)
equalInfLists :: Eq a => Int -> [[a]] -> Bool
equalInfLists n xs = equalLists (map (take n) xs)