#ifdef TEST #include "unity.h" #include "minirechner.h" void setUp(void) { } void tearDown(void) { } // test addition void test_minitaschenrechner_3_plus_4(void) { float result = addieren(3, 4); TEST_ASSERT_EQUAL(7, result); } void test_minitaschenrechner_float_plus_float(void) { float result = addieren(3.1, 4.2); TEST_ASSERT_EQUAL(7.3, result); } void test_minitaschenrechner_minus1_plus_minus3(void) { float result = addieren(-1, -3); TEST_ASSERT_EQUAL(-4, result); } void test_minitaschenrechner_0_plus_2(void) { float result = addieren(0, 2); TEST_ASSERT_EQUAL(2, result); } // test subtraktion void test_minitaschenrechner_5_minus_2(void) { float result = subtrahieren(5, 2); TEST_ASSERT_EQUAL(3, result); } void test_minitaschenrechner_float_minus_float(void) { float result = subtrahieren(2.7, 1.3); TEST_ASSERT_EQUAL(1.4, result); } void test_minitaschenrechner_minus7_minus_minus3(void) { float result = subtrahieren(-7, -3); TEST_ASSERT_EQUAL(-4, result); } void test_minitaschenrechner_4_minus_0(void) { float result = subtrahieren(4, 0); TEST_ASSERT_EQUAL(4, result); } // test multiplikation void test_minitaschenrechner_8_mal_3(void) { float result = multiplizieren(8, 3); TEST_ASSERT_EQUAL(24, result); } void test_minitaschenrechner_minus3_mal_minus4(void) { float result = multiplizieren(-3, -4); TEST_ASSERT_EQUAL(12, result); } void test_minitaschenrechner_0_mal_5(void) { float result = multiplizieren(0, 5); TEST_ASSERT_EQUAL(0, result); } // test dividieren void test_minitaschenrechner_9_durch_3(void) { float result = dividieren(9, 3); TEST_ASSERT_EQUAL(3, result); } void test_minitaschenrechner_minus6_durch_minus2(void) { float result = dividieren(-6, -2); TEST_ASSERT_EQUAL(3, result); } #endif // TEST