@@ -29,8 +29,9 @@ import Test.Tasty (TestTree, testGroup)
29
29
import Test.Tasty.QuickCheck (testProperty )
30
30
import Util.Key (Key , keyToInt )
31
31
32
- import qualified Data.Foldable as Foldable
33
- import qualified Data.List as List
32
+ import qualified Data.Foldable as Foldable
33
+ import qualified Data.HashMap.Internal as HMI
34
+ import qualified Data.List as List
34
35
35
36
#if defined(STRICT)
36
37
import Data.HashMap.Strict (HashMap )
@@ -319,6 +320,9 @@ pIntersection xs ys =
319
320
`eq_` HM. intersection (HM. fromList xs)
320
321
$ ys
321
322
323
+ pIntersectionValid :: HashMap Key () -> HashMap Key () -> Property
324
+ pIntersectionValid x y = HMI. valid (HM. intersection x y) === HMI. Valid
325
+
322
326
pIntersectionWith :: [(Key , Int )] -> [(Key , Int )] -> Property
323
327
pIntersectionWith xs ys = M. intersectionWith (-) (M. fromList xs) `eq_`
324
328
HM. intersectionWith (-) (HM. fromList xs) $ ys
@@ -529,6 +533,7 @@ tests =
529
533
[ testProperty " difference" pDifference
530
534
, testProperty " differenceWith" pDifferenceWith
531
535
, testProperty " intersection" pIntersection
536
+ , testProperty " intersection produces valid HashMap" pIntersectionValid
532
537
, testProperty " intersectionWith" pIntersectionWith
533
538
, testProperty " intersectionWithKey" pIntersectionWithKey
534
539
]
0 commit comments