From e7e67834c873a68fd8ec2dcfbdcd1429660126e3 Mon Sep 17 00:00:00 2001 From: Jochen Kupperschmidt Date: Mon, 6 Jun 2016 00:20:27 +0200 Subject: [PATCH] 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). --- tests/__init__.py | 0 tests/test_str_to_sprite.py | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_str_to_sprite.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_str_to_sprite.py b/tests/test_str_to_sprite.py new file mode 100644 index 000000000..41cc43c10 --- /dev/null +++ b/tests/test_str_to_sprite.py @@ -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