✨ feat(mq-lang,mq-test): add gen module and @property annotation for property-based testing - #2254
Open
harehare wants to merge 1 commit into
Open
✨ feat(mq-lang,mq-test): add gen module and @property annotation for property-based testing#2254harehare wants to merge 1 commit into
harehare wants to merge 1 commit into
Conversation
…property-based testing Adds a `gen` standard module of seed-driven generator combinators (int, float, bool, string, const, element, one_of, array, array_of, transform, tuple), built on the seeded rand/rand_int/random_string builtins added previously. Pairs with a new `# @Property(count, generators)` mq-test annotation that runs a test against `count` generated cases instead of a fixed list, desugaring into the same execution path as `@parametrize`. A failing case is labeled `name[i]` like `@parametrize`, and `i` doubles as the seed to reproduce it via `gen::tuple(generators)(i)`. Also updates two yaml_test.mq snapshot goldens: adding the gen module shifted mq-lang's global identifier-interning order, which reorders (but does not change the values of) unrelated dict fields rendered by yaml_to_json/yaml_to_markdown_table.
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.
Summary
Adds a
genstandard module of seed-driven generator combinators (int, float, bool, string, const, element, one_of, array, array_of, transform, tuple), built on the seeded rand/rand_int/random_string builtins added previously. Pairs with a new# @property(count, generators)mq-test annotation that runs a test againstcountgenerated cases instead of a fixed list, desugaring into the same execution path as@parametrize. A failing case is labeledname[i]like@parametrize, andidoubles as the seed to reproduce it viagen::tuple(generators)(i).Type of Change
Checklist
cargo fmtandcargo clippyand addressed any warningsjust test-alland all tests pass/docs, crateREADME.md) if neededAdditional Context