Skip to content

Commit 710e415

Browse files
committed
tests are ready
1 parent dbe2556 commit 710e415

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

tdd_demo/my_demo/src/printer.c

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11

22
#include "printer.h"
3+
4+
int sum(int a, int b)
5+
{
6+
return 2 * ( a + b);
7+
}

tdd_demo/my_demo/src/printer.h

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
#ifndef PRINTER_H
33
#define PRINTER_H
44

5+
int sum(int a, int b);
56

67
#endif // PRINTER_H

tdd_demo/my_demo/test/test_printer.c

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ void tearDown(void)
1515

1616
void test_printer_NeedToImplement(void)
1717
{
18+
TEST_ASSERT_EQUAL_INT(6, sum(1,2));
19+
TEST_ASSERT_EQUAL_INT(10, sum(2,3));
20+
TEST_ASSERT_EQUAL_INT(6, sum(2,2));
1821
TEST_IGNORE_MESSAGE("Need to Implement printer");
1922
}
2023

tdd_demo/readme.md

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Ceedling and Test
2-
> Ceedling is a tool to create project based on tests. True approach of TDD. To install Ceedlings we need to install ruby. Because Ceedling will be installed by:
2+
> Ceedling is a tool to create project based on tests. True approach of TDD. To install Ceedlings we need to install `ruby`. Because Ceedling will be installed by:
33
44
```sh
55
gem install ceedling
@@ -9,6 +9,7 @@ gem install ceedling
99
1010
```sh
1111
ceedling new my_demo
12+
cd my_demo
1213
```
1314

1415
> With this it craates a folder for our project:
@@ -19,4 +20,14 @@ ceedling new my_demo
1920
> Now we have an empty project. We are going to add our first module:
2021
2122
```sh
22-
```
23+
ceedling module:create[printer]
24+
```
25+
26+
> This gives us almost a complete setup ready for test with:
27+
28+
- src/printer.c our empty source with header include
29+
- src/printer.h our header with guards
30+
- test/test_printer.c test functions for printer module
31+
- build/ directory with logs, test folders, cmock and unity frameworks. With their meson files for building.
32+
33+
>

0 commit comments

Comments
 (0)