Browse Source

Merge branch 'subtraction' into 'master'

Subtraction

See merge request fdai8031/cstools101!3
remotes/origin/userinput
fdai7968 11 months ago
parent
commit
563174da69
  1. 0
      src/subtraction/.gitkeep
  2. 6
      src/subtraction/subtraction.c
  3. 8
      src/subtraction/subtraction.h
  4. 0
      test/subtraction/.gitkeep
  5. 11
      test/subtraction/subtraction.c

0
src/subtraction/.gitkeep

6
src/subtraction/subtraction.c

@ -0,0 +1,6 @@
#include "subtraction.h"
int subtract(int a, int b) {
if (a==0) return b;
if(b==0) return a;
else return a - b;
}

8
src/subtraction/subtraction.h

@ -0,0 +1,8 @@
#ifndef subtraction_H
#define subtraction_H
int subtract(int a, int b);
#endif

0
test/subtraction/.gitkeep

11
test/subtraction/subtraction.c

@ -0,0 +1,11 @@
#include "unity.h"
#include "subtraction.h"
void setUp(){}
void tearDown(){}
void test_subtraction() {
TEST_ASSERT_EQUAL_INT(1, subtract(3, 2));
TEST_ASSERT_EQUAL_INT(5, subtract(2, -3));
TEST_ASSERT_EQUAL_INT(0, subtract(0, 0));
}
Loading…
Cancel
Save