Browse Source

Konflikte gelöst

remotes/origin/siamak
Siamak 11 months ago
parent
commit
16c4a3b06c
  1. 6
      src/c/funktionen.c
  2. 10
      src/c/funktionen.h
  3. 42
      src/test/test_funktionen.c

6
src/c/funktionen.c

@ -101,6 +101,12 @@ int o_wins_00_10_20(char board[][3]) {
}
}
int o_wins_01_11_21(char board[][3]) {
if (board[0][1] == 'O' && board[1][1] == 'O' && board[2][1] == 'O') {
return 1;
}
}
int string_character_counter(char string[]) {
int stringLength = 0;

10
src/c/funktionen.h

@ -35,9 +35,6 @@ int x_wins_02_12_22(char board[][3]);
int x_wins_00_01_02(char board[][3]);
//prüft, ob X bei Index 00, 01, 02 ist
int o_wins_00_10_20(char board[][3]);
// prüft, ob O bei Index 00, 10, 20 ist.
int x_wins_10_11_12(char board[][3]);
//prüft, ob X bei Index 10, 11, 12 ist
@ -50,6 +47,13 @@ int x_wins_00_11_22(char board[][3]);
int x_wins_02_11_20(char board[][3]);
// prüft, ob X bei Index 02, 11, 20 ist
int o_wins_00_10_20(char board[][3]);
// prüft, ob O bei Index 00, 10, 20 ist.
int o_wins_01_11_21(char board[][3])
// prüft, ob O bei Index 01, 11, 21 ist.
int string_character_counter(char string[]);
// liefert die Länge eines Strings zurück

42
src/test/test_funktionen.c

@ -213,31 +213,31 @@ void test_x_wins_onIndex_00_01_02(void)
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_o_wins_onIndex_00_10_20(void)
void test_x_wins_onIndex_20_21_22(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{'O',' ',' '}, {'O',' ',' '}, {'O',' ',' '}};
char board[][3] = {{' ',' ',' '}, {' ',' ',' '}, {'X','X','X'}};
/* act */
actual = o_wins_00_10_20(board);
actual = x_wins_20_21_22(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_x_wins_onIndex_20_21_22(void)
void test_x_wins_onIndex_10_11_12(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{' ',' ',' '}, {' ',' ',' '}, {'X','X','X'}};
char board[][3] = {{' ',' ',' '}, {'X','X','X'}, {' ',' ',' '}};
/* act */
actual = x_wins_20_21_22(board);
actual = x_wins_10_11_12(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
@ -273,6 +273,36 @@ void test_x_wins_onIndex_02_11_20(void)
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_o_wins_onIndex_00_10_20(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{'O',' ',' '}, {'O',' ',' '}, {'O',' ',' '}};
/* act */
actual = o_wins_00_10_20(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_o_wins_onIndex_01_11_21(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{' ','O',' '}, {' ','O',' '}, {' ','O',' '}};
/* act */
actual = o_wins_01_11_21(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_stringLaenge_von_Kokosnuss(void)
{
/* arrange */

Loading…
Cancel
Save