diff --git a/src/arithmeticSubtraction.c b/src/arithmeticSubtraction.c new file mode 100644 index 0000000..f8a7eb5 --- /dev/null +++ b/src/arithmeticSubtraction.c @@ -0,0 +1,10 @@ + +#include "arithmeticSubtraction.h" + +#include + +int* subtraction_integer(int a, int b) { + int* result= malloc(sizeof (int)); + *result=a - b; + return result; +} diff --git a/src/arithmeticSubtraction.h b/src/arithmeticSubtraction.h new file mode 100644 index 0000000..5a36ba5 --- /dev/null +++ b/src/arithmeticSubtraction.h @@ -0,0 +1,7 @@ + +#ifndef THEADMIRALS_ARITHMETICSUBTRACTION_H +#define THEADMIRALS_ARITHMETICSUBTRACTION_H + +int* subtraction_integer(int a, int b); + +#endif //THEADMIRALS_ARITHMETICSUBTRACTION_H diff --git a/test/test_arithmeticSubtraction.c b/test/test_arithmeticSubtraction.c new file mode 100644 index 0000000..26d05c4 --- /dev/null +++ b/test/test_arithmeticSubtraction.c @@ -0,0 +1,18 @@ +#include "../src/arithmeticSubtraction.h" +#include "unity.h" +#include "limits.h" + +void setUp(void) { + // set stuff up here +} + +void tearDown(void) { + // clean stuff up here +} +void test_arithmeticSubtraction_subractionoftwonumbers(void) { + int expectedResult = 7; + int* result; + result = subtraction_integer(14, 7); + TEST_ASSERT_EQUAL_INT(expectedResult, *result); +} +