def test_get_inputs3(): asm = Assembler(sanity_check=True) prog3(asm) v = asm._instructions[0].verbose assert (len(checker.get_inputs(v)) == 2) assert (checker.get_inputs(v)[0].name == 'r1') assert (checker.get_inputs(v)[1].name == 'r2')
def test_get_inputs2(): asm = Assembler(sanity_check=True) prog2(asm) v = asm._instructions[0].verbose assert (len(checker.get_inputs(v)) == 4) assert (checker.get_inputs(v)[0].name == 'r0') assert (checker.get_inputs(v)[1].name == 'r0') assert (checker.get_inputs(v)[2].name == 'r3') assert (checker.get_inputs(v)[3].name == 'r3')
def test_nexts1(): @qpu def nexts(asm): mov(r0, r1) mov(r0, r2) asm = Assembler(sanity_check=True) nexts(asm) xs, labels = checker.prepare(asm._instructions, asm._labels) v = checker.get_nexts(xs[0], xs, labels, 1) assert (len(v) == 1) assert (v[0] == xs[1])
def test_nexts3(): @qpu def nexts(asm): L.label1 jzc(L.label1) nop() nop() mov(r0, r1) asm = Assembler(sanity_check=True) nexts(asm) xs, labels = checker.prepare(asm._instructions, asm._labels) v1 = checker.get_nexts(xs[3], xs, labels, 1) assert (len(v1) == 1) assert (v1[0] == xs[0]) v2 = checker.get_nexts(xs[3], xs, labels, 2) assert (len(v2) == 1) assert (v2[0] == xs[1])
def test_get_outputs1(): asm = Assembler(sanity_check=True) prog1(asm) v = asm._instructions[0].verbose assert (len(checker.get_outputs(v)) == 1) assert (checker.get_outputs(v)[0].name == 'r1')