def test_sub_typical(): warrior = Warrior(processes=[0]) core = Core( data=[SUB('AB', '#', '3', '$', '1'), DAT('F', '$', 1, '$', -5)]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert game.core()[1].b_value() == -8
def test_sub_x(): warrior = Warrior(processes=[0]) core = Core(data=[SUB('X', '#', '3', '$', '1'), DAT('F', '$', 2, '$', -5)]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() instruction = game.core()[1] assert instruction.a_value() == 1 assert instruction.b_value() == -8
def test_core_add_cycle_begin_two_times(): warrior = Warrior(processes=[1]) core = Core(data=[ DAT('F', '$', 1, '$', 5), ADD('AB', '#', '3', '$', '-5'), DAT('F', '$', 1, '$', -5) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert game.core()[2].b_value() == -2
def test_mov_x(): warrior = Warrior(processes=[0]) core = Core(data=[ MOV('X', '$', '1', '$', '2'), DAT('F', '$', 1, '$', 7), DAT('F', '$', 0, '$', 0) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert game.core()[2].a_value() == 7 assert game.core()[2].b_value() == 1
def test_core_postincrement_b(): warrior = Warrior(processes=[0]) core = Core(data=[DAT('F', '>', 1, '$', 1), DAT('F', '$', 0, '$', 0)]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert game.core()[1].b_value() == 1