diff --git a/ScoreBoard.txt b/ScoreBoard.txt new file mode 100644 index 0000000..e69de29 diff --git a/build/test/cache/test_Modules.c b/build/test/cache/test_Modules.c index 29312c3..147a4ac 100644 --- a/build/test/cache/test_Modules.c +++ b/build/test/cache/test_Modules.c @@ -6,8 +6,6 @@ - - void setUp(void) { @@ -93,3 +91,41 @@ void test_checkBallPosition_output_if_no_goal(void) ), (UNITY_UINT)(44), UNITY_DISPLAY_STYLE_INT); } + + + +void test_sortScoreboard_check_if_file_exists(void) { + + + + + + + + + + if (access("ScoreBoard.txt", 0) == 0) { + + remove("ScoreBoard.txt"); + + } + + + + sortScoreboard(); + + + + int output = access("ScoreBoard.txt", 0); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), ( + + ((void *)0) + + ), (UNITY_UINT)(61), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/out/c/cmock.o b/build/test/out/c/cmock.o index 3d4c559..07a76d0 100644 Binary files a/build/test/out/c/cmock.o and b/build/test/out/c/cmock.o differ diff --git a/build/test/out/c/test_Modules.o b/build/test/out/c/test_Modules.o index a047f73..c6ea77b 100644 Binary files a/build/test/out/c/test_Modules.o and b/build/test/out/c/test_Modules.o differ diff --git a/build/test/out/c/test_Modules_runner.o b/build/test/out/c/test_Modules_runner.o index c1ea468..ff2c344 100644 Binary files a/build/test/out/c/test_Modules_runner.o and b/build/test/out/c/test_Modules_runner.o differ diff --git a/build/test/out/c/unity.o b/build/test/out/c/unity.o index a48ad3f..1d833df 100644 Binary files a/build/test/out/c/unity.o and b/build/test/out/c/unity.o differ diff --git a/build/test/out/test_Modules.out b/build/test/out/test_Modules.out index c578d2a..451885d 100755 Binary files a/build/test/out/test_Modules.out and b/build/test/out/test_Modules.out differ diff --git a/build/test/preprocess/files/test_Modules.c b/build/test/preprocess/files/test_Modules.c index 29312c3..147a4ac 100644 --- a/build/test/preprocess/files/test_Modules.c +++ b/build/test/preprocess/files/test_Modules.c @@ -6,8 +6,6 @@ - - void setUp(void) { @@ -93,3 +91,41 @@ void test_checkBallPosition_output_if_no_goal(void) ), (UNITY_UINT)(44), UNITY_DISPLAY_STYLE_INT); } + + + +void test_sortScoreboard_check_if_file_exists(void) { + + + + + + + + + + if (access("ScoreBoard.txt", 0) == 0) { + + remove("ScoreBoard.txt"); + + } + + + + sortScoreboard(); + + + + int output = access("ScoreBoard.txt", 0); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((output)), ( + + ((void *)0) + + ), (UNITY_UINT)(61), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/results/test_Modules.pass b/build/test/results/test_Modules.pass index d51c967..94f6c16 100644 --- a/build/test/results/test_Modules.pass +++ b/build/test/results/test_Modules.pass @@ -11,12 +11,19 @@ :line: 31 :message: '' :unity_test_time: 0 +- :test: test_sortScoreboard_check_if_file_exists + :line: 47 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 2 - :passed: 2 + :total: 3 + :passed: 3 :failed: 0 :ignored: 0 -:stdout: [] -:time: 0.0006384879998222459 +:stdout: +- "\e[H\e[2J\e[3J" +- " Scoreboard:" +- '' +:time: 0.0021875080001336755 diff --git a/build/test/runners/test_Modules_runner.c b/build/test/runners/test_Modules_runner.c index 262f019..f60ccb9 100644 --- a/build/test/runners/test_Modules_runner.c +++ b/build/test/runners/test_Modules_runner.c @@ -12,6 +12,7 @@ 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); +extern void test_sortScoreboard_check_if_file_exists(void); /*=======Mock Management=====*/ @@ -78,6 +79,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); + run_test(test_sortScoreboard_check_if_file_exists, "test_sortScoreboard_check_if_file_exists", 47); return UnityEnd(); } diff --git a/test/test_Modules.c b/test/test_Modules.c index 0294fa0..e129a0e 100644 --- a/test/test_Modules.c +++ b/test/test_Modules.c @@ -1,7 +1,7 @@ #ifdef TEST #include "unity.h" - +#include "unistd.h" #include "Modules.c" void setUp(void) @@ -44,4 +44,21 @@ void test_checkBallPosition_output_if_no_goal(void) TEST_ASSERT_EQUAL(2, output); } -#endif // TEST +void test_sortScoreboard_check_if_file_is_created(void) { + + /* arrange */ + + /* act */ + if (access("ScoreBoard.txt", 0) == 0) { + remove("ScoreBoard.txt"); + } + + sortScoreboard(); + + int output = access("ScoreBoard.txt", 0); + + /* assert */ + TEST_ASSERT_EQUAL(0, output); +} + +#endif // TEST \ No newline at end of file