packages feed

range-set-list 0.0.2 → 0.0.3

raw patch · 3 files changed

+17/−4 lines, 3 filesdep ~tastydep ~tasty-quickcheck

Dependency ranges changed: tasty, tasty-quickcheck

Files

Data/RangeSet/List.hs view
@@ -96,8 +96,9 @@  -- | /O(n)/. Is the element in the set? member :: (Ord a, Enum a) => a -> RSet a -> Bool-member x (RSet xs) = any f xs+member x (RSet xs) = any f $ takeWhile g xs   where f (a, b) = a <= x && x <= b+        g (a,_) = a <= x  -- | /O(n)/. Is the element not in the set? notMember :: (Ord a, Enum a) => a -> RSet a -> Bool
range-set-list.cabal view
@@ -1,5 +1,5 @@ name:                range-set-list-version:             0.0.2+version:             0.0.3 synopsis:            Memory efficient sets with continuous ranges of elements. description:         Memory efficient sets with continuous ranges of elements. List based implementation. Interface mimics "Data.Set" interface where possible. homepage:            https://github.com/phadej/range-set-list@@ -33,6 +33,6 @@   ghc-options:         -Wall   build-depends:       base >=4.6 && <5,                        containers >= 0.5 && <0.6,-                       tasty >= 0.7,-                       tasty-quickcheck >= 0.3,+                       tasty >= 0.8,+                       tasty-quickcheck == 0.8.0.3,                        range-set-list
tests/Tests.hs view
@@ -10,6 +10,8 @@ import Control.Applicative import Data.Int +import Data.Monoid+ main :: IO () main = defaultMain tests @@ -136,7 +138,16 @@ orderedProp setAction = ordered rs && pairOrdered rs   where rs = RSet.toRangeList . rangeToRSet $ setAction +-- Monoid laws+monoidLaws :: TestTree+monoidLaws = testGroup "MonoidLaws"+  [ QC.testProperty "left identity"   (\a -> rs a == mempty <> rs a)+  , QC.testProperty "right identity"  (\a -> rs a == rs a <> mempty)+  , QC.testProperty "associativity"   (\a b c -> rs a <> (rs b <> rs c) == (rs a <> rs b) <> rs c)+  ]+  where rs = rangeToRSet :: RSetAction Int -> RSet Int +-- All QuickCheck properties qcProps :: TestTree qcProps = testGroup "QuickCheck properties"   [ QC.testProperty "element operations similar" elementsProp@@ -145,4 +156,5 @@   , QC.testProperty "notMember operation similar" notMemberProp   , QC.testProperty "range operations similar" rangeProp   , QC.testProperty "ranges remain ordered" orderedProp+  , monoidLaws   ]