-
Notifications
You must be signed in to change notification settings - Fork 119
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
Draft: pretty-printer tests with randomly generated AST Expressions #1248
base: main
Are you sure you want to change the base?
Conversation
when I see something like this, I immediately think of adding shrinking (fast-check should support it)
even shrinking integer literals would already help a lot here |
I'm thinking about that right now. It might become more user- friendly values value: fc.bigInt({ min: -1_000_000_000n, max: 1_000_000_000n }) |
80ca1e6
to
88786b8
Compare
@xpyctumo I took the liberty to merge the new parser into your branch and pushed a few fixes for the expressions generator too. Looks like the new parser fixed the issue with duplicated unary operators! |
Btw, these fuzzing-like tests should go into their own folder and only gets executed on a special request, separately from |
f5d0f1f
to
ccdf98c
Compare
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
const maxDepth = 3; | ||
const expression = () => randomAstExpression(maxDepth); | ||
|
||
const cases: [string, fc.Arbitrary<AstExpression>][] = [ |
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 like you don't need cases
here: you just need to generate a lot of random expressions, using randomAstExpression
: it will handle all the cases internally
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.
Do you want to generate one thing?
I left it out specifically so that you can selectively do tests on each subset
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.
yep, expressions are a fine level of granularity, given that you also need to generate functions with statements, contracts etc
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 removed the list of cases, but increased the number of runs
Issue
Towards #642
Checklist
docs/
and made the build locallya--b
anda++b
#1247Plan