Browse Source

Merge branch 'multiplication' into 'master'

Added Multiplication with tests

See merge request fdai8031/cstools101!2
remotes/origin/userinput
fdai7968 11 months ago
parent
commit
7afde97f52
  1. 0
      src/multiplication/.gitkeep
  2. 4
      src/multiplication/multiplication.c
  3. 7
      src/multiplication/multiplication.h
  4. 0
      test/multiplication/.gitkeep
  5. 12
      test/multiplication/test_multiplication.c

0
src/multiplication/.gitkeep

4
src/multiplication/multiplication.c

@ -0,0 +1,4 @@
int multiply(int a, int b) {
if (a==0||b==0) return 0;
else return a * b;
}

7
src/multiplication/multiplication.h

@ -0,0 +1,7 @@
#ifndef multiplication_H
#define multiplication_H
int multiply(int a, int b);
#endif

0
test/multiplication/.gitkeep

12
test/multiplication/test_multiplication.c

@ -0,0 +1,12 @@
#include "unity.h"
#include "multiplication.h"
void setUp(void){}
void tearDown(void){}
void test_multiplication() {
TEST_ASSERT_EQUAL_INT(6, multiply(2, 3));
TEST_ASSERT_EQUAL_INT(-6, multiply(2, -3));
TEST_ASSERT_EQUAL_INT(0, multiply(0, 0));
}
Loading…
Cancel
Save