Skip to content
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 .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "tests/unit_tests/test_michelson/test_repl/tzt"]
path = tests/unit_tests/test_michelson/test_repl/tzt
url = https://gitlab.com/tezos/tzt-reference-test-suite.git
url = https://github.com/baking-bad/tzt_reference_test_suite.git
148 changes: 108 additions & 40 deletions tests/unit_tests/test_michelson/test_repl/test_tzt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@

class TztTest(TestCase):
path = join(dirname(__file__), "tzt")
exclude = [
exclude = {
".git",
"LICENSE",
"NOTICE",
"LICENSES",
"coverage.md",
"README.md",
"macro_pack",
"legacy",
#
"add_00.tc.tzt",
"add_01.tc.tzt",
Expand All @@ -44,18 +47,6 @@ class TztTest(TestCase):
"contract_03.tzt",
"contract_04.tzt",
"contract_05.tzt",
# NOTE: failed to parse expression LexToken(_,'_',1,658)
"createcontract_00.tzt",
"createcontract_01.tzt",
"dip_00.tc.tzt",
"dipn_00.tc.tzt",
"dipn_01.tc.tzt",
"dipn_02.tc.tzt",
"drop_00.tc.tzt",
"dropn_00.tc.tzt",
"dup_00.tc.tzt",
"dupn_00.tc.tzt",
"dupn_01.tc.tzt",
# NOTE: unknown primitive `Failed`
"failwith_00.tc.tzt",
"failwith_00.tzt",
Expand All @@ -75,38 +66,40 @@ class TztTest(TestCase):
"lsl_01.tzt",
# NOTE: unknown primitive `GeneralOverflow`
"lsr_01.tzt",
"macro_pack",
# NOTE: unknown primitive `MutezOverflow`
"mul_mutez-nat_01.tzt",
# NOTE: unknown primitive `MutezOverflow`
"mul_nat-mutez_01.tzt",
# NOTE: MichelsonRuntimeError: ('NOT', 'unexpected types `bytes`')
"not_bytes_00.tzt",
"not_bytes_01.tzt",
"not_bytes_02.tzt",
"or_bytes-bytes_00.tzt",
"or_bytes-bytes_01.tzt",
"or_bytes-bytes_02.tzt",
"or_bytes-bytes_03.tzt",
"pack_key_03.tzt",
"pack_lambda_comb_pairs.tzt",
"pack_operation_00.tc.tzt",
"pack_signature_03.tzt",
"pair_00.tc.tzt",
"push_00.tc.tzt",
"not_bytes_03.tzt",
"not_bytes_04.tzt",
"not_bytes_05.tzt",
# NOTE: parameter type is not defined
"self_00.tzt",
"self_in_lambda.tc.tzt",
# NOTE: failed to parse expression LexToken(_,'_',1,199)
"concat_00.tc.tzt",
"createcontract_00.tzt",
"createcontract_01.tzt",
"dip_00.tc.tzt",
"emptyset_00.tc.tzt",
"dipn_00.tc.tzt",
"dipn_01.tc.tzt",
"dipn_02.tc.tzt",
"drop_00.tc.tzt",
"dropn_00.tc.tzt",
"dup_00.tc.tzt",
"dupn_00.tc.tzt",
"dupn_01.tc.tzt",
"pack_operation_00.tc.tzt",
"pair_00.tc.tzt",
"push_00.tc.tzt",
"setdelegate_00.tc.tzt",
"setdelegate_00.tzt",
# NOTE: ('SLICE', 'string is empty')
"slice_string_05.tzt",
"some_00.tc.tzt",
# NOTE: unknown primitive `MutezUnderflow`
"sub_mutez-mutez_01.tzt",
"swap_00.tc.tzt",
"swap_01.tc.tzt",
# NOTE: failed to parse expression LexToken(_,'_',1,238)
"never_00.tc.tzt",
"transfertokens_00.tc.tzt",
"transfertokens_00.tzt",
"transfertokens_01.tzt",
Expand All @@ -123,19 +116,94 @@ class TztTest(TestCase):
"xor_bytes-bytes_01.tzt",
"xor_bytes-bytes_02.tzt",
"xor_bytes-bytes_03.tzt",
]
# NOTE: ('SLICE', 'string is empty')
"slice_string_05.tzt",
"some_00.tc.tzt",
# NOTE: unknown primitive `MutezUnderflow`
"sub_mutez-mutez_01.tzt",
"swap_00.tc.tzt",
"swap_01.tc.tzt",
# NOTE: MichelsonRuntimeError: ('LSL', 'expected nat, got bytes at ``')
"lsl_bytes_00.tzt",
"lsl_bytes_02.tzt",
"lsl_bytes_03.tzt",
"lsl_bytes_04.tzt",
"lsl_bytes_05.tzt",
"lsl_bytes_06.tzt",
# NOTE: MichelsonRuntimeError: ('LSR', 'expected nat, got bytes at ``')
"lsr_bytes_00.tzt",
"lsr_bytes_01.tzt",
"lsr_bytes_02.tzt",
"lsr_bytes_03.tzt",
"lsr_bytes_04.tzt",
"lsr_bytes_05.tzt",
"lsr_bytes_06.tzt",
"lsr_bytes_07.tzt",
# NOTE: MichelsonRuntimeError: ('OR'/'AND'/'XOR', 'unexpected types `bytes * bytes`')
"and_bytes-bytes_04.tzt",
"and_bytes-bytes_05.tzt",
"and_bytes-bytes_06.tzt",
"or_bytes-bytes_00.tzt",
"or_bytes-bytes_01.tzt",
"or_bytes-bytes_02.tzt",
"or_bytes-bytes_03.tzt",
"or_bytes-bytes_04.tzt",
"or_bytes-bytes_05.tzt",
"or_bytes-bytes_06.tzt",
"xor_bytes-bytes_04.tzt",
"xor_bytes-bytes_05.tzt",
"xor_bytes-bytes_06.tzt",
# NOTE: MichelsonRuntimeError: ('Stack_elt', '`option` is neither pushable nor big_map')
"join_tickets_00.tzt",
"join_tickets_01.tzt",
"join_tickets_02.tzt",
"join_tickets_03.tzt",
"read_ticket_00.tzt",
"ticket_00.tzt",
"ticket_01.tzt",
"split_ticket_00.tzt",
"split_ticket_01.tzt",
"split_ticket_02.tzt",
"split_ticket_03.tzt",
"split_ticket_04.tzt",
# NOTE: MichelsonParserError: unknown primitive `IS_IMPLICIT_ACCOUNT`
"is_implicit_account_00.tzt",
"is_implicit_account_01.tzt",
# NOTE: MichelsonRuntimeError: ('SUB_MUTEZ', 'mutez', 'expected natural number, got -8')
"sub_mutez_01.tzt",
# NOTE: MichelsonRuntimeError: ('input', 'input', 'Stack_elt', 'unregistered primitive Lambda_rec (None args)')
"apply_01.tzt",
"apply_02.tzt",
# NOTE: MichelsonRuntimeError: Expected int, got 2024-12-18T09:39:21+00:00
"now_01.tzt",
# NOTE: MichelsonRuntimeError: ('Stack_elt', 'Stack content is not equal to expected')
"pack_lambda_comb_pairs.tzt",
# NOTE: MichelsonRuntimeError: unregistered primitive Overflow (None args)
"lsl_bytes_01.tzt",
"lsl_nat_01.tzt",
"lsr_nat_01.tzt",
# NOTE: MichelsonRuntimeError: unregistered primitive Gas_exhaustion (None args)
"gas_exhaustion.tzt",
}

def test_tzt(self) -> None:
parser = MichelsonParser()
for filename in listdir(self.path):
if filename in self.exclude:
continue
with self.subTest(filename):
filename = join(self.path, filename)
with open(filename) as file:
script = michelson_to_micheline(
file.read(),
parser=parser,
)
filepath = join(self.path, filename)
try:
with open(filepath) as file:
script = michelson_to_micheline(
file.read(),
parser=parser,
)

Interpreter.run_tzt(script=script)
Interpreter.run_tzt(script=script)
except Exception as e:
raise AssertionError(
f"TZT test execution failed for '{filename}'. "
f"This Tezos Test Format file contains Michelson code that failed during parsing or execution. "
f"Original error: {type(e).__name__}: {str(e)}"
) from e
2 changes: 1 addition & 1 deletion tests/unit_tests/test_michelson/test_repl/tzt
Submodule tzt updated from 177079 to 35f830
Loading