You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+27-15Lines changed: 27 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ I was missing `sei()`, `cli()` and `attachInterrupt()` in ArduinoFake, here is l
9
9
*`attachInterrupt()` was already in [Arduino.h](/src/arduino/Arduino.h) so we are done.
10
10
*`sei()` was not defined in [Arduino.h](/src/arduino/Arduino.h) so
11
11
* create a new header file [avr/interrupt.h](/src/arduino/avr/interrupt.h) to cover interrupt related definitions with a content
12
-
```c
12
+
```c++
13
13
/**
14
14
* Fake version of avr/interrupt.h
15
15
*/
@@ -18,14 +18,14 @@ I was missing `sei()`, `cli()` and `attachInterrupt()` in ArduinoFake, here is l
18
18
* add `#include "avr/interrupt.h"` in [Arduino.h](/src/arduino/Arduino.h)
19
19
1. Find approriate place for your functions, in my case I extended [src/FunctionFake.h](/src/FunctionFake.h) for new functions
20
20
```c++
21
-
struct FunctionFake
21
+
struct FunctionFake
22
22
{
23
-
...
23
+
...
24
24
virtual void attachInterrupt(uint8_t, void (*)(void), int mode) = 0;
25
-
virtual void cli() = 0;
26
-
virtual void sei() = 0;
27
-
...
28
-
}
25
+
virtual void cli() = 0;
26
+
virtual void sei() = 0;
27
+
...
28
+
}
29
29
```
30
30
1. add default implementations into corresponding cpp file, in my case [src/FunctionFake.cpp](/src/FunctionFake.cpp).
31
31
```c++
@@ -41,7 +41,7 @@ I was missing `sei()`, `cli()` and `attachInterrupt()` in ArduinoFake, here is l
41
41
ArduinoFakeInstance(Function)->sei();
42
42
}
43
43
```
44
-
1.**don't forgot to add TESTs** for new functionality, at least test if a function can be executed, in my case [test/test_functio.h](/test/test_functio.h)
44
+
1.**don't forget to add TESTs** for new functionality, at least test if a function can be executed, in my case [test/test_function.h](/test/test_function.h)
45
45
```c++
46
46
void test_attach(void)
47
47
{
@@ -78,21 +78,33 @@ I was missing `sei()`, `cli()` and `attachInterrupt()` in ArduinoFake, here is l
78
78
{
79
79
...
80
80
RUN_TEST(FunctionTest::test_attach);
81
-
RUN_TEST(FunctionTest::test_cli);
82
-
RUN_TEST(FunctionTest::test_sei);
81
+
RUN_TEST(FunctionTest::test_cli);
82
+
RUN_TEST(FunctionTest::test_sei);
83
83
...
84
84
}
85
-
1. excersice tests from command line
85
+
1. excersice tests from command line, there are two ways based on your Makefile
86
+
* default project [Makefile](/Makefile),
87
+
* execute `make`
88
+
* verify
86
89
```
87
-
make clean all && test/main
90
+
Running tests...
91
+
Test project /home/vlcvi01/Dropbox/git/ArduinoFake/build
92
+
Start 1: main
93
+
1/1 Test #1: main ............................. Passed 0.01 sec
94
+
95
+
100% tests passed, 0 tests failed out of 1
88
96
```
89
-
verify PASS of all tests
97
+
*[eclipse based Makefile](https://www.mantidproject.org/Setting_up_Eclipse_projects_with_CMake) generated via `cmake -G "Eclipse CDT4 - Unix Makefiles"`.
0 commit comments