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.
45 lines
1.2 KiB
45 lines
1.2 KiB
#include "../src/arithmeticAddition.h"
|
|
#include "unity.h"
|
|
#include "limits.h"
|
|
|
|
void setUp(void) {
|
|
// set stuff up here
|
|
}
|
|
|
|
void tearDown(void) {
|
|
// clean stuff up here
|
|
}
|
|
|
|
void test_arithmeticAddition_numberplusnumberequalsnumber(void) {
|
|
int expectedResult = 8;
|
|
int* result;
|
|
result = addition_integer(5, 3);
|
|
TEST_ASSERT_EQUAL_INT(expectedResult, *result);
|
|
}
|
|
|
|
void test_arithmeticAddition_numberplusmaxintegervalueequalsnull(void) {
|
|
int* result;
|
|
result = addition_integer(INT_MAX, 1);
|
|
TEST_ASSERT_NULL(result);
|
|
}
|
|
|
|
void test_arithmeticAddition_doublenumbercalculationequalscorrectdoublenumber(void) {
|
|
double expectedResult = 5.500000;
|
|
double* result;
|
|
result = addition_double(3.5, 2.0);
|
|
TEST_ASSERT_EQUAL_DOUBLE(expectedResult, *result);
|
|
}
|
|
|
|
void test_arithmeticAddition_longnumbercalculationequalscorrectlong(void) {
|
|
long expectedResult = 10;
|
|
long* result;
|
|
result = addition_long(5, 5);
|
|
TEST_ASSERT_EQUAL_INT(expectedResult, *result);
|
|
}
|
|
|
|
void test_arithmeticAddition_floatnumbercalculationequalsfloat(void) {
|
|
float expectedResult = 5.5;
|
|
float* result;
|
|
result = addition_float(3.5, 2.0);
|
|
TEST_ASSERT_EQUAL_FLOAT(expectedResult, *result);
|
|
}
|