Skip to content

Commit

Permalink
#18: Test for SWAP17
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Jan 10, 2025
1 parent f69a54a commit 3a5424d
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
78 changes: 78 additions & 0 deletions tests/greedy_permutation_files/swap_element17.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"name": "swap_element17",
"init_progr_len": 1,
"max_progr_len": 1,
"max_sk_sz": 18,
"vars": [
"s(0)",
"s(1)",
"s(10)",
"s(11)",
"s(12)",
"s(13)",
"s(14)",
"s(15)",
"s(16)",
"s(17)",
"s(2)",
"s(3)",
"s(4)",
"s(5)",
"s(6)",
"s(7)",
"s(8)",
"s(9)"
],
"src_ws": [
"s(0)",
"s(1)",
"s(2)",
"s(3)",
"s(4)",
"s(5)",
"s(6)",
"s(7)",
"s(8)",
"s(9)",
"s(10)",
"s(11)",
"s(12)",
"s(13)",
"s(14)",
"s(15)",
"s(16)",
"s(17)"
],
"tgt_ws": [
"s(17)",
"s(1)",
"s(2)",
"s(3)",
"s(4)",
"s(5)",
"s(6)",
"s(7)",
"s(8)",
"s(9)",
"s(10)",
"s(11)",
"s(12)",
"s(13)",
"s(14)",
"s(15)",
"s(16)",
"s(0)"
],
"user_instrs": [],
"current_cost": 3,
"storage_dependences": [],
"memory_dependences": [],
"dependencies": [],
"is_revert": false,
"rules_applied": false,
"rules": [],
"original_instrs": "SWAP16",
"min_length_instrs": 0,
"min_length_bounds": 0,
"min_length": 0
}
16 changes: 16 additions & 0 deletions tests/test_greedy_permutation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import glob

import pytest
from typing import Dict
from parser.cfg_block import CFGBlock
from parser.cfg_instruction import build_instr_spec, build_verbatim_spec, build_push_spec, CFGInstruction
from greedy.greedy_new_version import greedy_from_file, STACK_DEPTH
from analysis.greedy_validation import check_execution_from_ids


class TestGreedyPermutation:

def test_swap_element17(self):
sfs, seq, outcome = greedy_from_file("greedy_permutation_files/swap_element17.json")
print("LEN", len(seq))
assert check_execution_from_ids(sfs, seq), "Failing SWAP17 tests"

0 comments on commit 3a5424d

Please sign in to comment.