{-# LANGUAGE MultiParamTypeClasses #-} module Main where import Data.Universe.Class import Test.SmallCheck import Test.SmallCheck.Series import Test.Tasty import Test.Tasty.SmallCheck import Numeric.Rational.Positive main :: IO () main = defaultMain $ testGroup "" [testProperty "+-associative" $ \ a b c -> (a + b) + (c :: Qp) == a + (b + c), testProperty "+-commutative" $ \ a b -> a + b == (b + a :: Qp), testProperty "*-associative" $ \ a b c -> (a * b) * (c :: Qp) == a * (b * c), testProperty "*-commutative" $ \ a b -> a * b == (b * a :: Qp), testProperty "*-identity" $ \ a -> a * 1 == a && 1 * a == (a :: Qp), testProperty "+-distributive" $ \ a b c -> a * (b + c) == (a * b + a * c :: Qp)] instance Monad m => Serial m Qp where series = generate $ \ d -> take (2^(d+1)-1) universe