def test_execute_recruit(self): # Normal app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 1, [1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 1, [2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 0) self.assertEqual(app.cells, 15) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 13) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 2, [1, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 2, [2, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 0) self.assertEqual(app.cells, 15) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [1, 1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 3) self.assertEqual(app.cells, 12) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [1, 2, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 13) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [2, 1, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [2, 2, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 0) self.assertEqual(app.cells, 15) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) # Coherent app.cells = 15 unused_ops = app.execute_recruit("United States", 1, [1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 1, [2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 0) self.assertEqual(app.cells, 15) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 13) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 2, [1, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 2, [2, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 0) self.assertEqual(app.cells, 15) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [1, 1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 3) self.assertEqual(app.cells, 12) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [1, 2, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 13) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [2, 1, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 15 unused_ops = app.execute_recruit("United States", 3, [2, 2, 2]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 0) self.assertEqual(app.cells, 15) # not enough cells app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 1 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 1) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 2 app.funding = 9 unused_ops = app.execute_recruit("United States", 3, [2, 2, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 1) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 2 app.funding = 9 unused_ops = app.execute_recruit("United States", 3, [1, 2, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 2 app.funding = 9 unused_ops = app.execute_recruit("United States", 3, [1, 1, 2]) self.assertEqual(unused_ops, 1) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 0) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 1 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 1) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 0) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 2 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 0) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 3 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 1) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 3 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [2, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 2) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 5 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [2, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 1) self.assertEqual(app.cells, 4) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 5 app.funding = 9 unused_ops = app.execute_recruit("United States", 2, [1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 2) self.assertEqual(app.cells, 3) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 5 app.funding = 9 unused_ops = app.execute_recruit("United States", 3, [1, 1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 3) self.assertEqual(app.cells, 2) app = Labyrinth(1, 2, self.set_up_blank_test_scenario) app.cells = 4 app.funding = 9 unused_ops = app.execute_recruit("United States", 3, [1, 1, 1]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("United States").sleeperCells, 3) self.assertEqual(app.cells, 1) # IR RC app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 app.funding = 9 app.get_country("Iraq").make_poor() unused_ops = app.execute_recruit("Iraq", 1, [4]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("Iraq").sleeperCells, 0) self.assertEqual(app.cells, 15) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 app.funding = 9 app.get_country("Iraq").make_islamist_rule() unused_ops = app.execute_recruit("Iraq", 1, [6]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("Iraq").sleeperCells, 1) self.assertEqual(app.cells, 14) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.cells = 15 app.funding = 9 app.get_country("Iraq").make_fair() app.get_country("Iraq").make_regime_change() unused_ops = app.execute_recruit("Iraq", 1, [6]) self.assertEqual(unused_ops, 0) self.assertEqual(app.get_country("Iraq").sleeperCells, 1) self.assertEqual(app.cells, 14)
def test_num_cells_available(self): app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 9 app.cells = 15 self.assertEqual(app.num_cells_available(), 15) app.cells = 14 self.assertEqual(app.num_cells_available(), 14) app.cells = 13 self.assertEqual(app.num_cells_available(), 13) app.cells = 12 self.assertEqual(app.num_cells_available(), 12) app.cells = 11 self.assertEqual(app.num_cells_available(), 11) app.cells = 10 self.assertEqual(app.num_cells_available(), 10) app.cells = 9 self.assertEqual(app.num_cells_available(), 9) app.cells = 8 self.assertEqual(app.num_cells_available(), 8) app.cells = 7 self.assertEqual(app.num_cells_available(), 7) app.cells = 6 self.assertEqual(app.num_cells_available(), 6) app.cells = 5 self.assertEqual(app.num_cells_available(), 5) app.cells = 4 self.assertEqual(app.num_cells_available(), 4) app.cells = 3 self.assertEqual(app.num_cells_available(), 3) app.cells = 2 self.assertEqual(app.num_cells_available(), 2) app.cells = 1 self.assertEqual(app.num_cells_available(), 1) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 8 app.cells = 15 self.assertEqual(app.num_cells_available(), 15) app.cells = 14 self.assertEqual(app.num_cells_available(), 14) app.cells = 13 self.assertEqual(app.num_cells_available(), 13) app.cells = 12 self.assertEqual(app.num_cells_available(), 12) app.cells = 11 self.assertEqual(app.num_cells_available(), 11) app.cells = 10 self.assertEqual(app.num_cells_available(), 10) app.cells = 9 self.assertEqual(app.num_cells_available(), 9) app.cells = 8 self.assertEqual(app.num_cells_available(), 8) app.cells = 7 self.assertEqual(app.num_cells_available(), 7) app.cells = 6 self.assertEqual(app.num_cells_available(), 6) app.cells = 5 self.assertEqual(app.num_cells_available(), 5) app.cells = 4 self.assertEqual(app.num_cells_available(), 4) app.cells = 3 self.assertEqual(app.num_cells_available(), 3) app.cells = 2 self.assertEqual(app.num_cells_available(), 2) app.cells = 1 self.assertEqual(app.num_cells_available(), 1) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 7 app.cells = 15 self.assertEqual(app.num_cells_available(), 15) app.cells = 14 self.assertEqual(app.num_cells_available(), 14) app.cells = 13 self.assertEqual(app.num_cells_available(), 13) app.cells = 12 self.assertEqual(app.num_cells_available(), 12) app.cells = 11 self.assertEqual(app.num_cells_available(), 11) app.cells = 10 self.assertEqual(app.num_cells_available(), 10) app.cells = 9 self.assertEqual(app.num_cells_available(), 9) app.cells = 8 self.assertEqual(app.num_cells_available(), 8) app.cells = 7 self.assertEqual(app.num_cells_available(), 7) app.cells = 6 self.assertEqual(app.num_cells_available(), 6) app.cells = 5 self.assertEqual(app.num_cells_available(), 5) app.cells = 4 self.assertEqual(app.num_cells_available(), 4) app.cells = 3 self.assertEqual(app.num_cells_available(), 3) app.cells = 2 self.assertEqual(app.num_cells_available(), 2) app.cells = 1 self.assertEqual(app.num_cells_available(), 1) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 6 app.cells = 15 self.assertEqual(app.num_cells_available(), 10) app.cells = 14 self.assertEqual(app.num_cells_available(), 9) app.cells = 13 self.assertEqual(app.num_cells_available(), 8) app.cells = 12 self.assertEqual(app.num_cells_available(), 7) app.cells = 11 self.assertEqual(app.num_cells_available(), 6) app.cells = 10 self.assertEqual(app.num_cells_available(), 5) app.cells = 9 self.assertEqual(app.num_cells_available(), 4) app.cells = 8 self.assertEqual(app.num_cells_available(), 3) app.cells = 7 self.assertEqual(app.num_cells_available(), 2) app.cells = 6 self.assertEqual(app.num_cells_available(), 1) app.cells = 5 self.assertEqual(app.num_cells_available(), 0) app.cells = 4 self.assertEqual(app.num_cells_available(), 0) app.cells = 3 self.assertEqual(app.num_cells_available(), 0) app.cells = 2 self.assertEqual(app.num_cells_available(), 0) app.cells = 1 self.assertEqual(app.num_cells_available(), 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 5 app.cells = 15 self.assertEqual(app.num_cells_available(), 10) app.cells = 14 self.assertEqual(app.num_cells_available(), 9) app.cells = 13 self.assertEqual(app.num_cells_available(), 8) app.cells = 12 self.assertEqual(app.num_cells_available(), 7) app.cells = 11 self.assertEqual(app.num_cells_available(), 6) app.cells = 10 self.assertEqual(app.num_cells_available(), 5) app.cells = 9 self.assertEqual(app.num_cells_available(), 4) app.cells = 8 self.assertEqual(app.num_cells_available(), 3) app.cells = 7 self.assertEqual(app.num_cells_available(), 2) app.cells = 6 self.assertEqual(app.num_cells_available(), 1) app.cells = 5 self.assertEqual(app.num_cells_available(), 0) app.cells = 4 self.assertEqual(app.num_cells_available(), 0) app.cells = 3 self.assertEqual(app.num_cells_available(), 0) app.cells = 2 self.assertEqual(app.num_cells_available(), 0) app.cells = 1 self.assertEqual(app.num_cells_available(), 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 4 app.cells = 15 self.assertEqual(app.num_cells_available(), 10) app.cells = 14 self.assertEqual(app.num_cells_available(), 9) app.cells = 13 self.assertEqual(app.num_cells_available(), 8) app.cells = 12 self.assertEqual(app.num_cells_available(), 7) app.cells = 11 self.assertEqual(app.num_cells_available(), 6) app.cells = 10 self.assertEqual(app.num_cells_available(), 5) app.cells = 9 self.assertEqual(app.num_cells_available(), 4) app.cells = 8 self.assertEqual(app.num_cells_available(), 3) app.cells = 7 self.assertEqual(app.num_cells_available(), 2) app.cells = 6 self.assertEqual(app.num_cells_available(), 1) app.cells = 5 self.assertEqual(app.num_cells_available(), 0) app.cells = 4 self.assertEqual(app.num_cells_available(), 0) app.cells = 3 self.assertEqual(app.num_cells_available(), 0) app.cells = 2 self.assertEqual(app.num_cells_available(), 0) app.cells = 1 self.assertEqual(app.num_cells_available(), 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 3 app.cells = 15 self.assertEqual(app.num_cells_available(), 5) app.cells = 14 self.assertEqual(app.num_cells_available(), 4) app.cells = 13 self.assertEqual(app.num_cells_available(), 3) app.cells = 12 self.assertEqual(app.num_cells_available(), 2) app.cells = 11 self.assertEqual(app.num_cells_available(), 1) app.cells = 10 self.assertEqual(app.num_cells_available(), 0) app.cells = 9 self.assertEqual(app.num_cells_available(), 0) app.cells = 8 self.assertEqual(app.num_cells_available(), 0) app.cells = 7 self.assertEqual(app.num_cells_available(), 0) app.cells = 6 self.assertEqual(app.num_cells_available(), 0) app.cells = 5 self.assertEqual(app.num_cells_available(), 0) app.cells = 4 self.assertEqual(app.num_cells_available(), 0) app.cells = 3 self.assertEqual(app.num_cells_available(), 0) app.cells = 2 self.assertEqual(app.num_cells_available(), 0) app.cells = 1 self.assertEqual(app.num_cells_available(), 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 2 app.cells = 15 self.assertEqual(app.num_cells_available(), 5) app.cells = 14 self.assertEqual(app.num_cells_available(), 4) app.cells = 13 self.assertEqual(app.num_cells_available(), 3) app.cells = 12 self.assertEqual(app.num_cells_available(), 2) app.cells = 11 self.assertEqual(app.num_cells_available(), 1) app.cells = 10 self.assertEqual(app.num_cells_available(), 0) app.cells = 9 self.assertEqual(app.num_cells_available(), 0) app.cells = 8 self.assertEqual(app.num_cells_available(), 0) app.cells = 7 self.assertEqual(app.num_cells_available(), 0) app.cells = 6 self.assertEqual(app.num_cells_available(), 0) app.cells = 5 self.assertEqual(app.num_cells_available(), 0) app.cells = 4 self.assertEqual(app.num_cells_available(), 0) app.cells = 3 self.assertEqual(app.num_cells_available(), 0) app.cells = 2 self.assertEqual(app.num_cells_available(), 0) app.cells = 1 self.assertEqual(app.num_cells_available(), 0) app = Labyrinth(1, 1, self.set_up_blank_test_scenario) app.funding = 1 app.cells = 15 self.assertEqual(app.num_cells_available(), 5) app.cells = 14 self.assertEqual(app.num_cells_available(), 4) app.cells = 13 self.assertEqual(app.num_cells_available(), 3) app.cells = 12 self.assertEqual(app.num_cells_available(), 2) app.cells = 11 self.assertEqual(app.num_cells_available(), 1) app.cells = 10 self.assertEqual(app.num_cells_available(), 0) app.cells = 9 self.assertEqual(app.num_cells_available(), 0) app.cells = 8 self.assertEqual(app.num_cells_available(), 0) app.cells = 7 self.assertEqual(app.num_cells_available(), 0) app.cells = 6 self.assertEqual(app.num_cells_available(), 0) app.cells = 5 self.assertEqual(app.num_cells_available(), 0) app.cells = 4 self.assertEqual(app.num_cells_available(), 0) app.cells = 3 self.assertEqual(app.num_cells_available(), 0) app.cells = 2 self.assertEqual(app.num_cells_available(), 0) app.cells = 1 self.assertEqual(app.num_cells_available(), 0)