From 54a3160ebe0cedbfd89f05a944fd7e8bed11bb84 Mon Sep 17 00:00:00 2001 From: Simon Hildebrandt Date: Wed, 7 Feb 2024 12:57:12 +0100 Subject: [PATCH] 6 erster Test + Header --- src/main/c/TicTacToe.h | 7 +++++++ src/test/c/test_TicTacToe.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/c/TicTacToe.h create mode 100644 src/test/c/test_TicTacToe.c diff --git a/src/main/c/TicTacToe.h b/src/main/c/TicTacToe.h new file mode 100644 index 0000000..1e04a7d --- /dev/null +++ b/src/main/c/TicTacToe.h @@ -0,0 +1,7 @@ +#ifndef TICTACTOE_H +#define TICTACTOE_H + +int Winner(char board[3][3]); + +#endif + diff --git a/src/test/c/test_TicTacToe.c b/src/test/c/test_TicTacToe.c new file mode 100644 index 0000000..b1c8b25 --- /dev/null +++ b/src/test/c/test_TicTacToe.c @@ -0,0 +1,29 @@ + +#include "unity.h" + +#include "TicTacToe.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_TicTacToe_Winner_X_line_1(void) +{ + /* arrange */ + int expected = 1; + int actual; + char board[3][3] = { + {'X', 'X', 'X'}, + {'O', 'O', '_'}, + {'O', '_', '_'} + }; + /* act */ + actual = Winner(board); + + /* assert */ + TEST_ASSERT_EQUAL_INT(expected, actual); +} \ No newline at end of file