diff --git a/tests/case_constr/case_constr.flat b/tests/case_constr/case_constr.flat new file mode 100644 index 0000000..412ec24 --- /dev/null +++ b/tests/case_constr/case_constr.flat @@ -0,0 +1 @@ +4e0101009800600290003003480081 \ No newline at end of file diff --git a/tests/case_constr/case_constr.uplc b/tests/case_constr/case_constr.uplc new file mode 100644 index 0000000..42ee189 --- /dev/null +++ b/tests/case_constr/case_constr.uplc @@ -0,0 +1,4 @@ +(program + 1.1.0 + (case (constr 0)(constr 0(con integer 0))(constr 1(con integer 1))) +) \ No newline at end of file diff --git a/tests/test_misc.py b/tests/test_misc.py index 0ccdcde..e8f7e00 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1752,3 +1752,14 @@ def test_append_plutusdata_list(self): r.result, PlutusConstr(0, []), ) + + def test_case_constr_encoding(self): + with open(Path(__file__).parent / "case_constr" / "case_constr.uplc", "r") as f: + program = f.read() + p = parse(program) + encoded = flatten(p) + with open(Path(__file__).parent / "case_constr" / "case_constr.flat", "r") as f: + encoded_ref = bytes.fromhex(f.read()) + self.assertEqual(encoded, encoded_ref) + decoded = unflatten(encoded_ref) + self.assertEqual(p, decoded)