File tree 2 files changed +41
-1
lines changed
SampleProjects/TestSomething/test
2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change
1
+ #include < ArduinoUnitTests.h>
2
+ #include < Arduino.h>
3
+ #include < util/atomic.h>
4
+
5
+
6
+ unittest (atomic)
7
+ {
8
+ // The macros don't do anything on the host platform, just make sure
9
+ // they compile without error.
10
+
11
+ int a = 1 ;
12
+ int b = 2 ;
13
+
14
+ ATOMIC_BLOCK (ATOMIC_RESTORESTATE) {
15
+ a += b;
16
+ b++;
17
+ }
18
+
19
+ ATOMIC_BLOCK (ATOMIC_FORCEON) {
20
+ a += b;
21
+ b++;
22
+ }
23
+
24
+ NONATOMIC_BLOCK (NONATOMIC_RESTORESTATE) {
25
+ a += b;
26
+ b++;
27
+ }
28
+
29
+ NONATOMIC_BLOCK (NONATOMIC_FORCEOFF) {
30
+ a += b;
31
+ b++;
32
+ }
33
+
34
+ assertEqual (a, 15 );
35
+ assertEqual (b, 6 );
36
+ }
37
+
38
+
39
+ unittest_main ()
Original file line number Diff line number Diff line change 42
42
/* Internal helper functions. */
43
43
static __inline__ uint8_t __iSeiRetVal (void )
44
44
{
45
- sei ();
45
+ // Just do nothing
46
+ //sei();
46
47
return 1 ;
47
48
}
48
49
You can’t perform that action at this time.
0 commit comments