示例#1
0
    def test_game_over_with_pigs_and_birds(self):
        phase = Phase()
        pigs = [Pig(1, 1) for i in range(2)]  # creating 2 pigs
        birds = [YellowBird(1, 1) for i in range(2)]  # criating 2 birds
        phase.add_pigs(*pigs)
        phase.add_birds(*birds)

        self.assertEqual(ON_GOING, phase.status())

        # clashing bird against pig on time 3
        for bird, pig in zip(birds, pigs):
            bird.clash(pig, 3)

        self.assertEqual(VICTORY, phase.status())

        phase.add_obstacles(Obstacle())
        self.assertEqual(VICTORY, phase.status(),
                         'Obstacle must not interfere on game result')

        phase.add_pigs(Pig())
        self.assertEqual(
            DEFEAT, phase.status(),
            'With no active birds and one Pig active, player should lose')

        phase.add_birds(YellowBird())
        self.assertEqual(
            ON_GOING, phase.status(),
            'With one pig and bird both active, game should still going on')
示例#2
0
    def test_status(self):
        phase = Phase()
        pigs = [Pig(1, 1) for i in range(2)]
        birds = [YellowBird(1, 1) for i in range(2)]
        phase.add_pigs(*pigs)
        phase.add_birds(*birds)
        self.assertEqual(ON_GOING, phase.status())

        for bird, pig in zip(birds, pigs):
            bird.clash(pig, 3)

        self.assertEqual(VICTORY, phase.status(),
                         'Without active pigs game should end with victory')

        phase.add_obstacles(Obstacle())
        self.assertEqual(VICTORY, phase.status(),
                          'Obstacle must not interfere on game result')

        pig = Pig()
        phase.add_pigs(pig)
        self.assertEqual(DEFEAT, phase.status(),
                         'With Active Pig and with no Active bird, game should end with defeat')

        phase.add_birds(YellowBird())
        self.assertEqual(ON_GOING, phase.status(),
                         'With active pig and birds, game should not end')

        pig.clash(pig, 3)
        self.assertEqual(VICTORY, phase.status(),
                         'Without active pigs game should end with victory')
示例#3
0
    def teste_status(self):
        fase = Phase()
        porcos = [Pig(1, 1) for i in range(2)]
        passaros = [YellowBird(1, 1) for i in range(2)]
        fase.add_pigs(*porcos)
        fase.add_birds(*passaros)
        self.assertEqual(ON_GOING, fase.status())

        for passaro, porco in zip(passaros, porcos):
            passaro.clash(porco, 3)

        self.assertEqual(VICTORY, fase.status(),
                         'Sem porcos ativos o jogo deveria terminar com vitória')

        fase.add_obstacles(Obstacle())
        self.assertEqual(VICTORY, fase.status(),
                         'Obstáculo não interfere para definir vitória')

        porco = Pig()
        fase.add_pigs(porco)
        self.assertEqual(DEFEAT, fase.status(),
                         'Com Pig ativo e sem pássaro para lançar, o jogo deveria acabar em derrota')

        fase.add_birds(YellowBird())
        self.assertEqual(ON_GOING, fase.status(),
                         'Com Pig ativo e com pássaro para lançar, o jogo não deveria acabar')

        porco.clash(porco, 3)
        self.assertEqual(VICTORY, fase.status(),
                         'Sem porco ativo, o jogo deveria acabar com vitória')
示例#4
0
    def test_status(self):
        phase = Phase()
        pigs = [Pig(1, 1) for i in range(2)]
        birds = [YellowBird(1, 1) for i in range(2)]
        phase.add_pigs(*pigs)
        phase.add_birds(*birds)
        self.assertEqual(ON_GOING, phase.status())

        for bird, pig in zip(birds, pigs):
            bird.clash(pig, 3)

        self.assertEqual(VICTORY, phase.status(),
                         'Without active pigs game should end with victory')

        phase.add_obstacles(Obstacle())
        self.assertEqual(VICTORY, phase.status(),
                         'Obstacle must not interfere on game result')

        pig = Pig()
        phase.add_pigs(pig)
        self.assertEqual(
            DEFEAT, phase.status(),
            'With Active Pig and with no Active bird, game should end with defeat'
        )

        phase.add_birds(YellowBird())
        self.assertEqual(ON_GOING, phase.status(),
                         'With active pig and birds, game should not end')

        pig.clash(pig, 3)
        self.assertEqual(VICTORY, phase.status(),
                         'Without active pigs game should end with victory')
示例#5
0
    def test_game_over_with_pigs_and_birds(self):
        phase = Phase()
        pigs = [Pig(1, 1) for i in range(2)]  # creating 2 pigs
        birds = [YellowBird(1, 1) for i in range(2)]  # criating 2 birds
        phase.add_pigs(*pigs)
        phase.add_birds(*birds)

        self.assertEqual(ON_GOING, phase.status())

        # clashing bird against pig on time 3
        for bird, pig in zip(birds, pigs):
            bird.clash(pig, 3)

        self.assertEqual(VICTORY, phase.status())

        phase.add_obstacles(Obstacle())
        self.assertEqual(VICTORY, phase.status(), 'Obstacle must not interfere on game result')

        phase.add_pigs(Pig())
        self.assertEqual(DEFEAT, phase.status(), 'With no active birds and one Pig active, player should lose')

        phase.add_birds(YellowBird())
        self.assertEqual(ON_GOING, phase.status(),
                         'With one pig and bird both active, game should still going on')
示例#6
0
    def teste_acabou_com_porcos_e_passaros(self):
        fase = Phase()
        porcos = [Pig(1, 1) for i in range(2)]  # criando 2 porcos
        passaros = [YellowBird(1, 1) for i in range(2)]  # criando 2 pássaros
        fase.add_pigs(*porcos)
        fase.add_birds(*passaros)

        self.assertEqual(ON_GOING, fase.status())

        # colidindo cada passaro com um porco no tempo 3
        for passaro, porco in zip(passaros, porcos):
            passaro.clash(porco, 3)

        self.assertEqual(VICTORY, fase.status())

        fase.add_obstacles(Obstacle())
        self.assertEqual(VICTORY, fase.status(), 'Obstáculo não interfere no fim do jogo')

        fase.add_pigs(Pig())
        self.assertEqual(DEFEAT, fase.status(), 'Com Pig ativo e sem pássaro para lançar, o jogo deveria acabar')

        fase.add_birds(YellowBird())
        self.assertEqual(ON_GOING, fase.status(),
                         'Com Pig ativo e com pássaro para lançar, o jogo não deveria acabar')
示例#7
0
 def test_game_over_without_pigs(self):
     phase = Phase()
     self.assertEqual(VICTORY, phase.status())
示例#8
0
 def teste_acabou_sem_porcos(self):
     fase = Phase()
     self.assertEqual(VICTORY, fase.status())
示例#9
0
 def test_game_over_without_pigs(self):
     phase = Phase()
     self.assertEqual(VICTORY, phase.status())