From 27c7108b0ee66898a5438af05cbb2f14cf34e5b4 Mon Sep 17 00:00:00 2001 From: Nick Drozd Date: Tue, 20 Aug 2024 10:27:29 -0400 Subject: [PATCH] Change assertion to check --- test/prog_data.py | 9 +++++++++ test/test_coverage.py | 1 + test/test_turing.py | 8 ++++---- tm/rules.py | 3 ++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/test/prog_data.py b/test/prog_data.py index 07cb4453..4bc56c30 100644 --- a/test/prog_data.py +++ b/test/prog_data.py @@ -1986,6 +1986,15 @@ ), }, + "sub_add": { + "1RB 1LD 0RC 1LE 0RD 1RA 1LD 0LA 0LB 1LE": ( + 3314, + "(10 ↑↑ 6)", + "(59 + (((((2 ** 50) * (3 + (3 * (2 ** (-48 + (3 * (2 ** 50))))))) + (3 * (2 ** (2 + (3 * (2 ** (2 + (3 * (2 ** 50))))))))) + (3 * (2 ** (2 + (3 * (2 ** (2 + (3 * (2 ** (2 + (3 * (2 ** 50)))))))))))) + (3 * (2 ** (3 * (2 ** (2 + (3 * (2 ** (2 + (3 * (2 ** (2 + (3 * (2 ** 50)))))))))))))))", + "(???)", + ), + }, + "sub_mul": { "1RB 0LD 0RC 0RA 1LD 1LE 1RE 1LC 0LE 1LA": ( 2447, diff --git a/test/test_coverage.py b/test/test_coverage.py index 26539f75..7e44d8ce 100644 --- a/test/test_coverage.py +++ b/test/test_coverage.py @@ -130,6 +130,7 @@ def test_prover(self): "1RB 0LD 1LB 0RC 0RE 1LD 1LA ... 0RB 0LC", "1RB 0RC 1LC 1RA 1RE 0LD 0LC 0LE 0RB 1LD", "1RB 0LC 1LC 1RA 1LD 0LD 0LE 0LC 1RE 0RB", + "1RB 1LD 0RC 1LE 0RD 1RA 1LD 0LA 0LB 1LE", "1RB 3LA 4LB 0RB 1RA 3LA 2LA 2RA 4LA 1RA 5RB ...", "1RB 3RB 5RA 1LB 5LA 2LB 2LA 2RA 4RB ... 3LB 2LA", "1RB 1RA 1LC 0RF 0LE 0RD 0RE 1LB 1RA 0LC ... 1RD", diff --git a/test/test_turing.py b/test/test_turing.py index 09c2af9b..b2ae3a0e 100644 --- a/test/test_turing.py +++ b/test/test_turing.py @@ -1123,9 +1123,9 @@ def test_algebra(self): print(' },\n') assert_num_counts({ - "adds": 110605, + "adds": 110907, "divs": 13612, - "exps": 110617, - "muls": 11683, - "totl": 246517, + "exps": 110647, + "muls": 11747, + "totl": 246913, }) diff --git a/tm/rules.py b/tm/rules.py index 97030ce8..6b007ad0 100644 --- a/tm/rules.py +++ b/tm/rules.py @@ -133,7 +133,8 @@ def calculate_op_seq(*counts: Num) -> OpSeq: match sub: case Add(): - assert isinstance(l := sub.l, int) + if not isinstance(l := sub.l, int): + raise RuleLimit('sub_add') descent.append( ('+', -l))