def test_mod_zero(): warrior = Warrior(processes=[0]) core = Core(data=[ MOD('I', '$', 1, '$', 2), DAT('F', '$', 0, '$', 0), DAT('F', '$', 0, '$', 0) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert len(warrior.processes()) == 0
def test_djn_f_not_zero(): warrior = Warrior(processes=[0]) core = Core(data=[ DJN('B', '$', 2, '$', 0), DAT('F', '$', 0, '$', 1), DAT('F', '$', 0, '$', 1) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert warrior.processes() == [2]
def test_seq_i_no(): warrior = Warrior(processes=[0]) core = Core(data=[ SEQ('I', '$', 1, '$', 2), JMP('F', '$', 2, '$', 4), DAT('F', '$', 2, '$', 4) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert warrior.processes()[0] == 1
def test_spl_typical(): warrior = Warrior(processes=[0]) core = Core(data=[ SPL('F', '$', 2, '$', 2), DAT('F', '$', 0, '$', 0), DAT('F', '$', 0, '$', 0) ]) game = Round(core=core, warriors=[warrior], init_warriors=False) game.simulation_step() assert warrior.processes() == [1, 2]