diff --git a/test/test_timequiz.c b/test/test_timequiz.c index 3199b75..00e3be7 100644 --- a/test/test_timequiz.c +++ b/test/test_timequiz.c @@ -38,4 +38,19 @@ void test_displayQuestion(void) { displayQuestion(question, answers, correctIndex); } +void test_processUserAnswer_correct(void) { + int score = 0; + int totalCorrectAnswers = 0; + char* answers[] = {"Paris", "London", "Berlin", "Madrid"}; + int correctIndex = 0; + int userAnswer = 1; + + // 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