git.iko.soy/typeable/country-codes
on 0.1.2 help sign in
typeable/country-codes/test/country-codes-tests.hs
30 lines 775 B history raw
1{-# OPTIONS_GHC -F -pgmF htfpp #-}
2-- | entry module for tests
3module Main where
5import Control.Monad (forM_)
6import Data.Aeson
7import Test.Framework
8import Test.HUnit (Assertion)
11import Data.CountryCodes
13-- | test entry point
14main :: IO()
15main = htfMain [htf_thisModulesTests]
17-- | CountryCode -> Text -> CountryCode
18test_Text :: Assertion
19test_Text = forM_ [minBound .. maxBound] $ \c ->
20 assertEqual c (fromText $ toText c)
22-- | CountryCode -> name -> CountryCode
23test_Name :: Assertion
24test_Name = forM_ [minBound .. maxBound] $ \c ->
25 assertEqual c (fromName $ toName c)
27-- | CountryCode -> JSON -> CountryCode
28test_JSON :: Assertion
29test_JSON = forM_ ([minBound .. maxBound]::[CountryCode]) $ \c ->
30 assertEqual (Data.Aeson.Success c) (fromJSON $ toJSON c)