Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

QuickCheck tests for IntMap #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

galpsten
Copy link

Added QuickCheck tests for IntMap (didn't have time for more)

Important change in need of approval, we added deriving Eq to Data.UnionFind.IntMap.Point. The only other way to compare the descriptors of the points in the current implementation is to compare descriptors. As it is, only the representative point keep the descriptor, so it is not a very direct means of comparing (but it would possibly turn out correct anyway). A user of the library might also want to be able to compare Points, however, the users shouldn't confuse == with the function equivalence.

Description solution:

  • test/TestSuite.hs is called by cabal test and itself reference the quickCheck property tests.
  • test/Common.hs define a model for testing. It is essentially a list of "Calls", a type representing abstract API calls.
  • test/IntMapProps.hs uses Common as it tests IntMap.

We are two students (@dfurian) enrolled in a advanced functional programming course. We were told to contribute to an open source project and ended up here :) Unfortunately we did not have time to test the whole library, but hope it can be of any use.

@galpsten
Copy link
Author

IntMap only modifies the state when calling fresh and union, not for repr and equivalence. So the model Call in test/Common.hs only has only this simple definition:

data Call = Fresh Int | Union Int Int

where Int refer to the "id" of a point. But this model can easily be extended to include repr and equivalence

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant