aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-11-30 23:00:52 +0000
committerYann Herklotz <ymherklotz@gmail.com>2018-11-30 23:00:52 +0000
commitc4c80116eca7d498176b3f6fb8278f5bf8a17ea3 (patch)
tree33c5aa9180bee08c1edb6df0ea8a182673f2f6ea /tests
parent1f6343a964216ac67255df1c00412c672cda0784 (diff)
downloadverismith-c4c80116eca7d498176b3f6fb8278f5bf8a17ea3.tar.gz
verismith-c4c80116eca7d498176b3f6fb8278f5bf8a17ea3.zip
Add first property test
Diffstat (limited to 'tests')
-rw-r--r--tests/Property.hs20
-rw-r--r--tests/Test.hs15
-rw-r--r--tests/Unit.hs13
3 files changed, 36 insertions, 12 deletions
diff --git a/tests/Property.hs b/tests/Property.hs
new file mode 100644
index 0000000..ba9152e
--- /dev/null
+++ b/tests/Property.hs
@@ -0,0 +1,20 @@
+module Property (propertyTests) where
+
+import Data.Graph.Inductive
+import Test.Tasty
+import Test.Tasty.QuickCheck as QC
+import Test.VeriFuzz
+
+newtype TestGraph = TestGraph { getGraph :: Gr Gate ()}
+ deriving (Show)
+
+instance QC.Arbitrary TestGraph where
+ arbitrary = TestGraph <$> randomDAG 100
+
+simpleGraph = QC.testProperty "simple graph generation" $
+ \graph -> isSimple (getGraph (graph :: TestGraph)) == True
+
+propertyTests :: TestTree
+propertyTests = testGroup "Property"
+ [ simpleGraph
+ ]
diff --git a/tests/Test.hs b/tests/Test.hs
index 0c631b8..0eb9e0a 100644
--- a/tests/Test.hs
+++ b/tests/Test.hs
@@ -1,19 +1,10 @@
module Main where
+import Property
import Test.Tasty
-import Test.Tasty.HUnit
-import Test.Tasty.QuickCheck as QC
-
-unitTests = testGroup "Unit tests"
- [ testCase "List comparison (different length)" $
- [1, 2, 3] `compare` [1,2] @?= GT
-
- -- the following test does not hold
- , testCase "List comparison (same length)" $
- [1, 2, 3] `compare` [1,2,2] @?= GT
- ]
+import Unit
tests :: TestTree
-tests = testGroup "Tests" [unitTests]
+tests = testGroup "Tests" [unitTests, propertyTests]
main = defaultMain tests
diff --git a/tests/Unit.hs b/tests/Unit.hs
new file mode 100644
index 0000000..a04098b
--- /dev/null
+++ b/tests/Unit.hs
@@ -0,0 +1,13 @@
+module Unit (unitTests) where
+
+import Test.Tasty
+import Test.Tasty.HUnit
+
+unitTests = testGroup "Unit tests"
+ [ testCase "List comparison (different length)" $
+ [1, 2, 3] `compare` [1,2] @?= GT
+
+ -- the following test does not hold
+ , testCase "List comparison (same length)" $
+ [1, 2, 3] `compare` [1,2,2] @?= GT
+ ]