Introduced package for tests and added a test case for str_to_sprite.

The string variant of the "one-up" image, however, does not match the number-based one, to the expectation for the test had to be adjusted (basically replacing 1s with 0s).
This commit is contained in:
Jochen Kupperschmidt
2016-06-06 00:20:27 +02:00
parent 5b6a3cfc2c
commit e7e67834c8
2 changed files with 27 additions and 0 deletions

0
tests/__init__.py Normal file
View File

View File

@ -0,0 +1,27 @@
from gitfiti import str_to_sprite, ONEUP_STR
SYMBOLS = '''
*******
*=~~-~~=*
*~~---~~*
*=*****=*
**-*-*-**
*-----*
*****
'''
NUMBERS = [
[0,4,4,4,4,4,4,4,0],
[4,3,2,2,0,2,2,3,4],
[4,2,2,0,0,0,2,2,4],
[4,3,4,4,4,4,4,3,4],
[4,4,0,4,0,4,0,4,4],
[0,4,0,0,0,0,0,4,0],
[0,0,4,4,4,4,4,0,0],
]
def test_symbols_to_numbers():
actual = str_to_sprite(SYMBOLS)
assert actual == NUMBERS