Skip to content
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

Internal: script to generate a full test case #16

Merged
merged 2 commits into from
Nov 27, 2023

Conversation

odesenfans
Copy link
Contributor

Problem: we wish to create different test cases for unit and integration tests. Doing this manually is not trivial.

Solution: introduce a Python script that generates all test case files based on the Cairo program file.

The new generate_test_case.py script takes a Cairo v0 program as input, compiles it, runs it and proves it. It also generates the prover config and parameters based on the number of steps of the program.

@odesenfans odesenfans force-pushed the od/generate-test-case branch from a00a8ed to e9c0813 Compare November 24, 2023 12:22
@odesenfans odesenfans added the enhancement New feature or request label Nov 24, 2023
@odesenfans odesenfans force-pushed the od/generate-test-case branch 2 times, most recently from 3da2b7f to c248be1 Compare November 24, 2023 15:31
test-cases/README.md Outdated Show resolved Hide resolved
test-cases/README.md Outdated Show resolved Hide resolved
and put the binaries somewhere on your system (ex: `/opt/stone-prover/bin`)
or build the workspace and add `target/debug` to your PATH.

Then, if you have a `program.cairo` file on your system, you can generate the whole test case by running the following command:
Copy link
Contributor

Choose a reason for hiding this comment

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

It could be useful to provide a hint on where/what program.cairo is. I tried using fibonacci.cairo from stone-prover/dependencies/stone-prover/e2e_test/fibonacci.cairo but I seem to get cairo compile errors from this.

Copy link
Contributor

Choose a reason for hiding this comment

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

You could also provide a known-good sample (probably a minimal one) in this repo, this could help you isolate any breaking changes from upstream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I modified the fibonacci test case in another PR for that. I'll merge it and then I'll modify this one.

Copy link
Contributor

@notlesh notlesh left a comment

Choose a reason for hiding this comment

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

This seems good to me. I wasn't quite able to follow through with it yet, and left some comments about that, but don't let that hold you up.

Olivier Desenfans added 2 commits November 27, 2023 22:05
Problem: we wish to create different test cases for unit and integration
tests. Doing this manually is not trivial.

Solution: introduce a Python script that generates all test case files
based on the Cairo program file.

The new `generate_test_case.py` script takes a Cairo v0 program as
input, compiles it, runs it and proves it. It also generates the prover
config and parameters based on the number of steps of the program.
@odesenfans odesenfans force-pushed the od/generate-test-case branch from c248be1 to 6250191 Compare November 27, 2023 21:06
@odesenfans odesenfans merged commit e3a0e49 into main Nov 27, 2023
1 check passed
@odesenfans odesenfans deleted the od/generate-test-case branch November 27, 2023 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants