Browse Source

Zehnter Unit Test

main
fdai7103 2 years ago
parent
commit
86ea268436
  1. 40
      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. 40
      build/test/preprocess/files/test_Modules.c
  6. 41
      build/test/results/test_Modules.pass
  7. 2
      build/test/runners/test_Modules_runner.c
  8. 18
      test/test_Modules.c

40
build/test/cache/test_Modules.c

@ -417,3 +417,43 @@ void test_generateField_check_middle_position_change_on_score(void)
), (UNITY_UINT)(193), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(193), UNITY_DISPLAY_STYLE_INT);
} }
void test_generateField_check_first_position_change_on_score(void)
{
scorePoints = 321;
int output = 1;
generateField();
if (field[10][1] == '3')
{
output = 0;
}
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(211), 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

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

@ -417,3 +417,43 @@ void test_generateField_check_middle_position_change_on_score(void)
), (UNITY_UINT)(193), UNITY_DISPLAY_STYLE_INT); ), (UNITY_UINT)(193), UNITY_DISPLAY_STYLE_INT);
} }
void test_generateField_check_first_position_change_on_score(void)
{
scorePoints = 321;
int output = 1;
generateField();
if (field[10][1] == '3')
{
output = 0;
}
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(211), UNITY_DISPLAY_STYLE_INT);
}

41
build/test/results/test_Modules.pass

@ -39,15 +39,19 @@
:line: 178 :line: 178
:message: '' :message: ''
:unity_test_time: 0 :unity_test_time: 0
- :test: test_generateField_check_first_position_change_on_score
:line: 196
:message: ''
:unity_test_time: 0
:failures: [] :failures: []
:ignores: [] :ignores: []
:counts: :counts:
:total: 9
:passed: 9
:total: 10
:passed: 10
:failed: 0 :failed: 0
:ignored: 0 :ignored: 0
:stdout: :stdout:
- "\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J"
- "\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J\e[H\e[2J\e[3J"
- " Scoreboard:" - " Scoreboard:"
- '' - ''
- "|=======================|" - "|=======================|"
@ -139,4 +143,33 @@
- "| |" - "| |"
- "| |" - "| |"
- "|=======================|" - "|=======================|"
:time: 0.00713155700009338
- "|=======================|"
- "| OOO 321 |"
- "|=======================|"
- "| \\ |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| V |"
- "| / \\ |"
- "| / \\ |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "|=======================|"
:time: 0.005677399999967747

2
build/test/runners/test_Modules_runner.c

@ -19,6 +19,7 @@ extern void test_generateField_check_walls_length_correctly_inserted(void);
extern void test_sortScoreboard_check_if_file_is_being_read(void); extern void test_sortScoreboard_check_if_file_is_being_read(void);
extern void test_generateField_check_last_position_change_on_score(void); 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);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -92,6 +93,7 @@ int main(void)
run_test(test_sortScoreboard_check_if_file_is_being_read, "test_sortScoreboard_check_if_file_is_being_read", 132); run_test(test_sortScoreboard_check_if_file_is_being_read, "test_sortScoreboard_check_if_file_is_being_read", 132);
run_test(test_generateField_check_last_position_change_on_score, "test_generateField_check_last_position_change_on_score", 160); run_test(test_generateField_check_last_position_change_on_score, "test_generateField_check_last_position_change_on_score", 160);
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);
return UnityEnd(); return UnityEnd();
} }

18
test/test_Modules.c

@ -193,4 +193,22 @@ void test_generateField_check_middle_position_change_on_score(void)
TEST_ASSERT_EQUAL(0, output); TEST_ASSERT_EQUAL(0, output);
} }
void test_generateField_check_first_position_change_on_score(void)
{
/* arrange */
scorePoints = 321;
int output = 1;
/* act */
generateField();
if (field[10][1] == '3')
{
output = 0;
}
/* assert */
TEST_ASSERT_EQUAL(0, output);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save