We have two functions that compare two different power
functions, and return true if they return the same value (on the same input).
Then we have two other functions that test these functions against two lists to see if there is any value that doesn't return true.
But instead of using lists that use a range [1..100]
, we would like to use QuickCheck.
Is it possible to make QuickCheck only return positive integers?
Code:
comparePower1 :: Integer -> Integer -> Bool
comparePower1 n k = power n k == power1 n k
comparePower2 :: Integer -> Integer -> Bool
comparePower2 n k = power n k == power2 n k
testing1 = and [comparePower1 n k | n <- [0..100], k <- [0..100]]
testing2 = and [comparePower2 n k | n <- [0..100], k <- [0..100]]
(Integral a, Show a, Read a) => ...
– ZamboangasuchThat
modifier for generator? – Lafrance