From 7738edaa0b92635e2b9b42c13f82bcc1bfdea464 Mon Sep 17 00:00:00 2001 From: fdai8040 Date: Sat, 3 Feb 2024 16:03:16 +0000 Subject: [PATCH] test_clearScreen --- test_clearScreen.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test_clearScreen.c 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