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.
75 lines
1.1 KiB
75 lines
1.1 KiB
#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
|