File tree Expand file tree Collapse file tree 3 files changed +29
-22
lines changed
SampleProjects/TestSomething/test Expand file tree Collapse file tree 3 files changed +29
-22
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1717### Changed
1818- Unit tests and examples are now executed alphabetically by filename
1919- The ` pgm_read_... ` preprocessor macros in cpp/arduino/avr/pgmspace.h now expands to an expression with applicable type.
20+ - Unit tests for interrupts (` attachInterrupt ` and ` detachInterrupt ` ) get their own file
2021
2122### Deprecated
2223
Original file line number Diff line number Diff line change @@ -34,17 +34,6 @@ unittest(random)
3434 assertEqual (state->seed , 4294967282 );
3535}
3636
37- void myInterruptHandler () {
38- }
39-
40- unittest (interrupts)
41- {
42- // these are meaningless for testing; just call the routine directly.
43- // make sure our mocks work though
44- attachInterrupt (2 , myInterruptHandler, CHANGE);
45- detachInterrupt (2 );
46- }
47-
4837unittest (pins)
4938{
5039 GodmodeState* state = GODMODE ();
@@ -172,17 +161,6 @@ unittest(pin_write_history)
172161
173162}
174163
175- unittest (interrupt_attachment) {
176- GodmodeState *state = GODMODE ();
177- state->reset ();
178- assertFalse (state->interrupt [0 ].attached );
179- attachInterrupt (0 , (void (*)(void ))0 , 3 );
180- assertTrue (state->interrupt [0 ].attached );
181- assertEqual (state->interrupt [0 ].mode , 3 );
182- detachInterrupt (0 );
183- assertFalse (state->interrupt [0 ].attached );
184- }
185-
186164unittest (spi) {
187165 GodmodeState *state = GODMODE ();
188166 state->reset ();
Original file line number Diff line number Diff line change 1+ #include < ArduinoUnitTests.h>
2+ #include < Arduino.h>
3+
4+ void myInterruptHandler () {
5+ }
6+
7+ unittest (interrupts)
8+ {
9+ // these are meaningless for testing; just call the routine directly.
10+ // make sure our mocks work though
11+ attachInterrupt (2 , myInterruptHandler, CHANGE);
12+ detachInterrupt (2 );
13+ }
14+
15+ unittest (interrupt_attachment) {
16+ GodmodeState *state = GODMODE ();
17+ state->reset ();
18+ assertFalse (state->interrupt [0 ].attached );
19+ attachInterrupt (0 , (void (*)(void ))0 , 3 );
20+ assertTrue (state->interrupt [0 ].attached );
21+ assertEqual (state->interrupt [0 ].mode , 3 );
22+ detachInterrupt (0 );
23+ assertFalse (state->interrupt [0 ].attached );
24+ }
25+
26+
27+
28+ unittest_main ()
You can’t perform that action at this time.
0 commit comments