Skip to content

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented Aug 5, 2025

Also add a test for PerasWeightSnapshot. The tests for boostedWeightOf{Point,Fragment} are currently not that useful as the model implementation and the actual implementation are almost the same, but this will change with #1613. The test for takeVolatileSuffix is already useful.

amesgen added 2 commits August 5, 2025 17:16
This is purely for concise QuickCheck counterexample output.
@amesgen amesgen added the Peras label Aug 5, 2025
@amesgen amesgen force-pushed the amesgen/more-peras-weight-stuff branch 2 times, most recently from 0ae95b6 to 5cba290 Compare August 5, 2025 17:53
Copy link

@tbagrel1 tbagrel1 left a 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!

Some pieces of the tests were a bit hard to understand for me; I left a few comments.


prop_perasWeightSnapshot :: TestSetup -> Property
prop_perasWeightSnapshot testSetup =
tabulate "log₂ # of points" [show $ round @Double @Int $ logBase 2 (fromIntegral (length tsPoints))]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we round to the nearest integer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get a reasonable amount of labelling output; if we didn't round (or floor/ceiling, doesn't matter), then we would get one line of output for every amount of points that is present in some test case. This way, we essentially get "buckets" of exponentially increasing size.

The high-level motivation for this is to get an idea of how many points are present in this test, as the test is rather degenerate if there are only very few (and the test would be unnecessarily slow if there were, say, millions of points).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if the rounding was just for displaying, or also for producing the test cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed purely affecting "metrics" of the property tests; generation/execution of test cases is completely unaffected 👍

@amesgen amesgen force-pushed the amesgen/more-peras-weight-stuff branch from 5cba290 to 4c1afc8 Compare August 7, 2025 16:02
@amesgen amesgen merged commit 4c1afc8 into peras-staging Aug 8, 2025
13 checks passed
@amesgen amesgen deleted the amesgen/more-peras-weight-stuff branch August 8, 2025 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants