Browse Source

Merge branch 'main' into 'Ariana'

# Conflicts:
#   src/main/c/main.c
remotes/origin/Ariana
fdai8032 11 months ago
parent
commit
965a8309f1
  1. 9
      .vscode/settings.json
  2. 28
      .vscode/tasks.json
  3. BIN
      build/artifacts/release/project.out
  4. 1
      build/release/dependencies/get_character.d
  5. 3
      build/release/dependencies/main.d
  6. 3
      build/release/dependencies/minesweeper_start.d
  7. 1
      build/release/dependencies/pong.d
  8. 2
      build/release/dependencies/snake_start.d
  9. 1
      build/release/dependencies/tictactoe.d
  10. BIN
      build/release/out/c/get_character.o
  11. BIN
      build/release/out/c/main.o
  12. BIN
      build/release/out/c/minesweeper_start.o
  13. BIN
      build/release/out/c/pong.o
  14. BIN
      build/release/out/c/snake_start.o
  15. BIN
      build/release/out/c/tictactoe.o
  16. BIN
      build/release/project.out
  17. 10
      build/test/cache/defines_dependency.yml
  18. 79
      build/test/cache/test_bomb_in_array.c
  19. 143
      build/test/cache/test_checkCollision.c
  20. 69
      build/test/cache/test_checkGameEnd.c
  21. 73
      build/test/cache/test_clearScreen.c
  22. 102
      build/test/cache/test_collision.c
  23. 269
      build/test/cache/test_is_Valid_tile.c
  24. 142
      build/test/cache/test_moving_snake.c
  25. 205
      build/test/cache/test_number_of_bombs.c
  26. 102
      build/test/cache/test_part_of_snake.c
  27. 83
      build/test/cache/test_playerInputMovement.c
  28. 51
      build/test/cache/test_pong.c
  29. 0
      build/test/cache/test_tictactoe.c
  30. 1
      build/test/dependencies/get_character.d
  31. 3
      build/test/dependencies/minesweeper_start.d
  32. 1
      build/test/dependencies/pong.d
  33. 2
      build/test/dependencies/snake_start.d
  34. 5
      build/test/dependencies/test_bomb_in_array.d
  35. 4
      build/test/dependencies/test_bomb_in_array_runner.d
  36. 4
      build/test/dependencies/test_checkCollision.d
  37. 4
      build/test/dependencies/test_checkCollision_runner.d
  38. 4
      build/test/dependencies/test_checkGameEnd.d
  39. 4
      build/test/dependencies/test_checkGameEnd_runner.d
  40. 4
      build/test/dependencies/test_clearScreen.d
  41. 4
      build/test/dependencies/test_clearScreen_runner.d
  42. 4
      build/test/dependencies/test_collision.d
  43. 4
      build/test/dependencies/test_collision_runner.d
  44. 5
      build/test/dependencies/test_is_Valid_tile.d
  45. 4
      build/test/dependencies/test_is_Valid_tile_runner.d
  46. 5
      build/test/dependencies/test_moving_snake.d
  47. 4
      build/test/dependencies/test_moving_snake_runner.d
  48. 5
      build/test/dependencies/test_number_of_bombs.d
  49. 4
      build/test/dependencies/test_number_of_bombs_runner.d
  50. 5
      build/test/dependencies/test_part_of_snake.d
  51. 4
      build/test/dependencies/test_part_of_snake_runner.d
  52. 5
      build/test/dependencies/test_playerInputMovement.d
  53. 4
      build/test/dependencies/test_playerInputMovement_runner.d
  54. 4
      build/test/dependencies/test_pong.d
  55. 4
      build/test/dependencies/test_pong_runner.d
  56. 1
      build/test/dependencies/test_tictactoe.d
  57. 4
      build/test/dependencies/test_tictactoe_runner.d
  58. BIN
      build/test/out/c/get_character.o
  59. BIN
      build/test/out/c/minesweeper_start.o
  60. BIN
      build/test/out/c/pong.o
  61. BIN
      build/test/out/c/snake_start.o
  62. BIN
      build/test/out/c/test_bomb_in_array.o
  63. BIN
      build/test/out/c/test_bomb_in_array_runner.o
  64. BIN
      build/test/out/c/test_checkCollision.o
  65. BIN
      build/test/out/c/test_checkCollision_runner.o
  66. BIN
      build/test/out/c/test_checkGameEnd.o
  67. BIN
      build/test/out/c/test_checkGameEnd_runner.o
  68. BIN
      build/test/out/c/test_clearScreen.o
  69. BIN
      build/test/out/c/test_clearScreen_runner.o
  70. BIN
      build/test/out/c/test_collision.o
  71. BIN
      build/test/out/c/test_collision_runner.o
  72. BIN
      build/test/out/c/test_is_Valid_tile.o
  73. BIN
      build/test/out/c/test_is_Valid_tile_runner.o
  74. BIN
      build/test/out/c/test_moving_snake.o
  75. BIN
      build/test/out/c/test_moving_snake_runner.o
  76. BIN
      build/test/out/c/test_number_of_bombs.o
  77. BIN
      build/test/out/c/test_number_of_bombs_runner.o
  78. BIN
      build/test/out/c/test_part_of_snake.o
  79. BIN
      build/test/out/c/test_part_of_snake_runner.o
  80. BIN
      build/test/out/c/test_playerInputMovement.o
  81. BIN
      build/test/out/c/test_playerInputMovement_runner.o
  82. BIN
      build/test/out/c/test_pong.o
  83. BIN
      build/test/out/c/test_pong_runner.o
  84. BIN
      build/test/out/c/test_tictactoe.o
  85. BIN
      build/test/out/c/test_tictactoe_runner.o
  86. BIN
      build/test/out/test_bomb_in_array.out
  87. BIN
      build/test/out/test_checkCollision.out
  88. BIN
      build/test/out/test_checkGameEnd.out
  89. BIN
      build/test/out/test_clearScreen.out
  90. BIN
      build/test/out/test_collision.out
  91. BIN
      build/test/out/test_is_Valid_tile.out
  92. BIN
      build/test/out/test_moving_snake.out
  93. BIN
      build/test/out/test_number_of_bombs.out
  94. BIN
      build/test/out/test_part_of_snake.out
  95. BIN
      build/test/out/test_playerInputMovement.out
  96. BIN
      build/test/out/test_pong.out
  97. BIN
      build/test/out/test_tictactoe.out
  98. 79
      build/test/preprocess/files/test_bomb_in_array.c
  99. 143
      build/test/preprocess/files/test_checkCollision.c
  100. 69
      build/test/preprocess/files/test_checkGameEnd.c

9
.vscode/settings.json

@ -0,0 +1,9 @@
{
"files.associations": {
"*.embeddedhtml": "html",
"unistd.h": "c",
"fcntl.h": "c",
"stdio.h": "c",
"types.h": "c"
}
}

28
.vscode/tasks.json

@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}

BIN
build/artifacts/release/project.out

1
build/release/dependencies/get_character.d

@ -0,0 +1 @@
build/release/out/c/get_character.o: src/main/c/Snake/get_character.c

3
build/release/dependencies/main.d

@ -1,2 +1,3 @@
build/release/out/c/main.o: src/main/c/main.c \ build/release/out/c/main.o: src/main/c/main.c \
src/main/c/Template/game100.h
src/main/c/Snake/snake_start.h \
src/main/c/Minesweeper/minesweeper_start.h src/main/c/Pong/pong.h

3
build/release/dependencies/minesweeper_start.d

@ -0,0 +1,3 @@
build/release/out/c/minesweeper_start.o: \
src/main/c/Minesweeper/minesweeper_start.c \
src/main/c/Minesweeper/minesweeper_start.h

1
build/release/dependencies/pong.d

@ -0,0 +1 @@
build/release/out/c/pong.o: src/main/c/Pong/pong.c

2
build/release/dependencies/snake_start.d

@ -0,0 +1,2 @@
build/release/out/c/snake_start.o: src/main/c/Snake/snake_start.c \
src/main/c/Snake/snake_start.h src/main/c/Snake/get_character.h

1
build/release/dependencies/tictactoe.d

@ -0,0 +1 @@
build/release/out/c/tictactoe.o: src/main/c/GameTic_Tac_Toe/tictactoe.c

BIN
build/release/out/c/get_character.o

BIN
build/release/out/c/main.o

BIN
build/release/out/c/minesweeper_start.o

BIN
build/release/out/c/pong.o

BIN
build/release/out/c/snake_start.o

BIN
build/release/out/c/tictactoe.o

BIN
build/release/project.out

10
build/test/cache/defines_dependency.yml

@ -1,3 +1,13 @@
--- ---
src/main/c/Template/game100.c: src/main/c/Template/game100.c:
- TEST - TEST
src/main/c/Snake/snake_start.c:
- TEST
src/main/c/Snake/get_character.c:
- TEST
src/main/c/Minesweeper/minesweeper_start.c:
- TEST
src/main/c/GameTic_Tac_Toe/tictactoe.c:
- TEST
src/main/c/Pong/pong.c:
- TEST

79
build/test/cache/test_bomb_in_array.c

@ -0,0 +1,79 @@
#include "build/temp/../../src/main/c/Minesweeper/minesweeper_start.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_bomb_in_array(void){
_Bool
result;
int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78};
int bomb = 42;
int length = 10;
result = array_contains_value(array, bomb, length);
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(22)));}} while(0);
}
void test_bomb_not_in_array(void){
_Bool
result;
int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78};
int bomb = 0;
int length = 10;
result = array_contains_value(array, bomb, length);
do {if (!(result)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(37)));}} while(0);
}

143
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);
}

69
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);
}

73
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);
}
}
}

102
build/test/cache/test_collision.c

@ -0,0 +1,102 @@
#include "src/main/c/Snake/get_character.h"
#include "src/main/c/Snake/snake_start.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_self_collision(void){
_Bool
result;
Snake snake = {1, 5, {6 + 16 * 6, 6 + 16 * 7, 7 + 16 * 7, 7 + 16 * 6, 6 + 16 * 6}};
result = check_if_dead(&snake);
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(21)));}} while(0);
}
void test_no_collision(void){
_Bool
result;
Snake snake = initialize_snake();
result = check_if_dead(&snake);
do {if (!(result)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(34)));}} while(0);
}
void test_wall_collision(void){
_Bool
result;
Snake snake = {-1, 4, {0 + 16 * 6, 1 + 16 * 6, 2 + 16 * 6, 3 + 16 * 6}};
result = check_if_dead(&snake);
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(47)));}} while(0);
}

269
build/test/cache/test_is_Valid_tile.c

@ -0,0 +1,269 @@
#include "build/temp/../../src/main/c/Minesweeper/minesweeper_start.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_detect_not_valid_tile_left(void){
Minesweeper_Board board = initialize_minesweeper();
int tile = 0;
int direction = 2;
int result;
result = is_Valid_tile(&board, tile, direction);
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(21), UNITY_DISPLAY_STYLE_INT);
}
void test_detect_not_valid_tile_up(void){
Minesweeper_Board board = initialize_minesweeper();
int tile = 0;
int direction = 3;
int result;
result = is_Valid_tile(&board, tile, direction);
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT);
}
void test_detect_not_valid_tile_right(void){
Minesweeper_Board board = initialize_minesweeper();
int tile = board.width * board.height - 1;
int direction = 5;
int result;
result = is_Valid_tile(&board, tile, direction);
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(49), UNITY_DISPLAY_STYLE_INT);
}
void test_detect_not_valid_tile_down(void){
Minesweeper_Board board = initialize_minesweeper();
int tile = board.width * board.height - 1;
int direction = 4;
int result;
result = is_Valid_tile(&board, tile, direction);
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT);
}
void test_detect_valid_tile_left(void){
Minesweeper_Board board = initialize_minesweeper();
int tile = board.width * board.height - 1;
int direction = 2;
int result;
result = is_Valid_tile(&board, tile, direction);
UnityAssertEqualNumber((UNITY_INT)((board.width * board.height - 2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(77), UNITY_DISPLAY_STYLE_INT);
}
void test_detect_valid_tile_up(void){
Minesweeper_Board board = initialize_minesweeper();
int tile = board.width * board.height - 1;
int direction = 3;
int result;
result = is_Valid_tile(&board, tile, direction);
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);
}

142
build/test/cache/test_moving_snake.c

@ -0,0 +1,142 @@
#include "build/temp/../../src/main/c/Snake/get_character.h"
#include "build/temp/../../src/main/c/Snake/snake_start.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_moving_right(void){
_Bool
result;
Snake snake = {1, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}};
Snake expected = {1, 3, {9 + 16 * 6, 8 + 16 * 6, 7 + 16 * 6}};
move_snake(&snake);
result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(24)));}} while(0);
}
void test_moving_down(void){
_Bool
result;
Snake snake = {16, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}};
Snake expected = {16, 3, {8 + 16 * 7, 8 + 16 * 6, 7 + 16 * 6}};
move_snake(&snake);
result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(38)));}} while(0);
}
void test_moving_left(void){
_Bool
result;
Snake snake = {-1, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}};
Snake expected = {-1, 3, {7 + 16 * 6, 8 + 16 * 6, 7 + 16 * 6}};
move_snake(&snake);
result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(52)));}} while(0);
}
void test_moving_up(void){
_Bool
result;
Snake snake = {-16, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}};
Snake expected = {-16, 3, {8 + 16 * 5, 8 + 16 * 6, 7 + 16 * 6}};
move_snake(&snake);
result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(66)));}} while(0);
}

205
build/test/cache/test_number_of_bombs.c

@ -0,0 +1,205 @@
#include "build/temp/../../src/main/c/Minesweeper/minesweeper_start.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_no_bombs_placed_around_tile(void){
int result;
Minesweeper_Board board = initialize_minesweeper();
int tile = 0 + board.width * 1;
result = number_of_bombs(&board, tile);
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(21), UNITY_DISPLAY_STYLE_INT);
}
void test_searching_for_bombs_on_correct_tiles(void){
int result;
Minesweeper_Board board = initialize_minesweeper();
int tile = 0 + board.width * 1;
board.bombs[0] = 0 + board.width * 3;
board.bombs[1] = 2 + board.width * 1;
board.bombs[2] = board.width - 1 + board.width * 1;
board.bombs[3] = 0 + board.width * (board.height - 1);
result = number_of_bombs(&board, tile);
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(38), UNITY_DISPLAY_STYLE_INT);
}
void test_2_bombs_around_tile(void){
int result;
Minesweeper_Board board = initialize_minesweeper();
int tile = 0 + board.width * 1;
board.bombs[0] = 0 + board.width * 2;
board.bombs[1] = 1 + board.width * 1;
board.bombs[2] = board.width - 1 + board.width * 1;
board.bombs[3] = 0 + board.width * (board.height - 1);
result = number_of_bombs(&board, tile);
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(55), UNITY_DISPLAY_STYLE_INT);
}
void test_5_bombs_around_tile(void){
int result;
Minesweeper_Board board = initialize_minesweeper();
int tile = 1 + board.width * 0;
board.bombs[0] = 0 + board.width * 0;
board.bombs[1] = 2 + board.width * 0;
board.bombs[2] = 0 + board.width * 1;
board.bombs[3] = 1 + board.width * 1;
board.bombs[4] = 2 + board.width * 1;
result = number_of_bombs(&board, tile);
UnityAssertEqualNumber((UNITY_INT)((5)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(73), UNITY_DISPLAY_STYLE_INT);
}
void test_8_bombs_around_tile(void){
int result;
Minesweeper_Board board = initialize_minesweeper();
int tile = 7 + board.width * 7;
board.bombs[0] = 6 + board.width * 6;
board.bombs[1] = 7 + board.width * 6;
board.bombs[2] = 8 + board.width * 6;
board.bombs[3] = 6 + board.width * 7;
board.bombs[4] = 8 + board.width * 7;
board.bombs[5] = 6 + board.width * 8;
board.bombs[6] = 7 + board.width * 8;
board.bombs[7] = 8 + board.width * 8;
result = number_of_bombs(&board, tile);
UnityAssertEqualNumber((UNITY_INT)((8)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(94), UNITY_DISPLAY_STYLE_INT);
}

102
build/test/cache/test_part_of_snake.c

@ -0,0 +1,102 @@
#include "build/temp/../../src/main/c/Snake/get_character.h"
#include "build/temp/../../src/main/c/Snake/snake_start.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_find_head(void){
int result;
Snake snake = initialize_snake();
result = part_of_snake(&snake, 8 * 16 + 8);
UnityAssertEqualNumber((UNITY_INT)((0)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(20), UNITY_DISPLAY_STYLE_INT);
}
void test_get_correct_index(void){
int result;
Snake snake = initialize_snake();
result = part_of_snake(&snake, 8 * 16 + 6);
UnityAssertEqualNumber((UNITY_INT)((2)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(33), UNITY_DISPLAY_STYLE_INT);
}
void test_snake_not_on_tile(void){
int result;
Snake snake = initialize_snake();
result = part_of_snake(&snake, 6 * 16 + 6);
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), (
((void *)0)
), (UNITY_UINT)(46), UNITY_DISPLAY_STYLE_INT);
}

83
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);
}

51
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);
}

0
build/test/cache/test_tictactoe.c

1
build/test/dependencies/get_character.d

@ -0,0 +1 @@
build/test/out/c/get_character.o: src/main/c/Snake/get_character.c

3
build/test/dependencies/minesweeper_start.d

@ -0,0 +1,3 @@
build/test/out/c/minesweeper_start.o: \
src/main/c/Minesweeper/minesweeper_start.c \
src/main/c/Minesweeper/minesweeper_start.h

1
build/test/dependencies/pong.d

@ -0,0 +1 @@
build/test/out/c/pong.o: src/main/c/Pong/pong.c

2
build/test/dependencies/snake_start.d

@ -0,0 +1,2 @@
build/test/out/c/snake_start.o: src/main/c/Snake/snake_start.c \
src/main/c/Snake/snake_start.h src/main/c/Snake/get_character.h

5
build/test/dependencies/test_bomb_in_array.d

@ -0,0 +1,5 @@
build/test/out/c/test_bomb_in_array.o: \
test/Minesweeper/test_bomb_in_array.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 \
test/Minesweeper/../../src/main/c/Minesweeper/minesweeper_start.h

4
build/test/dependencies/test_bomb_in_array_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_bomb_in_array_runner.o: \
build/test/runners/test_bomb_in_array_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

4
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

4
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

4
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

4
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

4
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

4
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

4
build/test/dependencies/test_collision.d

@ -0,0 +1,4 @@
build/test/out/c/test_collision.o: test/Snake/test_collision.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/Snake/snake_start.h src/main/c/Snake/get_character.h

4
build/test/dependencies/test_collision_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_collision_runner.o: \
build/test/runners/test_collision_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

5
build/test/dependencies/test_is_Valid_tile.d

@ -0,0 +1,5 @@
build/test/out/c/test_is_Valid_tile.o: \
test/Minesweeper/test_is_Valid_tile.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 \
test/Minesweeper/../../src/main/c/Minesweeper/minesweeper_start.h

4
build/test/dependencies/test_is_Valid_tile_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_is_Valid_tile_runner.o: \
build/test/runners/test_is_Valid_tile_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

5
build/test/dependencies/test_moving_snake.d

@ -0,0 +1,5 @@
build/test/out/c/test_moving_snake.o: test/Snake/test_moving_snake.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 \
test/Snake/../../src/main/c/Snake/snake_start.h \
test/Snake/../../src/main/c/Snake/get_character.h

4
build/test/dependencies/test_moving_snake_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_moving_snake_runner.o: \
build/test/runners/test_moving_snake_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

5
build/test/dependencies/test_number_of_bombs.d

@ -0,0 +1,5 @@
build/test/out/c/test_number_of_bombs.o: \
test/Minesweeper/test_number_of_bombs.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 \
test/Minesweeper/../../src/main/c/Minesweeper/minesweeper_start.h

4
build/test/dependencies/test_number_of_bombs_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_number_of_bombs_runner.o: \
build/test/runners/test_number_of_bombs_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

5
build/test/dependencies/test_part_of_snake.d

@ -0,0 +1,5 @@
build/test/out/c/test_part_of_snake.o: test/Snake/test_part_of_snake.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 \
test/Snake/../../src/main/c/Snake/snake_start.h \
test/Snake/../../src/main/c/Snake/get_character.h

4
build/test/dependencies/test_part_of_snake_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_part_of_snake_runner.o: \
build/test/runners/test_part_of_snake_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

5
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

4
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

4
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

4
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

1
build/test/dependencies/test_tictactoe.d

@ -0,0 +1 @@
build/test/out/c/test_tictactoe.o: test/test_tictactoe.c

4
build/test/dependencies/test_tictactoe_runner.d

@ -0,0 +1,4 @@
build/test/out/c/test_tictactoe_runner.o: \
build/test/runners/test_tictactoe_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

BIN
build/test/out/c/get_character.o

BIN
build/test/out/c/minesweeper_start.o

BIN
build/test/out/c/pong.o

BIN
build/test/out/c/snake_start.o

BIN
build/test/out/c/test_bomb_in_array.o

BIN
build/test/out/c/test_bomb_in_array_runner.o

BIN
build/test/out/c/test_checkCollision.o

BIN
build/test/out/c/test_checkCollision_runner.o

BIN
build/test/out/c/test_checkGameEnd.o

BIN
build/test/out/c/test_checkGameEnd_runner.o

BIN
build/test/out/c/test_clearScreen.o

BIN
build/test/out/c/test_clearScreen_runner.o

BIN
build/test/out/c/test_collision.o

BIN
build/test/out/c/test_collision_runner.o

BIN
build/test/out/c/test_is_Valid_tile.o

BIN
build/test/out/c/test_is_Valid_tile_runner.o

BIN
build/test/out/c/test_moving_snake.o

BIN
build/test/out/c/test_moving_snake_runner.o

BIN
build/test/out/c/test_number_of_bombs.o

BIN
build/test/out/c/test_number_of_bombs_runner.o

BIN
build/test/out/c/test_part_of_snake.o

BIN
build/test/out/c/test_part_of_snake_runner.o

BIN
build/test/out/c/test_playerInputMovement.o

BIN
build/test/out/c/test_playerInputMovement_runner.o

BIN
build/test/out/c/test_pong.o

BIN
build/test/out/c/test_pong_runner.o

BIN
build/test/out/c/test_tictactoe.o

BIN
build/test/out/c/test_tictactoe_runner.o

BIN
build/test/out/test_bomb_in_array.out

BIN
build/test/out/test_checkCollision.out

BIN
build/test/out/test_checkGameEnd.out

BIN
build/test/out/test_clearScreen.out

BIN
build/test/out/test_collision.out

BIN
build/test/out/test_is_Valid_tile.out

BIN
build/test/out/test_moving_snake.out

BIN
build/test/out/test_number_of_bombs.out

BIN
build/test/out/test_part_of_snake.out

BIN
build/test/out/test_playerInputMovement.out

BIN
build/test/out/test_pong.out

BIN
build/test/out/test_tictactoe.out

79
build/test/preprocess/files/test_bomb_in_array.c

@ -0,0 +1,79 @@
#include "build/temp/../../src/main/c/Minesweeper/minesweeper_start.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_bomb_in_array(void){
_Bool
result;
int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78};
int bomb = 42;
int length = 10;
result = array_contains_value(array, bomb, length);
do {if ((result)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(22)));}} while(0);
}
void test_bomb_not_in_array(void){
_Bool
result;
int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78};
int bomb = 0;
int length = 10;
result = array_contains_value(array, bomb, length);
do {if (!(result)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(37)));}} while(0);
}

143
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);
}

69
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);
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save