Skip to content

Commit

Permalink
Change assertion to check
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Aug 20, 2024
1 parent eca1a38 commit 27c7108
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions test/prog_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions test/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions test/test_turing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
3 changes: 2 additions & 1 deletion tm/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 27c7108

Please sign in to comment.