Skip to content

Larger keys for intmap and intset #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
6 changes: 6 additions & 0 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ jobs:
- name: tests
run: |
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct --test-options="--pattern=intset --quickcheck-tests=10000"
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct --test-options="--pattern=intset --quickcheck-tests=1000 --quickcheck-max-size=100"
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct --test-options="--pattern=intset --quickcheck-tests=10 --quickcheck-max-size=1000"
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct --test-options="--pattern=intmap --quickcheck-tests=10000"
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct --test-options="--pattern=intmap --quickcheck-tests=1000 --quickcheck-max-size=100"
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct --test-options="--pattern=intmap --quickcheck-tests=10 --quickcheck-max-size=1000"
- name: haddock
run: |
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
Expand Down
6 changes: 3 additions & 3 deletions containers-tests/tests/intmap-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ apply3 f a b c = apply f (a, b, c)


{--------------------------------------------------------------------
Arbitrary, reasonably balanced trees
Arbitrary IntMaps, including those with large keys
--------------------------------------------------------------------}

instance Arbitrary a => Arbitrary (IntMap a) where
arbitrary = fmap fromList arbitrary
arbitrary = fmap (fromList . fmap (\(k,v) -> (getLarge k, v))) arbitrary

newtype NonEmptyIntMap a = NonEmptyIntMap {getNonEmptyIntMap :: IntMap a} deriving (Eq, Show)

instance Arbitrary a => Arbitrary (NonEmptyIntMap a) where
arbitrary = fmap (NonEmptyIntMap . fromList . getNonEmpty) arbitrary
arbitrary = fmap (NonEmptyIntMap . fromList . fmap (\(k,v) -> (getLarge k, v)) . getNonEmpty) arbitrary


------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions containers-tests/tests/intset-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ test_split = do
split 3 (fromList [1..5]) @?= (fromList [1,2], fromList [4,5])

{--------------------------------------------------------------------
Arbitrary, reasonably balanced trees
Arbitrary IntSets, including those with large elements
--------------------------------------------------------------------}
instance Arbitrary IntSet where
arbitrary = do{ xs <- arbitrary
; return (fromList xs)
; return (fromList (fmap getLarge xs))
}

{--------------------------------------------------------------------
Expand Down