Files
functional-programming/lab4/test/Spec.hs

21 lines
596 B
Haskell

import Test.QuickCheck
import Lib (isCongruent)
propCongruentDifference :: Int -> Int -> Int -> Property
propCongruentDifference a b m =
m /= 0 ==> isCongruent a b m == ((a - b) `mod` m == 0)
propCongruentSymmetric :: Int -> Int -> Int -> Property
propCongruentSymmetric a b m =
m /= 0 ==> isCongruent a b m == isCongruent b a m
propCongruentEqualNumbers :: Int -> Int -> Property
propCongruentEqualNumbers a m =
m /= 0 ==> isCongruent a a m == True
main :: IO ()
main = do
quickCheck propCongruentDifference
quickCheck propCongruentSymmetric
quickCheck propCongruentEqualNumbers