diff --git a/tests/greedy_permutation_files/swap_element17.json b/tests/greedy_permutation_files/swap_element17.json new file mode 100644 index 00000000..8f0d4868 --- /dev/null +++ b/tests/greedy_permutation_files/swap_element17.json @@ -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 +} \ No newline at end of file diff --git a/tests/test_greedy_permutation.py b/tests/test_greedy_permutation.py new file mode 100644 index 00000000..c29bdbda --- /dev/null +++ b/tests/test_greedy_permutation.py @@ -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"