non-negative 0.0.5 → 0.0.5.1
raw patch · 4 files changed
+34/−35 lines, 4 filesdep ~QuickCheck
Dependency ranges changed: QuickCheck
Files
- Test/Numeric/NonNegative/Chunky.hs +25/−25
- non-negative.cabal +3/−3
- src/Numeric/NonNegative/ChunkyPrivate.hs +5/−5
- src/Numeric/NonNegative/Wrapper.hs +1/−2
Test/Numeric/NonNegative/Chunky.hs view
@@ -8,7 +8,7 @@ module Test.Numeric.NonNegative.Chunky (tests) where -- import Test.Utility-import Test.QuickCheck (test, Property, (==>))+import Test.QuickCheck (quickCheck, Property, (==>)) import qualified Numeric.NonNegative.Chunky as Chunky import qualified Numeric.NonNegative.Class as NonNeg@@ -161,56 +161,56 @@ -type Card = NonNegW.T Int+type Card = NonNegW.Integer tests :: [(String, IO ())] tests = ("add",- test (add :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (add :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("sub",- test (sub :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (sub :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("mul",- test (mul :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (mul :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("min",- test (min :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (min :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("max",- test (max :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (max :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("abs",- test (abs :: Chunky.T Card -> Bool)) :+ quickCheck (abs :: Chunky.T Card -> Bool)) : ("signum",- test (signum :: Chunky.T Card -> Bool)) :+ quickCheck (signum :: Chunky.T Card -> Bool)) : ("equal",- test (equal :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (equal :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("compare",- test (compare :: Chunky.T Card -> Chunky.T Card -> Bool)) :+ quickCheck (compare :: Chunky.T Card -> Chunky.T Card -> Bool)) : ("addInfiniteL",- test (addInfiniteL :: Card -> Card -> Chunky.T Card -> Bool)) :+ quickCheck (addInfiniteL :: Card -> Card -> Chunky.T Card -> Bool)) : ("addInfiniteR",- test (addInfiniteR :: Card -> Card -> Chunky.T Card -> Bool)) :+ quickCheck (addInfiniteR :: Card -> Card -> Chunky.T Card -> Bool)) : ("mulInfiniteL",- test (mulInfiniteL :: Card -> Card -> Chunky.T Card -> Property)) :+ quickCheck (mulInfiniteL :: Card -> Card -> Chunky.T Card -> Property)) : ("mulInfiniteR",- test (mulInfiniteR :: Card -> Card -> Chunky.T Card -> Property)) :+ quickCheck (mulInfiniteR :: Card -> Card -> Chunky.T Card -> Property)) : ("minRecursiveL",- test (minRecursiveL :: Chunky.T Card -> Chunky.T Card -> Property)) :+ quickCheck (minRecursiveL :: Chunky.T Card -> Chunky.T Card -> Property)) : ("minRecursiveR",- test (minRecursiveR :: Chunky.T Card -> Chunky.T Card -> Property)) :+ quickCheck (minRecursiveR :: Chunky.T Card -> Chunky.T Card -> Property)) : ("minInfiniteL",- test (minInfiniteL :: Card -> Chunky.T Card -> Bool)) :+ quickCheck (minInfiniteL :: Card -> Chunky.T Card -> Bool)) : ("minInfiniteR",- test (minInfiniteR :: Card -> Chunky.T Card -> Bool)) :+ quickCheck (minInfiniteR :: Card -> Chunky.T Card -> Bool)) : ("maxInfiniteL",- test (maxInfiniteL :: Card -> Card -> Chunky.T Card -> Bool)) :+ quickCheck (maxInfiniteL :: Card -> Card -> Chunky.T Card -> Bool)) : ("maxInfiniteR",- test (maxInfiniteR :: Card -> Card -> Chunky.T Card -> Bool)) :+ quickCheck (maxInfiniteR :: Card -> Card -> Chunky.T Card -> Bool)) : ("minInfiniteAssociative",- test (minInfiniteAssociative :: Card -> Card -> Chunky.T Card -> Bool)) :+ quickCheck (minInfiniteAssociative :: Card -> Card -> Chunky.T Card -> Bool)) : ("maxInfiniteAssociative",- test (maxInfiniteAssociative :: Card -> Card -> Card -> Chunky.T Card -> Bool)) :+ quickCheck (maxInfiniteAssociative :: Card -> Card -> Card -> Chunky.T Card -> Bool)) : ("compareInfiniteL",- test (compareInfiniteL :: Card -> Chunky.T Card -> Bool)) :+ quickCheck (compareInfiniteL :: Card -> Chunky.T Card -> Bool)) : ("compareInfiniteR",- test (compareInfiniteR :: Card -> Chunky.T Card -> Bool)) :+ quickCheck (compareInfiniteR :: Card -> Chunky.T Card -> Bool)) : []
non-negative.cabal view
@@ -1,10 +1,10 @@ Name: non-negative-Version: 0.0.5+Version: 0.0.5.1 License: GPL License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de> Maintainer: Henning Thielemann <haskell@henning-thielemann.de>-Homepage: http://darcs.haskell.org/non-negative/+Homepage: http://code.haskell.org/~thielema/non-negative/ Category: Math Synopsis: Non-negative numbers Description:@@ -25,7 +25,7 @@ default: False Library- Build-Depends: QuickCheck >= 1.0 && <2+ Build-Depends: QuickCheck >= 1.0 && <3 If flag(splitBase) Build-Depends: base >= 2 && < 5 Else
src/Numeric/NonNegative/ChunkyPrivate.hs view
@@ -17,10 +17,11 @@ fromChunksUnsafe, toChunksUnsafe, ) where import qualified Numeric.NonNegative.Class as NonNeg+import Numeric.NonNegative.Class ((-|), ) import Control.Monad (liftM, liftM2) import qualified Data.Monoid as Mn-import Test.QuickCheck (Arbitrary(..))+import Test.QuickCheck (Arbitrary(arbitrary)) {- | A chunky non-negative number is a list of non-negative numbers.@@ -95,8 +96,8 @@ glue (x:xs) (y:ys) = let (z,(zs,rs,b)) = case compare x y of- LT -> (x, glue xs ((y-x):ys))- GT -> (y, glue ((x-y):xs) ys)+ LT -> (x, glue xs ((y-|x):ys))+ GT -> (y, glue ((x-|y):xs) ys) EQ -> (x, glue xs ys) in (z:zs,rs,b) @@ -146,7 +147,7 @@ (Cons x) -| (Cons w) = let sub _ [] = [] sub z (y:ys) =- if z<y then (y-z):ys else sub (z-y) ys+ if z<y then (y-|z):ys else sub (z-|y) ys in Cons (foldr sub x w) instance (NonNeg.C a) => Num (T a) where@@ -168,7 +169,6 @@ instance (NonNeg.C a, Arbitrary a) => Arbitrary (T a) where arbitrary = liftM Cons arbitrary- coarbitrary = undefined {- * Functions that may break invariants -}
src/Numeric/NonNegative/Wrapper.hs view
@@ -16,7 +16,7 @@ import qualified Numeric.NonNegative.Class as NonNeg -import Test.QuickCheck (Arbitrary(..))+import Test.QuickCheck (Arbitrary(arbitrary)) import Numeric.NonNegative.Utility(mapPair, mapSnd) import Control.Monad (liftM) @@ -174,7 +174,6 @@ instance (Num a, Arbitrary a) => Arbitrary (T a) where arbitrary = liftM (Cons . abs) arbitrary- coarbitrary = undefined type Int = T P.Int