format everything with hindent
[packages/time.git] / test / main / Test / Clock / Conversion.hs
1 module Test.Clock.Conversion
2 ( testClockConversion
3 ) where
4
5 import Data.Time.Clock
6 import Data.Time.Clock.System
7 import Test.Tasty
8 import Test.Tasty.HUnit
9
10 testClockConversion :: TestTree
11 testClockConversion =
12 testGroup "clock conversion" $ let
13 testPair :: (SystemTime, UTCTime) -> TestTree
14 testPair (st, ut) =
15 testGroup (show ut) $
16 [ testCase "systemToUTCTime" $ assertEqual (show ut) ut $ systemToUTCTime st
17 , testCase "utcToSystemTime" $ assertEqual (show ut) st $ utcToSystemTime ut
18 ]
19 in [ testPair (MkSystemTime 0 0, UTCTime systemEpochDay 0)
20 , testPair (MkSystemTime 86399 0, UTCTime systemEpochDay 86399)
21 , testPair (MkSystemTime 86399 999999999, UTCTime systemEpochDay 86399.999999999)
22 , testPair (MkSystemTime 86399 1000000000, UTCTime systemEpochDay 86400)
23 , testPair (MkSystemTime 86399 1999999999, UTCTime systemEpochDay 86400.999999999)
24 , testPair (MkSystemTime 86400 0, UTCTime (succ systemEpochDay) 0)
25 ]