From 93bd716e6d6c1b7a180797039a9797155b3a1c2b Mon Sep 17 00:00:00 2001 From: Eric Bagus Date: Fri, 9 Feb 2024 16:09:57 +0100 Subject: [PATCH] Added multiple tests for arithmetic addition methods --- test/test_arithmeticAddition.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/test_arithmeticAddition.c b/test/test_arithmeticAddition.c index a7089a6..5e261b2 100644 --- a/test/test_arithmeticAddition.c +++ b/test/test_arithmeticAddition.c @@ -21,4 +21,25 @@ void test_arithmeticAddition_numberplusmaxintegervalueequalsnull(void) { int* result; result = addition_integer(INT_MAX, 1); TEST_ASSERT_NULL(result); -} \ No newline at end of file +} + +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); +}