Skip to content

Commit

Permalink
Add Distance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Dec 6, 2024
1 parent f98060f commit 51a1d7f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/unit/Unit/Running/Data/Distance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ tests =
testGroup
"Running.Data.Distance"
[ parseTests,
equalityTests
equalityTests,
displayTests
]

parseTests :: TestTree
Expand Down Expand Up @@ -128,6 +129,19 @@ testEqualityCases = testCase "Tests expected equality cases" $ do
mkDistanceD @d 10_000 @/=? mkDistanceD 9_999.1
mkDistanceD @d 10_000 @/=? mkDistanceD 9_998.9

displayTests :: TestTree
displayTests =
testGroup
"Display"
[ testDisplayCases
]

testDisplayCases :: TestTree
testDisplayCases = testCase "Displays expected" $ do
"10000.9 m" @=? display (mkDistanceD @Meter 10_000.9)
"10000.9 km" @=? display (mkDistanceD @Kilometer 10_000.9)
"10000.9 mi" @=? display (mkDistanceD @Mile 10_000.9)

genDistance :: Gen (SomeDistance Double)
genDistance = do
d <- Utils.genDoubleNN
Expand Down

0 comments on commit 51a1d7f

Please sign in to comment.