08547780655ff269aefd9adcf500e630d5d0aa41
[packages/time.git] / test / main / Test / Calendar / Calendars.hs
1 module Test.Calendar.Calendars(testCalendars) where
2
3 import Data.Time.Calendar.Julian
4 import Data.Time.Calendar.WeekDate
5 import Data.Time.Calendar
6 import Test.Tasty
7 import Test.Tasty.HUnit
8 import Test.Calendar.CalendarsRef
9
10 showers :: [(String,Day -> String)]
11 showers = [
12 ("MJD",show . toModifiedJulianDay),
13 ("Gregorian",showGregorian),
14 ("Julian",showJulian),
15 ("ISO 8601",showWeekDate)
16 ]
17
18 days :: [Day]
19 days = [
20 fromGregorian 0 12 31,
21 fromJulian 1752 9 2,
22 fromGregorian 1752 9 14,
23 fromGregorian 2005 1 23
24 ]
25
26 testCalendars :: TestTree
27 testCalendars = testCase "testCalendars" $
28 assertEqual "" testCalendarsRef $ unlines $ map (\d -> showShowers d) days
29 where
30 showShowers day =
31 concatMap (\(nm,shower) -> unwords [" ==", nm, shower day]) showers