def test_0000000000_0(self): """ Todos as jogadas com o zero retorna 0 como pontuacao """ self.assertEquals(bowling([ (0,0), (0,0), (0,0), (0,0), (0,0) ]) , 0)
def test_ultimo_spare_espera_uma_jogada_extra_55(self): """ Ocorre spare em 2 rodadas seguidas """ self.assertEquals(bowling([ (3,7), (5,5), (4,1), (2,5), (5,5,4) ]) , 55)
def test_dois_spares_seguidos_49(self): """ Ocorre spare em 2 rodadas seguidas """ self.assertEquals(bowling([ (3,7), (5,5), (4,1), (2,5), (5,3) ]) , 49)
def go_bowl(match, team): print('BOWLING ' + team[0]) disp_players(team) b_ch = int(input('CHOOSE THE BOWLER: ')) #creation of bowler bowl_temp = bowling(team[b_ch]) #bowling object append bowl_list.append(bowl_temp) #bowling dict append bowl_stats.append(bowl_temp.b_stats) scoreboard(match.match_stats, bat_stats, bowl_stats) return team, bowl_temp
def test_3152412553_31(self): """ Nenhum spare ou strike, somente soma os elementos """ self.assertEquals(bowling([ (3,1), (5,2), (4,1), (2,5), (5,3) ]) , 31)
def test_3752412553_42(self): """ Ocorre spare na primeira jogada """ self.assertEquals(bowling([ (3,7), (5,2), (4,1), (2,5), (5,3) ]) , 42)
def choose_bowler(bowl, bowler): bowl = list(bowl) bowl.remove(bowler.bname) disp_players(bowl) b_ch = int(input('CHOOSE THE BOWLER')) for bowlers in bowl_list: if bowlers.bname == bowl[b_ch] and bowl[b_ch] != bowler.bname: bowler = bowlers break else: bowler = bowling(bowl[b_ch]) bowl_list.append(bowler) return bowler
def test_derrubou_5_pinos_em_rodadas_e_tentativas_diferentes(self): game = ((1,1),(1,1),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(5, bowling(game))
def test_final_x(): assert_equals(bowling("111111111111111111X11"),30)
def test_strike_na_primeira_rodada(self): game = ((10, 0), (1, 0), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(14, bowling(game))
def test_derrubou_2_pinos_na_primeira_rodada(self): game = ((2,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(2, bowling(game))
def test_spare_na_primeira_rodada(self): game = ((5, 5), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(12, bowling(game))
def test_spare_na_segunda_rodada(self): game = ((5, 4), (6, 4), (0, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(21, bowling(game))
def test_5slash(): assert_equals(bowling("5/5/5/5/5/5/5/5/5/5/5"), 150)
def test_derrubou_3_pinos_na_primeira_rodada_em_tentativas_diferentes( self): game = ((2, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(3, bowling(game))
def test_fast_perfect_game(): assert_equals(bowling("X X 3/ X X X X X X XXX"),273)
def test_999(): assert_equals(bowling("9-9-9-9-9-9-9-9-9-9-"), 90)
def test_perfect_game(): assert_equals(bowling("X X X X X X X X X XXX"),300)
def test_last_frame_full(): assert_equals(bowling("11 11 X 11 11 11 11 11 11 XXX"),58)
def test_good_game(): assert_equals(bowling("1111X111111111111X11"),40)
def test_dois_spares(self): game = ((4,6),(5,5),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(32, bowling(game))
def test_168(): assert_equals(bowling("X7/729/XXX236/7/3"), 168)
def test_final_spare(): assert_equals(bowling("1111111111111111111/1"),29)
def test_final(): assert_equals(bowling("111111111111111111X--"),28)
def test_derrubou_5_pinos_em_rodadas_e_tentativas_diferentes(self): game = ((1, 1), (1, 1), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(5, bowling(game))
def test_final2(): assert_equals(bowling("1111111111111111111/-"),28)
def test_derrubou_0_pino(self): game = ((0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(0, bowling(game))
def test_final677(): assert_equals(bowling("111111111111111111X-/"),38)
def test_spare_na_segunda_rodada_com_proximo_dif_de_1(self): game = ((5, 4), (6, 4), (4, 1), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(29, bowling(game))
def test_total_miss(): assert_equals(bowling("--------------------"),0)
def test_dois_spares(self): game = ((4, 6), (5, 5), (1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(32, bowling(game))
def test_spare_na_segunda_rodada(self): game = ((5,4),(6,4),(0,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(21, bowling(game))
def test_derrubou_3_pinos_na_primeira_rodada_em_tentativas_diferentes(self): game = ((2,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(3, bowling(game))
def test_strike_na_primeira_rodada(self): game = ((10,0),(1,0),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(14, bowling(game))
def test_spare_na_primeira_rodada(self): game = ((5,5),(1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(12, bowling(game))
def test_slash_irnxwo(): assert_equals(bowling("1/11111111111111111/1"),38)
def test_spare_na_segunda_rodada_com_proximo_dif_de_1(self): game = ((5,4),(6,4),(4,1),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(29, bowling(game))
def test_derrubou_1_pino_na_primeira_rodada(self): game = ((1, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(1, bowling(game))
def test_derrubou_0_pino(self): game = ((0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(0, bowling(game))
def test_derrubou_2_pinos_na_primeira_rodada(self): game = ((2, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)) self.assertEqual(2, bowling(game))
def test_derrubou_1_pino_na_primeira_rodada(self): game = ((1,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0)) self.assertEqual(1, bowling(game))
def test_low_score(): assert_equals(bowling("11111111111111111111"),20)