Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main :: IO ()
- main = do
- -- right length
- quickCheck $ forAll genPos $ \n -> (toInteger . length . grayCode) n == 2 ^ n
- -- right elements, and sorted
- quickCheck $
- forAll genPos $ \n -> map fromBaseTwo (grayRead n) == [0 .. 2 ^ n - 1]
- -- test in base 10
- quickCheck $ forAll genPos $ \n -> n == (n `fromBase` 10) `inBase` 10
- -- test in all bases
- quickCheck $
- forAll genPos $ \d ->
- forAll (genBaseD d) $ \n -> n == (n `fromBase` d) `inBase` d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement