Browse Source

Commit arithmetic Subtraction double

remotes/origin/develop
Leon Wolf 11 months ago
parent
commit
cd1a80534e
  1. 5
      src/arithmeticSubtraction.c
  2. 1
      src/arithmeticSubtraction.h
  3. 7
      test/test_arithmeticSubtraction.c

5
src/arithmeticSubtraction.c

@ -13,3 +13,8 @@ float* subtraction_float(float a, float b) {
*result=a - b;
return result;
}
double* subtraction_double(double a, double b) {
double* result= malloc(sizeof (double));
*result=a - b;
return result;
}

1
src/arithmeticSubtraction.h

@ -4,5 +4,6 @@
int* subtraction_integer(int a, int b);
float* subtraction_float(float a, float b);
double* subtraction_double(double a, double b);
#endif //THEADMIRALS_ARITHMETICSUBTRACTION_H

7
test/test_arithmeticSubtraction.c

@ -21,4 +21,11 @@ void test_arithmeticSubtraction_subractionoftwonumberswithfloat(void) {
result = subtraction_float(14, 7);
TEST_ASSERT_EQUAL_FLOAT(expectedResult, *result);
}
void test_arithmeticSubtraction_subractionoftwonumberswithdouble(void) {
double expectedResult = 7;
double* result;
result = subtraction_double(14, 7);
TEST_ASSERT_EQUAL_DOUBLE (expectedResult, *result);
}
Loading…
Cancel
Save