File: Features.hs

package info (click to toggle)
haskell-text-builder-dev 0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 104 kB
  • sloc: haskell: 587; makefile: 3
file content (44 lines) | stat: -rw-r--r-- 1,433 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
module Features (tests) where

import Data.Int
import Data.String
import Data.Time
import Data.Time.Format.ISO8601 (iso8601Show)
import Data.Word
import qualified Features.StrictBuilder as StrictBuilder
import qualified Features.StrictTextBuilder as StrictTextBuilder
import Numeric.Natural (Natural)
import Test.QuickCheck.Instances ()
import Test.Tasty
import Test.Tasty.QuickCheck
import TextBuilderDev
import Util.TestTrees
import Prelude

tests :: [TestTree]
tests =
  [ testGroup "StrictBuilder" StrictBuilder.tests,
    testGroup "StrictTextBuilder" StrictTextBuilder.tests,
    testGroup "doubleFixedPoint" $
      [ mapsToMonoid (doubleFixedPoint 3)
      ],
    testGroup "doubleFixedPointPercent" $
      [ mapsToMonoid (doubleFixedPointPercent 3)
      ],
    testGroup "utcTimeIso8601Timestamp" $
      [ mapsToMonoid utcTimeIso8601Timestamp,
        testProperty "Same as iso8601Show" $ \x ->
          let roundedToSecondsTime =
                x {utctDayTime = (fromIntegral @Int . round . utctDayTime) x}
           in (fromString . flip mappend "Z" . take 19 . iso8601Show) roundedToSecondsTime
                === toText (utcTimeIso8601Timestamp roundedToSecondsTime)
      ],
    testGroup "approximateDataSize" $
      [ testGroup "Word" $
          [ mapsToMonoid @Word approximateDataSize
          ],
        testGroup "Natural" $
          [ mapsToMonoid @Natural approximateDataSize
          ]
      ]
  ]