diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 9599e0f..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 62043bc..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-cmake_minimum_required(VERSION 3.26)
-project(arcade C)
-
-set(CMAKE_C_STANDARD 11)
-
-include_directories(src/main/c)
-include_directories(src/main/c/GameTic_Tac_Toe)
-include_directories(src/main/c/Hangman)
-include_directories(src/main/c/Minesweeper)
-include_directories(src/main/c/Pong)
-include_directories(src/main/c/Snake)
-
-add_executable(arcade
- src/main/c/GameTic_Tac_Toe/tictactoe.c
- src/main/c/GameTic_Tac_Toe/tictactoe.h
- src/main/c/Hangman/drawHangman.c
- src/main/c/Hangman/drawHangman.h
- src/main/c/Hangman/initializeHangman.c
- src/main/c/Hangman/initializeHangman.h
- src/main/c/Hangman/playHangman.c
- src/main/c/Hangman/playHangman.h
- src/main/c/Hangman/word_selector.c
- src/main/c/Hangman/word_selector.h
- src/main/c/Minesweeper/minesweeper_start.c
- src/main/c/Minesweeper/minesweeper_start.h
- src/main/c/Pong/pong.c
- src/main/c/Pong/pong.h
- src/main/c/Snake/get_character.c
- src/main/c/Snake/get_character.h
- src/main/c/Snake/snake_start.c
- src/main/c/Snake/snake_start.h
- src/main/c/main.c
- src/main/c/main.h)
diff --git a/Shell b/Shell
deleted file mode 100644
index e69de29..0000000
diff --git a/test/Hangman/test_drawHangman.c b/test/Hangman/test_drawHangman.c
new file mode 100644
index 0000000..debca49
--- /dev/null
+++ b/test/Hangman/test_drawHangman.c
@@ -0,0 +1,40 @@
+#include
+#include
+#include "drawHangman.h"
+#include "playHangman.h"
+
+void test_drawHangman() {
+ // Test each case of incorrectGuesses
+ printf("Testing drawHangman(0):\n");
+ drawHangman(0);
+ printf("\n");
+
+ printf("Testing drawHangman(1):\n");
+ drawHangman(1);
+ printf("\n");
+
+ printf("Testing drawHangman(2):\n");
+ drawHangman(2);
+ printf("\n");
+
+ printf("Testing drawHangman(3):\n");
+ drawHangman(3);
+ printf("\n");
+
+ printf("Testing drawHangman(4):\n");
+ drawHangman(4);
+ printf("\n");
+
+ printf("Testing drawHangman(5):\n");
+ drawHangman(5);
+ printf("\n");
+
+ printf("Testing drawHangman(6):\n");
+ drawHangman(6);
+ printf("\n");
+
+ printf("Testing drawHangman(7):\n");
+ drawHangman(7);
+ printf("\n");
+
+}
\ No newline at end of file
diff --git a/test/Hangman/test_drawHangman.h b/test/Hangman/test_drawHangman.h
new file mode 100644
index 0000000..2c0ba83
--- /dev/null
+++ b/test/Hangman/test_drawHangman.h
@@ -0,0 +1,4 @@
+#ifndef PMUW_PROJEKT_NOTEBINDER_TEST_DRAWHANGMAN_H
+#define PMUW_PROJEKT_NOTEBINDER_TEST_DRAWHANGMAN_H
+#include "drawHangman.c"
+#endif //PMUW_PROJEKT_NOTEBINDER_TEST_DRAWHANGMAN_H
diff --git a/test/Hangman/test_initializeHangman.c b/test/Hangman/test_initializeHangman.c
new file mode 100644
index 0000000..9b5238b
--- /dev/null
+++ b/test/Hangman/test_initializeHangman.c
@@ -0,0 +1,23 @@
+#include
+#include "playHangman.h"
+
+
+void test_displayRules() {
+ printf("Test Case 1: User inputs '1'\n");
+ printf("Expected Output: 'Let's get started!'\n");
+ printf("Actual Output: ");
+ printf("1\n");
+ displayRules();
+
+ printf("\nTest Case 2: User inputs '2'\n");
+ printf("Expected Output: Output of printRules() function\n");
+ printf("Actual Output: ");
+ printf("2\n");
+ displayRules();
+
+ printf("\nTest Case 3: User inputs invalid value\n");
+ printf("Expected Output: 'Please enter either 1 or 2 to continue'\n");
+ printf("Actual Output: ");
+ printf("invalid\n");
+ displayRules();
+}
diff --git a/test/Hangman/test_playHangman.c b/test/Hangman/test_playHangman.c
new file mode 100644
index 0000000..94e9743
--- /dev/null
+++ b/test/Hangman/test_playHangman.c
@@ -0,0 +1,56 @@
+#include
+#include "playHangman.c"
+#include
+
+void test_displayRules() {
+ // Simulate user input: 1, 2, and an invalid input
+ printf("Test Case 1: User enters '1' (YES)\n");
+ printf("Expected Output: \"Let's get started!\"\n");
+ printf("Actual Output: ");
+ displayRules(); // Call displayRules() with input 1
+
+ printf("\nTest Case 2: User enters '2' (NO)\n");
+ printf("Expected Output: Output of printRules()\n");
+ printf("Actual Output: ");
+ displayRules(); // Call displayRules() with input 2
+
+ printf("\nTest Case 3: User enters an invalid input\n");
+ printf("Expected Output: \"Please enter either 1 or 2 to continue:\"\n");
+ printf("Actual Output: ");
+ displayRules(); // Call displayRules() with invalid input
+}
+
+void test_toLower() {
+ printf("Test Case 1: Lowercase letter 'a'\n");
+ printf("Expected Output: 'a'\n");
+ char result = toLower('a');
+ printf("Actual Output: '%c'\n", result);
+ assert(result == 'a');
+
+ printf("\nTest Case 2: Uppercase letter 'B'\n");
+ printf("Expected Output: 'b'\n");
+ result = toLower('B');
+ printf("Actual Output: '%c'\n", result);
+ assert(result == 'b');
+
+ printf("\nTest Case 3: Non-alphabetic character '#'\n");
+ printf("Expected Output: '#'\n");
+ result = toLower('?');
+ printf("Actual Output: '%c'\n", result);
+ assert(result == '?');
+}
+
+void test_initializeHangman() {
+ // Test case 1: Word with alphabets only
+ char wordToGuess1[] = "hangman";
+ char currentGuess1[8]; // Make sure this size is enough to accommodate the wordToGuess and the null terminator
+ initializeHangman(wordToGuess1, currentGuess1);
+ assert(strcmp(currentGuess1, "_______") == 0);
+
+ // Test case 2: Word with spaces (e.g: table tennis)
+ char wordToGuess2[] = "hello world";
+ char currentGuess2[12]; // Make sure this size is enough to accommodate the wordToGuess and the null terminator
+ initializeHangman(wordToGuess2, currentGuess2);
+ assert(strcmp(currentGuess2, "_____ _____") == 0);
+ printf("initializeHangman test passed!\n");
+}
\ No newline at end of file
diff --git a/test/Minesweeper/test_bomb_in_array.c b/test/Minesweeper/test_bomb_in_array.c
new file mode 100644
index 0000000..7073857
--- /dev/null
+++ b/test/Minesweeper/test_bomb_in_array.c
@@ -0,0 +1,40 @@
+#ifdef TEST
+#include "unity.h"
+#include
+#include "../../src/main/c/Minesweeper/minesweeper_start.h"
+
+
+void setUp(void){}
+void tearDown(void){}
+
+
+void test_bomb_in_array(void){
+ /* arrange */
+ bool result;
+ int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78};
+ int bomb = 42;
+ int length = 10;
+
+ /* act */
+ result = array_contains_value(array, bomb, length);
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);
+}
+
+
+void test_bomb_not_in_array(void){
+ /* arrange */
+ bool result;
+ int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78};
+ int bomb = 0;
+ int length = 10;
+
+ /* act */
+ result = array_contains_value(array, bomb, length);
+
+ /* assert */
+ TEST_ASSERT_FALSE(result);
+}
+
+#endif // TEST
\ No newline at end of file
diff --git a/test/Minesweeper/test_is_Valid_tile.c b/test/Minesweeper/test_is_Valid_tile.c
new file mode 100644
index 0000000..13e8980
--- /dev/null
+++ b/test/Minesweeper/test_is_Valid_tile.c
@@ -0,0 +1,122 @@
+#ifdef TEST
+#include "unity.h"
+#include "../../src/main/c/Minesweeper/minesweeper_start.h"
+
+
+void setUp(void){}
+void tearDown(void){}
+
+
+void test_detect_not_valid_tile_left(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = 0;
+ int direction = 2;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile
+}
+
+void test_detect_not_valid_tile_up(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = 0;
+ int direction = 3;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile
+}
+
+void test_detect_not_valid_tile_right(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = board.width * board.height - 1;
+ int direction = 5;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile
+}
+
+void test_detect_not_valid_tile_down(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = board.width * board.height - 1;
+ int direction = 4;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile
+}
+
+void test_detect_valid_tile_left(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = board.width * board.height - 1;
+ int direction = 2;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(board.width * board.height - 2, result);//not valid tile
+}
+
+void test_detect_valid_tile_up(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = board.width * board.height - 1;
+ int direction = 3;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(board.width * (board.height - 1) - 1, result);//not valid tile
+}
+
+void test_detect_valid_tile_right(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = 0;
+ int direction = 5;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(1, result);//not valid tile
+}
+
+void test_detect_valid_tile_down(void){
+ /* arrange */
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = 0;
+ int direction = 4;
+ int result;
+
+ /* act */
+ result = is_Valid_tile(&board, tile, direction);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(0 + board.width, result);//not valid tile
+}
+
+#endif // TEST
\ No newline at end of file
diff --git a/test/Minesweeper/test_number_of_bombs.c b/test/Minesweeper/test_number_of_bombs.c
new file mode 100644
index 0000000..6a0dd4f
--- /dev/null
+++ b/test/Minesweeper/test_number_of_bombs.c
@@ -0,0 +1,97 @@
+#ifdef TEST
+#include "unity.h"
+#include
+#include "../../src/main/c/Minesweeper/minesweeper_start.h"
+
+
+void setUp(void){}
+void tearDown(void){}
+
+
+void test_no_bombs_placed_around_tile(void){
+ /* arrange */
+ int result;
+ Minesweeper_Board board = initialize_minesweeper();
+ int tile = 0 + board.width * 1;
+
+ /* act */
+ result = number_of_bombs(&board, tile);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(0, result);//no bombs placed
+}
+
+void test_searching_for_bombs_on_correct_tiles(void){
+ /* arrange */
+ 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);
+
+ /* act */
+ result = number_of_bombs(&board, tile);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(0, result);//no bombs placed around tile
+}
+
+void test_2_bombs_around_tile(void){
+ /* arrange */
+ 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);
+
+ /* act */
+ result = number_of_bombs(&board, tile);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(2, result);//2 bombs placed around tile
+}
+
+void test_5_bombs_around_tile(void){
+ /* arrange */
+ 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;
+
+ /* act */
+ result = number_of_bombs(&board, tile);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(5, result);//5 bombs placed around tile
+}
+
+void test_8_bombs_around_tile(void){
+ /* arrange */
+ 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;
+
+ /* act */
+ result = number_of_bombs(&board, tile);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(8, result);//2 bombs placed around tile
+}
+
+#endif // TEST
\ No newline at end of file
diff --git a/And b/test/Pong/.gitkeep
similarity index 100%
rename from And
rename to test/Pong/.gitkeep
diff --git a/test/Pong/test_checkCollision.c b/test/Pong/test_checkCollision.c
new file mode 100644
index 0000000..16be1ca
--- /dev/null
+++ b/test/Pong/test_checkCollision.c
@@ -0,0 +1,63 @@
+#ifdef TEST
+#include "unity.h"
+#include "pong.h"
+#define WIDTH 40 //Breite Spielfeld
+#define HEIGHT 20 //Höhe Spielfeld
+
+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){
+ //Wenn Funktion Vorraussetzungen braucht
+}
+
+void tearDown(void){
+}
+
+void test_checkCollision(void){
+ Ball ball = {10, 10, 1, 1};
+ Paddle paddle = {50, 10, 5, 10};
+
+ // Test Ball trifft rechte und linke Wand
+ ball.x = 0;
+ int result1 = checkCollision(ball, paddle.y, paddle.y);
+ TEST_ASSERT_EQUAL_INT(1, result1);
+
+ ball.x = WIDTH - 1;
+ int result2 = checkCollision(ball, paddle.y, paddle.y);
+ TEST_ASSERT_EQUAL_INT(2, result2);
+
+ // Test Ball trifft obere und untere Wand
+ ball.x = 5;
+ ball.y = 0;
+ int result3 = checkCollision(ball, paddle.y, paddle.y);
+ TEST_ASSERT_EQUAL_INT(0, result3);
+
+ ball.y = HEIGHT - 1;
+ int result4 = checkCollision(ball, paddle.y, paddle.y);
+ TEST_ASSERT_EQUAL_INT(0, result4);
+
+ // Test wenn Ball Paddle trifft
+ ball.x = paddle.x - 1;
+ ball.y = paddle.y + 1;
+ int result5 = checkCollision(ball, paddle.y, paddle.y);
+ TEST_ASSERT_EQUAL_INT(2, result5);
+
+ ball.x = paddle.x + 1;
+ ball.y = paddle.y + 1;
+ int result6 = checkCollision(ball, paddle.y, paddle.y);
+ TEST_ASSERT_EQUAL_INT(2, result6);
+}
+
+#endif // TEST
diff --git a/test/Pong/test_checkGameEnd.c b/test/Pong/test_checkGameEnd.c
new file mode 100644
index 0000000..4f9144d
--- /dev/null
+++ b/test/Pong/test_checkGameEnd.c
@@ -0,0 +1,34 @@
+#ifdef TEST
+#include "unity.h"
+#include "pong.h"
+
+// Prüfen Spiellogik für Beenden des Spiels
+
+void setUp(void){
+ //Wenn Funktion Vorraussetzungen braucht
+}
+
+void tearDown(void){
+}
+
+void test_checkGameEnd(void){
+ /* arrange */
+ int maxScore = 5;
+ int score1 = 4, score2 = 2;
+
+ /* act */
+ int result = checkGameEnd(score1, score2, maxScore);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(0, result); // Das Spiel sollte noch nicht enden
+
+ /* Spieler 1 erreicht den Maximalscore */
+ score1 = 5;
+ result = checkGameEnd(score1, score2, maxScore);
+ TEST_ASSERT_EQUAL_INT(1, result); // Das Spiel sollte enden, da Spieler 1 den Maximalscore erreicht hat
+
+ /* Weitere Tests mit anderen Spiellogikfällen und Endspielbedingungen können hinzugefügt werden */
+
+}
+
+#endif // TEST
diff --git a/test/Pong/test_clearScreen.c b/test/Pong/test_clearScreen.c
new file mode 100644
index 0000000..f2701a1
--- /dev/null
+++ b/test/Pong/test_clearScreen.c
@@ -0,0 +1,38 @@
+#ifdef TEST
+#include "unity.h"
+#include "pong.h"
+
+#define TEST_SCREEN_WIDTH 40
+#define TEST_SCREEN_HEIGHT 20
+
+char screen[TEST_SCREEN_HEIGHT][TEST_SCREEN_WIDTH+1];
+
+void setUp(void){
+ //Wenn Funktion Vorraussetzungen braucht
+}
+
+void tearDown(void){
+}
+
+void test_clearScreen(void){
+ /* arrange */
+ int i, j;
+ for (i = 0; i < TEST_SCREEN_HEIGHT; i++) {
+ for (j = 0; j < TEST_SCREEN_WIDTH; j++) {
+ screen[i][j] = ' ';
+ }
+ screen[i][j] = '\0';
+ }
+
+ /* act */
+ clearScreen();
+
+ /* assert */
+ for (i = 0; i < TEST_SCREEN_HEIGHT; i++) {
+ for (j = 0; j < TEST_SCREEN_WIDTH; j++) {
+ TEST_ASSERT_EQUAL_INT(' ', screen[i][j]);
+ }
+ }
+}
+
+#endif // TEST
diff --git a/test/Pong/test_playerInputMovement.c b/test/Pong/test_playerInputMovement.c
new file mode 100644
index 0000000..e8ebbdd
--- /dev/null
+++ b/test/Pong/test_playerInputMovement.c
@@ -0,0 +1,42 @@
+#ifdef TEST
+#include "unity.h"
+#include "pong.h"
+
+typedef struct {
+ int x;
+ int y;
+ int speedX;
+ int speedY;
+} Paddle;
+// sicherstellen korrekte Funktion Steuerung für Schläger
+
+void setUp(void){
+ //Wenn Funktion Vorraussetzungen braucht
+}
+
+void tearDown(void){
+}
+
+void test_playerInputMovement(void){
+ /* Test 1: Bewegung nach oben */
+ int paddlePositionY = 10;
+ int userInput = -1; // Benutzereingabe für Bewegung nach oben
+ int expectedY = paddlePositionY - 1;
+
+ processPlayerInput(&paddlePositionY, userInput);
+ TEST_ASSERT_EQUAL_INT(expectedY, paddlePositionY);
+
+ /* Test 2: Bewegung nach unten */
+ userInput = 1;
+ expectedY = paddlePositionY + 1;
+ // Benutzereingabe für Bewegung nach unten
+
+ processPlayerInput(&paddlePositionY, userInput);
+ TEST_ASSERT_EQUAL_INT(expectedY, paddlePositionY);
+
+ /* Weitere Tests mit anderen Bewegungsrichtungen und Grenzfällen können hinzugefügt werden */
+
+}
+
+
+#endif // TEST
diff --git a/nano.20128.save b/test/Pong/test_pong.c
similarity index 54%
rename from nano.20128.save
rename to test/Pong/test_pong.c
index 92c01a5..0b12481 100644
--- a/nano.20128.save
+++ b/test/Pong/test_pong.c
@@ -1,6 +1,6 @@
#ifdef TEST
#include "unity.h"
-#include "game100.h"
+#include "pong.h"
void setUp(void){
@@ -10,16 +10,16 @@ void tearDown(void){
}
-void test_log(void){
+void test_input_all_5(void){
/* arrange */
- int result;
- double a = 4;
+ int a = 4, b = 5;
/* act */
- result = log(4);
+ resetScore( &a, &b );
/* assert */
- TEST_ASSERT_EQUAL_INT(4, result);//log(4)= 0.60205991
+ TEST_ASSERT_EQUAL_INT(0, a);
+ TEST_ASSERT_EQUAL_INT(0, b);
}
diff --git a/test/Snake/test_collision.c b/test/Snake/test_collision.c
new file mode 100644
index 0000000..df400b0
--- /dev/null
+++ b/test/Snake/test_collision.c
@@ -0,0 +1,50 @@
+#ifdef TEST
+#include "unity.h"
+#include
+#include "snake_start.h"
+#include "get_character.h"
+
+
+void setUp(void){}
+void tearDown(void){}
+
+
+void test_self_collision(void){
+ /* arrange */
+ bool result;
+ Snake snake = {1, 5, {6 + 16 * 6, 6 + 16 * 7, 7 + 16 * 7, 7 + 16 * 6, 6 + 16 * 6}};
+
+ /* act */
+ result = check_if_dead(&snake);
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);//head collides with body
+}
+
+
+void test_no_collision(void){
+ /* arrange */
+ bool result;
+ Snake snake = initialize_snake();
+
+ /* act */
+ result = check_if_dead(&snake);
+
+ /* assert */
+ TEST_ASSERT_FALSE(result);//head collides with body
+}
+
+
+void test_wall_collision(void){
+ /* arrange */
+ bool result;
+ Snake snake = {-1, 4, {0 + 16 * 6, 1 + 16 * 6, 2 + 16 * 6, 3 + 16 * 6}};
+
+ /* act */
+ result = check_if_dead(&snake);
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);//head collides with body
+}
+
+#endif // TEST
\ No newline at end of file
diff --git a/test/Snake/test_moving_snake.c b/test/Snake/test_moving_snake.c
new file mode 100644
index 0000000..115d55f
--- /dev/null
+++ b/test/Snake/test_moving_snake.c
@@ -0,0 +1,69 @@
+#ifdef TEST
+#include "unity.h"
+#include
+#include
+#include "../../src/main/c/Snake/snake_start.h"
+#include "../../src/main/c/Snake/get_character.h"
+
+
+void setUp(void){}
+void tearDown(void){}
+
+
+void test_moving_right(void){
+ /* arrange */
+ 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}};
+
+ /* act */
+ move_snake(&snake);
+ result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);
+}
+
+void test_moving_down(void){
+ /* arrange */
+ 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}};
+
+ /* act */
+ move_snake(&snake);
+ result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);
+}
+
+void test_moving_left(void){
+ /* arrange */
+ 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}};
+
+ /* act */
+ move_snake(&snake);
+ result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);
+}
+
+void test_moving_up(void){
+ /* arrange */
+ 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}};
+
+ /* act */
+ move_snake(&snake);
+ result = memcmp(&snake, &expected, sizeof(Snake)) == 0;
+
+ /* assert */
+ TEST_ASSERT_TRUE(result);
+}
+
+#endif // TEST
\ No newline at end of file
diff --git a/test/Snake/test_part_of_snake.c b/test/Snake/test_part_of_snake.c
new file mode 100644
index 0000000..95ce3bd
--- /dev/null
+++ b/test/Snake/test_part_of_snake.c
@@ -0,0 +1,49 @@
+#ifdef TEST
+#include "unity.h"
+#include "../../src/main/c/Snake/snake_start.h"
+#include "../../src/main/c/Snake/get_character.h"
+
+
+void setUp(void){}
+void tearDown(void){}
+
+
+void test_find_head(void){
+ /* arrange */
+ int result;
+ Snake snake = initialize_snake();
+
+ /* act */
+ result = part_of_snake(&snake, 8 * 16 + 8);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(0, result);//head is at 8/8
+}
+
+
+void test_get_correct_index(void){
+ /* arrange */
+ int result;
+ Snake snake = initialize_snake();
+
+ /* act */
+ result = part_of_snake(&snake, 8 * 16 + 6);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(2, result);//2. part ist at 6/8
+}
+
+
+void test_snake_not_on_tile(void){
+ /* arrange */
+ int result;
+ Snake snake = initialize_snake();
+
+ /* act */
+ result = part_of_snake(&snake, 6 * 16 + 6);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(-1, result);//-1 snake is not on 6/6
+}
+
+#endif // TEST
\ No newline at end of file
diff --git a/test/test_battleship.c b/test/test_battleship.c
new file mode 100644
index 0000000..56d6aa3
--- /dev/null
+++ b/test/test_battleship.c
@@ -0,0 +1,43 @@
+#ifdef TEST
+#include "unity.h"
+#include "battleship_game.h"
+
+
+void setUp(void){
+
+}
+void tearDown(void){
+}
+
+
+void test_convertcoor(void) {
+
+ int output;
+
+
+ output = convertcoor('b', 5);
+
+
+ TEST_ASSERT_EQUAL_INT(14, output);
+}
+
+void setUp(void){
+
+}
+void tearDown(void){
+}
+
+
+void test_convertcoor(void) {
+
+ int output;
+
+
+ output = convertcoor('F', 6);
+
+
+ TEST_ASSERT_EQUAL_INT(55, output);
+}
+
+#endif
+
diff --git a/test/test_template.c b/test/test_template.c
new file mode 100644
index 0000000..4aba361
--- /dev/null
+++ b/test/test_template.c
@@ -0,0 +1,36 @@
+#ifdef TEST
+#include "unity.h"
+#include "game100.h"
+
+
+void setUp(void){
+ //Wenn Funktion Vorraussetzungen braucht
+}
+void tearDown(void){
+}
+
+
+void test_input_all_5(void){
+ /* arrange */
+ int result;
+
+ /* act */
+ result = some_function(5, 5);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(6, result);//5 / 5 + 5 = 6
+}
+
+
+void test_ignore_rest_from_division(void){
+ /* arrange */
+ int result;
+
+ /* act */
+ result = some_function(5, 6);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_INT(5, result);//5 / 6 + 5 = 5
+}
+
+#endif // TEST
diff --git a/test/test_tictactoe.c b/test/test_tictactoe.c
new file mode 100644
index 0000000..887aad7
--- /dev/null
+++ b/test/test_tictactoe.c
@@ -0,0 +1,88 @@
+
+#ifdef TEST
+#include "unity.h"
+#include "tictactoe.h"
+
+
+void setUp(void){
+ //Wenn Funktion Vorraussetzungen braucht
+}
+void tearDown(void){
+ reset_board();
+ displayBoard();
+}
+
+
+void test_if_not_identical(void){
+ /* arrange */
+ char result;
+ char a = 'a', b = 'b', c = 'c';
+
+ result = checkLine(a, b, c);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_CHAR(' ', result);
+}
+
+
+void test_if_identical(void){
+ /* arrange */
+ char result;
+ char a = 'a', b = 'a', c = 'a';
+
+ result = checkLine(a, b, c);
+
+ /* assert */
+ TEST_ASSERT_EQUAL_CHAR(a, result);
+}
+
+void test_isValidMove_gueltigerZug(void) {
+ /* arrangieren */
+ int result;
+ int choice = 5;
+
+ /* handeln */
+ result = isValidMove(choice);
+
+ /* überprüfen */
+ TEST_ASSERT_EQUAL_INT(1, result);
+}
+
+
+void test_checkWinner_vertikalerGewinner(void) {
+ /* arrangieren */
+ char result;
+
+ // Setze die Daten für einen vertikalen Gewinne
+ makeMove(1);
+ makeMove(2);
+ makeMove(4);
+ makeMove(3);
+ makeMove(7);
+
+ /* handeln */
+ result = checkWinner();
+
+ /* überprüfen */
+ TEST_ASSERT_EQUAL_CHAR('O', result);
+}
+
+void test_checkWinner_horizontalerGewinner(void) {
+ /* arrangieren */
+ char result;
+
+ //makeMove(1);
+ //makeMove(4);
+ //makeMove(2);
+ //makeMove(5);
+ //makeMove(3);
+
+ /* handeln */
+ result = checkWinner();
+
+ /* überprüfen */
+ TEST_ASSERT_EQUAL_CHAR('X', result);
+ reset_board();
+}
+
+#endif // TEST