diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..ef6068e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "files.associations": { + "*.embeddedhtml": "html", + "unistd.h": "c", + "fcntl.h": "c", + "stdio.h": "c", + "types.h": "c" + } +} \ No newline at end of file diff --git a/build/release/dependencies/main.d b/build/release/dependencies/main.d index d6a73f0..cab5c66 100644 --- a/build/release/dependencies/main.d +++ b/build/release/dependencies/main.d @@ -1,3 +1,3 @@ build/release/out/c/main.o: src/main/c/main.c \ src/main/c/Snake/snake_start.h \ - src/main/c/Minesweeper/minesweeper_start.h + src/main/c/Minesweeper/minesweeper_start.h src/main/c/Pong/pong.h diff --git a/build/release/dependencies/pong.d b/build/release/dependencies/pong.d new file mode 100644 index 0000000..4a40a82 --- /dev/null +++ b/build/release/dependencies/pong.d @@ -0,0 +1 @@ +build/release/out/c/pong.o: src/main/c/Pong/pong.c diff --git a/build/release/out/c/main.o b/build/release/out/c/main.o index 517a416..17adbcd 100644 Binary files a/build/release/out/c/main.o and b/build/release/out/c/main.o differ diff --git a/build/release/out/c/pong.o b/build/release/out/c/pong.o new file mode 100644 index 0000000..6cbb7e4 Binary files /dev/null and b/build/release/out/c/pong.o differ diff --git a/build/release/out/c/tictactoe.o b/build/release/out/c/tictactoe.o index a10f2f1..39f5d21 100644 Binary files a/build/release/out/c/tictactoe.o and b/build/release/out/c/tictactoe.o differ diff --git a/build/release/project.out b/build/release/project.out deleted file mode 100755 index 2b21304..0000000 Binary files a/build/release/project.out and /dev/null differ diff --git a/build/test/cache/defines_dependency.yml b/build/test/cache/defines_dependency.yml index 717335e..6dae52a 100644 --- a/build/test/cache/defines_dependency.yml +++ b/build/test/cache/defines_dependency.yml @@ -9,3 +9,5 @@ src/main/c/Minesweeper/minesweeper_start.c: - TEST src/main/c/GameTic_Tac_Toe/tictactoe.c: - TEST +src/main/c/Pong/pong.c: +- TEST diff --git a/build/test/cache/test_checkCollision.c b/build/test/cache/test_checkCollision.c new file mode 100644 index 0000000..79e7083 --- /dev/null +++ b/build/test/cache/test_checkCollision.c @@ -0,0 +1,143 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +typedef struct { + + int x; + + int y; + + int speedX; + + int speedY; + +} Ball; + + + +typedef struct { + + int x; + + int y; + + int width; + + int height; + +} Paddle; + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_checkCollision(void){ + + Ball ball = {10, 10, 1, 1}; + + Paddle paddle = {50, 10, 5, 10}; + + + + + + ball.x = 0; + + int result1 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result1)), ( + + ((void *)0) + + ), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); + + + + ball.x = 40 - 1; + + int result2 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result2)), ( + + ((void *)0) + + ), (UNITY_UINT)(39), UNITY_DISPLAY_STYLE_INT); + + + + + + ball.x = 5; + + ball.y = 0; + + int result3 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result3)), ( + + ((void *)0) + + ), (UNITY_UINT)(45), UNITY_DISPLAY_STYLE_INT); + + + + ball.y = 20 - 1; + + int result4 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result4)), ( + + ((void *)0) + + ), (UNITY_UINT)(49), UNITY_DISPLAY_STYLE_INT); + + + + + + ball.x = paddle.x - 1; + + ball.y = paddle.y + 1; + + int result5 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result5)), ( + + ((void *)0) + + ), (UNITY_UINT)(55), UNITY_DISPLAY_STYLE_INT); + + + + ball.x = paddle.x + 1; + + ball.y = paddle.y + 1; + + int result6 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result6)), ( + + ((void *)0) + + ), (UNITY_UINT)(60), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_checkGameEnd.c b/build/test/cache/test_checkGameEnd.c new file mode 100644 index 0000000..3c0d662 --- /dev/null +++ b/build/test/cache/test_checkGameEnd.c @@ -0,0 +1,69 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_checkGameEnd(void){ + + + + int maxScore = 5; + + int score1 = 4, score2 = 2; + + + + + + int result = checkGameEnd(score1, score2, maxScore); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + + + + + + score1 = 5; + + result = checkGameEnd(score1, score2, maxScore); + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(28), UNITY_DISPLAY_STYLE_INT); + + + + + + + +} diff --git a/build/test/cache/test_clearScreen.c b/build/test/cache/test_clearScreen.c new file mode 100644 index 0000000..74ec6bf --- /dev/null +++ b/build/test/cache/test_clearScreen.c @@ -0,0 +1,73 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + + + +char screen[20][40 +1]; + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_clearScreen(void){ + + + + int i, j; + + for (i = 0; i < 20; i++) { + + for (j = 0; j < 40; j++) { + + screen[i][j] = ' '; + + } + + screen[i][j] = '\0'; + + } + + + + + + clearScreen(); + + + + + + for (i = 0; i < 20; i++) { + + for (j = 0; j < 40; j++) { + + UnityAssertEqualNumber((UNITY_INT)((' ')), (UNITY_INT)((screen[i][j])), ( + + ((void *)0) + + ), (UNITY_UINT)(33), UNITY_DISPLAY_STYLE_INT); + + } + + } + +} diff --git a/build/test/cache/test_is_Valid_tile.c b/build/test/cache/test_is_Valid_tile.c index 6ad87c9..5911aa4 100644 --- a/build/test/cache/test_is_Valid_tile.c +++ b/build/test/cache/test_is_Valid_tile.c @@ -22,7 +22,7 @@ void test_detect_not_valid_tile_left(void){ int tile = 0; - int direction = 1; + int direction = 2; int result; @@ -78,13 +78,13 @@ void test_detect_not_valid_tile_up(void){ -void test_detect_valid_tile_right(void){ +void test_detect_not_valid_tile_right(void){ Minesweeper_Board board = initialize_minesweeper(); - int tile = 0; + int tile = board.width * board.height - 1; int direction = 5; @@ -100,7 +100,7 @@ void test_detect_valid_tile_right(void){ - UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( ((void *)0) @@ -110,13 +110,13 @@ void test_detect_valid_tile_right(void){ -void test_detect_valid_tile_down(void){ +void test_detect_not_valid_tile_down(void){ Minesweeper_Board board = initialize_minesweeper(); - int tile = 0; + int tile = board.width * board.height - 1; int direction = 4; @@ -132,7 +132,7 @@ void test_detect_valid_tile_down(void){ - UnityAssertEqualNumber((UNITY_INT)((0 + board.width)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( ((void *)0) @@ -142,7 +142,7 @@ void test_detect_valid_tile_down(void){ -void test_detect_not_valid_tile_right(void){ +void test_detect_valid_tile_left(void){ @@ -150,7 +150,7 @@ void test_detect_not_valid_tile_right(void){ int tile = board.width * board.height - 1; - int direction = 5; + int direction = 2; int result; @@ -164,7 +164,7 @@ void test_detect_not_valid_tile_right(void){ - UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((board.width * board.height - 2)), (UNITY_INT)((result)), ( ((void *)0) @@ -174,7 +174,7 @@ void test_detect_not_valid_tile_right(void){ -void test_detect_not_valid_tile_down(void){ +void test_detect_valid_tile_up(void){ @@ -182,7 +182,7 @@ void test_detect_not_valid_tile_down(void){ int tile = board.width * board.height - 1; - int direction = 4; + int direction = 3; int result; @@ -196,10 +196,74 @@ void test_detect_not_valid_tile_down(void){ - UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((board.width * (board.height - 1) - 1)), (UNITY_INT)((result)), ( ((void *)0) ), (UNITY_UINT)(91), UNITY_DISPLAY_STYLE_INT); } + + + +void test_detect_valid_tile_right(void){ + + + + Minesweeper_Board board = initialize_minesweeper(); + + int tile = 0; + + int direction = 5; + + int result; + + + + + + result = is_Valid_tile(&board, tile, direction); + + + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); + +} + + + +void test_detect_valid_tile_down(void){ + + + + Minesweeper_Board board = initialize_minesweeper(); + + int tile = 0; + + int direction = 4; + + int result; + + + + + + result = is_Valid_tile(&board, tile, direction); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0 + board.width)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(119), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_playerInputMovement.c b/build/test/cache/test_playerInputMovement.c new file mode 100644 index 0000000..d38ca76 --- /dev/null +++ b/build/test/cache/test_playerInputMovement.c @@ -0,0 +1,83 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + +typedef struct { + + int x; + + int y; + + int speedX; + + int speedY; + +} Paddle; + + + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_playerInputMovement(void){ + + + + int paddlePositionY = 10; + + int userInput = -1; + + int expectedY = paddlePositionY - 1; + + + + processPlayerInput(&paddlePositionY, userInput); + + UnityAssertEqualNumber((UNITY_INT)((expectedY)), (UNITY_INT)((paddlePositionY)), ( + + ((void *)0) + + ), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT); + + + + + + userInput = 1; + + expectedY = paddlePositionY + 1; + + + + + + processPlayerInput(&paddlePositionY, userInput); + + UnityAssertEqualNumber((UNITY_INT)((expectedY)), (UNITY_INT)((paddlePositionY)), ( + + ((void *)0) + + ), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); + + + + + + + +} diff --git a/build/test/cache/test_pong.c b/build/test/cache/test_pong.c new file mode 100644 index 0000000..7e1dfbf --- /dev/null +++ b/build/test/cache/test_pong.c @@ -0,0 +1,51 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_input_all_5(void){ + + + + int a = 4, b = 5; + + + + + + resetScore( &a, &b ); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((a)), ( + + ((void *)0) + + ), (UNITY_UINT)(21), UNITY_DISPLAY_STYLE_INT); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((b)), ( + + ((void *)0) + + ), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/cache/test_tictactoe.c b/build/test/cache/test_tictactoe.c index 7971f22..e69de29 100644 --- a/build/test/cache/test_tictactoe.c +++ b/build/test/cache/test_tictactoe.c @@ -1,105 +0,0 @@ -#include "src/main/c/GameTic_Tac_Toe/tictactoe.h" -#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" - - - - - - - - -void setUp(void){ - - - -} - -void tearDown(void){ - -} - - - - - -void test_if_not_identical(void){ - - - - char result; - - char a = 'a', b = 'b', c = 'c'; - - - - result = checkLine(a, b, c); - - - - - - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((' ')), (UNITY_INT)(UNITY_INT8 )((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_CHAR); - -} - - - - - -void test_if_identical(void){ - - - - char result; - - char a = 'a', b = 'a', c = 'a'; - - - - result = checkLine(a, b, c); - - - - - - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((a)), (UNITY_INT)(UNITY_INT8 )((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(34), UNITY_DISPLAY_STYLE_CHAR); - -} - - - -void test_checkLine_horizontalerGewinner(void) { - - - - char result; - - char a = 'X', b = 'X', c = 'X'; - - - - - - result = checkLine(a, b, c); - - - - - - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('X')), (UNITY_INT)(UNITY_INT8 )((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(46), UNITY_DISPLAY_STYLE_CHAR); - -} - -} diff --git a/build/test/dependencies/pong.d b/build/test/dependencies/pong.d new file mode 100644 index 0000000..9bafeb3 --- /dev/null +++ b/build/test/dependencies/pong.d @@ -0,0 +1 @@ +build/test/out/c/pong.o: src/main/c/Pong/pong.c diff --git a/build/test/dependencies/test_checkCollision.d b/build/test/dependencies/test_checkCollision.d new file mode 100644 index 0000000..598f40e --- /dev/null +++ b/build/test/dependencies/test_checkCollision.d @@ -0,0 +1,4 @@ +build/test/out/c/test_checkCollision.o: test/Pong/test_checkCollision.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/main/c/Pong/pong.h diff --git a/build/test/dependencies/test_checkCollision_runner.d b/build/test/dependencies/test_checkCollision_runner.d new file mode 100644 index 0000000..8caa0f9 --- /dev/null +++ b/build/test/dependencies/test_checkCollision_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_checkCollision_runner.o: \ + build/test/runners/test_checkCollision_runner.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/test_checkGameEnd.d b/build/test/dependencies/test_checkGameEnd.d new file mode 100644 index 0000000..0d4bf78 --- /dev/null +++ b/build/test/dependencies/test_checkGameEnd.d @@ -0,0 +1,4 @@ +build/test/out/c/test_checkGameEnd.o: test/Pong/test_checkGameEnd.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/main/c/Pong/pong.h diff --git a/build/test/dependencies/test_checkGameEnd_runner.d b/build/test/dependencies/test_checkGameEnd_runner.d new file mode 100644 index 0000000..74bebf4 --- /dev/null +++ b/build/test/dependencies/test_checkGameEnd_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_checkGameEnd_runner.o: \ + build/test/runners/test_checkGameEnd_runner.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/test_clearScreen.d b/build/test/dependencies/test_clearScreen.d new file mode 100644 index 0000000..7f5431c --- /dev/null +++ b/build/test/dependencies/test_clearScreen.d @@ -0,0 +1,4 @@ +build/test/out/c/test_clearScreen.o: test/Pong/test_clearScreen.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/main/c/Pong/pong.h diff --git a/build/test/dependencies/test_clearScreen_runner.d b/build/test/dependencies/test_clearScreen_runner.d new file mode 100644 index 0000000..0f74b3c --- /dev/null +++ b/build/test/dependencies/test_clearScreen_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_clearScreen_runner.o: \ + build/test/runners/test_clearScreen_runner.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/test_playerInputMovement.d b/build/test/dependencies/test_playerInputMovement.d new file mode 100644 index 0000000..a22d018 --- /dev/null +++ b/build/test/dependencies/test_playerInputMovement.d @@ -0,0 +1,5 @@ +build/test/out/c/test_playerInputMovement.o: \ + test/Pong/test_playerInputMovement.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/main/c/Pong/pong.h diff --git a/build/test/dependencies/test_playerInputMovement_runner.d b/build/test/dependencies/test_playerInputMovement_runner.d new file mode 100644 index 0000000..c2f9cb9 --- /dev/null +++ b/build/test/dependencies/test_playerInputMovement_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_playerInputMovement_runner.o: \ + build/test/runners/test_playerInputMovement_runner.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/test_pong.d b/build/test/dependencies/test_pong.d new file mode 100644 index 0000000..de38849 --- /dev/null +++ b/build/test/dependencies/test_pong.d @@ -0,0 +1,4 @@ +build/test/out/c/test_pong.o: test/Pong/test_pong.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ + src/main/c/Pong/pong.h diff --git a/build/test/dependencies/test_pong_runner.d b/build/test/dependencies/test_pong_runner.d new file mode 100644 index 0000000..ae30bd9 --- /dev/null +++ b/build/test/dependencies/test_pong_runner.d @@ -0,0 +1,4 @@ +build/test/out/c/test_pong_runner.o: \ + build/test/runners/test_pong_runner.c \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ + /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h diff --git a/build/test/dependencies/test_tictactoe.d b/build/test/dependencies/test_tictactoe.d index 9b5c05c..f4ff40e 100644 --- a/build/test/dependencies/test_tictactoe.d +++ b/build/test/dependencies/test_tictactoe.d @@ -1,4 +1 @@ -build/test/out/c/test_tictactoe.o: test/test_tictactoe.c \ - /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h \ - /var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity_internals.h \ - src/main/c/GameTic_Tac_Toe/tictactoe.h +build/test/out/c/test_tictactoe.o: test/test_tictactoe.c diff --git a/build/test/out/c/pong.o b/build/test/out/c/pong.o new file mode 100644 index 0000000..7ed8663 Binary files /dev/null and b/build/test/out/c/pong.o differ diff --git a/build/test/out/c/test_checkCollision.o b/build/test/out/c/test_checkCollision.o new file mode 100644 index 0000000..dd26e7b Binary files /dev/null and b/build/test/out/c/test_checkCollision.o differ diff --git a/build/test/out/c/test_checkCollision_runner.o b/build/test/out/c/test_checkCollision_runner.o new file mode 100644 index 0000000..747c52e Binary files /dev/null and b/build/test/out/c/test_checkCollision_runner.o differ diff --git a/build/test/out/c/test_checkGameEnd.o b/build/test/out/c/test_checkGameEnd.o new file mode 100644 index 0000000..1a23238 Binary files /dev/null and b/build/test/out/c/test_checkGameEnd.o differ diff --git a/build/test/out/c/test_checkGameEnd_runner.o b/build/test/out/c/test_checkGameEnd_runner.o new file mode 100644 index 0000000..caad412 Binary files /dev/null and b/build/test/out/c/test_checkGameEnd_runner.o differ diff --git a/build/test/out/c/test_clearScreen.o b/build/test/out/c/test_clearScreen.o new file mode 100644 index 0000000..53e83a8 Binary files /dev/null and b/build/test/out/c/test_clearScreen.o differ diff --git a/build/test/out/c/test_clearScreen_runner.o b/build/test/out/c/test_clearScreen_runner.o new file mode 100644 index 0000000..a4e758e Binary files /dev/null and b/build/test/out/c/test_clearScreen_runner.o differ diff --git a/build/test/out/c/test_is_Valid_tile.o b/build/test/out/c/test_is_Valid_tile.o index aeddeac..ac4d5d3 100644 Binary files a/build/test/out/c/test_is_Valid_tile.o and b/build/test/out/c/test_is_Valid_tile.o differ diff --git a/build/test/out/c/test_is_Valid_tile_runner.o b/build/test/out/c/test_is_Valid_tile_runner.o index f1c95db..84ab5b4 100644 Binary files a/build/test/out/c/test_is_Valid_tile_runner.o and b/build/test/out/c/test_is_Valid_tile_runner.o differ diff --git a/build/test/out/c/test_playerInputMovement.o b/build/test/out/c/test_playerInputMovement.o new file mode 100644 index 0000000..0c89b5e Binary files /dev/null and b/build/test/out/c/test_playerInputMovement.o differ diff --git a/build/test/out/c/test_playerInputMovement_runner.o b/build/test/out/c/test_playerInputMovement_runner.o new file mode 100644 index 0000000..870cc10 Binary files /dev/null and b/build/test/out/c/test_playerInputMovement_runner.o differ diff --git a/build/test/out/c/test_pong.o b/build/test/out/c/test_pong.o new file mode 100644 index 0000000..a6be32c Binary files /dev/null and b/build/test/out/c/test_pong.o differ diff --git a/build/test/out/c/test_pong_runner.o b/build/test/out/c/test_pong_runner.o new file mode 100644 index 0000000..77ffebf Binary files /dev/null and b/build/test/out/c/test_pong_runner.o differ diff --git a/build/test/out/c/test_tictactoe.o b/build/test/out/c/test_tictactoe.o new file mode 100644 index 0000000..a704cef Binary files /dev/null and b/build/test/out/c/test_tictactoe.o differ diff --git a/build/test/out/c/test_tictactoe_runner.o b/build/test/out/c/test_tictactoe_runner.o index 104bf35..eff4dfd 100644 Binary files a/build/test/out/c/test_tictactoe_runner.o and b/build/test/out/c/test_tictactoe_runner.o differ diff --git a/build/test/out/test_checkCollision.out b/build/test/out/test_checkCollision.out new file mode 100755 index 0000000..4a9b6f9 Binary files /dev/null and b/build/test/out/test_checkCollision.out differ diff --git a/build/test/out/test_checkGameEnd.out b/build/test/out/test_checkGameEnd.out new file mode 100755 index 0000000..476ee5f Binary files /dev/null and b/build/test/out/test_checkGameEnd.out differ diff --git a/build/test/out/test_clearScreen.out b/build/test/out/test_clearScreen.out new file mode 100755 index 0000000..2429c48 Binary files /dev/null and b/build/test/out/test_clearScreen.out differ diff --git a/build/test/out/test_is_Valid_tile.out b/build/test/out/test_is_Valid_tile.out index 38aa278..736e224 100755 Binary files a/build/test/out/test_is_Valid_tile.out and b/build/test/out/test_is_Valid_tile.out differ diff --git a/build/test/out/test_playerInputMovement.out b/build/test/out/test_playerInputMovement.out new file mode 100755 index 0000000..3b9604e Binary files /dev/null and b/build/test/out/test_playerInputMovement.out differ diff --git a/build/test/out/test_pong.out b/build/test/out/test_pong.out new file mode 100755 index 0000000..a2c366e Binary files /dev/null and b/build/test/out/test_pong.out differ diff --git a/build/test/out/test_tictactoe.out b/build/test/out/test_tictactoe.out new file mode 100755 index 0000000..3718d07 Binary files /dev/null and b/build/test/out/test_tictactoe.out differ diff --git a/build/test/preprocess/files/test_checkCollision.c b/build/test/preprocess/files/test_checkCollision.c new file mode 100644 index 0000000..79e7083 --- /dev/null +++ b/build/test/preprocess/files/test_checkCollision.c @@ -0,0 +1,143 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +typedef struct { + + int x; + + int y; + + int speedX; + + int speedY; + +} Ball; + + + +typedef struct { + + int x; + + int y; + + int width; + + int height; + +} Paddle; + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_checkCollision(void){ + + Ball ball = {10, 10, 1, 1}; + + Paddle paddle = {50, 10, 5, 10}; + + + + + + ball.x = 0; + + int result1 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result1)), ( + + ((void *)0) + + ), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); + + + + ball.x = 40 - 1; + + int result2 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result2)), ( + + ((void *)0) + + ), (UNITY_UINT)(39), UNITY_DISPLAY_STYLE_INT); + + + + + + ball.x = 5; + + ball.y = 0; + + int result3 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result3)), ( + + ((void *)0) + + ), (UNITY_UINT)(45), UNITY_DISPLAY_STYLE_INT); + + + + ball.y = 20 - 1; + + int result4 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result4)), ( + + ((void *)0) + + ), (UNITY_UINT)(49), UNITY_DISPLAY_STYLE_INT); + + + + + + ball.x = paddle.x - 1; + + ball.y = paddle.y + 1; + + int result5 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result5)), ( + + ((void *)0) + + ), (UNITY_UINT)(55), UNITY_DISPLAY_STYLE_INT); + + + + ball.x = paddle.x + 1; + + ball.y = paddle.y + 1; + + int result6 = checkCollision(ball, paddle.y, paddle.y); + + UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result6)), ( + + ((void *)0) + + ), (UNITY_UINT)(60), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_checkGameEnd.c b/build/test/preprocess/files/test_checkGameEnd.c new file mode 100644 index 0000000..3c0d662 --- /dev/null +++ b/build/test/preprocess/files/test_checkGameEnd.c @@ -0,0 +1,69 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_checkGameEnd(void){ + + + + int maxScore = 5; + + int score1 = 4, score2 = 2; + + + + + + int result = checkGameEnd(score1, score2, maxScore); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); + + + + + + score1 = 5; + + result = checkGameEnd(score1, score2, maxScore); + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(28), UNITY_DISPLAY_STYLE_INT); + + + + + + + +} diff --git a/build/test/preprocess/files/test_clearScreen.c b/build/test/preprocess/files/test_clearScreen.c new file mode 100644 index 0000000..74ec6bf --- /dev/null +++ b/build/test/preprocess/files/test_clearScreen.c @@ -0,0 +1,73 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + + + + + +char screen[20][40 +1]; + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_clearScreen(void){ + + + + int i, j; + + for (i = 0; i < 20; i++) { + + for (j = 0; j < 40; j++) { + + screen[i][j] = ' '; + + } + + screen[i][j] = '\0'; + + } + + + + + + clearScreen(); + + + + + + for (i = 0; i < 20; i++) { + + for (j = 0; j < 40; j++) { + + UnityAssertEqualNumber((UNITY_INT)((' ')), (UNITY_INT)((screen[i][j])), ( + + ((void *)0) + + ), (UNITY_UINT)(33), UNITY_DISPLAY_STYLE_INT); + + } + + } + +} diff --git a/build/test/preprocess/files/test_is_Valid_tile.c b/build/test/preprocess/files/test_is_Valid_tile.c index 6ad87c9..5911aa4 100644 --- a/build/test/preprocess/files/test_is_Valid_tile.c +++ b/build/test/preprocess/files/test_is_Valid_tile.c @@ -22,7 +22,7 @@ void test_detect_not_valid_tile_left(void){ int tile = 0; - int direction = 1; + int direction = 2; int result; @@ -78,13 +78,13 @@ void test_detect_not_valid_tile_up(void){ -void test_detect_valid_tile_right(void){ +void test_detect_not_valid_tile_right(void){ Minesweeper_Board board = initialize_minesweeper(); - int tile = 0; + int tile = board.width * board.height - 1; int direction = 5; @@ -100,7 +100,7 @@ void test_detect_valid_tile_right(void){ - UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( ((void *)0) @@ -110,13 +110,13 @@ void test_detect_valid_tile_right(void){ -void test_detect_valid_tile_down(void){ +void test_detect_not_valid_tile_down(void){ Minesweeper_Board board = initialize_minesweeper(); - int tile = 0; + int tile = board.width * board.height - 1; int direction = 4; @@ -132,7 +132,7 @@ void test_detect_valid_tile_down(void){ - UnityAssertEqualNumber((UNITY_INT)((0 + board.width)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( ((void *)0) @@ -142,7 +142,7 @@ void test_detect_valid_tile_down(void){ -void test_detect_not_valid_tile_right(void){ +void test_detect_valid_tile_left(void){ @@ -150,7 +150,7 @@ void test_detect_not_valid_tile_right(void){ int tile = board.width * board.height - 1; - int direction = 5; + int direction = 2; int result; @@ -164,7 +164,7 @@ void test_detect_not_valid_tile_right(void){ - UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((board.width * board.height - 2)), (UNITY_INT)((result)), ( ((void *)0) @@ -174,7 +174,7 @@ void test_detect_not_valid_tile_right(void){ -void test_detect_not_valid_tile_down(void){ +void test_detect_valid_tile_up(void){ @@ -182,7 +182,7 @@ void test_detect_not_valid_tile_down(void){ int tile = board.width * board.height - 1; - int direction = 4; + int direction = 3; int result; @@ -196,10 +196,74 @@ void test_detect_not_valid_tile_down(void){ - UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((board.width * (board.height - 1) - 1)), (UNITY_INT)((result)), ( ((void *)0) ), (UNITY_UINT)(91), UNITY_DISPLAY_STYLE_INT); } + + + +void test_detect_valid_tile_right(void){ + + + + Minesweeper_Board board = initialize_minesweeper(); + + int tile = 0; + + int direction = 5; + + int result; + + + + + + result = is_Valid_tile(&board, tile, direction); + + + + + + UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); + +} + + + +void test_detect_valid_tile_down(void){ + + + + Minesweeper_Board board = initialize_minesweeper(); + + int tile = 0; + + int direction = 4; + + int result; + + + + + + result = is_Valid_tile(&board, tile, direction); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0 + board.width)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(119), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_playerInputMovement.c b/build/test/preprocess/files/test_playerInputMovement.c new file mode 100644 index 0000000..d38ca76 --- /dev/null +++ b/build/test/preprocess/files/test_playerInputMovement.c @@ -0,0 +1,83 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + +typedef struct { + + int x; + + int y; + + int speedX; + + int speedY; + +} Paddle; + + + + + +void setUp(void){ + + + +} + + + +void tearDown(void){ + +} + + + +void test_playerInputMovement(void){ + + + + int paddlePositionY = 10; + + int userInput = -1; + + int expectedY = paddlePositionY - 1; + + + + processPlayerInput(&paddlePositionY, userInput); + + UnityAssertEqualNumber((UNITY_INT)((expectedY)), (UNITY_INT)((paddlePositionY)), ( + + ((void *)0) + + ), (UNITY_UINT)(27), UNITY_DISPLAY_STYLE_INT); + + + + + + userInput = 1; + + expectedY = paddlePositionY + 1; + + + + + + processPlayerInput(&paddlePositionY, userInput); + + UnityAssertEqualNumber((UNITY_INT)((expectedY)), (UNITY_INT)((paddlePositionY)), ( + + ((void *)0) + + ), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); + + + + + + + +} diff --git a/build/test/preprocess/files/test_pong.c b/build/test/preprocess/files/test_pong.c new file mode 100644 index 0000000..7e1dfbf --- /dev/null +++ b/build/test/preprocess/files/test_pong.c @@ -0,0 +1,51 @@ +#include "src/main/c/Pong/pong.h" +#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" + + + + + + +void setUp(void){ + + + +} + +void tearDown(void){ + +} + + + + + +void test_input_all_5(void){ + + + + int a = 4, b = 5; + + + + + + resetScore( &a, &b ); + + + + + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((a)), ( + + ((void *)0) + + ), (UNITY_UINT)(21), UNITY_DISPLAY_STYLE_INT); + + UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((b)), ( + + ((void *)0) + + ), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/preprocess/files/test_tictactoe.c b/build/test/preprocess/files/test_tictactoe.c index 7971f22..e69de29 100644 --- a/build/test/preprocess/files/test_tictactoe.c +++ b/build/test/preprocess/files/test_tictactoe.c @@ -1,105 +0,0 @@ -#include "src/main/c/GameTic_Tac_Toe/tictactoe.h" -#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" - - - - - - - - -void setUp(void){ - - - -} - -void tearDown(void){ - -} - - - - - -void test_if_not_identical(void){ - - - - char result; - - char a = 'a', b = 'b', c = 'c'; - - - - result = checkLine(a, b, c); - - - - - - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((' ')), (UNITY_INT)(UNITY_INT8 )((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(22), UNITY_DISPLAY_STYLE_CHAR); - -} - - - - - -void test_if_identical(void){ - - - - char result; - - char a = 'a', b = 'a', c = 'a'; - - - - result = checkLine(a, b, c); - - - - - - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )((a)), (UNITY_INT)(UNITY_INT8 )((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(34), UNITY_DISPLAY_STYLE_CHAR); - -} - - - -void test_checkLine_horizontalerGewinner(void) { - - - - char result; - - char a = 'X', b = 'X', c = 'X'; - - - - - - result = checkLine(a, b, c); - - - - - - UnityAssertEqualNumber((UNITY_INT)(UNITY_INT8 )(('X')), (UNITY_INT)(UNITY_INT8 )((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(46), UNITY_DISPLAY_STYLE_CHAR); - -} - -} diff --git a/build/test/preprocess/includes/test_checkCollision.c b/build/test/preprocess/includes/test_checkCollision.c new file mode 100644 index 0000000..2b3a590 --- /dev/null +++ b/build/test/preprocess/includes/test_checkCollision.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/main/c/Pong/pong.h diff --git a/build/test/preprocess/includes/test_checkGameEnd.c b/build/test/preprocess/includes/test_checkGameEnd.c new file mode 100644 index 0000000..2b3a590 --- /dev/null +++ b/build/test/preprocess/includes/test_checkGameEnd.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/main/c/Pong/pong.h diff --git a/build/test/preprocess/includes/test_clearScreen.c b/build/test/preprocess/includes/test_clearScreen.c new file mode 100644 index 0000000..2b3a590 --- /dev/null +++ b/build/test/preprocess/includes/test_clearScreen.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/main/c/Pong/pong.h diff --git a/build/test/preprocess/includes/test_playerInputMovement.c b/build/test/preprocess/includes/test_playerInputMovement.c new file mode 100644 index 0000000..2b3a590 --- /dev/null +++ b/build/test/preprocess/includes/test_playerInputMovement.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/main/c/Pong/pong.h diff --git a/build/test/preprocess/includes/test_pong.c b/build/test/preprocess/includes/test_pong.c new file mode 100644 index 0000000..2b3a590 --- /dev/null +++ b/build/test/preprocess/includes/test_pong.c @@ -0,0 +1,3 @@ +--- +- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" +- src/main/c/Pong/pong.h diff --git a/build/test/preprocess/includes/test_tictactoe.c b/build/test/preprocess/includes/test_tictactoe.c index f398b3c..dcd024e 100644 --- a/build/test/preprocess/includes/test_tictactoe.c +++ b/build/test/preprocess/includes/test_tictactoe.c @@ -1,3 +1 @@ ---- -- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" -- src/main/c/GameTic_Tac_Toe/tictactoe.h +--- [] diff --git a/build/test/results/test_bomb_in_array.pass b/build/test/results/test_bomb_in_array.pass index 9327716..bd446c6 100644 --- a/build/test/results/test_bomb_in_array.pass +++ b/build/test/results/test_bomb_in_array.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.00173795400041854 +:time: 0.0019388419968890958 diff --git a/build/test/results/test_checkCollision.pass b/build/test/results/test_checkCollision.pass new file mode 100644 index 0000000..b40115a --- /dev/null +++ b/build/test/results/test_checkCollision.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Pong + :file: test_checkCollision.c +:successes: +- :test: test_checkCollision + :line: 28 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0029658310013473965 diff --git a/build/test/results/test_checkGameEnd.pass b/build/test/results/test_checkGameEnd.pass new file mode 100644 index 0000000..7cc50eb --- /dev/null +++ b/build/test/results/test_checkGameEnd.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Pong + :file: test_checkGameEnd.c +:successes: +- :test: test_checkGameEnd + :line: 14 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0017021699968609028 diff --git a/build/test/results/test_clearScreen.pass b/build/test/results/test_clearScreen.pass new file mode 100644 index 0000000..29b3121 --- /dev/null +++ b/build/test/results/test_clearScreen.pass @@ -0,0 +1,19 @@ +--- +:source: + :path: test/Pong + :file: test_clearScreen.c +:successes: +- :test: test_clearScreen + :line: 17 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: +- "\e[H\e[2J\e[3J" +:time: 0.0033668149990262464 diff --git a/build/test/results/test_collision.pass b/build/test/results/test_collision.pass index ca7129a..15afef4 100644 --- a/build/test/results/test_collision.pass +++ b/build/test/results/test_collision.pass @@ -23,4 +23,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0023196109978016466 +:time: 0.0019110120047116652 diff --git a/build/test/results/test_is_Valid_tile.pass b/build/test/results/test_is_Valid_tile.pass index dea454b..37c45ae 100644 --- a/build/test/results/test_is_Valid_tile.pass +++ b/build/test/results/test_is_Valid_tile.pass @@ -11,28 +11,36 @@ :line: 24 :message: '' :unity_test_time: 0 -- :test: test_detect_valid_tile_right +- :test: test_detect_not_valid_tile_right :line: 38 :message: '' :unity_test_time: 0 -- :test: test_detect_valid_tile_down +- :test: test_detect_not_valid_tile_down :line: 52 :message: '' :unity_test_time: 0 -- :test: test_detect_not_valid_tile_right +- :test: test_detect_valid_tile_left :line: 66 :message: '' :unity_test_time: 0 -- :test: test_detect_not_valid_tile_down +- :test: test_detect_valid_tile_up :line: 80 :message: '' :unity_test_time: 0 +- :test: test_detect_valid_tile_right + :line: 94 + :message: '' + :unity_test_time: 0 +- :test: test_detect_valid_tile_down + :line: 108 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 6 - :passed: 6 + :total: 8 + :passed: 8 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.002173025997763034 +:time: 0.0018614720029290766 diff --git a/build/test/results/test_moving_snake.pass b/build/test/results/test_moving_snake.pass index 2da558d..435237e 100644 --- a/build/test/results/test_moving_snake.pass +++ b/build/test/results/test_moving_snake.pass @@ -27,4 +27,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0014848970022285357 +:time: 0.0017703789999359287 diff --git a/build/test/results/test_number_of_bombs.pass b/build/test/results/test_number_of_bombs.pass index 2f16863..b61eb52 100644 --- a/build/test/results/test_number_of_bombs.pass +++ b/build/test/results/test_number_of_bombs.pass @@ -31,4 +31,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0023246400014613755 +:time: 0.001969636003195774 diff --git a/build/test/results/test_part_of_snake.pass b/build/test/results/test_part_of_snake.pass index dd4d43d..0b0c31d 100644 --- a/build/test/results/test_part_of_snake.pass +++ b/build/test/results/test_part_of_snake.pass @@ -23,4 +23,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.0021876099999644794 +:time: 0.0018195759985246696 diff --git a/build/test/results/test_playerInputMovement.pass b/build/test/results/test_playerInputMovement.pass new file mode 100644 index 0000000..02080f5 --- /dev/null +++ b/build/test/results/test_playerInputMovement.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Pong + :file: test_playerInputMovement.c +:successes: +- :test: test_playerInputMovement + :line: 20 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0020938829984515905 diff --git a/build/test/results/test_pong.pass b/build/test/results/test_pong.pass new file mode 100644 index 0000000..44f9ebf --- /dev/null +++ b/build/test/results/test_pong.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test/Pong + :file: test_pong.c +:successes: +- :test: test_input_all_5 + :line: 13 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.0018966770003316924 diff --git a/build/test/results/test_template.pass b/build/test/results/test_template.pass index 1e7a02f..3f7836b 100644 --- a/build/test/results/test_template.pass +++ b/build/test/results/test_template.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.002167227001336869 +:time: 0.002368312001635786 diff --git a/build/test/results/test_tictactoe.pass b/build/test/results/test_tictactoe.pass new file mode 100644 index 0000000..c006705 --- /dev/null +++ b/build/test/results/test_tictactoe.pass @@ -0,0 +1,14 @@ +--- +:source: + :path: test + :file: test_tictactoe.c +:successes: [] +:failures: [] +:ignores: [] +:counts: + :total: 0 + :passed: 0 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.001759689002938103 diff --git a/build/test/runners/test_checkCollision_runner.c b/build/test/runners/test_checkCollision_runner.c new file mode 100644 index 0000000..0bed50f --- /dev/null +++ b/build/test/runners/test_checkCollision_runner.c @@ -0,0 +1,81 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_checkCollision(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_checkCollision.c"); + run_test(test_checkCollision, "test_checkCollision", 28); + + return UnityEnd(); +} diff --git a/build/test/runners/test_checkGameEnd_runner.c b/build/test/runners/test_checkGameEnd_runner.c new file mode 100644 index 0000000..d83fa82 --- /dev/null +++ b/build/test/runners/test_checkGameEnd_runner.c @@ -0,0 +1,81 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_checkGameEnd(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_checkGameEnd.c"); + run_test(test_checkGameEnd, "test_checkGameEnd", 14); + + return UnityEnd(); +} diff --git a/build/test/runners/test_clearScreen_runner.c b/build/test/runners/test_clearScreen_runner.c new file mode 100644 index 0000000..9c1799e --- /dev/null +++ b/build/test/runners/test_clearScreen_runner.c @@ -0,0 +1,81 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_clearScreen(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_clearScreen.c"); + run_test(test_clearScreen, "test_clearScreen", 17); + + return UnityEnd(); +} diff --git a/build/test/runners/test_is_Valid_tile_runner.c b/build/test/runners/test_is_Valid_tile_runner.c index 13f3de7..25de69d 100644 --- a/build/test/runners/test_is_Valid_tile_runner.c +++ b/build/test/runners/test_is_Valid_tile_runner.c @@ -12,10 +12,12 @@ extern void setUp(void); extern void tearDown(void); extern void test_detect_not_valid_tile_left(void); extern void test_detect_not_valid_tile_up(void); -extern void test_detect_valid_tile_right(void); -extern void test_detect_valid_tile_down(void); extern void test_detect_not_valid_tile_right(void); extern void test_detect_not_valid_tile_down(void); +extern void test_detect_valid_tile_left(void); +extern void test_detect_valid_tile_up(void); +extern void test_detect_valid_tile_right(void); +extern void test_detect_valid_tile_down(void); /*=======Mock Management=====*/ @@ -82,10 +84,12 @@ int main(void) UnityBegin("test_is_Valid_tile.c"); run_test(test_detect_not_valid_tile_left, "test_detect_not_valid_tile_left", 10); run_test(test_detect_not_valid_tile_up, "test_detect_not_valid_tile_up", 24); - run_test(test_detect_valid_tile_right, "test_detect_valid_tile_right", 38); - run_test(test_detect_valid_tile_down, "test_detect_valid_tile_down", 52); - run_test(test_detect_not_valid_tile_right, "test_detect_not_valid_tile_right", 66); - run_test(test_detect_not_valid_tile_down, "test_detect_not_valid_tile_down", 80); + run_test(test_detect_not_valid_tile_right, "test_detect_not_valid_tile_right", 38); + run_test(test_detect_not_valid_tile_down, "test_detect_not_valid_tile_down", 52); + run_test(test_detect_valid_tile_left, "test_detect_valid_tile_left", 66); + run_test(test_detect_valid_tile_up, "test_detect_valid_tile_up", 80); + run_test(test_detect_valid_tile_right, "test_detect_valid_tile_right", 94); + run_test(test_detect_valid_tile_down, "test_detect_valid_tile_down", 108); return UnityEnd(); } diff --git a/build/test/runners/test_playerInputMovement_runner.c b/build/test/runners/test_playerInputMovement_runner.c new file mode 100644 index 0000000..6fde093 --- /dev/null +++ b/build/test/runners/test_playerInputMovement_runner.c @@ -0,0 +1,81 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_playerInputMovement(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_playerInputMovement.c"); + run_test(test_playerInputMovement, "test_playerInputMovement", 20); + + return UnityEnd(); +} diff --git a/build/test/runners/test_pong_runner.c b/build/test/runners/test_pong_runner.c new file mode 100644 index 0000000..93a6451 --- /dev/null +++ b/build/test/runners/test_pong_runner.c @@ -0,0 +1,81 @@ +/* AUTOGENERATED FILE. DO NOT EDIT. */ + +/*=======Automagically Detected Files To Include=====*/ +#include "unity.h" + +int GlobalExpectCount; +int GlobalVerifyOrder; +char* GlobalOrderError; + +/*=======External Functions This Runner Calls=====*/ +extern void setUp(void); +extern void tearDown(void); +extern void test_input_all_5(void); + + +/*=======Mock Management=====*/ +static void CMock_Init(void) +{ + GlobalExpectCount = 0; + GlobalVerifyOrder = 0; + GlobalOrderError = NULL; +} +static void CMock_Verify(void) +{ +} +static void CMock_Destroy(void) +{ +} + +/*=======Test Reset Options=====*/ +void resetTest(void); +void resetTest(void) +{ + tearDown(); + CMock_Verify(); + CMock_Destroy(); + CMock_Init(); + setUp(); +} +void verifyTest(void); +void verifyTest(void) +{ + CMock_Verify(); +} + +/*=======Test Runner Used To Run Each Test=====*/ +static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) +{ + Unity.CurrentTestName = name; + Unity.CurrentTestLineNumber = line_num; +#ifdef UNITY_USE_COMMAND_LINE_ARGS + if (!UnityTestMatches()) + return; +#endif + Unity.NumberOfTests++; + UNITY_CLR_DETAILS(); + UNITY_EXEC_TIME_START(); + CMock_Init(); + if (TEST_PROTECT()) + { + setUp(); + func(); + } + if (TEST_PROTECT()) + { + tearDown(); + CMock_Verify(); + } + CMock_Destroy(); + UNITY_EXEC_TIME_STOP(); + UnityConcludeTest(); +} + +/*=======MAIN=====*/ +int main(void) +{ + UnityBegin("test_pong.c"); + run_test(test_input_all_5, "test_input_all_5", 13); + + return UnityEnd(); +} diff --git a/build/test/runners/test_tictactoe_runner.c b/build/test/runners/test_tictactoe_runner.c index 0cbfabd..161ff95 100644 --- a/build/test/runners/test_tictactoe_runner.c +++ b/build/test/runners/test_tictactoe_runner.c @@ -10,9 +10,6 @@ char* GlobalOrderError; /*=======External Functions This Runner Calls=====*/ extern void setUp(void); extern void tearDown(void); -extern void test_if_not_identical(void); -extern void test_if_identical(void); -extern void test_checkLine_horizontalerGewinner(void); /*=======Mock Management=====*/ @@ -29,6 +26,12 @@ static void CMock_Destroy(void) { } +/*=======Setup (stub)=====*/ +void setUp(void) {} + +/*=======Teardown (stub)=====*/ +void tearDown(void) {} + /*=======Test Reset Options=====*/ void resetTest(void); void resetTest(void) @@ -45,41 +48,10 @@ void verifyTest(void) CMock_Verify(); } -/*=======Test Runner Used To Run Each Test=====*/ -static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num) -{ - Unity.CurrentTestName = name; - Unity.CurrentTestLineNumber = line_num; -#ifdef UNITY_USE_COMMAND_LINE_ARGS - if (!UnityTestMatches()) - return; -#endif - Unity.NumberOfTests++; - UNITY_CLR_DETAILS(); - UNITY_EXEC_TIME_START(); - CMock_Init(); - if (TEST_PROTECT()) - { - setUp(); - func(); - } - if (TEST_PROTECT()) - { - tearDown(); - CMock_Verify(); - } - CMock_Destroy(); - UNITY_EXEC_TIME_STOP(); - UnityConcludeTest(); -} - /*=======MAIN=====*/ int main(void) { UnityBegin("test_tictactoe.c"); - run_test(test_if_not_identical, "test_if_not_identical", 14); - run_test(test_if_identical, "test_if_identical", 26); - run_test(test_checkLine_horizontalerGewinner, "test_checkLine_horizontalerGewinner", 37); return UnityEnd(); }