[#32] Add InsertLookup property test for PrefixTree#34
Merged
Conversation
vrom911
reviewed
May 1, 2018
Member
vrom911
left a comment
There was a problem hiding this comment.
I like what is going on there! Cool one, thank you! I just wrote few comments in there 🙂
| deriving (Show, Eq, Hashable) | ||
|
|
||
| instance IsString Piece where | ||
| fromString = Piece . fromString |
Member
There was a problem hiding this comment.
I just made the same thing 🙂 I just derived :)
Contributor
Author
There was a problem hiding this comment.
Yeah, I should derive it as well...
| @@ -0,0 +1,13 @@ | |||
| module Test.Toml.PrefixTree | |||
Member
There was a problem hiding this comment.
I really like this structure! 👍 It makes code easier to read with this test separation
| pure $ HashMap.fromList kvps | ||
|
|
||
| genPrefixTree :: forall m . MonadGen m => Key -> m (PrefixTree V) | ||
| genPrefixTree key = Gen.recursive |
Member
There was a problem hiding this comment.
That's nice to see this library feature to work for us! 👏
|
|
||
| -- DEBUG: ensures that trees of depth at least 5 are generated | ||
| -- assert $ depth prefMap < 5 | ||
|
|
Member
There was a problem hiding this comment.
Another property I can think of is
lookup a (insert a y $ insert a x t) === Just y
to check that it uses the latest value. How do you think?
Contributor
Author
There was a problem hiding this comment.
@vrom911 That's an excellent property! I can add it as well.
6a27cf5 to
599131d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #32
Implements
InsertLookupproperty test forPrefixTree. I can't think of more properties for now... Maybe more of them can be discovered in future.I've also added some unit tests.