diff --git a/src/main/c/taschenrechner.h b/src/main/c/taschenrechner.h index 6b7955b..aedb4f3 100644 --- a/src/main/c/taschenrechner.h +++ b/src/main/c/taschenrechner.h @@ -1,22 +1,22 @@ #ifndef TASCHENRECHNER_H #define TASCHENRECHNER_H -//add function +// add function double add(double a, double b); -//minus function +// minus function double minus(double a, double b); -//multiply function +// multiply function double multiply(double a, double b); -//divide function +// divide function double divide(double a, double b); -//get input and check if its a number +// get input and check if its a number double testForNumber(); -//get input and check if its a operator +// get input and check if its a operator char testForOperator(); // Square root function @@ -56,7 +56,7 @@ int mode(int userChoice); int displayMenu(); -//Conversion Functions +// Conversion Functions double ConMeter(double meter, int startingUnit, int endingUnit); double ConMeterToFoot(double distance, int startingUnit, int endingUnit); diff --git a/src/test/c/test_taschenrechner.c b/src/test/c/test_taschenrechner.c index f51aaad..33f7f6c 100644 --- a/src/test/c/test_taschenrechner.c +++ b/src/test/c/test_taschenrechner.c @@ -156,4 +156,40 @@ void test_exponentialFunction(void) { TEST_ASSERT_EQUAL_FLOAT(1.0, exponentialFunction(0.0)); } +// Test case for subtraction +void test_performOperation_Subtraction(void) { + // Arrange + int result; + + // Act + result = performOperation(10, '-', 3); + + // Assert + TEST_ASSERT_EQUAL_INT(7, result); +} + +// Test case for multiplication +void test_performOperation_Multiplication(void) { + // Arrange + int result; + + // Act + result = performOperation(4, '*', 6); + + // Assert + TEST_ASSERT_EQUAL_INT(24, result); +} + +// Test case for division +void test_performOperation_Division(void) { + // Arrange + int result; + + // Act + result = performOperation(8, '/', 2); + + // Assert + TEST_ASSERT_EQUAL_INT(4, result); +} + #endif // TEST