]> gitweb.michael.orlitzky.com - spline3.git/blobdiff - src/Assertions.hs
Remove some dead code.
[spline3.git] / src / Assertions.hs
index 44d793b989be2f4eb83955995adfca976e4cfb9b..b2ec7c15ef70fee0ad4b9c189ce9249b4c33b7f8 100644 (file)
@@ -5,13 +5,15 @@ module Assertions
 where
 
 import Control.Monad (unless)
-import Test.HUnit
+import Test.HUnit (Assertion,
+                   assertBool,
+                   assertFailure)
 
-import Comparisons
-import Point
+import Comparisons ((~=))
+import Point (Point, is_close)
 
 -- | An HUnit assertion that wraps the almost_equals function. Stolen
---   from the definition of 'assertEqual' in Test/HUnit/Base.hs.
+--   from the definition of 'assertEqual' in Test\/HUnit\/Base.hs.
 assertAlmostEqual :: String -> Double -> Double -> Assertion
 assertAlmostEqual preface expected actual =
   unless (actual ~= expected) (assertFailure msg)
@@ -20,9 +22,14 @@ assertAlmostEqual preface expected actual =
 
 
 -- | An HUnit assertion that wraps the is_close function. Stolen
---   from the definition of 'assertEqual' in Test/HUnit/Base.hs.
+--   from the definition of 'assertEqual' in Test\/HUnit\/Base.hs.
 assertClose :: String -> Point -> Point -> Assertion
 assertClose preface expected actual =
   unless (actual `is_close` expected) (assertFailure msg)
     where msg = (if null preface then "" else preface ++ "\n") ++
                 "expected: " ++ show expected ++ "\n but got: " ++ show actual
+
+
+-- | It's asinine that this doesn't exist already.
+assertTrue :: String -> Bool -> Assertion
+assertTrue = assertBool