Exemplo n.º 1
0
assert type(board.get_item(1,2)) == Dice, "Should return the the 3rd item from the second row, an Dice object"

assert len(board.get_surrounds(3,3)) == 3, "Should return a list with 3 Dices, the surrounds of the dice on 4th row and 4th column."
assert len(board.get_surrounds(1,1)) == 8, "Should return a list with 8 Dices, the surrounds of the dice on 2nd row and 2nd column."
assert len(board.get_surrounds(0,2)) == 5, "Should return a list with 5 Dices, the surrounds of the dice on 1st row and 3rd column."


### Boggle tests ###
from boggle import Boggle

boggle = Boggle()
boggle.start()
assert type(boggle) == Boggle, "Should be an instance of boggle"

word = ''
word += str(boggle.get_item(0,0))
word += str(boggle.get_item(0,1))
word += str(boggle.get_item(0,2))
print(boggle)
print(word)
assert boggle.has_word(word) == True, "Should be True as the 'word' is the first 3 letters from 1st row"

word = ''
word += str(boggle.get_item(1,1))
word += str(boggle.get_item(2,2))
word += str(boggle.get_item(3,3))
print(boggle)
print(word)
assert boggle.has_word(word) == True, "Should be True as the 'word' is a sequence of diagonal letter in the board"

word = ''