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.

63 lines
915 B

  1. #ifdef TEST
  2. #include "unity.h"
  3. #include "unistd.h"
  4. #include "Modules.c"
  5. void setUp(void)
  6. {
  7. }
  8. void tearDown(void)
  9. {
  10. }
  11. void test_checkBallPosition_output_if_goal(void)
  12. {
  13. /* arrange */
  14. binX = 1;
  15. binY = 1;
  16. ballX = 1;
  17. ballY = 3;
  18. /* act */
  19. int output = checkBallPosition();
  20. /* assert */
  21. TEST_ASSERT_EQUAL(1, output);
  22. }
  23. void test_checkBallPosition_output_if_no_goal(void)
  24. {
  25. /* arrange */
  26. binX = 1;
  27. binY = 1;
  28. ballX = 1;
  29. ballY = 1;
  30. /* act */
  31. int output = checkBallPosition();
  32. /* assert */
  33. TEST_ASSERT_EQUAL(2, output);
  34. }
  35. void test_sortScoreboard_check_if_file_is_created(void) {
  36. /* arrange */
  37. /* act */
  38. if (access("ScoreBoard.txt", 0) == 0) {
  39. remove("ScoreBoard.txt");
  40. }
  41. sortScoreboard();
  42. int output = access("ScoreBoard.txt", 0);
  43. /* assert */
  44. TEST_ASSERT_EQUAL(0, output);
  45. }
  46. #endif // TEST