Skip to content

✨ feat(mq-lang,mq-test): add gen module and @property annotation for property-based testing - #2254

Open
harehare wants to merge 1 commit into
mainfrom
feat/property-based-testing
Open

✨ feat(mq-lang,mq-test): add gen module and @property annotation for property-based testing#2254
harehare wants to merge 1 commit into
mainfrom
feat/property-based-testing

Conversation

@harehare

Copy link
Copy Markdown
Owner

Summary

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).

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor
  • 📝 Documentation
  • ⚡ Performance
  • ✅ Test
  • 📦 Build / dependencies
  • 👷 CI

Checklist

  • I ran cargo fmt and cargo clippy and addressed any warnings
  • I ran just test-all and all tests pass
  • I added or updated tests covering this change
  • I updated relevant documentation (/docs, crate README.md) if needed
  • I added a changelog entry if this is a user-facing change

Additional Context

…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.
@codspeed-hq

codspeed-hq Bot commented Aug 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing feat/property-based-testing (ff64e91) with main (018aa54)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (accd6a3) during the generation of this report, so 018aa54 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant