Browse Source

Alle Änderungen commitet.

remotes/origin/siamak
Siamak 11 months ago
parent
commit
8011aabdde
  1. 24
      src/c/funktionen.c
  2. 15
      src/c/funktionen.h
  3. 60
      src/test/test_funktionen.c

24
src/c/funktionen.c

@ -69,30 +69,6 @@ int x_wins_02_11_20(char board[][3]) {
}
}
int o_wins_00_10_20(char board[][3]) {
if (board[0][0] == 'O' && board[1][0] == 'O' && board[2][0] == 'O') {
return 1;
}
}
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 o_wins_02_12_22(char board[][3]) {
if (board[0][2] == 'O' && board[1][2] == 'O' && board[2][2] == 'O') {
return 1;
}
}
int o_wins_00_01_02(char board[][3]) {
if (board[0][0] == 'O' && board[0][1] == 'O' && board[0][2] == 'O') {
return 1;
}
}
int stringCharacterCounter(char string[]) {
int stringLength = 0;

15
src/c/funktionen.h

@ -47,21 +47,6 @@ 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 o_wins_02_12_22(char board[][3]);
// prüft, ob O bei Index 02, 12, 22 ist.
int o_wins_00_01_02(char board[][3]);
// prüft, ob O bei Index 00, 01, 02 ist.
int string_character_counter(char string[]);
int stringCharacterCounter(char string[]);
// liefert die Länge eines Strings zurück

60
src/test/test_funktionen.c

@ -275,66 +275,6 @@ 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_o_wins_onIndex_02_12_22(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{' ',' ','O'}, {' ',' ','O'}, {' ',' ','O'}};
/* act */
actual = o_wins_02_12_22(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_o_wins_onIndex_00_01_02(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{'O','O','O'}, {' ',' ',' '}, {' ',' ',' '}};
/* act */
actual = o_wins_00_01_02(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_stringLaenge_von_Kokosnuss(void)
{
/* arrange */

Loading…
Cancel
Save