Browse Source

Zwölfter Unit Test (Korrektur)

main
fdai7037 2 years ago
parent
commit
2aad9b3dbf
  1. BIN
      build/test/out/c/test_Modules.o
  2. BIN
      build/test/out/c/test_Modules_runner.o
  3. BIN
      build/test/out/test_Modules.out
  4. 38
      build/test/preprocess/files/test_Modules.c
  5. 39
      build/test/results/test_Modules.pass
  6. 2
      build/test/runners/test_Modules_runner.c
  7. 17
      test/test_Modules.c

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

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

BIN
build/test/out/test_Modules.out

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

@ -493,3 +493,41 @@ void test_generateField_check_if_first_life_away(void)
), (UNITY_UINT)(227), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(227), UNITY_DISPLAY_STYLE_INT);
} }
void test_generateField_check_if_second_life_away(void)
{
int output = 1;
lifeCount = 1;
generateField();
if (field[2][1] == 'X')
{
output = 0;
}
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(244), UNITY_DISPLAY_STYLE_INT);
}

39
build/test/results/test_Modules.pass

@ -47,11 +47,15 @@
:line: 213 :line: 213
:message: '' :message: ''
:unity_test_time: 0 :unity_test_time: 0
- :test: test_generateField_check_if_second_life_away
:line: 230
:message: ''
:unity_test_time: 0
:failures: [] :failures: []
:ignores: [] :ignores: []
:counts: :counts:
:total: 11
:passed: 11
:total: 12
:passed: 12
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: :stdout:
@ -188,6 +192,35 @@
- "| |" - "| |"
- "| V |" - "| V |"
- "| / \\ |" - "| / \\ |"
- "| / \\ \e[H\e[2J\e[3J |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "|=======================|"
- "|=======================|"
- "| OXX 321 |"
- "|=======================|"
- "| \\ |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| V |"
- "| / \\ |"
- "| / \\ |" - "| / \\ |"
- "| |" - "| |"
- "| |" - "| |"
@ -205,4 +238,4 @@
- "| |" - "| |"
- "| |" - "| |"
- "|=======================|" - "|=======================|"
:time: 0.004887977000180399
:time: 0.008251766999819665

2
build/test/runners/test_Modules_runner.c

@ -21,6 +21,7 @@ extern void test_generateField_check_last_position_change_on_score(void);
extern void test_generateField_check_middle_position_change_on_score(void); extern void test_generateField_check_middle_position_change_on_score(void);
extern void test_generateField_check_first_position_change_on_score(void); extern void test_generateField_check_first_position_change_on_score(void);
extern void test_generateField_check_if_first_life_away(void); extern void test_generateField_check_if_first_life_away(void);
extern void test_generateField_check_if_second_life_away(void);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -96,6 +97,7 @@ int main(void)
run_test(test_generateField_check_middle_position_change_on_score, "test_generateField_check_middle_position_change_on_score", 178); run_test(test_generateField_check_middle_position_change_on_score, "test_generateField_check_middle_position_change_on_score", 178);
run_test(test_generateField_check_first_position_change_on_score, "test_generateField_check_first_position_change_on_score", 196); run_test(test_generateField_check_first_position_change_on_score, "test_generateField_check_first_position_change_on_score", 196);
run_test(test_generateField_check_if_first_life_away, "test_generateField_check_if_first_life_away", 213); run_test(test_generateField_check_if_first_life_away, "test_generateField_check_if_first_life_away", 213);
run_test(test_generateField_check_if_second_life_away, "test_generateField_check_if_second_life_away", 230);
return UnityEnd(); return UnityEnd();
} }

17
test/test_Modules.c

@ -227,4 +227,21 @@ void test_generateField_check_if_first_life_away(void)
TEST_ASSERT_EQUAL(0, output); TEST_ASSERT_EQUAL(0, output);
} }
void test_generateField_check_if_second_life_away(void)
{
/* arrange */
int output = 1;
lifeCount = 1;
/* act */
generateField();
if (field[2][1] == 'X')
{
output = 0;
}
/* assert */
TEST_ASSERT_EQUAL(0, output);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save