Skip to content

Commit 0a84107

Browse files
authored
Merge pull request #26 from bxparks/develop
0.5.1 - support ESP32
2 parents b955dfd + ce9b102 commit 0a84107

File tree

117 files changed

+1341
-858
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1341
-858
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
* 0.5.1 (2018-05-01)
4+
* Support ESP32.
5+
* Add failNow(), passNow(), skipNow() and expireNow() macros.
36
* 0.5.0 (2018-04-25)
47
* Support verbose assertion messages using AUnitVerbose.h. Fixes #8.
58
* Better assertion messages for assertTrue() and assertFalse(). Fixes #17.

README.md

Lines changed: 69 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A unit testing framework for Arduino platforms inspired by ArduinoUnit and
44
Google Test.
55

6-
Version: 0.5.0 (2018-04-25)
6+
Version: 0.5.1 (2018-05-01)
77

88
## Summary
99

@@ -86,24 +86,32 @@ Here are the features in AUnit which are not available in ArduinoUnit:
8686
* `checkTestXxxF()`
8787
* `externTestF()`
8888
* `externTestingF()`
89+
* Status setters
90+
* `passNow()`
91+
* `failNow()`
92+
* `skipNow()`
93+
* `expireNow()`
8994
* `teardown()` method, mirroring the `setup()`
9095
* `teardown()`
9196
* Tested on the following Arduino platforms:
9297
* AVR (8-bit)
9398
* Teensy ARM (32-bit)
9499
* ESP8266 (32-bit)
100+
* ESP32 (32-bit)
95101
* Test filters support the 2 arguments versions:
96102
* `TestRunner::include(testClass, name)` - matching `testF()`
97103
* `TestRunner::exclude(testClass, name)` - matching `testingF()`
98104
* Terse and verbose modes:
99105
* `#include <AUnit.h>` - terse messages uses less flash memory
100106
* `#include <AUnitVerbose.h>` - verbose messages uses more flash
101107

108+
Every feature of AUnit is unit tested using AUnit itself.
109+
102110
### Beta Status
103111

104-
Although this library has been extensively tested by me, and I converted my
105-
[AceButton](https://github.com/bxparks/AceButton) library to use it, I consider
106-
it currently in "beta stage" until more users have tested it.
112+
Although this library has been extensively tested by me, and two of my Arduino
113+
libraries (AceButton and AceSegment, see Examples below) now use it, I consider
114+
it currently in "beta stage" until more users have tested it.
107115

108116
## Installation
109117

@@ -146,6 +154,20 @@ In the `tests/` directory:
146154
* `SetupAndTeardownTest` - tests to verify that `setup()` and `teardown()` are
147155
called properly by the finite state machine
148156

157+
Perhaps the best way to see AUnit in action through real life examples. I
158+
currently have 2 Arduino project using AUnit extensively:
159+
160+
* [AceButton](https://github.com/bxparks/AceButton)
161+
* [AceSegment](https://github.com/bxparks/AceSegment)
162+
163+
Look under the `tests` directory in each project.
164+
165+
The tests for AceButton were originally created using ArduinoUnit 2.2, and I
166+
have kept those tests backwards compatible. They do not use the new features of
167+
AUnit.
168+
169+
The tests for AceSegment demonstrate the full power of AUnit better.
170+
149171
### Header and Namespace
150172

151173
To prevent name clashes with other libraries and code, all classes in the AUnit
@@ -180,8 +202,8 @@ instead:
180202
```
181203

182204
The flash memory consumption on an 8-bit AVR may go up by 20-25% for medium to
183-
large tests. On Teensy ARM or ESP8266, the increased memory size probably does
184-
not matter too much because these microcontrollers have far more flash and
205+
large tests. On Teensy ARM, ESP8266 or ESP32, the increased memory size probably
206+
does not matter too much because these microcontrollers have far more flash and
185207
static memory.
186208

187209
### Defining the Tests
@@ -229,9 +251,9 @@ testing(looping_test) {
229251
if (...) {
230252
pass();
231253
} else if (...) {
232-
fail();
254+
failNow();
233255
} else {
234-
skip();
256+
skipNow();
235257
}
236258
}
237259
@@ -399,8 +421,8 @@ will produce a compiler error:
399421
unsigned short ushortValue = 5;
400422
assertEqual(5U, ushortValue);
401423
```
402-
But on Teensy-ARM and ESP8266, a 16-bit (short) can be promoted to a 32-bit
403-
(int) without loss of precision, so the above will compile just fine. For
424+
But on Teensy-ARM, ESP8266, and ESP32, a 16-bit (short) can be promoted to a
425+
32-bit (int) without loss of precision, so the above will compile just fine. For
404426
portability, the following should be used on all platforms:
405427
```
406428
unsigned short ushortValue = 5;
@@ -644,17 +666,39 @@ assertTestXxx() meta assertion macros._
644666

645667
### Status Indicator Methods
646668

647-
These methods can be used inside a `test()` or `testing()` macro
648-
to indicate whether the test has passed or failed (or reached some other
649-
status reason).
669+
The following macros can be used inside the body of `test()` or `testing()`
670+
macro to indicate whether the test has passed or failed (or reached some other
671+
status). Each macro prints a short message, and returns immediately from the
672+
test, much like an `assertXxx()` macro that fails.
673+
674+
* `passNow()` [&ast;]
675+
* `failNow()` [&ast;]
676+
* `skipNow()` [&ast;]
677+
* `expireNow()` [&ast;]
678+
679+
The message looks like:
680+
```
681+
Status timed out, file AUnitTest.ino, line 381.
682+
Status failed, file AUnitTest.ino, line 378.
683+
Status failed, file AUnitTest.ino, line 378.
684+
Status skipped, file AUnitTest.ino, line 380.
685+
```
686+
687+
The above methods are recommended over the following methods on the `Test` class
688+
because the `xxxNow()` versions print the file and line number of the statement.
689+
The methods on `Test` are completely silent which makes debugging difficult.
650690

651691
* `pass()` - test passed
652692
* `fail()` - test failed
653693
* `skip()` - test skipped
654694
* `expire()` - test timed out [&ast;]
655695

656-
***ArduinoUnit Compatibility***: _The method(s) marked by [&ast;] are only
657-
available in AUnit._
696+
***ArduinoUnit Compatibility***: _
697+
_The method(s) marked by [&ast;] are only available in AUnit. For most cases,
698+
the failNow(), skipNow() and expireNow() methods are recommended over the
699+
methods from ArduinoUnit which have been carried over for compatibility and for
700+
internal use. In a testing() loop test, the pass() method may be more useful
701+
than the passNow() macro._
658702

659703
### Overridable Methods
660704

@@ -1000,7 +1044,7 @@ Collection of useful tidbits.
10001044

10011045
### Debugging Assertions in Fixtures
10021046

1003-
When using test fixtures with the `testF()` and testingF()` macros, it's often
1047+
When using test fixtures with the `testF()` and `testingF()` macros, it's often
10041048
useful to create helper assertions, such as the `assertCustomStuff()` below.
10051049
Debugging such assertion statements can be tricky. I've found that turning on
10061050
messages for successful assertions (with a
@@ -1123,18 +1167,23 @@ This library was developed and tested using:
11231167
* [Arduino IDE 1.8.5](https://www.arduino.cc/en/Main/Software)
11241168
* [Teensyduino 1.41](https://www.pjrc.com/teensy/td_download.html)
11251169
* [ESP8266 Arduino Core 2.4.1](https://arduino-esp8266.readthedocs.io/en/2.4.1/)
1170+
* [arduino-esp32](https://github.com/espressif/arduino-esp32)
11261171

11271172
I used MacOS 10.13.3 and Ubuntu 17.10 for most of my development.
11281173

1129-
The library has been verified to work on the following hardware:
1174+
The library is tested on the following hardware before each release:
11301175

11311176
* Arduino Nano clone (16 MHz ATmega328P)
1132-
* Arduino UNO R3 clone (16 MHz ATmega328P)
1133-
* Arduino Pro Mini clone (16 MHz ATmega328P)
11341177
* Arduino Pro Micro clone (16 MHz ATmega32U4)
1135-
* Teensy LC (48 MHz ARM Cortex-M0+)
11361178
* Teensy 3.2 (72 MHz ARM Cortex-M4)
11371179
* NodeMCU 1.0 clone (ESP-12E module, 80 MHz ESP8266)
1180+
* ESP32 dev board (ESP-WROOM-32 module, 240 MHz dual core Tensilica LX6)
1181+
1182+
I will occasionally test on the following hardware as a sanity check:
1183+
1184+
* Arduino UNO R3 clone (16 MHz ATmega328P)
1185+
* Arduino Pro Mini clone (16 MHz ATmega328P)
1186+
* Teensy LC (48 MHz ARM Cortex-M0+)
11381187
* ESP-01 (ESP-01 module, 80 MHz ESP8266)
11391188

11401189
## License

docs/doxygen.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "AUnit"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 0.5.0
41+
PROJECT_NUMBER = 0.5.1
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

docs/html/AUnitVerbose_8h.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<tr style="height: 56px;">
2323
<td id="projectalign" style="padding-left: 0.5em;">
2424
<div id="projectname">AUnit
25-
&#160;<span id="projectnumber">0.5.0</span>
25+
&#160;<span id="projectnumber">0.5.1</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -90,20 +90,20 @@
9090
<div class="dyncontent">
9191
<div class="center"><img src="AUnitVerbose_8h__incl.png" border="0" usemap="#_2home_2brian_2dev_2AUnit_2src_2AUnitVerbose_8h" alt=""/></div>
9292
<map name="_2home_2brian_2dev_2AUnit_2src_2AUnitVerbose_8h" id="_2home_2brian_2dev_2AUnit_2src_2AUnitVerbose_8h">
93-
<area shape="rect" id="node2" href="Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="316,468,436,495"/>
94-
<area shape="rect" id="node4" href="Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="44,95,163,121"/>
95-
<area shape="rect" id="node6" href="Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="239,319,342,345"/>
96-
<area shape="rect" id="node7" href="Test_8h_source.html" title="aunit/Test.h" alt="" coords="389,393,480,420"/>
97-
<area shape="rect" id="node9" href="Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="366,319,486,345"/>
98-
<area shape="rect" id="node12" href="MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="340,244,489,271"/>
99-
<area shape="rect" id="node13" href="TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="721,169,844,196"/>
100-
<area shape="rect" id="node14" href="TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="415,169,539,196"/>
101-
<area shape="rect" id="node15" href="TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="561,319,694,345"/>
102-
<area shape="rect" id="node16" href="AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="546,95,741,121"/>
103-
<area shape="rect" id="node17" href="MetaAssertMacros_8h.html" title="Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t..." alt="" coords="766,95,940,121"/>
104-
<area shape="rect" id="node18" href="TestMacros_8h.html" title="Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header. " alt="" coords="964,95,1099,121"/>
105-
<area shape="rect" id="node8" href="FCString_8h_source.html" title="FCString.h" alt="" coords="689,468,774,495"/>
106-
<area shape="rect" id="node10" href="Flash_8h.html" title="Flash strings (using F() macro) on the ESP8266 platform cannot be placed in an inline context..." alt="" coords="952,393,1018,420"/>
93+
<area shape="rect" id="node2" href="Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="391,468,511,495"/>
94+
<area shape="rect" id="node4" href="Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="45,95,163,121"/>
95+
<area shape="rect" id="node6" href="Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="365,319,467,345"/>
96+
<area shape="rect" id="node7" href="Test_8h_source.html" title="aunit/Test.h" alt="" coords="439,393,529,420"/>
97+
<area shape="rect" id="node9" href="Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="492,319,612,345"/>
98+
<area shape="rect" id="node11" href="MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="463,244,612,271"/>
99+
<area shape="rect" id="node12" href="TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="689,169,812,196"/>
100+
<area shape="rect" id="node13" href="TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="541,169,665,196"/>
101+
<area shape="rect" id="node14" href="TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="207,319,340,345"/>
102+
<area shape="rect" id="node15" href="AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="615,95,809,121"/>
103+
<area shape="rect" id="node16" href="MetaAssertMacros_8h.html" title="Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t..." alt="" coords="1090,244,1265,271"/>
104+
<area shape="rect" id="node17" href="TestMacros_8h.html" title="Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header. " alt="" coords="834,95,969,121"/>
105+
<area shape="rect" id="node8" href="FCString_8h_source.html" title="FCString.h" alt="" coords="687,468,772,495"/>
106+
<area shape="rect" id="node10" href="Flash_8h.html" title="Various macros to smooth over the differences among the various platforms with regards to their suppo..." alt="" coords="1039,393,1105,420"/>
107107
</map>
108108
</div>
109109
</div>
@@ -112,7 +112,7 @@
112112
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
113113
Macros</h2></td></tr>
114114
<tr class="memitem:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memItemLeft" align="right" valign="top"><a id="a87cbb10969eff63f8ae66afc4e9457eb"></a>
115-
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;000500</td></tr>
115+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;000501</td></tr>
116116
<tr class="separator:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
117117
</table>
118118
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<map id="/home/brian/dev/AUnit/src/AUnitVerbose.h" name="/home/brian/dev/AUnit/src/AUnitVerbose.h">
2-
<area shape="rect" id="node2" href="$Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="316,468,436,495"/>
3-
<area shape="rect" id="node4" href="$Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="44,95,163,121"/>
4-
<area shape="rect" id="node6" href="$Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="239,319,342,345"/>
5-
<area shape="rect" id="node7" href="$Test_8h_source.html" title="aunit/Test.h" alt="" coords="389,393,480,420"/>
6-
<area shape="rect" id="node9" href="$Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="366,319,486,345"/>
7-
<area shape="rect" id="node12" href="$MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="340,244,489,271"/>
8-
<area shape="rect" id="node13" href="$TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="721,169,844,196"/>
9-
<area shape="rect" id="node14" href="$TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="415,169,539,196"/>
10-
<area shape="rect" id="node15" href="$TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="561,319,694,345"/>
11-
<area shape="rect" id="node16" href="$AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="546,95,741,121"/>
12-
<area shape="rect" id="node17" href="$MetaAssertMacros_8h.html" title="Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t..." alt="" coords="766,95,940,121"/>
13-
<area shape="rect" id="node18" href="$TestMacros_8h.html" title="Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header. " alt="" coords="964,95,1099,121"/>
14-
<area shape="rect" id="node8" href="$FCString_8h_source.html" title="FCString.h" alt="" coords="689,468,774,495"/>
15-
<area shape="rect" id="node10" href="$Flash_8h.html" title="Flash strings (using F() macro) on the ESP8266 platform cannot be placed in an inline context..." alt="" coords="952,393,1018,420"/>
2+
<area shape="rect" id="node2" href="$Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="391,468,511,495"/>
3+
<area shape="rect" id="node4" href="$Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="45,95,163,121"/>
4+
<area shape="rect" id="node6" href="$Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="365,319,467,345"/>
5+
<area shape="rect" id="node7" href="$Test_8h_source.html" title="aunit/Test.h" alt="" coords="439,393,529,420"/>
6+
<area shape="rect" id="node9" href="$Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="492,319,612,345"/>
7+
<area shape="rect" id="node11" href="$MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="463,244,612,271"/>
8+
<area shape="rect" id="node12" href="$TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="689,169,812,196"/>
9+
<area shape="rect" id="node13" href="$TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="541,169,665,196"/>
10+
<area shape="rect" id="node14" href="$TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="207,319,340,345"/>
11+
<area shape="rect" id="node15" href="$AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="615,95,809,121"/>
12+
<area shape="rect" id="node16" href="$MetaAssertMacros_8h.html" title="Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t..." alt="" coords="1090,244,1265,271"/>
13+
<area shape="rect" id="node17" href="$TestMacros_8h.html" title="Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header. " alt="" coords="834,95,969,121"/>
14+
<area shape="rect" id="node8" href="$FCString_8h_source.html" title="FCString.h" alt="" coords="687,468,772,495"/>
15+
<area shape="rect" id="node10" href="$Flash_8h.html" title="Various macros to smooth over the differences among the various platforms with regards to their suppo..." alt="" coords="1039,393,1105,420"/>
1616
</map>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dd1d0ed32d54834939a1889af843be14
1+
044106ba5bbe5761f934b018fc950f1a
9.62 KB
Loading

0 commit comments

Comments
 (0)