Browse Source

Elfter Unit Test

main
fdai7172 2 years ago
parent
commit
ea7a221301
  1. 36
      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. 36
      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. 16
      test/test_Modules.c

36
build/test/cache/test_Modules.c

@ -457,3 +457,39 @@ void test_generateField_check_first_position_change_on_score(void)
), (UNITY_UINT)(211), UNITY_DISPLAY_STYLE_INT);
}
void test_generateField_check_if_first_life_away(void)
{
int output = 1;
lifeCount=2;
generateField();
if (field[3][1] == 'X')
{
output = 0;
}
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(227), 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

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

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

41
build/test/results/test_Modules.pass

@ -43,15 +43,19 @@
:line: 196
:message: ''
:unity_test_time: 0
- :test: test_generateField_check_if_first_life_away
:line: 213
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 10
:passed: 10
:total: 11
:passed: 11
:failed: 0
:ignored: 0
: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\e[H\e[2J\e[3J\e[H\e[2J\e[3J"
- " Scoreboard:"
- ''
- "|=======================|"
@ -172,4 +176,33 @@
- "| |"
- "| |"
- "|=======================|"
:time: 0.005677399999967747
- "|=======================|"
- "| OOX 321 |"
- "|=======================|"
- "| \\ |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| V |"
- "| / \\ |"
- "| / \\ |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "|=======================|"
:time: 0.004887977000180399

2
build/test/runners/test_Modules_runner.c

@ -20,6 +20,7 @@ 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_middle_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);
/*=======Mock Management=====*/
@ -94,6 +95,7 @@ int main(void)
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_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);
return UnityEnd();
}

16
test/test_Modules.c

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