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

test(output): compare python output to rust output #9

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
run: rustup show
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test
run: pip install cairo-lang; cargo test
EvolveArt marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
build/test.zip
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ hex = "0.4.3"
starknet = { git = "https://github.com/xJonathanLEI/starknet-rs" }
uuid = { version = "1.4.0", features = ["v4", "serde"] }
reqwest = { version = "0.11.18", features = ["blocking", "json"] }
pretty_assertions = "1.4.0"

[dev-dependencies]
rstest = "0.18.2"
269 changes: 269 additions & 0 deletions build/different_output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
{
"attributes": [],
"builtins": [
"output"
],
"compiler_version": "0.12.2",
"data": [
"0x480680017fff8000",
"0x12",
"0x480280007ffd7fff",
"0x482680017ffd8000",
"0x1",
"0x208b7fff7fff7ffe"
],
"debug_info": {
"file_contents": {},
"instruction_locations": {
"0": {
"accessible_scopes": [
"__main__",
"__main__.main"
],
"flow_tracking_data": {
"ap_tracking": {
"group": 0,
"offset": 0
},
"reference_ids": {
"__main__.main.output_ptr": 0
}
},
"hints": [],
"inst": {
"end_col": 19,
"end_line": 4,
"input_file": {
"filename": "tests/contracts/different_output.cairo"
},
"start_col": 17,
"start_line": 4
}
},
"2": {
"accessible_scopes": [
"__main__",
"__main__.main"
],
"flow_tracking_data": {
"ap_tracking": {
"group": 0,
"offset": 1
},
"reference_ids": {
"__main__.main.a": 1,
"__main__.main.output_ptr": 0
}
},
"hints": [],
"inst": {
"end_col": 27,
"end_line": 5,
"input_file": {
"filename": "tests/contracts/different_output.cairo"
},
"start_col": 5,
"start_line": 5
}
},
"3": {
"accessible_scopes": [
"__main__",
"__main__.main"
],
"flow_tracking_data": {
"ap_tracking": {
"group": 0,
"offset": 2
},
"reference_ids": {
"__main__.main.a": 1,
"__main__.main.output_ptr": 2
}
},
"hints": [
{
"location": {
"end_col": 23,
"end_line": 8,
"input_file": {
"filename": "tests/contracts/different_output.cairo"
},
"start_col": 5,
"start_line": 8
},
"n_prefix_newlines": 0
}
],
"inst": {
"end_col": 36,
"end_line": 9,
"input_file": {
"filename": "tests/contracts/different_output.cairo"
},
"parent_location": [
{
"end_col": 35,
"end_line": 11,
"input_file": {
"filename": "tests/contracts/different_output.cairo"
},
"start_col": 25,
"start_line": 11
},
"While expanding the reference 'output_ptr' in:"
],
"start_col": 22,
"start_line": 9
}
},
"5": {
"accessible_scopes": [
"__main__",
"__main__.main"
],
"flow_tracking_data": {
"ap_tracking": {
"group": 0,
"offset": 3
},
"reference_ids": {
"__main__.main.a": 1,
"__main__.main.output_ptr": 2
}
},
"hints": [],
"inst": {
"end_col": 37,
"end_line": 11,
"input_file": {
"filename": "tests/contracts/different_output.cairo"
},
"start_col": 5,
"start_line": 11
}
}
}
},
"hints": {
"3": [
{
"accessible_scopes": [
"__main__",
"__main__.main"
],
"code": "print(ids.a)",
"flow_tracking_data": {
"ap_tracking": {
"group": 0,
"offset": 2
},
"reference_ids": {
"__main__.main.a": 1,
"__main__.main.output_ptr": 0
}
}
}
]
},
"identifiers": {
"__main__.main": {
"decorators": [],
"pc": 0,
"type": "function"
},
"__main__.main.Args": {
"full_name": "__main__.main.Args",
"members": {
"output_ptr": {
"cairo_type": "felt*",
"offset": 0
}
},
"size": 1,
"type": "struct"
},
"__main__.main.ImplicitArgs": {
"full_name": "__main__.main.ImplicitArgs",
"members": {},
"size": 0,
"type": "struct"
},
"__main__.main.Return": {
"cairo_type": "(output_ptr: felt*)",
"type": "type_definition"
},
"__main__.main.SIZEOF_LOCALS": {
"type": "const",
"value": 0
},
"__main__.main.a": {
"cairo_type": "felt",
"full_name": "__main__.main.a",
"references": [
{
"ap_tracking_data": {
"group": 0,
"offset": 1
},
"pc": 2,
"value": "[cast(ap + (-1), felt*)]"
}
],
"type": "reference"
},
"__main__.main.output_ptr": {
"cairo_type": "felt*",
"full_name": "__main__.main.output_ptr",
"references": [
{
"ap_tracking_data": {
"group": 0,
"offset": 0
},
"pc": 0,
"value": "[cast(fp + (-3), felt**)]"
},
{
"ap_tracking_data": {
"group": 0,
"offset": 2
},
"pc": 3,
"value": "cast([fp + (-3)] + 1, felt*)"
}
],
"type": "reference"
}
},
"main_scope": "__main__",
"prime": "0x800000000000011000000000000000000000000000000000000000000000001",
"reference_manager": {
"references": [
{
"ap_tracking_data": {
"group": 0,
"offset": 0
},
"pc": 0,
"value": "[cast(fp + (-3), felt**)]"
},
{
"ap_tracking_data": {
"group": 0,
"offset": 1
},
"pc": 2,
"value": "[cast(ap + (-1), felt*)]"
},
{
"ap_tracking_data": {
"group": 0,
"offset": 2
},
"pc": 3,
"value": "cast([fp + (-3)] + 1, felt*)"
}
]
}
}
Loading
Loading