1901835f9321ae9e1b7c0a2d80e741863cbc3fa4
[packages/time.git] / test / main / Test / Calendar / Easter.hs
1 module Test.Calendar.Easter(testEaster) where
2
3 import Data.Time.Calendar.Easter
4 import Data.Time.Calendar
5 import Data.Time.Format
6
7 import Test.Tasty
8 import Test.Tasty.HUnit
9 import Test.Calendar.EasterRef
10
11 --
12
13 days :: [Day]
14 days = [ModifiedJulianDay 53000 .. ModifiedJulianDay 53014]
15
16 showWithWDay :: Day -> String
17 showWithWDay = formatTime defaultTimeLocale "%F %A"
18
19 testEaster :: TestTree
20 testEaster = testCase "testEaster" $ let
21 ds = unlines $ map (\day ->
22 unwords [ showWithWDay day, "->"
23 , showWithWDay (sundayAfter day)]) days
24
25 f y = unwords [ show y ++ ", Gregorian: moon,"
26 , show (gregorianPaschalMoon y) ++ ": Easter,"
27 , showWithWDay (gregorianEaster y)]
28 ++ "\n"
29
30 g y = unwords [ show y ++ ", Orthodox : moon,"
31 , show (orthodoxPaschalMoon y) ++ ": Easter,"
32 , showWithWDay (orthodoxEaster y)]
33 ++ "\n"
34
35 in assertEqual "" testEasterRef $ ds ++ concatMap (\y -> f y ++ g y) [2000..2020]