module Main where import qualified Track (Track, Pos(..), pos, parse, length ) import Test.HUnit import qualified System.Exit as Exit import Control.Exception import Debug.Trace (trace, traceShow) test1 :: Test test1 = TestCase $ case Track.parse "" of Left err -> assertFailure (displayException err) Right t -> assertEqual "empty track has no elements" 0 (Track.length t) test2 = TestCase $ case Track.parse " \n\ \ \n\ \ " of Left err -> assertFailure (displayException err) Right (p:ps) -> assertEqual "matches lat/lon" (Track.pos p) (Track.Pos 51.0 (-0.1)) tests :: Test tests = TestList [ TestLabel "test1" test1, TestLabel "test2" test2 ] main :: IO () main = do result <- runTestTT tests if failures result > 0 then Exit.exitFailure else Exit.exitSuccess