Files
gitfiti/tests/test_str_to_sprite.py
Jochen Kupperschmidt e7e67834c8 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).
2016-06-06 01:23:25 +02:00

28 lines
409 B
Python

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