Browse Source

Commit arithmetic Subtraction integer

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

10
src/arithmeticSubtraction.c

@ -0,0 +1,10 @@
#include "arithmeticSubtraction.h"
#include <stdlib.h>
int* subtraction_integer(int a, int b) {
int* result= malloc(sizeof (int));
*result=a - b;
return result;
}

7
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

18
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);
}
Loading…
Cancel
Save