You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
734 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "pong.h"
  4. #define TEST_SCREEN_WIDTH 40
  5. #define TEST_SCREEN_HEIGHT 20
  6. char screen[TEST_SCREEN_HEIGHT][TEST_SCREEN_WIDTH+1];
  7. void setUp(void){
  8. //Wenn Funktion Vorraussetzungen braucht
  9. }
  10. void tearDown(void){
  11. }
  12. void test_clearScreen(void){
  13. /* arrange */
  14. int i, j;
  15. for (i = 0; i < TEST_SCREEN_HEIGHT; i++) {
  16. for (j = 0; j < TEST_SCREEN_WIDTH+1; j++) {
  17. screen[i][j] = 'X';
  18. }
  19. screen[i][j-1] = '\0';
  20. }
  21. /* act */
  22. clearScreen();
  23. /* assert */
  24. for (i = 0; i < TEST_SCREEN_HEIGHT; i++) {
  25. for (j = 0; j < TEST_SCREEN_WIDTH+1; j++) {
  26. TEST_ASSERT_EQUAL_INT(' ', screen[i][j]);
  27. }
  28. }
  29. }
  30. #endif // TEST