aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test/VeriFuzz/Types.hs
blob: 3b17b8cea9f379f61590c5c4635c8d8c4cf1119d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Test.VeriFuzz.Types where

import           System.Random
import           Test.QuickCheck

data Gate = And
          | Or
          | Xor
          deriving (Show, Eq, Enum, Bounded, Ord)

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]