We have two functions that compare 2 different power
functions, and return true if they return the same value (on the same input). Then we have 2 other functions that tests these functions against 2 lists to see if there is any value that dont return true.
But instead of using lists that ranges [1..100]
we would like to use quickcheck. So is it possible to get quickcheck to only return postive 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]]
Aucun commentaire:
Enregistrer un commentaire