Тесты для первой функции
This commit is contained in:
@@ -62,6 +62,7 @@ test-suite lab4-test
|
||||
test
|
||||
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
|
||||
build-depends:
|
||||
base >=4.7 && <5
|
||||
QuickCheck
|
||||
, base >=4.7 && <5
|
||||
, lab4
|
||||
default-language: Haskell2010
|
||||
|
||||
@@ -57,3 +57,4 @@ tests:
|
||||
- -with-rtsopts=-N
|
||||
dependencies:
|
||||
- lab4
|
||||
- QuickCheck
|
||||
|
||||
@@ -1,2 +1,20 @@
|
||||
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 = putStrLn "Test suite not yet implemented"
|
||||
main = do
|
||||
quickCheck propCongruentDifference
|
||||
quickCheck propCongruentSymmetric
|
||||
quickCheck propCongruentEqualNumbers
|
||||
|
||||
Reference in New Issue
Block a user