-
Notifications
You must be signed in to change notification settings - Fork 16
/
continuous.ino
46 lines (37 loc) · 1.19 KB
/
continuous.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#line 2 "continuous.ino"
// Adapted from:
// https://github.com/mmurdoch/arduinounit/blob/master/examples/continuous/continuous.ino
#include <AUnit.h>
// test-once test named "once"
test(once) {
int x = 1;
assertLessOrEqual(x, 1);
}
// test-until-skip-pass-or-fail test named "continuous"
testing(continuous) {
static unsigned long startTime = millis();
unsigned long t = millis();
assertLessOrEqual(t, startTime + 100UL);
if (t >= 100UL + startTime) pass();
}
//----------------------------------------------------------------------------
// setup() and loop()
//----------------------------------------------------------------------------
void setup() {
#if ! defined(EPOXY_DUINO)
delay(1000); // wait for stability on some boards to prevent garbage Serial
#endif
Serial.begin(115200); // ESP8266 default of 74880 not supported on Linux
while(!Serial); // for the Arduino Leonardo/Micro only
#if defined(EPOXY_DUINO)
Serial.setLineModeUnix();
#endif
Serial.println(F("This test should produce the following:"));
Serial.println(
F("2 passed, 0 failed, 0 skipped, 0 timed out, out of 2 test(s).")
);
Serial.println(F("----"));
}
void loop() {
aunit::TestRunner::run();
}