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.
115 lines
1.8 KiB
115 lines
1.8 KiB
#ifdef TEST
|
|
|
|
#include "unity.h"
|
|
|
|
#include "calculatorAdd.c"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void test1_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 26.24;
|
|
y = 23.22;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test2_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 56.24;
|
|
y = 233.22;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test3_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 1226.24;
|
|
y = 323.22;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test4_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 2623.24;
|
|
y = 2323.22;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test5_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 2435.24;
|
|
y = 23423.22;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test6_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 4534.24;
|
|
y = 2221.22;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test7_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 26322.24;
|
|
y = 2332.222;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test8_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 26132.24;
|
|
y = 2331122.222;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test9_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 6322.24;
|
|
y = 21232.2322;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
void test10_calculatorAdd(void)
|
|
{
|
|
float x, y, a ,e;
|
|
x = 1234.456;
|
|
y = 654.4321;
|
|
a = calculatorAdd(x, y);
|
|
e = x + y;
|
|
TEST_ASSERT_EQUAL_FLOAT(e, a);
|
|
}
|
|
|
|
#endif // TEST
|