Skip to content

Commit

Permalink
Merge pull request #26 from bxparks/develop
Browse files Browse the repository at this point in the history
0.5.1 - support ESP32
  • Loading branch information
bxparks authored May 1, 2018
2 parents b955dfd + ce9b102 commit 0a84107
Show file tree
Hide file tree
Showing 117 changed files with 1,341 additions and 858 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

* 0.5.1 (2018-05-01)
* Support ESP32.
* Add failNow(), passNow(), skipNow() and expireNow() macros.
* 0.5.0 (2018-04-25)
* Support verbose assertion messages using AUnitVerbose.h. Fixes #8.
* Better assertion messages for assertTrue() and assertFalse(). Fixes #17.
Expand Down
89 changes: 69 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A unit testing framework for Arduino platforms inspired by ArduinoUnit and
Google Test.

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

## Summary

Expand Down Expand Up @@ -86,24 +86,32 @@ Here are the features in AUnit which are not available in ArduinoUnit:
* `checkTestXxxF()`
* `externTestF()`
* `externTestingF()`
* Status setters
* `passNow()`
* `failNow()`
* `skipNow()`
* `expireNow()`
* `teardown()` method, mirroring the `setup()`
* `teardown()`
* Tested on the following Arduino platforms:
* AVR (8-bit)
* Teensy ARM (32-bit)
* ESP8266 (32-bit)
* ESP32 (32-bit)
* Test filters support the 2 arguments versions:
* `TestRunner::include(testClass, name)` - matching `testF()`
* `TestRunner::exclude(testClass, name)` - matching `testingF()`
* Terse and verbose modes:
* `#include <AUnit.h>` - terse messages uses less flash memory
* `#include <AUnitVerbose.h>` - verbose messages uses more flash

Every feature of AUnit is unit tested using AUnit itself.

### Beta Status

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

## Installation

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

Perhaps the best way to see AUnit in action through real life examples. I
currently have 2 Arduino project using AUnit extensively:

* [AceButton](https://github.com/bxparks/AceButton)
* [AceSegment](https://github.com/bxparks/AceSegment)

Look under the `tests` directory in each project.

The tests for AceButton were originally created using ArduinoUnit 2.2, and I
have kept those tests backwards compatible. They do not use the new features of
AUnit.

The tests for AceSegment demonstrate the full power of AUnit better.

### Header and Namespace

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

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

### Defining the Tests
Expand Down Expand Up @@ -229,9 +251,9 @@ testing(looping_test) {
if (...) {
pass();
} else if (...) {
fail();
failNow();
} else {
skip();
skipNow();
}
}
Expand Down Expand Up @@ -399,8 +421,8 @@ will produce a compiler error:
unsigned short ushortValue = 5;
assertEqual(5U, ushortValue);
```
But on Teensy-ARM and ESP8266, a 16-bit (short) can be promoted to a 32-bit
(int) without loss of precision, so the above will compile just fine. For
But on Teensy-ARM, ESP8266, and ESP32, a 16-bit (short) can be promoted to a
32-bit (int) without loss of precision, so the above will compile just fine. For
portability, the following should be used on all platforms:
```
unsigned short ushortValue = 5;
Expand Down Expand Up @@ -644,17 +666,39 @@ assertTestXxx() meta assertion macros._

### Status Indicator Methods

These methods can be used inside a `test()` or `testing()` macro
to indicate whether the test has passed or failed (or reached some other
status reason).
The following macros can be used inside the body of `test()` or `testing()`
macro to indicate whether the test has passed or failed (or reached some other
status). Each macro prints a short message, and returns immediately from the
test, much like an `assertXxx()` macro that fails.

* `passNow()` [&ast;]
* `failNow()` [&ast;]
* `skipNow()` [&ast;]
* `expireNow()` [&ast;]

The message looks like:
```
Status timed out, file AUnitTest.ino, line 381.
Status failed, file AUnitTest.ino, line 378.
Status failed, file AUnitTest.ino, line 378.
Status skipped, file AUnitTest.ino, line 380.
```

The above methods are recommended over the following methods on the `Test` class
because the `xxxNow()` versions print the file and line number of the statement.
The methods on `Test` are completely silent which makes debugging difficult.

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

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

### Overridable Methods

Expand Down Expand Up @@ -1000,7 +1044,7 @@ Collection of useful tidbits.

### Debugging Assertions in Fixtures

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

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

The library has been verified to work on the following hardware:
The library is tested on the following hardware before each release:

* Arduino Nano clone (16 MHz ATmega328P)
* Arduino UNO R3 clone (16 MHz ATmega328P)
* Arduino Pro Mini clone (16 MHz ATmega328P)
* Arduino Pro Micro clone (16 MHz ATmega32U4)
* Teensy LC (48 MHz ARM Cortex-M0+)
* Teensy 3.2 (72 MHz ARM Cortex-M4)
* NodeMCU 1.0 clone (ESP-12E module, 80 MHz ESP8266)
* ESP32 dev board (ESP-WROOM-32 module, 240 MHz dual core Tensilica LX6)

I will occasionally test on the following hardware as a sanity check:

* Arduino UNO R3 clone (16 MHz ATmega328P)
* Arduino Pro Mini clone (16 MHz ATmega328P)
* Teensy LC (48 MHz ARM Cortex-M0+)
* ESP-01 (ESP-01 module, 80 MHz ESP8266)

## License
Expand Down
2 changes: 1 addition & 1 deletion docs/doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "AUnit"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.5.0
PROJECT_NUMBER = 0.5.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
32 changes: 16 additions & 16 deletions docs/html/AUnitVerbose_8h.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">AUnit
&#160;<span id="projectnumber">0.5.0</span>
&#160;<span id="projectnumber">0.5.1</span>
</div>
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
</td>
Expand Down Expand Up @@ -90,20 +90,20 @@
<div class="dyncontent">
<div class="center"><img src="AUnitVerbose_8h__incl.png" border="0" usemap="#_2home_2brian_2dev_2AUnit_2src_2AUnitVerbose_8h" alt=""/></div>
<map name="_2home_2brian_2dev_2AUnit_2src_2AUnitVerbose_8h" id="_2home_2brian_2dev_2AUnit_2src_2AUnitVerbose_8h">
<area shape="rect" id="node2" href="Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="316,468,436,495"/>
<area shape="rect" id="node4" href="Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="44,95,163,121"/>
<area shape="rect" id="node6" href="Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="239,319,342,345"/>
<area shape="rect" id="node7" href="Test_8h_source.html" title="aunit/Test.h" alt="" coords="389,393,480,420"/>
<area shape="rect" id="node9" href="Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="366,319,486,345"/>
<area shape="rect" id="node12" href="MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="340,244,489,271"/>
<area shape="rect" id="node13" href="TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="721,169,844,196"/>
<area shape="rect" id="node14" href="TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="415,169,539,196"/>
<area shape="rect" id="node15" href="TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="561,319,694,345"/>
<area shape="rect" id="node16" href="AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="546,95,741,121"/>
<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"/>
<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"/>
<area shape="rect" id="node8" href="FCString_8h_source.html" title="FCString.h" alt="" coords="689,468,774,495"/>
<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"/>
<area shape="rect" id="node2" href="Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="391,468,511,495"/>
<area shape="rect" id="node4" href="Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="45,95,163,121"/>
<area shape="rect" id="node6" href="Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="365,319,467,345"/>
<area shape="rect" id="node7" href="Test_8h_source.html" title="aunit/Test.h" alt="" coords="439,393,529,420"/>
<area shape="rect" id="node9" href="Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="492,319,612,345"/>
<area shape="rect" id="node11" href="MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="463,244,612,271"/>
<area shape="rect" id="node12" href="TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="689,169,812,196"/>
<area shape="rect" id="node13" href="TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="541,169,665,196"/>
<area shape="rect" id="node14" href="TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="207,319,340,345"/>
<area shape="rect" id="node15" href="AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="615,95,809,121"/>
<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"/>
<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"/>
<area shape="rect" id="node8" href="FCString_8h_source.html" title="FCString.h" alt="" coords="687,468,772,495"/>
<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"/>
</map>
</div>
</div>
Expand All @@ -112,7 +112,7 @@
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memItemLeft" align="right" valign="top"><a id="a87cbb10969eff63f8ae66afc4e9457eb"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;000500</td></tr>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;000501</td></tr>
<tr class="separator:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
Expand Down
28 changes: 14 additions & 14 deletions docs/html/AUnitVerbose_8h__incl.map
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<map id="/home/brian/dev/AUnit/src/AUnitVerbose.h" name="/home/brian/dev/AUnit/src/AUnitVerbose.h">
<area shape="rect" id="node2" href="$Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="316,468,436,495"/>
<area shape="rect" id="node4" href="$Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="44,95,163,121"/>
<area shape="rect" id="node6" href="$Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="239,319,342,345"/>
<area shape="rect" id="node7" href="$Test_8h_source.html" title="aunit/Test.h" alt="" coords="389,393,480,420"/>
<area shape="rect" id="node9" href="$Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="366,319,486,345"/>
<area shape="rect" id="node12" href="$MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="340,244,489,271"/>
<area shape="rect" id="node13" href="$TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="721,169,844,196"/>
<area shape="rect" id="node14" href="$TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="415,169,539,196"/>
<area shape="rect" id="node15" href="$TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="561,319,694,345"/>
<area shape="rect" id="node16" href="$AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="546,95,741,121"/>
<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"/>
<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"/>
<area shape="rect" id="node8" href="$FCString_8h_source.html" title="FCString.h" alt="" coords="689,468,774,495"/>
<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"/>
<area shape="rect" id="node2" href="$Verbosity_8h_source.html" title="aunit/Verbosity.h" alt="" coords="391,468,511,495"/>
<area shape="rect" id="node4" href="$Compare_8h_source.html" title="aunit/Compare.h" alt="" coords="45,95,163,121"/>
<area shape="rect" id="node6" href="$Printer_8h_source.html" title="aunit/Printer.h" alt="" coords="365,319,467,345"/>
<area shape="rect" id="node7" href="$Test_8h_source.html" title="aunit/Test.h" alt="" coords="439,393,529,420"/>
<area shape="rect" id="node9" href="$Assertion_8h_source.html" title="aunit/Assertion.h" alt="" coords="492,319,612,345"/>
<area shape="rect" id="node11" href="$MetaAssertion_8h_source.html" title="aunit/MetaAssertion.h" alt="" coords="463,244,612,271"/>
<area shape="rect" id="node12" href="$TestOnce_8h_source.html" title="aunit/TestOnce.h" alt="" coords="689,169,812,196"/>
<area shape="rect" id="node13" href="$TestAgain_8h_source.html" title="aunit/TestAgain.h" alt="" coords="541,169,665,196"/>
<area shape="rect" id="node14" href="$TestRunner_8h_source.html" title="aunit/TestRunner.h" alt="" coords="207,319,340,345"/>
<area shape="rect" id="node15" href="$AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h. " alt="" coords="615,95,809,121"/>
<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"/>
<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"/>
<area shape="rect" id="node8" href="$FCString_8h_source.html" title="FCString.h" alt="" coords="687,468,772,495"/>
<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"/>
</map>
2 changes: 1 addition & 1 deletion docs/html/AUnitVerbose_8h__incl.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dd1d0ed32d54834939a1889af843be14
044106ba5bbe5761f934b018fc950f1a
Binary file modified docs/html/AUnitVerbose_8h__incl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0a84107

Please sign in to comment.