You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.7 KiB
62 lines
1.7 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "TicTacToe.h"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void test_switchPlayer_10_to_11(void) {
|
|
TEST_ASSERT(switchPlayer(10) == 11);
|
|
}
|
|
|
|
// Testfall für die Funktion checkForWin - Horizontaler Sieg
|
|
void test_CheckForWin_Horizontal_1_2_3(void) {
|
|
// Teste horizontalen Sieg in der ersten Zeile
|
|
TEST_ASSERT(checkForWin(10, 10, 10, 4, 5, 6, 7, 8, 9, 10) == 1);
|
|
}
|
|
|
|
void test_CheckForWin_Horizontal_4_5_6(void) {
|
|
// Teste horizontalen Sieg in der zweiten Zeile
|
|
TEST_ASSERT(checkForWin(1, 2, 3, 11, 11, 11, 7, 8, 9, 11) == 1);
|
|
}
|
|
|
|
void test_CheckForWin_Horizontal_7_8_9(void) {
|
|
// Teste horizontalen Sieg in der dritten Zeile
|
|
TEST_ASSERT(checkForWin(1, 2, 3, 4, 5, 6, 11, 11, 11, 11) == 1);
|
|
}
|
|
|
|
// Testfall für die Funktion checkForWin - Vertikaler Sieg
|
|
void test_CheckForWin_Vertical_1_4_7(void) {
|
|
// Teste vertikalen Sieg in der ersten Spalte
|
|
TEST_ASSERT(checkForWin(10, 2, 3, 10, 5, 6, 10, 8, 9, 10) == 1);
|
|
}
|
|
|
|
void test_CheckForWin_Vertical_2_5_8(void) {
|
|
// Teste vertikalen Sieg in der zweiten Spalte
|
|
TEST_ASSERT(checkForWin(1, 11, 3, 4, 11, 6, 7, 11, 9, 11) == 1);
|
|
}
|
|
|
|
void test_CheckForWin_Vertical_3_6_9(void) {
|
|
// Teste vertikalen Sieg in der dritten Spalte
|
|
TEST_ASSERT(checkForWin(1, 2, 11, 4, 5, 11, 7, 8, 11, 11) == 1);
|
|
}
|
|
|
|
// Testfall für die Funktion checkForWin - Diagonaler Sieg
|
|
void test_CheckForWin_Diagonal_Right_To_Left(void) {
|
|
// Teste diagonalen Sieg von links oben nach rechts unten
|
|
TEST_ASSERT(checkForWin(10, 2, 3, 4, 10, 6, 7, 8, 10, 10) == 1);
|
|
}
|
|
|
|
void test_CheckForWin_Diagonal_Left_To_Right(void) {
|
|
// Teste diagonalen Sieg von rechts oben nach links unten
|
|
TEST_ASSERT(checkForWin(1, 2, 11, 4, 11, 6, 11, 8, 9, 11) == 1);
|
|
}
|
|
|
|
#endif // TEST
|