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.
61 lines
877 B
61 lines
877 B
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "division.h"
|
|
#include "divsion.c"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void test_division_1(void)
|
|
{
|
|
int result, expected = 5;
|
|
|
|
result = divisionInt(10,2);
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
void test_division_1_durch_0(void)
|
|
{
|
|
int result, expected = 0;
|
|
|
|
result = divisionInt(10,0);
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
void test_division_2(void)
|
|
{
|
|
double result, expected = 5.0;
|
|
|
|
result = divisionDouble(10.0,2.0);
|
|
|
|
TEST_ASSERT_EQUAL_DOUBLE(expected, result);
|
|
}
|
|
|
|
void test_bitshift_druch_0(void)
|
|
{
|
|
int result, expected = 16;
|
|
|
|
result = divisionByTwo(16,0);
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
void test_division_3(void)
|
|
{
|
|
int result, expected = 4;
|
|
|
|
result = divisionByTwo(16,2);
|
|
|
|
TEST_ASSERT_EQUAL_INT(expected, result);
|
|
}
|
|
|
|
#endif // TEST
|