|
@ -108,5 +108,19 @@ void test_processUserAnswer_correctAnswer_index1(void) { |
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_processUserAnswer_correctAnswer_index2(void) { |
|
|
|
|
|
int score = 0; |
|
|
|
|
|
int totalCorrectAnswers = 0; |
|
|
|
|
|
char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; |
|
|
|
|
|
int correctIndex = 2; |
|
|
|
|
|
int userAnswer = 3; // Assuming user selects the third option |
|
|
|
|
|
|
|
|
|
|
|
// Call the function to process user answer |
|
|
|
|
|
processUserAnswer(userAnswer, correctIndex, &score, &totalCorrectAnswers, answers); |
|
|
|
|
|
|
|
|
|
|
|
// Assert that the score and total correct answers are updated correctly |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, score); |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endif //TEST |
|
|
#endif //TEST |