check lat/lon attrs in test

This commit is contained in:
Daniel Barlow 2024-10-29 19:21:25 +00:00
parent 6b6c1d487e
commit 1a1186fbff
2 changed files with 13 additions and 6 deletions

View File

@ -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

View File

@ -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 [