Browse Source

x_wins_02_12_22() definiert und einen Test für die Funktion erstellt

remotes/origin/habib
Habib 11 months ago
parent
commit
bafa2f3a92
  1. 6
      src/c/funktionen.c
  2. 15
      src/test/test_funktionen.c

6
src/c/funktionen.c

@ -55,6 +55,12 @@ int x_wins_01_11_21(char board[][3]) {
} }
} }
int x_wins_02_12_22(char board[][3]) {
if (board[0][2] == 'X' && board[1][2] == 'X' && board[2][2] == 'X') {
return 1;
}
}
int string_character_counter(char string[]) { int string_character_counter(char string[]) {
int stringLength = 0; int stringLength = 0;

15
src/test/test_funktionen.c

@ -106,6 +106,21 @@ void test_x_wins_onIndex_01_11_21(void)
TEST_ASSERT_EQUAL_INT(expected, actual); TEST_ASSERT_EQUAL_INT(expected, actual);
} }
void test_x_wins_onIndex_02_12_22(void)
{
/* arrange */
int actual;
int expected = 1;
char board[][3] = {{' ',' ','X'}, {' ',' ','X'}, {' ',' ','X'}};
/* act */
actual = x_wins_02_12_22(board);
/* assert */
TEST_ASSERT_EQUAL_INT(expected, actual);
}
void test_stringLaenge_von_Kokosnuss(void) void test_stringLaenge_von_Kokosnuss(void)
{ {
/* arrange */ /* arrange */

Loading…
Cancel
Save