git.iko.soy/typeable/generic-arbitrary
on master help sign in
enum test
commit949d4d958639e5f9e55d3711e8fc89cea2676ef3 authorAleksey Uymanov <s9gf4ult@gmail.com> dateFri 12 Jan 2024, 12:51 (3 years ago) parent97851dd
2 files changed+19
generic-arbitrary.cabal+1 test/EnumTest.hs+18
generic-arbitrary.cabal+1
@@ -66,6 +66,7 @@ test-suite test
6666 , tasty-hunit
6767 , tasty-quickcheck
6868 other-modules: Auxiliary
69+ , EnumTest
6970 , LimitationDemo
7071 , NoTypecheckTest
7172 , ParametersTest
test/EnumTest.hsnew file+18
@@ -0,0 +1,18 @@
1+{-# OPTIONS_GHC -fconstraint-solver-iterations=6 #-}
2+
3+module EnumTest where
4+
5+import Control.DeepSeq
6+import GHC.Generics
7+import Test.QuickCheck
8+import Test.QuickCheck.Arbitrary.Generic
9+
10+data Country = PL | GB | RU | RO | CZ | HR | SK | DE | NL | ES | BR
11+ deriving (Generic, NFData, Show)
12+
13+instance Arbitrary Country where
14+ arbitrary = genericArbitrary
15+ shrink = genericShrink
16+
17+prop_CountryTest :: Country -> Property
18+prop_CountryTest = total