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.
116 lines
1.9 KiB
116 lines
1.9 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "calculatorSubtract.h"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
|
|
void test1_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 123.211;
|
|
q = 112.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test2_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 13.21;
|
|
q = 112.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test3_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 12231.211;
|
|
q = 1122.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test4_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 113453.211;
|
|
q = 11254.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test5_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 12133.211;
|
|
q = 112.231;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test6_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 1133.201;
|
|
q = 11221.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test7_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 12213.2211;
|
|
q = 111.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test8_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 16213.711;
|
|
q = 1214.2251;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test9_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 1933.611;
|
|
q = 1432.21;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test10_calculatorSubtract(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 1233.811;
|
|
q = 1121.131;
|
|
e = p - q;
|
|
a = calculatorSubtract(p, q);
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
#endif // TEST
|