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.

72 lines
1.3 KiB

#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);
}
#endif // TEST