X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FAssertions.hs;h=4e09b82974f301762dcdefcd0253e50ceeec3459;hb=8c7f684c5b1a6941a552d2101aff70fe1f9a23ec;hp=6641e8c988c146026bd79191f8d7f7c4273f64c8;hpb=23f7d3668482dfbe768bc3009b92836e94578137;p=spline3.git diff --git a/src/Assertions.hs b/src/Assertions.hs index 6641e8c..4e09b82 100644 --- a/src/Assertions.hs +++ b/src/Assertions.hs @@ -5,10 +5,12 @@ module Assertions where import Control.Monad (unless) -import Test.HUnit +import Test.HUnit (Assertion, + assertBool, + assertFailure) + +import Comparisons ((~=)) -import Comparisons -import Point -- | An HUnit assertion that wraps the almost_equals function. Stolen -- from the definition of 'assertEqual' in Test\/HUnit\/Base.hs. @@ -19,13 +21,7 @@ assertAlmostEqual preface expected actual = "expected: " ++ show expected ++ "\n but got: " ++ show actual --- | An HUnit assertion that wraps the is_close function. Stolen --- 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