Skip to content

Commit

Permalink
test: normalize ARC-56 output
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-makerx committed Oct 18, 2024
1 parent 7034893 commit 5bf9c64
Show file tree
Hide file tree
Showing 51 changed files with 176 additions and 147 deletions.
6 changes: 3 additions & 3 deletions examples/amm/out/ConstantProductAMM.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/arc_28/out/EventEmitter.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/auction/out/Auction.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/box_storage/out/BoxContract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/hello_world_arc4/out/HelloWorldContract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/merkle/out/MerkleTree.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/struct_in_box/out/ExampleContract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/tictactoe/out/TicTacToeContract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions examples/voting/out/VotingRoundApp.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
15 changes: 15 additions & 0 deletions scripts/compile_all_examples.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
import argparse
import json
import operator
import os
import re
Expand Down Expand Up @@ -233,6 +234,11 @@ def checked_compile(
)
bin_files_written = re.findall(r"info: Writing (.+\.bin)", result.stdout)

# normalize ARC-56 output
arc56_files_written = re.findall(r"info: Writing (.+\.arc56\.json)", result.stdout)
for arc56_file in arc56_files_written:
_normalize_arc56(root / arc56_file)

if write_logs:
if p.is_dir():
log_path = p / "puya.log"
Expand All @@ -250,6 +256,15 @@ def checked_compile(
)


def _normalize_arc56(path: Path) -> None:
arc56 = json.loads(path.read_text())
compiler_version = arc56.get("compilerInfo", {}).get("compilerVersion", {})
compiler_version["major"] = 99
compiler_version["minor"] = 99
compiler_version["patch"] = 99
path.write_text(json.dumps(arc56, indent=4), encoding="utf8")


def _load_template_vars(path: Path) -> Iterable[str]:
if path.exists():
for line in path.read_text("utf8").splitlines():
Expand Down
6 changes: 3 additions & 3 deletions test_cases/abi_routing/out/CustomApproval.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/abi_routing/out/MinimumARC4.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/abi_routing/out/Reference.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/arc_56/out/Contract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/avm_types_in_abi/out/TestContract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/Hello.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/HelloBase.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/HelloFactory.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/HelloOtherConstants.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/HelloPrfx.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/HelloTmpl.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/compile/out/LargeProgram.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/debug/out/DebugContract.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/diamond_mro/out/Base1.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
6 changes: 3 additions & 3 deletions test_cases/diamond_mro/out/Base2.arc56.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@
"compilerInfo": {
"compiler": "puya",
"compilerVersion": {
"major": 3,
"minor": 2,
"patch": 2
"major": 99,
"minor": 99,
"patch": 99
}
}
}
Loading

0 comments on commit 5bf9c64

Please sign in to comment.