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.8 KiB
116 lines
1.8 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "calculatorDivide.h"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void test1_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 26.24;
|
|
q = 23.22;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test2_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 2236.24;
|
|
q = 2123.22;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test3_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 623.2;
|
|
q = 23.22;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test4_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 234.7;
|
|
q = 124.2;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test5_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 26207.2;
|
|
q = 278.23;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test6_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 111;
|
|
q = 21;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test7_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 167;
|
|
q = 23.22;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test8_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 26124;
|
|
q = 23022;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test9_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 1234;
|
|
q = 4321;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test10_calculatorDivide(void)
|
|
{
|
|
float p, q, a, e;
|
|
p = 2345;
|
|
q = 123.7;
|
|
a = calculatorDivide(p, q);
|
|
e = p/q;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
|
|
#endif // TEST
|