packages feed

time-w3c-0.1: tests/FormatterTest.hs

module FormatterTest
    ( testData
    )
    where

import Data.Time
import Data.Time.W3C
import Test.HUnit


testData :: [Test]
testData = [ format (W3CDateTime 2010 Nothing Nothing Nothing Nothing Nothing Nothing)
             ~?=
             "2010"

           , format (W3CDateTime 2010 (Just 12) Nothing Nothing Nothing Nothing Nothing)
             ~?=
             "2010-12"

           , format (W3CDateTime 2010 (Just 12) (Just 31) Nothing Nothing Nothing Nothing)
             ~?=
             "2010-12-31"

           , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) Nothing (Just utc))
             ~?=
             "2010-12-31T01:23Z"

           , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) (Just 45) (Just (hoursToTimeZone 9)))
             ~?=
             "2010-12-31T01:23:45+09:00"

           , format (W3CDateTime 2010 (Just 12) (Just 31) (Just 1) (Just 23) (Just 45.666666) (Just (hoursToTimeZone 9)))
             ~?=
             "2010-12-31T01:23:45.666666+09:00"
           ]