haskell-unordered-containers / unordered-containers

Efficient hashing-based container types
BSD 3-Clause "New" or "Revised" License
222 stars 97 forks source link

Add invariant checking #444

Closed sjakobi closed 2 years ago

sjakobi commented 2 years ago

Addresses #366.


TODO:

sjakobi commented 2 years ago

I've checked that this tooling could have caught #420. Sample output:

        intersection produces valid HashMap: FAIL
          *** Failed! Falsified (after 61 tests and 10 shrinks):
          fromList [(K {hash = 265, _x = D},()),(K {hash = 16649, _x = A},())]
          fromList [(K {hash = 265, _x = D},()),(K {hash = 16649, _x = A},())]
          Invalid (INV2_misplaced_hash 265) (Cons 0 Root) /= Valid
          Use --quickcheck-replay=665566 to reproduce.
          Use -p '/intersection/&&/Data.HashMap.Lazy.difference and intersection.intersection produces valid HashMap/' to rerun this test only.
sjakobi commented 2 years ago

Hmm, is there another bug in the new intersection implementation?! oO

sjakobi commented 2 years ago

Hmm, is there another bug in the new intersection implementation?! oO

Probably not. I'm getting the same errors with the naive old intersection implementation. I must have made a mistake in the validation logic.

sjakobi commented 2 years ago

This should be ready for review. I'll hold off on adding more validity tests until I've refactored the existing property tests a bit.

treeowl commented 2 years ago

Huzzah!