]> gitweb @ CieloNegro.org - time-w3c.git/blob - tests/FormatterTest.hs
more tests
[time-w3c.git] / tests / FormatterTest.hs
1 module FormatterTest
2     ( testData
3     )
4     where
5
6 import Data.Time
7 import Data.Time.W3C
8 import Test.HUnit
9
10
11 testData :: [Test]
12 testData = [ format (W3CDateTime 2010 Nothing Nothing Nothing Nothing Nothing Nothing)
13              ~?=
14              "2010"
15
16            , format (W3CDateTime 2010 (Just 12) Nothing Nothing Nothing Nothing Nothing)
17              ~?=
18              "2010-12"
19
20            , format (W3CDateTime 2010 (Just 12) (Just 31) Nothing Nothing Nothing Nothing)
21              ~?=
22              "2010-12-31"
23
24            , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) Nothing (Just utc))
25              ~?=
26              "2010-12-31T01:23Z"
27
28            , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) (Just 45) (Just (hoursToTimeZone 9)))
29              ~?=
30              "2010-12-31T01:23:45+09:00"
31
32            , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) (Just 45.666666) (Just (hoursToTimeZone 9)))
33              ~?=
34              "2010-12-31T01:23:45.666666+09:00"
35            ]