-
Notifications
You must be signed in to change notification settings - Fork 6
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
Integration tests for prepare_os_context #114
Open
mmsc2
wants to merge
7
commits into
main
Choose a base branch
from
PrepareOsContext
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
af0a891
Integration tests for prepare_os_context
mmsc2 cca703b
Add script to run tests
mmsc2 95367ec
upload run_test.sh
mmsc2 559aaa2
Merge branch 'main' into PrepareOsContext
mmsc2 5305118
Add two tests to prepare os
mmsc2 d12c8ff
Move python tests to tests/ folder
mmsc2 63c47ef
add newlines at end of file, rename script to run_python_tests.sh
mmsc2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
echo "Running hint tests" | ||
python3 tests/hints_tests.py | ||
python3 tests/get_builtins_initial_stack.py | ||
|
||
echo "Running prepare_os_context integration tests" | ||
python3 tests/prepare_os_context.py | ||
Comment on lines
+2
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question. |
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import cairo_rs_py | ||
|
||
def init_runner(program_name): | ||
with open(f"cairo_programs/{program_name}.json") as file: | ||
return cairo_rs_py.CairoRunner(file.read(), "main", "small", False) | ||
|
||
|
||
def prepare_os_context_without_builtins(runner): | ||
syscall_segment = runner.add_segment() | ||
os_context = [syscall_segment] | ||
os_context.extend(runner.get_builtins_initial_stack()) | ||
return os_context | ||
|
||
def prepare_os_context_with_builtins(runner): | ||
syscall_segment = runner.add_segment() | ||
os_context = [syscall_segment] | ||
runner.initialize_function_runner() | ||
os_context.extend(runner.get_builtins_initial_stack()) | ||
return os_context | ||
|
||
|
||
if __name__ == "__main__": | ||
runner = init_runner("get_builtins_initial_stack") | ||
print("initialize no builtin") | ||
expected_output = [(0,0)] | ||
context = prepare_os_context_without_builtins(runner) | ||
assert str(context) == str(expected_output) | ||
|
||
print("initialize builtins") | ||
runner = init_runner("get_builtins_initial_stack") | ||
context = prepare_os_context_with_builtins(runner) | ||
expected_output = [(0, 0), ('output', [(3, 0)]), ('pedersen', [(4, 0)]), ('range_check', [(5, 0)]), ('bitwise', [(6, 0)]), ('ec_op', [(7, 0)])] | ||
assert str(context) == str(expected_output) | ||
print("prepare_os_context tests passed") |
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.
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.
Is the
PYENV_VERSION
still the same here? I'm not entirely sure if thevenv
takes care of that.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.
As far as i know yes, venv takes care about the python version with which the tests are ran.
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.
Can you make sure?