@@ -7,33 +7,31 @@ Maintainer: Kowainik <xrom.xkov@gmail.com>
7
7
-}
8
8
9
9
module Test.Relude.Property
10
- ( hedgehogTestTree
10
+ ( hedgehogTestList
11
11
) where
12
12
13
13
import Relude
14
14
15
15
import Data.List (nub )
16
- import Hedgehog (Gen , Property , assert , forAll , property , (===) )
17
- import Test.Tasty (TestTree , testGroup )
18
- import Test.Tasty.Hedgehog
16
+ import Hedgehog (Gen , Property , Group (.. ), assert , forAll , property , (===) )
19
17
20
18
import qualified Hedgehog.Gen as Gen
21
19
import qualified Hedgehog.Range as Range
22
20
23
- hedgehogTestTree :: TestTree
24
- hedgehogTestTree = testGroup " Tests " [utfProps, listProps, boolMProps ]
21
+ hedgehogTestList :: [ Group ]
22
+ hedgehogTestList = [utfProps, listProps, logicProps ]
25
23
26
24
----------------------------------------------------------------------------
27
25
-- utf8 conversion
28
26
----------------------------------------------------------------------------
29
27
30
- utfProps :: TestTree
31
- utfProps = testGroup " utf8 conversion property tests"
32
- [ testProperty " String to ByteString invertible" prop_StringToBytes
33
- , testProperty " Text to ByteString invertible" prop_TextToBytes
34
- , testProperty " ByteString to Text or String invertible" prop_BytesTo
28
+ utfProps :: Group
29
+ utfProps = Group " utf8 conversion property tests"
30
+ [ ( " String to ByteString invertible: " , prop_StringToBytes)
31
+ , ( " Text to ByteString invertible: " , prop_TextToBytes)
32
+ , ( " ByteString to Text or String invertible: " , prop_BytesTo)
35
33
]
36
-
34
+
37
35
utf8String :: Gen String
38
36
utf8String = Gen. string (Range. linear 0 1000 ) Gen. unicode
39
37
@@ -72,14 +70,14 @@ prop_BytesTo = property $ do
72
70
-- ordNub
73
71
----------------------------------------------------------------------------
74
72
75
- listProps :: TestTree
76
- listProps = testGroup " list function property tests"
77
- [ testProperty " ordNub xs == nub xs" prop_ordNubCorrect
78
- , testProperty " hashNub xs == nub xs" prop_hashNubCorrect
79
- , testProperty " sortNub xs == sort (nub xs)" prop_sortNubCorrect
80
- , testProperty " sort (unstableNub xs) == sort (nub xs)" prop_unstableNubCorrect
73
+ listProps :: Group
74
+ listProps = Group " list function property tests"
75
+ [ ( " ordNub xs == nub xs: " , prop_ordNubCorrect)
76
+ , ( " hashNub xs == nub xs: " , prop_hashNubCorrect)
77
+ , ( " sortNub xs == sort (nub xs): " , prop_sortNubCorrect)
78
+ , ( " sort (unstableNub xs) == sort (nub xs): " , prop_unstableNubCorrect)
81
79
]
82
-
80
+
83
81
genIntList :: Gen [Int ]
84
82
genIntList = Gen. list (Range. linear 0 1000 ) Gen. enumBounded
85
83
@@ -107,15 +105,15 @@ prop_unstableNubCorrect = property $ do
107
105
-- logicM
108
106
----------------------------------------------------------------------------
109
107
108
+ logicProps :: Group
109
+ logicProps = Group " lifted logic function property tests"
110
+ [ (" andM:" , prop_andM)
111
+ , (" orM:" , prop_orM)
112
+ ]
113
+
110
114
genBoolList :: Gen [Bool ]
111
115
genBoolList = Gen. list (Range. linear 0 1000 ) Gen. bool
112
116
113
- boolMProps :: TestTree
114
- boolMProps = testGroup " lifted logic function property tests"
115
- [ testProperty " andM" prop_andM
116
- , testProperty " orM" prop_orM
117
- ]
118
-
119
117
prop_andM :: Property
120
118
prop_andM = property $ do
121
119
bs <- forAll genBoolList
0 commit comments