|
|
@ -8,14 +8,14 @@ void setUp(void) { |
|
|
|
|
|
|
|
void tearDown(void) { |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob richtger Index rausgegeben wird |
|
|
|
void test_getRandomQuestionIndex(void) { |
|
|
|
int askedQuestions[10] = {0}; |
|
|
|
int totalQuestions = 10; |
|
|
|
int index = getRandomQuestionIndex(askedQuestions, totalQuestions); |
|
|
|
TEST_ASSERT_TRUE(index >= 0 && index < totalQuestions); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob die Fragen richtig angezeigt werden |
|
|
|
void test_displayQuestion(void) { |
|
|
|
const char* question = "Test Question"; |
|
|
|
const char* answers[] = {"A", "B", "C", "D"}; |
|
|
@ -29,7 +29,7 @@ void test_displayQuestion(void) { |
|
|
|
printf("Actual Output:\n"); |
|
|
|
displayQuestion(question, answers, correctIndex); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe richtig ist |
|
|
|
void test_processUserAnswer_correct(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -41,7 +41,7 @@ void test_processUserAnswer_correct(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(1, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe falsch ist |
|
|
|
void test_processUserAnswer_wrong(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -52,7 +52,7 @@ void test_processUserAnswer_wrong(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(0, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(0, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe richtig ist |
|
|
|
void test_processUserAnswer_correctAnswer_index3(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -61,7 +61,7 @@ void test_processUserAnswer_correctAnswer_index3(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(1, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe richtig ist |
|
|
|
void test_processUserAnswer_correctAnswer_index0(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -70,7 +70,7 @@ void test_processUserAnswer_correctAnswer_index0(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(1, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe falsch ist |
|
|
|
void test_processUserAnswer_wrongAnswer_index3(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -81,7 +81,7 @@ void test_processUserAnswer_wrongAnswer_index3(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(0, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(0, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe richtig ist |
|
|
|
void test_processUserAnswer_correctAnswer_index1(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -92,7 +92,7 @@ void test_processUserAnswer_correctAnswer_index1(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(1, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe richtig ist |
|
|
|
void test_processUserAnswer_correctAnswer_index2(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
@ -103,7 +103,7 @@ void test_processUserAnswer_correctAnswer_index2(void) { |
|
|
|
TEST_ASSERT_EQUAL_INT(1, score); |
|
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
|
} |
|
|
|
|
|
|
|
//Funktion schaut, ob User-Eingabe falsch ist |
|
|
|
void test_processUserAnswer_wrongAnswer_index1(void) { |
|
|
|
int score = 0; |
|
|
|
int totalCorrectAnswers = 0; |
|
|
|