From b92f32503f12e2daec57b8695bcbd778fd049152 Mon Sep 17 00:00:00 2001 From: Pascal Schneider Date: Tue, 6 Feb 2024 00:05:03 +0100 Subject: [PATCH] 5. Unittest --- test/test_timequiz.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/test_timequiz.c b/test/test_timequiz.c index 086c595..b42386a 100644 --- a/test/test_timequiz.c +++ b/test/test_timequiz.c @@ -68,4 +68,14 @@ void test_processUserAnswer_wrong(void) { TEST_ASSERT_EQUAL_INT(0, totalCorrectAnswers); } +void test_processUserAnswer_correctAnswer_index3(void) { + int score = 0; + int totalCorrectAnswers = 0; + char* answers[] = {"A", "B", "C", "D"}; + processUserAnswer(4, 3, &score, &totalCorrectAnswers, answers); + TEST_ASSERT_EQUAL_INT(1, score); + TEST_ASSERT_EQUAL_INT(1, totalCorrectAnswers); +} + + #endif //TEST