-
Notifications
You must be signed in to change notification settings - Fork 217
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
Add coverage checks to property tests for TokenMap.intersection
#2756
Add coverage checks to property tests for TokenMap.intersection
#2756
Conversation
This combinator provides a way to generate larger arbitrary values through simple monoidal concatenation of smaller arbitrary values.
Before this change, coverage of the intersection is not empty" condition was only 1%.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
-- generate larger values of 'A', based on simple monoidal concatenation of | ||
-- multiple smaller values. | ||
-- | ||
newtype ManyFolded a = ManyFolded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required because the available Arbitrary instance for TokenMap is something like this:
instance Arbitrary TokenMap where
arbitrary = genTokenMapSmallRange
right?
I think I prefer Hedgehog's use of functions to Quickcheck's typeclass instances, but that's not the question here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this confusing @jonathanknowles.
Adding in Blind
didn't help (couldn't Show
be defined with show . mconcat
?
Why can't we just use the QuickCheck size
parameter? See Coding Standards - QuickCheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @jonathanknowles .
Coverage checks - good.
ManyFolded - unsure.
-- generate larger values of 'A', based on simple monoidal concatenation of | ||
-- multiple smaller values. | ||
-- | ||
newtype ManyFolded a = ManyFolded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this confusing @jonathanknowles.
Adding in Blind
didn't help (couldn't Show
be defined with show . mconcat
?
Why can't we just use the QuickCheck size
parameter? See Coding Standards - QuickCheck.
This allows the generation and shrinking of token quantities from a range that depends on the size parameter.
This allows the generation and shrinking of token names from a range that depends on the size parameter.
In this change, we use sized generators for token maps instead of relying on the `ManyFolded` combinator. In response to review feedback: #2756 (comment)
In this change, we use sized generators for token maps instead of relying on the `ManyFolded` combinator. In response to review feedback: #2756 (comment)
86f4856
to
4fae8c4
Compare
This allows the generation and shrinking of token policy identifiers from a range that depends on the size parameter.
This allows the generation and shrinking of asset identifiers from a range that depends on the size parameter.
This allows the generation and shrinking of token maps where the number of entries, the range of asset identifiers, and the range of token quantities all depend on the size parameter.
In this change, we use sized generators for token maps instead of relying on the `ManyFolded` combinator. In response to review feedback: #2756 (comment)
4fae8c4
to
5673f74
Compare
bors r+ |
Build succeeded: |
Issue Number
ADP-997
Pre-merge checks
(✅ 1000 test runs with
--match "/Token map properties/Arithmetic/prop_intersection"
passed with no failures.)Overview
PR #2725 added a
TokenMap.intersection
function and property tests.This PR:
prop_intersection_*
series of properties.