|
@ -0,0 +1,75 @@ |
|
|
|
|
|
#ifdef TEST |
|
|
|
|
|
#include "unity.h" |
|
|
|
|
|
#include "kleiner_groessergleich.h" |
|
|
|
|
|
#include "kleiner_groessergleich.c" |
|
|
|
|
|
|
|
|
|
|
|
void setUp(void) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void tearDown(void) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Test 1 |
|
|
|
|
|
void test_gleich(void) |
|
|
|
|
|
{ |
|
|
|
|
|
int result, expected = 3; |
|
|
|
|
|
|
|
|
|
|
|
result = vergleicheZahlen_int(1,1); |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Test 2 |
|
|
|
|
|
void test_kleiner(void) |
|
|
|
|
|
{ |
|
|
|
|
|
int result, expected = 1; |
|
|
|
|
|
|
|
|
|
|
|
result = vergleicheZahlen_int(1,2); |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Test 3 |
|
|
|
|
|
void test_groesser(void) |
|
|
|
|
|
{ |
|
|
|
|
|
int result, expected = 2; |
|
|
|
|
|
|
|
|
|
|
|
result = vergleicheZahlen_int(2,1); |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Test4 |
|
|
|
|
|
void test_groesser_d(void) |
|
|
|
|
|
{ |
|
|
|
|
|
int result, expected = 2.0; |
|
|
|
|
|
|
|
|
|
|
|
result = vergleicheZahlen_d(2.0,1.0); |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_DOUBLE(expected, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Test 5 |
|
|
|
|
|
void test_kleiner_d(void) |
|
|
|
|
|
{ |
|
|
|
|
|
int result, expected = 1.0; |
|
|
|
|
|
|
|
|
|
|
|
result = vergleicheZahlen_d(1.0,2.0); |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_DOUBLE(expected, result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Test 6 |
|
|
|
|
|
void test_gleich_d(void) |
|
|
|
|
|
{ |
|
|
|
|
|
int result, expected = 3.0; |
|
|
|
|
|
|
|
|
|
|
|
result = vergleicheZahlen_d(1.0,1.0); |
|
|
|
|
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_DOUBLE(expected, result); |
|
|
|
|
|
} |
|
|
|
|
|
#endif //TEST |