def test_pair(): ''' Pair: The player scores the sum of the two highest matching dice. ''' # El algoritmo del metodo no es optimo, es complicado e ilegible. # La abstraccion, el nombre del metodo, no es adecuada # puesto que la categoria se llama pair. assert 8 == Yatzy.score_pair(3, 3, 3, 4, 4) assert 12 == Yatzy.score_pair(1, 1, 6, 2, 6) assert 6 == Yatzy.score_pair(3, 3, 3, 4, 1) assert 6 == Yatzy.score_pair(3, 3, 3, 3, 1) assert 0 == Yatzy.score_pair(1, 2, 3, 4, 5)
def test_one_pair(): assert 6 == Yatzy.score_pair(3, 4, 3, 5, 6) assert 10 == Yatzy.score_pair(5, 3, 3, 3, 5) assert 12 == Yatzy.score_pair(5, 3, 6, 6, 5)
def test_pair_dos(): assert 8 == Yatzy.score_pair(3, 3, 3, 4, 4)
def test_pair_uno(): assert 12 == Yatzy.score_pair(1, 1, 6, 2, 6)
def test_one_pair(): assert Yatzy.score_pair(1, 4, 3, 5, 6) == 0 assert Yatzy.score_pair(3, 4, 3, 5, 6) == 6 assert Yatzy.score_pair(5, 3, 3, 3, 5) == 10 assert Yatzy.score_pair(5, 3, 6, 6, 5) == 12 assert Yatzy.score_pair(5, 3, 6, 6, 3) == 12
def test_score_pair(): assert 8 == Yatzy.score_pair(4, 5, 6, 7, 4) assert 10 == Yatzy.score_pair(4, 3, 5, 3, 5) assert 12 == Yatzy.score_pair(6, 2, 3, 4, 6) assert 0 == Yatzy.score_pair(1, 2, 3, 4, 6)