Subtraction See merge request fdai8031/cstools101!3
@ -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;
}
@ -0,0 +1,8 @@
#ifndef subtraction_H
#define subtraction_H
int subtract(int a, int b);
#endif
@ -0,0 +1,11 @@
#include "unity.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));