blob: 78fde7dbe06b96439820d21453d3a58112365223 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Test.VeriFuzz.Types where
import Data.Graph.Inductive
import System.Random
import Test.QuickCheck
data Gate = And
| Or
| Xor
deriving (Show, Eq, Enum, Bounded, Ord)
newtype Circuit = Circuit { getCircuit :: Gr Gate () }
instance Random Gate where
randomR (a, b) g =
case randomR (fromEnum a, fromEnum b) g of
(x, g') -> (toEnum x, g')
random = randomR (minBound, maxBound)
instance Arbitrary Gate where
arbitrary = elements [And, Or, Xor]
|