Browse Source

Einundzwanwiegster Unit Test

main
David PC Saiz 2 years ago
parent
commit
5d6933a170
  1. 56
      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. 56
      build/test/preprocess/files/test_Modules.c
  6. 42
      build/test/results/test_Modules.pass
  7. 2
      build/test/runners/test_Modules_runner.c
  8. 26
      test/test_Modules.c

56
build/test/cache/test_Modules.c

@ -825,3 +825,59 @@ void test_generateField_check_if_wind_force_correct_displayed(void)
), (UNITY_UINT)(375), UNITY_DISPLAY_STYLE_INT);
}
void test_generateField_check_if_wall_is_build_correctly(void)
{
windForce = 2;
binX = 16;
binY = 12;
wallX = 5;
wallY = 7;
wallLength = 5;
int output = 0;
generateField();
for (int i = wallX; i < +wallX + wallLength; i++)
{
if (field[i][wallY] != '_')
{
output = 1;
}
}
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(401), 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

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

@ -825,3 +825,59 @@ void test_generateField_check_if_wind_force_correct_displayed(void)
), (UNITY_UINT)(375), UNITY_DISPLAY_STYLE_INT);
}
void test_generateField_check_if_wall_is_build_correctly(void)
{
windForce = 2;
binX = 16;
binY = 12;
wallX = 5;
wallY = 7;
wallLength = 5;
int output = 0;
generateField();
for (int i = wallX; i < +wallX + wallLength; i++)
{
if (field[i][wallY] != '_')
{
output = 1;
}
}
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(401), UNITY_DISPLAY_STYLE_INT);
}

42
build/test/results/test_Modules.pass

@ -83,11 +83,15 @@
:line: 361
:message: ''
:unity_test_time: 0
- :test: test_generateField_check_if_wall_is_build_correctly
:line: 378
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 20
:passed: 20
:total: 21
:passed: 21
:failed: 0
:ignored: 0
:stdout:
@ -369,7 +373,8 @@
- "| |"
- "| |"
- "| V |"
- "| \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 /
\\ |"
- "| / \\ |"
- "| |"
- "| |"
@ -503,4 +508,33 @@
- "| |"
- "| |"
- "|=======================|"
:time: 0.010942392999822914
- "|=======================|"
- "| OXX 000 >2 |"
- "|=======================|"
- "| \\ |"
- "| |"
- "| |"
- "| |"
- "| _____ |"
- "| |"
- "| |"
- "| V |"
- "| / \\ |"
- "| / \\ V |"
- "| / \\ |"
- "| / \\ |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "| |"
- "|=======================|"
:time: 0.020374785000058182

2
build/test/runners/test_Modules_runner.c

@ -30,6 +30,7 @@ extern void test_generateField_check_if_third_live_is_displayed_correctly(void);
extern void test_generateField_check_if_wind_form_right_correct_displayed(void);
extern void test_generateField_check_if_wind_form_left_correct_displayed(void);
extern void test_generateField_check_if_wind_force_correct_displayed(void);
extern void test_generateField_check_if_wall_is_build_correctly(void);
/*=======Mock Management=====*/
@ -114,6 +115,7 @@ int main(void)
run_test(test_generateField_check_if_wind_form_right_correct_displayed, "test_generateField_check_if_wind_form_right_correct_displayed", 327);
run_test(test_generateField_check_if_wind_form_left_correct_displayed, "test_generateField_check_if_wind_form_left_correct_displayed", 344);
run_test(test_generateField_check_if_wind_force_correct_displayed, "test_generateField_check_if_wind_force_correct_displayed", 361);
run_test(test_generateField_check_if_wall_is_build_correctly, "test_generateField_check_if_wall_is_build_correctly", 378);
return UnityEnd();
}

26
test/test_Modules.c

@ -375,4 +375,30 @@ void test_generateField_check_if_wind_force_correct_displayed(void)
TEST_ASSERT_EQUAL(0, output);
}
void test_generateField_check_if_wall_is_build_correctly(void)
{
/* arrange */
windForce = 2;
binX = 16;
binY = 12;
wallX = 5;
wallY = 7;
wallLength = 5;
int output = 0;
/* act */
generateField();
for (int i = wallX; i < +wallX + wallLength; i++)
{
if (field[i][wallY] != '_')
{
output = 1;
}
}
/* assert */
TEST_ASSERT_EQUAL(0, output);
}
#endif // TEST
Loading…
Cancel
Save