Exemple #1
0
    def test_game_info_2(self):
        test_player_1 = Player()
        test_player_2 = Player()
        test_obs = AccumulatingObserver()

        ex_referee = Referee([test_player_1, test_player_2],4,4)
        ex_referee.add_observer(test_obs)
        
        ex_referee.setup_game()

        self.assertEqual(ex_referee.get_game_info()[0],"In Progress")
Exemple #2
0
    def test_end_game_info(self):
        test_player_1 = Player()
        test_player_2 = Player()
        test_obs = AccumulatingObserver()

        ex_referee = Referee([test_player_1, test_player_2],4,4)
        ex_referee.add_observer(test_obs)
        
        ex_referee.setup_game()
        ex_referee.run_placement_phase()
        ex_referee.run_move_phase()
        ex_referee.end_game()

        self.assertEqual(ex_referee.get_game_info()[0],"End")
Exemple #3
0
    def test_end_game(self):
        test_player_1 = Player()
        test_player_2 = Player()
        test_obs = AccumulatingObserver()

        ex_referee = Referee([test_player_1, test_player_2],4,4)
        ex_referee.add_observer(test_obs)
        
        ex_referee.setup_game()
        ex_referee.run_placement_phase()
        self.assertEqual(test_obs.messages_rec[-1][0],"Placement")

        ex_referee.run_move_phase()
        self.assertEqual(test_obs.messages_rec[-1][0],"Move")

        ex_referee.end_game()

        #test that the observer's received an end message
        self.assertEqual(test_obs.messages_rec[-1][0],"End")
        #list of kicked players is empty
        self.assertEqual(test_obs.messages_rec[-1][2],[])