git.iko.soy/typeable/generic-arbitrary
on master help sign in
add failing tests
c58b7fcAleksey Uymanov
generic-arbitrary.cabal+21
@@ -28,3 +28,24 @@ library
28 build-depends: QuickCheck >= 2.14, base >=4.8 && <5
28 build-depends: QuickCheck >= 2.14, base >=4.8 && <5
29 hs-source-dirs: src
29 hs-source-dirs: src
30 default-language: Haskell2010
30 default-language: Haskell2010
31+
32+test-suite test
33+ type: exitcode-stdio-1.0
34+ hs-source-dirs: test
35+ main-is: Test.hs
36+ default-language: Haskell2010
37+ build-depends: base >= 4.8 && <5
38+ , QuickCheck
39+ , deepseq
40+ , generic-arbitrary
41+ , tasty
42+ , tasty-discover
43+ , tasty-quickcheck
44+ other-modules: RecursiveTest
45+ build-tools: tasty-discover
46+ ghc-options: -Wall
47+ -threaded
48+ -rtsopts
49+ "-with-rtsopts=-N -A64m -qb0 -n4m -T -I1"
50+ ghc-prof-options: -fprof-auto
51+ default-extensions: DeriveGeneric
test/RecursiveTest.hsnew file+23
@@ -0,0 +1,23 @@
1+module RecursiveTest where
2+
3+import Control.DeepSeq
4+import GHC.Generics (Generic)
5+import Test.QuickCheck
6+import Test.QuickCheck.Arbitrary.Generic
7+
8+data Expr
9+ = Lit Int
10+ | Add Expr Expr
11+ | Mul Expr Expr
12+ deriving (Eq, Show, Generic)
13+
14+-- | Instance with may fall into infinite loop
15+instance Arbitrary Expr where
16+ arbitrary = genericArbitrary
17+ shrink = genericShrink
18+
19+instance NFData Expr
20+
21+-- | Check that we are not generating infinite
22+prop_exprTotal :: Expr -> Property
23+prop_exprTotal = total
test/Test.hsnew file+1
@@ -0,0 +1 @@
1+{-# OPTIONS_GHC -F -pgmF tasty-discover #-}