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.
45 lines
1.8 KiB
45 lines
1.8 KiB
#ifdef TEST
|
|
|
|
#include <stdlib.h>
|
|
#include "unity.h"
|
|
#include "quizduell.h"
|
|
|
|
void setUp(void) {}
|
|
|
|
void tearDown(void) {}
|
|
|
|
void test_erstelleFrage(void) {
|
|
QuizFrage testFrage = erstelleFrage("Testfrage", "AntwortA", "AntwortB", "AntwortC", "AntwortD", 'A');
|
|
|
|
TEST_ASSERT_EQUAL_STRING("Testfrage", testFrage.frage);
|
|
TEST_ASSERT_EQUAL_STRING("AntwortA", testFrage.antwortA);
|
|
TEST_ASSERT_EQUAL_STRING("AntwortB", testFrage.antwortB);
|
|
TEST_ASSERT_EQUAL_STRING("AntwortC", testFrage.antwortC);
|
|
TEST_ASSERT_EQUAL_STRING("AntwortD", testFrage.antwortD);
|
|
TEST_ASSERT_EQUAL_CHAR('A', testFrage.korrekteAntwort);
|
|
}
|
|
|
|
void test_CookingFragen(void) {
|
|
Kategorie kategorien[MAX_CATEGORIES];
|
|
|
|
kategorien[1].fragen = (QuizFrage*)malloc(MAX_QUESTIONS_PER_CATEGORY * sizeof(QuizFrage));
|
|
|
|
kategorien[1].fragen[0] = erstelleFrage("Which Ingredient is used traditionally for Pesto?", "Tomatoes", "Basil", "Spinach", "Oregano", 'B');
|
|
kategorien[1].fragen[1] = erstelleFrage("Which meal is known for its usage of rice?", "Lasagna", "Sushi", "Pizza", "Hamburger", 'B');
|
|
kategorien[1].fragen[2] = erstelleFrage("Which color has a ripe banana?", "Red", "Green", "Yellow", "Orange", 'C');
|
|
|
|
kategorien[1].anzahlFragen = MAX_QUESTIONS_PER_CATEGORY;
|
|
kategorien[1].joker = 1;
|
|
|
|
TEST_ASSERT_EQUAL_STRING("Which Ingredient is used traditionally for Pesto?", kategorien[1].fragen[0].frage);
|
|
TEST_ASSERT_EQUAL_STRING("Tomatoes", kategorien[1].fragen[0].antwortA);
|
|
TEST_ASSERT_EQUAL_STRING("Basil", kategorien[1].fragen[0].antwortB);
|
|
TEST_ASSERT_EQUAL_STRING("Spinach", kategorien[1].fragen[0].antwortC);
|
|
TEST_ASSERT_EQUAL_STRING("Oregano", kategorien[1].fragen[0].antwortD);
|
|
TEST_ASSERT_EQUAL_CHAR('B', kategorien[1].fragen[0].korrekteAntwort);
|
|
|
|
|
|
free(kategorien[1].fragen);
|
|
}
|
|
|
|
#endif //TEST
|