diff --git a/test_clearScreen.c b/test_clearScreen.c new file mode 100644 index 0000000..e859d99 --- /dev/null +++ b/test_clearScreen.c @@ -0,0 +1,38 @@ +#ifdef TEST +#include "unity.h" +#include "pong.h" + +#define TEST_SCREEN_WIDTH 40 +#define TEST_SCREEN_HEIGHT 20 + +char screen[TEST_SCREEN_HEIGHT][TEST_SCREEN_WIDTH+1]; + +void setUp(void){ + //Wenn Funktion Vorraussetzungen braucht +} + +void tearDown(void){ +} + +void test_clearScreen(void){ + /* arrange */ + int i, j; + for (i = 0; i < TEST_SCREEN_HEIGHT; i++) { + for (j = 0; j < TEST_SCREEN_WIDTH+1; j++) { + screen[i][j] = 'X'; + } + screen[i][j-1] = '\0'; + } + + /* act */ + clearScreen(); + + /* assert */ + for (i = 0; i < TEST_SCREEN_HEIGHT; i++) { + for (j = 0; j < TEST_SCREEN_WIDTH+1; j++) { + TEST_ASSERT_EQUAL_INT(' ', screen[i][j]); + } + } +} + +#endif // TEST