Zuletzt geändert: So, 23.04.2006

«K12/K13» Test.hs «PDF», «POD»



Download
module Test where

import Test.QuickCheck
import N0

instance Arbitrary N0 where
  arbitrary = do
    x <- arbitrary :: Gen Double
    return $ fromInteger $ round $ 15 * 1/(abs x + 1)

prop_add :: (Num a, Integral a) => a -> a -> Bool
prop_add m n = m + n == fromInteger (m' + n') where (m', n') = (toInteger m, toInteger n)

prop_minus :: (Num a, Integral a) => a -> a -> Bool
prop_minus m n = m*n - n == fromInteger (m'*n' - n') where (m', n') = (toInteger m, toInteger n)