timestamp is optional
This commit is contained in:
parent
a762245d86
commit
cf6d4cf9c0
@ -9,7 +9,7 @@ type alias Point =
|
|||||||
{ lat : Float
|
{ lat : Float
|
||||||
, lon : Float
|
, lon : Float
|
||||||
, ele : Maybe Float
|
, ele : Maybe Float
|
||||||
, time : Time.Posix
|
, time : Maybe Time.Posix
|
||||||
}
|
}
|
||||||
|
|
||||||
type alias Track = List Point
|
type alias Track = List Point
|
||||||
@ -26,7 +26,7 @@ pointDecoder = XD.map4 Point
|
|||||||
(floatAttr "lat")
|
(floatAttr "lat")
|
||||||
(floatAttr "lon")
|
(floatAttr "lon")
|
||||||
(XD.maybe (path ["ele"] (single XD.float)))
|
(XD.maybe (path ["ele"] (single XD.float)))
|
||||||
(path ["time"] (single timeDecoder))
|
(XD.maybe (path ["time"] (single timeDecoder)))
|
||||||
|
|
||||||
|
|
||||||
gpxDecoder =
|
gpxDecoder =
|
||||||
|
@ -65,7 +65,7 @@ xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
threepoints_expected =
|
threepoints_expected =
|
||||||
[ (Point 51.600643 -0.01856 (Just 64.8) (Time.millisToPosix 1729669252256))
|
[ (Point 51.600643 -0.01856 (Just 64.8) (Just (Time.millisToPosix 1729669252256)))
|
||||||
, (Point 51.600679 -0.018179 (Just 65.5) (Time.millisToPosix 1729669255259))
|
, (Point 51.600679 -0.018179 (Just 65.5) (Just (Time.millisToPosix 1729669255259)))
|
||||||
, (Point 51.600697 -0.018064 (Just 66.2) (Time.millisToPosix 1729669256231))
|
, (Point 51.600697 -0.018064 (Just 66.2) (Just (Time.millisToPosix 1729669256231)))
|
||||||
]
|
]
|
||||||
|
@ -23,7 +23,7 @@ specs =
|
|||||||
Fixtures.threepoints
|
Fixtures.threepoints
|
||||||
in
|
in
|
||||||
case Track.parse xml of
|
case Track.parse xml of
|
||||||
Ok (p::pts) -> Expect.equal p (Point 51.600643 -0.01856 Nothing (Time.millisToPosix 1729669252256))
|
Ok (p::pts) -> Expect.equal p (Point 51.600643 -0.01856 Nothing (Just (Time.millisToPosix 1729669252256)))
|
||||||
Ok _ -> Expect.fail "empty list"
|
Ok _ -> Expect.fail "empty list"
|
||||||
(Err f) -> Expect.fail f
|
(Err f) -> Expect.fail f
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user