Example #1
0
 def test_launched(self):
     red_bird = RedBird(1, 1)
     self.assertFalse(red_bird.launched(),
                      'Once launch method was not executed, should return False')
     red_bird.launch(0, 0)
     self.assertTrue(red_bird.launched(),
                     'Once launch method was executed on previous line, should return True')
Example #2
0
 def teste_foi_lancado(self):
     """
     Teste de lançamento. Enquanto o método lançar do passaro não for chamado, o méotod foi_lancado deve retornar
     Falso
     :return:
     """
     passaro_vermelho = RedBird(1, 1)
     self.assertFalse(passaro_vermelho.launched(),
                      'Se o método lançar ainda não foi executado, deve retornar falso')
     passaro_vermelho.launch(0, 0)
     self.assertTrue(passaro_vermelho.launched(),
                     'Se o método lançar foi executado, deve retornar verdadeiro')
Example #3
0
    def test_launch_without_error_when_there_is_no_bird_to_be_launch(self):
        red_bird, yellow_bird = RedBird(1, 1), YellowBird(1, 1)
        phase = Phase()
        phase.add_birds(red_bird, yellow_bird)
        self.assertFalse(red_bird.launched())
        self.assertFalse(yellow_bird.launched())
        phase.launch(90, 1)
        phase.launch(45, 3)
        phase.launch(31, 5)  # There is no bird to launch here

        self.assertTrue(red_bird.launched())
        self.assertEqual(math.radians(90), red_bird._launch_angle)
        self.assertEqual(1, red_bird._launch_time)

        self.assertTrue(yellow_bird.launched())
        self.assertEqual(math.radians(45), yellow_bird._launch_angle)
        self.assertEqual(3, yellow_bird._launch_time)
Example #4
0
    def teste_lancar_passaro_sem_erro_quando_nao_existe_passaro(self):
        passaro_vermelho, passaro_amarelo = RedBird(1, 1), YellowBird(1, 1)
        fase = Phase()
        fase.add_birds(passaro_vermelho, passaro_amarelo)
        self.assertFalse(passaro_vermelho.launched())
        self.assertFalse(passaro_amarelo.launched())
        fase.launch(90, 1)
        fase.launch(45, 3)
        fase.launch(31, 5)  # testando que lançar passaros depios de todos lançados não causa erro

        self.assertTrue(passaro_vermelho.launched())
        self.assertEqual(math.radians(90), passaro_vermelho._launch_angle)
        self.assertEqual(1, passaro_vermelho._launch_time)

        self.assertTrue(passaro_amarelo.launched())
        self.assertEqual(math.radians(45), passaro_amarelo._launch_angle)
        self.assertEqual(3, passaro_amarelo._launch_time)
Example #5
0
    def test_launch_without_error_when_there_is_no_bird_to_be_launch(self):
        red_bird, yellow_bird = RedBird(1, 1), YellowBird(1, 1)
        phase = Phase()
        phase.add_birds(red_bird, yellow_bird)
        self.assertFalse(red_bird.launched())
        self.assertFalse(yellow_bird.launched())
        phase.launch(90, 1)
        phase.launch(45, 3)
        phase.launch(31, 5)  # There is no bird to launch here

        self.assertTrue(red_bird.launched())
        self.assertEqual(math.radians(90), red_bird._launch_angle)
        self.assertEqual(1, red_bird._launch_time)

        self.assertTrue(yellow_bird.launched())
        self.assertEqual(math.radians(45), yellow_bird._launch_angle)
        self.assertEqual(3, yellow_bird._launch_time)