commit 1a1186fbffd517a9395f7a0392ab37806d91ed6c
parent 6b6c1d487e3c2942cc8b323e1be7b8978879aa87
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 29 Oct 2024 19:21:25 +0000
check lat/lon attrs in test
Diffstat:
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/lib/Track.hs b/lib/Track.hs
@@ -1,6 +1,12 @@
{-# LANGUAGE OverloadedStrings #-}
-module Track where
+module Track (
+ Track,
+ Pos(..),
+ pos,
+ parse,
+ Track.length
+ ) where
import Data.Time
import qualified Data.List
-- import qualified Text.XML as X
@@ -14,7 +20,7 @@ import Data.List as List
import Data.Map as Map
import Control.Exception
-data Pos = Pos Float Float Float deriving (Show)
+data Pos = Pos Float Float Float deriving (Show, Eq)
type Power = Maybe Int
diff --git a/tests/UnitTest.hs b/tests/UnitTest.hs
@@ -1,6 +1,6 @@
module Main where
-import qualified Track (Track, parse, length )
+import qualified Track (Track, Pos(..), pos, parse, length )
import Test.HUnit
import qualified System.Exit as Exit
import Control.Exception
@@ -21,9 +21,10 @@ test2 = TestCase $
\</trkseg> </trk> </gpx>"
of
Left err -> assertFailure (displayException err)
- Right trk ->
- traceShow trk $
- assertEqual "one el" 1 (Track.length trk)
+ Right (p:ps) ->
+ assertEqual "matches lat/lon"
+ (Track.pos p)
+ (Track.Pos 51.0 (-0.1) 0.0)
tests :: Test
tests = TestList [