diff --git a/src/add/add.c b/src/add/add.c new file mode 100644 index 0000000..f2b0a32 --- /dev/null +++ b/src/add/add.c @@ -0,0 +1,5 @@ +#include "add.h" + +int add(int a, int b) { + return a + b; +} \ No newline at end of file diff --git a/src/add/add.h b/src/add/add.h new file mode 100644 index 0000000..5b40b2f --- /dev/null +++ b/src/add/add.h @@ -0,0 +1,4 @@ +#ifndef SOME_H +#define SOME_H +int add(int a, int b); +#endif \ No newline at end of file diff --git a/src/add/add_main.c b/src/add/add_main.c new file mode 100644 index 0000000..c846a32 --- /dev/null +++ b/src/add/add_main.c @@ -0,0 +1,10 @@ +#include "add.h" +#include "../userinput.h" +#include + +int main() { + printf("add two numbers:\n"); + int firstNum = getd("first number: ", NULL, NULL); + int secondNum = getd("second number: ", NULL, NULL); + printf("The result is: %d\n", add(firstNum, secondNum)); +} \ No newline at end of file diff --git a/test/add/test_add.c b/test/add/test_add.c new file mode 100644 index 0000000..616f7a5 --- /dev/null +++ b/test/add/test_add.c @@ -0,0 +1,9 @@ +#include "unity.h" +#include "add.h" + +void setUp(void){} +void tearDown(void){} + +void test_add(void) { + TEST_ASSERT_EQUAL_INT(100, add(50, 50)); +}