diff --git a/src/main/duellist-spielesammlung-projekt.c b/src/main/duellist-spielesammlung-projekt.c index 54fb0ca..75e49d3 100644 --- a/src/main/duellist-spielesammlung-projekt.c +++ b/src/main/duellist-spielesammlung-projekt.c @@ -427,13 +427,13 @@ int compare(int a, int b) { } } -int exponent(int base, int exponent) { - if (exponent < 0) { +int exponent(int base, int expo){ + if (expo < 0) { printf("Negative Exponenten werden nicht unterstützt.\n"); return 0; } int result = 1; - for (int i = 0; i < exponent; ++i) { + for (int i = 0; i < expo; ++i) { result *= base; } return result; @@ -466,28 +466,28 @@ void playGame() { int totalQuestions = 5; // Anzahl der Fragen im Spiel for (int i = 0; i < totalQuestions; ++i) { - int num1 = generateRandomNumber(1, 10); - int num2 = generateRandomNumber(1, 10); - int operation = generateRandomNumber(1, 8); + int num1 = zufallszahl(1, 10); + int num2 = zufallszahl(1, 10); + int operation = zufallszahl(1, 8); int result; char operator; switch (operation) { case 1: - result = addition(num1, num2); + result = add(num1, num2); operator = '+'; break; case 2: - result = subtraction(num1, num2); + result = minus(num1, num2); operator = '-'; break; case 3: - result = multiplication(num1, num2); + result = mal(num1, num2); operator = '*'; break; case 4: - result = division(num1, num2); + result = durch(num1, num2); operator = '/'; break; case 5: @@ -499,7 +499,7 @@ void playGame() { operator = '='; break; case 7: - result = exponentiation(num1, num2); + result = exponent(num1, num2); operator = '^'; break; case 8: diff --git a/src/test/test_duellist_spielesammlung_projekt.c b/src/test/test_duellist_spielesammlung_projekt.c index d04e012..b40c9f9 100644 --- a/src/test/test_duellist_spielesammlung_projekt.c +++ b/src/test/test_duellist_spielesammlung_projekt.c @@ -453,7 +453,7 @@ void test_generateRandomNumber_withinValidRange(void) /* arrange */ /* act */ - int result = generateRandomNumber(1, 100); + int result = zufallszahl(1, 100); /* assert */ TEST_ASSERT_TRUE(result >= 1 && result <= 100); @@ -466,7 +466,7 @@ void test_addition(void) int b = 10; /* act */ - int result = addition(a, b); + int result = add(a, b); /* assert */ TEST_ASSERT_EQUAL_INT(15, result); @@ -479,7 +479,7 @@ void test_subtraction(void) int b = 10; /* act */ - int result = subtraction(a, b); + int result = minus(a, b); /* assert */ TEST_ASSERT_EQUAL_INT(5, result); @@ -493,7 +493,7 @@ void test_multiplication(void) int b = 10; /* act */ - int result = multiplication(a, b); + int result = mal(a, b); /* assert */ TEST_ASSERT_EQUAL_INT(50, result); @@ -506,7 +506,7 @@ void test_division(void) int b = 3; /* act */ - int result = division(a, b); + int result = durch(a, b); /* assert */ TEST_ASSERT_EQUAL_INT(5, result); @@ -519,7 +519,7 @@ void test_division_byZero_returnsZero(void) int num2 = 0; /* act */ - int result = division(num1, num2); + int result = durch(num1, num2); /* assert */ TEST_ASSERT_EQUAL_INT(0, result); @@ -584,7 +584,7 @@ void test_exponentiation(void) int exponent = 3; /* act */ - int result = exponentiation(base, exponent); + int result = exponent(base, expo); /* assert */ TEST_ASSERT_EQUAL_INT(8, result); @@ -597,7 +597,7 @@ void test_exponentiation_negativeExponent(void) int exponent = -3; /* act */ - int result = exponentiation(base, exponent); + int result = exponent(base, expo); /* assert */ TEST_ASSERT_EQUAL_INT(0, result);