Browse Source

Zweiter Unit Test

main
fdai7103 2 years ago
parent
commit
66ef1bb5ca
  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. 10
      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

@ -57,3 +57,39 @@ void test_checkBallPosition_output_if_goal(void)
), (UNITY_UINT)(28), UNITY_DISPLAY_STYLE_INT);
}
void test_checkBallPosition_output_if_no_goal(void)
{
binX = 1;
binY = 1;
ballX = 1;
ballY = 1;
int output = checkBallPosition();
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(44), 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

@ -57,3 +57,39 @@ void test_checkBallPosition_output_if_goal(void)
), (UNITY_UINT)(28), UNITY_DISPLAY_STYLE_INT);
}
void test_checkBallPosition_output_if_no_goal(void)
{
binX = 1;
binY = 1;
ballX = 1;
ballY = 1;
int output = checkBallPosition();
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((output)), (
((void *)0)
), (UNITY_UINT)(44), UNITY_DISPLAY_STYLE_INT);
}

10
build/test/results/test_Modules.pass

@ -7,12 +7,16 @@
:line: 15
:message: ''
:unity_test_time: 0
- :test: test_checkBallPosition_output_if_no_goal
:line: 31
:message: ''
:unity_test_time: 0
:failures: []
:ignores: []
:counts:
:total: 1
:passed: 1
:total: 2
:passed: 2
:failed: 0
:ignored: 0
:stdout: []
:time: 0.0009687959991424577
:time: 0.0006384879998222459

2
build/test/runners/test_Modules_runner.c

@ -11,6 +11,7 @@ char* GlobalOrderError;
extern void setUp(void);
extern void tearDown(void);
extern void test_checkBallPosition_output_if_goal(void);
extern void test_checkBallPosition_output_if_no_goal(void);
/*=======Mock Management=====*/
@ -76,6 +77,7 @@ int main(void)
{
UnityBegin("test_Modules.c");
run_test(test_checkBallPosition_output_if_goal, "test_checkBallPosition_output_if_goal", 15);
run_test(test_checkBallPosition_output_if_no_goal, "test_checkBallPosition_output_if_no_goal", 31);
return UnityEnd();
}

16
test/test_Modules.c

@ -28,4 +28,20 @@ void test_checkBallPosition_output_if_goal(void)
TEST_ASSERT_EQUAL(1, output);
}
void test_checkBallPosition_output_if_no_goal(void)
{
/* arrange */
binX = 1;
binY = 1;
ballX = 1;
ballY = 1;
/* act */
int output = checkBallPosition();
/* assert */
TEST_ASSERT_EQUAL(2, output);
}
#endif // TEST
Loading…
Cancel
Save