Browse Source

Fünfter Unit Test

main
David PC Saiz 2 years ago
parent
commit
5c522ad489
  1. 46
      build/test/cache/test_Modules.c
  2. BIN
      build/test/out/c/test_Modules.o
  3. BIN
      build/test/out/c/test_Modules_runner.o
  4. BIN
      build/test/out/test_Modules.out
  5. 46
      build/test/preprocess/files/test_Modules.c
  6. 10
      build/test/results/test_Modules.pass
  7. 2
      build/test/runners/test_Modules_runner.c
  8. 21
      test/test_Modules.c

46
build/test/cache/test_Modules.c

@ -177,3 +177,49 @@ void test_clearField_check_if_Playgroung_clear(void)
), (UNITY_UINT)(83), UNITY_DISPLAY_STYLE_INT);
}
void test_getStartPosition_check_given_position(void)
{
int output = 0;
int width = 10;
int heigth = 10;
buildBin(width, heigth);
if (field[width][heigth] != 'V' ||
field[width + 1][heigth + 1] != '\\' ||
field[width + 2][heigth + 2] != '\\' ||
field[width - 1][heigth + 1] != '/' ||
field[width - 2][heigth + 2] != '/' ||
field[width][heigth + 1] != ' ')
output = 1;
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(104), UNITY_DISPLAY_STYLE_INT);
}

BIN
build/test/out/c/test_Modules.o

BIN
build/test/out/c/test_Modules_runner.o

BIN
build/test/out/test_Modules.out

46
build/test/preprocess/files/test_Modules.c

@ -177,3 +177,49 @@ void test_clearField_check_if_Playgroung_clear(void)
), (UNITY_UINT)(83), UNITY_DISPLAY_STYLE_INT);
}
void test_getStartPosition_check_given_position(void)
{
int output = 0;
int width = 10;
int heigth = 10;
buildBin(width, heigth);
if (field[width][heigth] != 'V' ||
field[width + 1][heigth + 1] != '\\' ||
field[width + 2][heigth + 2] != '\\' ||
field[width - 1][heigth + 1] != '/' ||
field[width - 2][heigth + 2] != '/' ||
field[width][heigth + 1] != ' ')
output = 1;
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(104), UNITY_DISPLAY_STYLE_INT);
}

10
build/test/results/test_Modules.pass

@ -19,15 +19,19 @@
:line: 64
:message: ''
:unity_test_time: 0
- :test: test_getStartPosition_check_given_position
:line: 86
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 4
:passed: 4
:total: 5
:passed: 5
:failed: 0
:ignored: 0
:stdout:
- "\e[H\e[2J\e[3J"
- " Scoreboard:"
- ''
:time: 0.0012868310004705563
:time: 0.0020466310015763156

2
build/test/runners/test_Modules_runner.c

@ -14,6 +14,7 @@ extern void test_checkBallPosition_output_if_goal(void);
extern void test_checkBallPosition_output_if_no_goal(void);
extern void test_sortScoreboard_check_if_file_is_created(void);
extern void test_clearField_check_if_Playgroung_clear(void);
extern void test_getStartPosition_check_given_position(void);
/*=======Mock Management=====*/
@ -82,6 +83,7 @@ int main(void)
run_test(test_checkBallPosition_output_if_no_goal, "test_checkBallPosition_output_if_no_goal", 31);
run_test(test_sortScoreboard_check_if_file_is_created, "test_sortScoreboard_check_if_file_is_created", 47);
run_test(test_clearField_check_if_Playgroung_clear, "test_clearField_check_if_Playgroung_clear", 64);
run_test(test_getStartPosition_check_given_position, "test_getStartPosition_check_given_position", 86);
return UnityEnd();
}

21
test/test_Modules.c

@ -83,4 +83,25 @@ void test_clearField_check_if_Playgroung_clear(void)
TEST_ASSERT_EQUAL(0, output);
}
void test_getStartPosition_check_given_position(void)
{
/* arrange */
int output = 0;
int width = 10;
int heigth = 10;
/* act */
buildBin(width, heigth);
if (field[width][heigth] != 'V' ||
field[width + 1][heigth + 1] != '\\' ||
field[width + 2][heigth + 2] != '\\' ||
field[width - 1][heigth + 1] != '/' ||
field[width - 2][heigth + 2] != '/' ||
field[width][heigth + 1] != ' ')
output = 1;
/* assert */
TEST_ASSERT_EQUAL(0, output);
}
#endif // TEST
Loading…
Cancel
Save