1 module UnitTests
.Distribution
.Utils
.ShortText
5 import Data
.Monoid
as Mon
7 import Test
.Tasty
.QuickCheck
9 import Distribution
.Compat
.Binary
(encode
, decode
)
11 import Distribution
.Utils
.ShortText
13 prop_ShortTextOrd
:: String -> String -> Bool
14 prop_ShortTextOrd a b
= compare a b
== compare (toShortText a
) (toShortText b
)
16 prop_ShortTextMonoid
:: String -> String -> Bool
17 prop_ShortTextMonoid a b
= Mon
.mappend a b
== fromShortText
(mappend
(toShortText a
) (toShortText b
))
19 prop_ShortTextId
:: String -> Bool
20 prop_ShortTextId a
= (fromShortText
. toShortText
) a
== a
22 prop_ShortTextBinaryId
:: String -> Bool
23 prop_ShortTextBinaryId a
= (decode
. encode
) a
' == a
'
29 [ testProperty
"ShortText Id" prop_ShortTextId
30 , testProperty
"ShortText Ord" prop_ShortTextOrd
31 , testProperty
"ShortText Monoid" prop_ShortTextMonoid
32 , testProperty
"ShortText BinaryId" prop_ShortTextBinaryId