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:
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
27
tests/test_str_to_sprite.py
Normal file
27
tests/test_str_to_sprite.py
Normal 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
|
Reference in New Issue
Block a user