diff --git a/test/test_convert_M_in_KM.c b/test/test_convert_M_in_KM.c new file mode 100644 index 0000000..bdfeea0 --- /dev/null +++ b/test/test_convert_M_in_KM.c @@ -0,0 +1,32 @@ +#include "../src/convert_M_in_KM.h" +#include "unity.h" +#include "limits.h" + +void setUp(void) { + // Set up resources here if needed +} + +void tearDown(void) { + // Clean up resources here if needed +} +void test_meter_to_kilometer(void) { + // Testfall 1: 1000 Meter sollten 1 Kilometer sein + double value_1 = 1000.0; + double expectedResult_1 = 1.0; + double result_1 = meter_to_kilometer(value_1); + TEST_ASSERT_EQUAL_FLOAT(expectedResult_1, result_1); +} +void test_meter_to_kilometer2(void) { + // Testfall 2: 500 Meter sollten 0.5 Kilometer sein + double value_2 = 500.0; + double expectedResult_2 = 0.5; + double result_2 = meter_to_kilometer(value_2); + TEST_ASSERT_EQUAL_FLOAT(expectedResult_2, result_2); +} +void test_meter_to_kilometer3(void) { +// Testfall 3: 1500 Meter sollten 1.5 Kilometer sein + double value_3 = 1500.0; + double expectedResult_3 = 1.5; + double result_3 = meter_to_kilometer(value_3); + TEST_ASSERT_EQUAL_FLOAT(expectedResult_3, result_3); +} \ No newline at end of file diff --git a/test/test_trigonometricFunctions.c b/test/test_trigonometricFunctions.c new file mode 100644 index 0000000..f21eb02 --- /dev/null +++ b/test/test_trigonometricFunctions.c @@ -0,0 +1,29 @@ +#include "../src/trigonometricFunctions.h" +#include "unity.h" +#include "limits.h" + +void setUp(void) { + // set stuff up here +} + +void tearDown(void) { + // clean stuff up here +} +void test_trigonometricFunctions_trigonometricFunctionsofsin(void) { + double expectedResult = 0.850903525 ; + double *result; + result = calculate_sin_double(45); + TEST_ASSERT_DOUBLE_WITHIN(0.1, expectedResult, *result); +} +void test_trigonometricFunctions_trigonometricFunctionsofcos(void) { + double expectedResult = 0.525321989 ; + double *result; + result = calculate_cos_double(45); + TEST_ASSERT_DOUBLE_WITHIN(0.1, expectedResult, *result); +} +void test_trigonometricFunctions_trigonometricFunctionsoftan(void) { + double expectedResult = 1.61977519 ; + double *result; + result = calculate_tan_double(45); + TEST_ASSERT_DOUBLE_WITHIN(0.1, expectedResult, *result); +} \ No newline at end of file