David Moeller
11 months ago
89 changed files with 2841 additions and 3 deletions
-
28.vscode/tasks.json
-
BINbuild/artifacts/release/project.out
-
1build/release/dependencies/get_character.d
-
3build/release/dependencies/main.d
-
3build/release/dependencies/minesweeper_start.d
-
2build/release/dependencies/snake_start.d
-
1build/release/dependencies/tictactoe.d
-
BINbuild/release/out/c/get_character.o
-
BINbuild/release/out/c/main.o
-
BINbuild/release/out/c/minesweeper_start.o
-
BINbuild/release/out/c/snake_start.o
-
BINbuild/release/out/c/tictactoe.o
-
BINbuild/release/project.out
-
8build/test/cache/defines_dependency.yml
-
79build/test/cache/test_bomb_in_array.c
-
102build/test/cache/test_collision.c
-
205build/test/cache/test_is_Valid_tile.c
-
142build/test/cache/test_moving_snake.c
-
205build/test/cache/test_number_of_bombs.c
-
102build/test/cache/test_part_of_snake.c
-
105build/test/cache/test_tictactoe.c
-
1build/test/dependencies/get_character.d
-
3build/test/dependencies/minesweeper_start.d
-
2build/test/dependencies/snake_start.d
-
5build/test/dependencies/test_bomb_in_array.d
-
4build/test/dependencies/test_bomb_in_array_runner.d
-
4build/test/dependencies/test_collision.d
-
4build/test/dependencies/test_collision_runner.d
-
5build/test/dependencies/test_is_Valid_tile.d
-
4build/test/dependencies/test_is_Valid_tile_runner.d
-
5build/test/dependencies/test_moving_snake.d
-
4build/test/dependencies/test_moving_snake_runner.d
-
5build/test/dependencies/test_number_of_bombs.d
-
4build/test/dependencies/test_number_of_bombs_runner.d
-
5build/test/dependencies/test_part_of_snake.d
-
4build/test/dependencies/test_part_of_snake_runner.d
-
4build/test/dependencies/test_tictactoe.d
-
4build/test/dependencies/test_tictactoe_runner.d
-
BINbuild/test/out/c/get_character.o
-
BINbuild/test/out/c/minesweeper_start.o
-
BINbuild/test/out/c/snake_start.o
-
BINbuild/test/out/c/test_bomb_in_array.o
-
BINbuild/test/out/c/test_bomb_in_array_runner.o
-
BINbuild/test/out/c/test_collision.o
-
BINbuild/test/out/c/test_collision_runner.o
-
BINbuild/test/out/c/test_is_Valid_tile.o
-
BINbuild/test/out/c/test_is_Valid_tile_runner.o
-
BINbuild/test/out/c/test_moving_snake.o
-
BINbuild/test/out/c/test_moving_snake_runner.o
-
BINbuild/test/out/c/test_number_of_bombs.o
-
BINbuild/test/out/c/test_number_of_bombs_runner.o
-
BINbuild/test/out/c/test_part_of_snake.o
-
BINbuild/test/out/c/test_part_of_snake_runner.o
-
BINbuild/test/out/c/test_tictactoe_runner.o
-
BINbuild/test/out/test_bomb_in_array.out
-
BINbuild/test/out/test_collision.out
-
BINbuild/test/out/test_is_Valid_tile.out
-
BINbuild/test/out/test_moving_snake.out
-
BINbuild/test/out/test_number_of_bombs.out
-
BINbuild/test/out/test_part_of_snake.out
-
79build/test/preprocess/files/test_bomb_in_array.c
-
102build/test/preprocess/files/test_collision.c
-
205build/test/preprocess/files/test_is_Valid_tile.c
-
142build/test/preprocess/files/test_moving_snake.c
-
205build/test/preprocess/files/test_number_of_bombs.c
-
102build/test/preprocess/files/test_part_of_snake.c
-
105build/test/preprocess/files/test_tictactoe.c
-
3build/test/preprocess/includes/test_bomb_in_array.c
-
4build/test/preprocess/includes/test_collision.c
-
3build/test/preprocess/includes/test_is_Valid_tile.c
-
4build/test/preprocess/includes/test_moving_snake.c
-
3build/test/preprocess/includes/test_number_of_bombs.c
-
4build/test/preprocess/includes/test_part_of_snake.c
-
3build/test/preprocess/includes/test_tictactoe.c
-
22build/test/results/test_bomb_in_array.pass
-
26build/test/results/test_collision.pass
-
38build/test/results/test_is_Valid_tile.pass
-
30build/test/results/test_moving_snake.pass
-
34build/test/results/test_number_of_bombs.pass
-
26build/test/results/test_part_of_snake.pass
-
2build/test/results/test_template.pass
-
83build/test/runners/test_bomb_in_array_runner.c
-
85build/test/runners/test_collision_runner.c
-
91build/test/runners/test_is_Valid_tile_runner.c
-
87build/test/runners/test_moving_snake_runner.c
-
89build/test/runners/test_number_of_bombs_runner.c
-
85build/test/runners/test_part_of_snake_runner.c
-
85build/test/runners/test_tictactoe_runner.c
-
44test/Minesweeper/test_is_Valid_tile.c
@ -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" |
|||
} |
@ -0,0 +1 @@ |
|||
build/release/out/c/get_character.o: src/main/c/Snake/get_character.c |
@ -1,2 +1,3 @@ |
|||
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 |
@ -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 |
@ -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 |
@ -0,0 +1 @@ |
|||
build/release/out/c/tictactoe.o: src/main/c/GameTic_Tac_Toe/tictactoe.c |
@ -1,3 +1,11 @@ |
|||
--- |
|||
src/main/c/Template/game100.c: |
|||
- 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 |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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_detect_not_valid_tile_left(void){ |
|||
|
|||
|
|||
|
|||
Minesweeper_Board board = initialize_minesweeper(); |
|||
|
|||
int tile = 0; |
|||
|
|||
int direction = 1; |
|||
|
|||
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_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)(49), 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)(63), 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)(77), 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)(91), UNITY_DISPLAY_STYLE_INT); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -0,0 +1,105 @@ |
|||
#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); |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1 @@ |
|||
build/test/out/c/get_character.o: src/main/c/Snake/get_character.c |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -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 |
@ -0,0 +1,4 @@ |
|||
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 |
@ -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 |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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_detect_not_valid_tile_left(void){ |
|||
|
|||
|
|||
|
|||
Minesweeper_Board board = initialize_minesweeper(); |
|||
|
|||
int tile = 0; |
|||
|
|||
int direction = 1; |
|||
|
|||
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_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)(49), 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)(63), 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)(77), 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)(91), UNITY_DISPLAY_STYLE_INT); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -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); |
|||
|
|||
} |
@ -0,0 +1,105 @@ |
|||
#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); |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,3 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- build/temp/../../src/main/c/Minesweeper/minesweeper_start.h |
@ -0,0 +1,4 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- src/main/c/Snake/snake_start.h |
|||
- src/main/c/Snake/get_character.h |
@ -0,0 +1,3 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- build/temp/../../src/main/c/Minesweeper/minesweeper_start.h |
@ -0,0 +1,4 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- build/temp/../../src/main/c/Snake/snake_start.h |
|||
- build/temp/../../src/main/c/Snake/get_character.h |
@ -0,0 +1,3 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- build/temp/../../src/main/c/Minesweeper/minesweeper_start.h |
@ -0,0 +1,4 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- build/temp/../../src/main/c/Snake/snake_start.h |
|||
- build/temp/../../src/main/c/Snake/get_character.h |
@ -0,0 +1,3 @@ |
|||
--- |
|||
- "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|||
- src/main/c/GameTic_Tac_Toe/tictactoe.h |
@ -0,0 +1,22 @@ |
|||
--- |
|||
:source: |
|||
:path: test/Minesweeper |
|||
:file: test_bomb_in_array.c |
|||
:successes: |
|||
- :test: test_bomb_in_array |
|||
:line: 11 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_bomb_not_in_array |
|||
:line: 26 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
:failures: [] |
|||
:ignores: [] |
|||
:counts: |
|||
:total: 2 |
|||
:passed: 2 |
|||
:failed: 0 |
|||
:ignored: 0 |
|||
:stdout: [] |
|||
:time: 0.00173795400041854 |
@ -0,0 +1,26 @@ |
|||
--- |
|||
:source: |
|||
:path: test/Snake |
|||
:file: test_collision.c |
|||
:successes: |
|||
- :test: test_self_collision |
|||
:line: 12 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_no_collision |
|||
:line: 25 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_wall_collision |
|||
:line: 38 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
:failures: [] |
|||
:ignores: [] |
|||
:counts: |
|||
:total: 3 |
|||
:passed: 3 |
|||
:failed: 0 |
|||
:ignored: 0 |
|||
:stdout: [] |
|||
:time: 0.0023196109978016466 |
@ -0,0 +1,38 @@ |
|||
--- |
|||
:source: |
|||
:path: test/Minesweeper |
|||
:file: test_is_Valid_tile.c |
|||
:successes: |
|||
- :test: test_detect_not_valid_tile_left |
|||
:line: 10 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_detect_not_valid_tile_up |
|||
:line: 24 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_detect_valid_tile_right |
|||
:line: 38 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_detect_valid_tile_down |
|||
:line: 52 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_detect_not_valid_tile_right |
|||
:line: 66 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_detect_not_valid_tile_down |
|||
:line: 80 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
:failures: [] |
|||
:ignores: [] |
|||
:counts: |
|||
:total: 6 |
|||
:passed: 6 |
|||
:failed: 0 |
|||
:ignored: 0 |
|||
:stdout: [] |
|||
:time: 0.002173025997763034 |
@ -0,0 +1,30 @@ |
|||
--- |
|||
:source: |
|||
:path: test/Snake |
|||
:file: test_moving_snake.c |
|||
:successes: |
|||
- :test: test_moving_right |
|||
:line: 13 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_moving_down |
|||
:line: 27 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_moving_left |
|||
:line: 41 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_moving_up |
|||
:line: 55 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
:failures: [] |
|||
:ignores: [] |
|||
:counts: |
|||
:total: 4 |
|||
:passed: 4 |
|||
:failed: 0 |
|||
:ignored: 0 |
|||
:stdout: [] |
|||
:time: 0.0014848970022285357 |
@ -0,0 +1,34 @@ |
|||
--- |
|||
:source: |
|||
:path: test/Minesweeper |
|||
:file: test_number_of_bombs.c |
|||
:successes: |
|||
- :test: test_no_bombs_placed_around_tile |
|||
:line: 11 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_searching_for_bombs_on_correct_tiles |
|||
:line: 24 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_2_bombs_around_tile |
|||
:line: 41 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_5_bombs_around_tile |
|||
:line: 58 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_8_bombs_around_tile |
|||
:line: 76 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
:failures: [] |
|||
:ignores: [] |
|||
:counts: |
|||
:total: 5 |
|||
:passed: 5 |
|||
:failed: 0 |
|||
:ignored: 0 |
|||
:stdout: [] |
|||
:time: 0.0023246400014613755 |
@ -0,0 +1,26 @@ |
|||
--- |
|||
:source: |
|||
:path: test/Snake |
|||
:file: test_part_of_snake.c |
|||
:successes: |
|||
- :test: test_find_head |
|||
:line: 11 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_get_correct_index |
|||
:line: 24 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
- :test: test_snake_not_on_tile |
|||
:line: 37 |
|||
:message: '' |
|||
:unity_test_time: 0 |
|||
:failures: [] |
|||
:ignores: [] |
|||
:counts: |
|||
:total: 3 |
|||
:passed: 3 |
|||
:failed: 0 |
|||
:ignored: 0 |
|||
:stdout: [] |
|||
:time: 0.0021876099999644794 |
@ -0,0 +1,83 @@ |
|||
/* 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_bomb_in_array(void); |
|||
extern void test_bomb_not_in_array(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_bomb_in_array.c"); |
|||
run_test(test_bomb_in_array, "test_bomb_in_array", 11); |
|||
run_test(test_bomb_not_in_array, "test_bomb_not_in_array", 26); |
|||
|
|||
return UnityEnd(); |
|||
} |
@ -0,0 +1,85 @@ |
|||
/* 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_self_collision(void); |
|||
extern void test_no_collision(void); |
|||
extern void test_wall_collision(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_collision.c"); |
|||
run_test(test_self_collision, "test_self_collision", 12); |
|||
run_test(test_no_collision, "test_no_collision", 25); |
|||
run_test(test_wall_collision, "test_wall_collision", 38); |
|||
|
|||
return UnityEnd(); |
|||
} |
@ -0,0 +1,91 @@ |
|||
/* 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_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); |
|||
|
|||
|
|||
/*=======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_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); |
|||
|
|||
return UnityEnd(); |
|||
} |
@ -0,0 +1,87 @@ |
|||
/* 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_moving_right(void); |
|||
extern void test_moving_down(void); |
|||
extern void test_moving_left(void); |
|||
extern void test_moving_up(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_moving_snake.c"); |
|||
run_test(test_moving_right, "test_moving_right", 13); |
|||
run_test(test_moving_down, "test_moving_down", 27); |
|||
run_test(test_moving_left, "test_moving_left", 41); |
|||
run_test(test_moving_up, "test_moving_up", 55); |
|||
|
|||
return UnityEnd(); |
|||
} |
@ -0,0 +1,89 @@ |
|||
/* 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_no_bombs_placed_around_tile(void); |
|||
extern void test_searching_for_bombs_on_correct_tiles(void); |
|||
extern void test_2_bombs_around_tile(void); |
|||
extern void test_5_bombs_around_tile(void); |
|||
extern void test_8_bombs_around_tile(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_number_of_bombs.c"); |
|||
run_test(test_no_bombs_placed_around_tile, "test_no_bombs_placed_around_tile", 11); |
|||
run_test(test_searching_for_bombs_on_correct_tiles, "test_searching_for_bombs_on_correct_tiles", 24); |
|||
run_test(test_2_bombs_around_tile, "test_2_bombs_around_tile", 41); |
|||
run_test(test_5_bombs_around_tile, "test_5_bombs_around_tile", 58); |
|||
run_test(test_8_bombs_around_tile, "test_8_bombs_around_tile", 76); |
|||
|
|||
return UnityEnd(); |
|||
} |
@ -0,0 +1,85 @@ |
|||
/* 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_find_head(void); |
|||
extern void test_get_correct_index(void); |
|||
extern void test_snake_not_on_tile(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_part_of_snake.c"); |
|||
run_test(test_find_head, "test_find_head", 11); |
|||
run_test(test_get_correct_index, "test_get_correct_index", 24); |
|||
run_test(test_snake_not_on_tile, "test_snake_not_on_tile", 37); |
|||
|
|||
return UnityEnd(); |
|||
} |
@ -0,0 +1,85 @@ |
|||
/* 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_if_not_identical(void); |
|||
extern void test_if_identical(void); |
|||
extern void test_checkLine_horizontalerGewinner(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_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(); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue