aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test/VeriFuzz/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Test/VeriFuzz/Types.hs')
-rw-r--r--src/Test/VeriFuzz/Types.hs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Test/VeriFuzz/Types.hs b/src/Test/VeriFuzz/Types.hs
index 9c0de17..0528972 100644
--- a/src/Test/VeriFuzz/Types.hs
+++ b/src/Test/VeriFuzz/Types.hs
@@ -1,8 +1,21 @@
-module VeriFuzz.Types where
+module Test.VeriFuzz.Types where
+
+import Test.QuickCheck
+import System.Random
data Gate = And
| Or
| Xor
| Nor
| Nand
- deriving (Show, Eq, Ord)
+ deriving (Show, Eq, Enum, Bounded)
+
+instance Random Gate where
+ randomR (a, b) g =
+ case randomR (fromEnum a, fromEnum b) g of
+ (x, g') -> (toEnum x, g')
+
+ random g = randomR (minBound, maxBound) g
+
+instance Arbitrary Gate where
+ arbitrary = elements [And, Or, Xor, Nor, Nand]