Skip to content

Commit 65df58b

Browse files
authored
Merge pull request #78 from bxparks/develop
merge v1.6.0 into master
2 parents ebd0aac + fb9b87d commit 65df58b

File tree

155 files changed

+2925
-1751
lines changed

Some content is hidden

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

155 files changed

+2925
-1751
lines changed

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
# Changelog
22

33
* Unreleased
4+
* 1.6.0 (2021-11-02)
5+
* Add `TestRunner::includesub(word)` and `TestRunner::excludesub(word)`
6+
which includes or excludes tests based on the substring match on the
7+
`word`.
8+
* Call `excludeAll()` if the first filtering request is an `include()` or
9+
`includesub()`.
10+
* Otherwise, the first include request does not do anything.
11+
* Add command line flags and arguments when compiled under EpoxyDuino.
12+
See [Command Line Flags and
13+
Arguments](README.md#CommandLineFlagsAndArguments) in the README.md for
14+
full details. Fixes
15+
[Issue#76](https://github.com/bxparks/AUnit/issues/76).
16+
* `--include pattern,...`
17+
* Calls `TestRunner::include(pattern)` on each `pattern` in the
18+
comma-separated list.
19+
* `--exclude pattern,...`
20+
* Calls `TestRunner::exclude(pattern)` on each `pattern` in the
21+
comma-separated list.
22+
* `--includesub substring,...`
23+
* Calls `TestRunner::includesub(substring)` on each `substring` in
24+
the comma-separated list.
25+
* `--excludesub substring,...`
26+
* Calls `TestRunner::excludesub(substring)` on each `substring` in
27+
the comma-separated list.
28+
* `substring ...`
29+
* Any remaining **space**-separated list of words are processed
30+
using `TestRunner::includesub(substring)`.
431
* 1.5.5 (2021-05-03)
532
* Prevent accidental inclusion of `HardwareSerial` class (via the `Serial`
633
global variable). Remove reference to `SERIAL_PORT_MONITOR` from

README.md

Lines changed: 120 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
[![AUnit Tests](https://github.com/bxparks/AUnit/actions/workflows/aunit_tests.yml/badge.svg)](https://github.com/bxparks/AUnit/actions/workflows/aunit_tests.yml)
44

5-
**New**: [GitHub Discussions](https://github.com/bxparks/AUnit/discussions)
6-
for this project is now active! Let's use that for general support questions,
7-
and reserve the [GitHub Issues](https://github.com/bxparks/AUnit/issues)
8-
section for bugs and feature requests.
9-
105
A unit testing framework for Arduino platforms inspired by by
116
[ArduinoUnit](https://github.com/mmurdoch/arduinounit) and [Google
127
Test](https://github.com/google/googletest/). The unit tests usually run on the
@@ -16,7 +11,7 @@ natively on Linux or MacOS using the
1611
[EpoxyDuino](https://github.com/bxparks/EpoxyDuino) companion project.
1712

1813
AUnit is almost a drop-in replacement of ArduinoUnit with some advantages. AUnit
19-
supports timeouts and test fixtures. It somtimes consumes 50% less flash memory
14+
supports timeouts and test fixtures. It sometimes consumes 50% less flash memory
2015
on the AVR platform, and it has been tested to work on the AVR, SAMD21, STM32,
2116
ESP8266, ESP32 and Teensy platforms. Another companion project
2217
[AUniter](https://github.com/bxparks/AUniter) project provides command line
@@ -25,7 +20,7 @@ instead of having to go through the Arduino IDE. Both the AUniter and
2520
EpoxyDuino tools can be used in a continuous integration system like Jenkins,
2621
or with [GitHub Actions](https://github.com/features/actions).
2722

28-
**Version**: 1.5.5 (2021-05-03)
23+
**Version**: 1.6 (2021-11-02)
2924

3025
**Changelog**: [CHANGELOG.md](CHANGELOG.md)
3126

@@ -57,7 +52,7 @@ or with [GitHub Actions](https://github.com/features/actions).
5752
* [Unconditional Termination](#UnconditionalTermination)
5853
* [Overridable Methods](#OverridableMethods)
5954
* [Running the Tests](#RunningTests)
60-
* [Filering Test Cases](#FilteringTestCases)
55+
* [Filtering Test Cases](#FilteringTestCases)
6156
* [Output Printer](#OutputPrinter)
6257
* [Controlling Verbosity](#ControllingVerbosity)
6358
* [Line Number Mismatch](#LineNumberMismatch)
@@ -71,11 +66,12 @@ or with [GitHub Actions](https://github.com/features/actions).
7166
* [Command Line Tools](#CommandLineTools)
7267
* [AUniter](#AUniter)
7368
* [EpoxyDuino](#EpoxyDuino)
69+
* [Command Line Flags and Arguments](#CommandLineFlagsAndArguments)
7470
* [Continuous Integration](#ContinuousIntegration)
7571
* [Arduino IDE/CLI + Cloud](#IdePlusCloud)
7672
* [Arduino IDE/CLI + Jenkins](#IdePlusJenkins)
7773
* [EpoxyDuino + Jenkins](#EpoxyDuinoPlusJenkins)
78-
* [EpoxyDuino + Cloud (Recommmended)](#EpoxyDuinoPlusCloud)
74+
* [EpoxyDuino + Cloud (Recommended)](#EpoxyDuinoPlusCloud)
7975
* [Tips](#Tips)
8076
* [Debugging Assertions in Fixtures](#DebuggingFixtures)
8177
* [Class Hierarchy](#ClassHierarchy)
@@ -652,7 +648,7 @@ test(nullPointer) {
652648
}
653649
```
654650
655-
prints the following:
651+
This will print the following:
656652
657653
```
658654
Assertion failed: (aa=0x3FFFFF58) == (nullptr=0x0), file AUnitTest.ino, line 348.
@@ -710,7 +706,7 @@ errors. Google Test provides
710706
`a` and `b` is within the given `error`
711707

712708
Since floating point operations are relatively rare in Arduino programming,
713-
AUnit offers only the equilvalent of `ASSERT_NEAR()` function:
709+
AUnit offers only the equivalent of `ASSERT_NEAR()` function:
714710

715711
* `assertNear(a, b, error)`
716712
* `assertNotNear(a, b, error)`
@@ -761,7 +757,7 @@ The following boolean asserts are also available:
761757

762758
When the unit tests become more complex, using test fixtures will allow you to
763759
place common data objects and methods into a class that can be shared among
764-
multiple test cases. This concept matches very closely to the the test fixtures
760+
multiple test cases. This concept matches very closely to the test fixtures
765761
in
766762
[Google Test](https://github.com/google/googletest/blob/master/googletest/docs/Primer.md).
767763

@@ -1056,32 +1052,45 @@ only a single test case, then returns._
10561052
<a name="FilteringTestCases"></a>
10571053
### Filtering Test Cases
10581054

1059-
We can `exclude()` or `include()` test cases using a pattern match:
1060-
1061-
* `TestRunner::exclude(pattern)`
1062-
* `TestRunner::exclude(testClass, pattern)`
1063-
* `TestRunner::include(pattern)`
1064-
* `TestRunner::include(testClass, pattern)`
1055+
Six filtering methods are available on the `TestRunner` class:
1056+
* `TestRunner::include(pattern)` - prefix match
1057+
* `TestRunner::include(testClass, pattern)` - prefix match
1058+
* `TestRunner::exclude(pattern)` - prefix match
1059+
* `TestRunner::exclude(testClass, pattern)` - prefix match
1060+
* `TestRunner::includesub(substring)` - substring match (v1.6)
1061+
* `TestRunner::excludesub(substring)` - substring match (v1.6)
10651062

1066-
These methods are called from the global `setup()` method:
1063+
These methods are called from the global `setup()` method, for example:
10671064

10681065
```C++
10691066
void setup() {
1070-
TestRunner::exclude("*");
10711067
TestRunner::include("looping*");
10721068
TestRunner::exclude("CustomTestAgain", "*");
10731069
TestRunner::include("CustomTestAgain", "test*");
1070+
TestRunner::include("CustomTestAgain", "test*");
1071+
TestRunner::includesub("net");
1072+
TestRunner::excludesub("net");
10741073
...
10751074
}
10761075
```
10771076

1078-
Excluded tests bypass their `setup()` and `teardown()` methods and terminate
1079-
immidiately. For the purposes of reporting, however, excluded tests are
1080-
counted as "skipped".
1077+
Excluded tests bypass their `Test::setup()` and `Test::teardown()` methods and
1078+
terminate immediately. For the purposes of reporting, excluded tests are counted
1079+
as "skipped".
10811080

10821081
The 2-argument versions of `include()` and `exclude()` correspond to the
10831082
2 arguments of `testF()` and `testingF()`.
10841083

1084+
The filtering methods are also available as command line flags and arguments
1085+
(`--include`, `--exclude`, `--includesub` `--excludesub`) if the test
1086+
program is compiled using EpoxyDuino under a Unix-like environment. See
1087+
the [EpoxyDuino](#EpoxyDuino) section below.
1088+
1089+
**Implicit Exclude All**: If the *first* filtering request is an "include" (i.e.
1090+
`include(pattern)`, `include(testClass, pattern)`, `includesub(substring)`),
1091+
all tests are excluded by default initially, instead of being included by
1092+
default. Otherwise, the first "include" statement would have no effect.
1093+
10851094
***ArduinoUnit Compatibility***:
10861095
_The equivalent versions in ArduinoUnit are `Test::exclude()` and
10871096
`Test::include()` The matching algorithm in AUnit is not as powerful as the one
@@ -1398,7 +1407,7 @@ or
13981407
## Command Line Tools
13991408

14001409
Each unit test is an independent `*.ino` program. You can run it using your
1401-
Ardunio IDE. But there are 2 command line tools that can be used to run them.
1410+
Arduino IDE. But there are 2 command line tools that can be used to run them.
14021411

14031412
<a name="AUniter"></a>
14041413
### AUniter
@@ -1490,6 +1499,65 @@ EpoxyDuino, the test program will terminate at the end through the
14901499
will call `exit(0)`. If there are any failing tests (i.e. failed or timed out),
14911500
it will call `exit(1)`.
14921501
1502+
<a name="CommandLineFlagsAndArguments"></a>
1503+
### Command Line Flags and Arguments
1504+
1505+
(Added in v1.6)
1506+
1507+
The standard Arduino environment does not provide command line arguments, since
1508+
a microcontroller does not normally provide a command line environment. However,
1509+
if the AUnit test program is compiled under EpoxyDuino, the standard Unix
1510+
command line parameters (`argc` and `argv`) become available through the
1511+
`extern int epoxy_argc` and `extern const char* const* epoxy_argv` global
1512+
variables. These allow the `TestRunner` class to provide command line flags and
1513+
arguments as follows:
1514+
1515+
```bash
1516+
$ ./test.out --help
1517+
Usage: ./test.out [--help] [--include pattern,...] [--exclude pattern,...]
1518+
[--includesub substring,...] [--excludesub substring,...]
1519+
[--] [substring ...]
1520+
```
1521+
1522+
Example, the following runs all tests with substring "net" or "led" in its
1523+
name, and skips all others:
1524+
1525+
```bash
1526+
$ ./test.out net led
1527+
```
1528+
1529+
Flags:
1530+
1531+
* `--include pattern,...`
1532+
* Comma-separated list of patterns to pass to the
1533+
`TestRunner::include(pattern)` method
1534+
* `--exclude pattern,...`
1535+
* Comma-separated list of patterns to pass to the
1536+
`TestRunner::exclude(pattern)` method
1537+
* `--includesub substring,...`
1538+
* Comma-separated list of substrings to pass to the
1539+
`TestRunner::includesub(substring)` method
1540+
* `--excludesub substring,...`
1541+
* Comma-separated list of substrings to pass to the
1542+
`TestRunner::excludesub(substring)` method
1543+
1544+
Arguments:
1545+
1546+
* Any **Space**-separated list of words after the optional flags are passed to
1547+
the `TestRunner::includesub(substring)` method.
1548+
1549+
The command line flags and arguments are processed *after* any hardcoded calls
1550+
to `TestRunner::include()` and `TestRunner::exclude()` methods in the global
1551+
`setup()` method.
1552+
1553+
The flags and command line arguments are processed *in order* of appearance
1554+
on the command line.
1555+
1556+
Similar to the hardcoded calls to `TestRunner::include()` and
1557+
`TestRunner::exclude()`, if the first command line flag is an `--include` or
1558+
`--includesub`, then all tests are *excluded* by default initially. Otherwise,
1559+
the first include flag would have no effect.
1560+
14931561
<a name="ContinuousIntegration"></a>
14941562
## Continuous Integration
14951563

@@ -1542,7 +1610,7 @@ Although I think it's theoretically possible, I have never actually verified
15421610
that this can be done.
15431611

15441612
<a name="IdePlusJenkins"></a>
1545-
### Arduion IDE/CLI + Jenkins
1613+
### Arduino IDE/CLI + Jenkins
15461614

15471615
This setup is described in [Continuous Integration with
15481616
Jenkins](https://github.com/bxparks/AUniter/tree/develop/jenkins), and it worked
@@ -1835,15 +1903,15 @@ I will occasionally test on the following hardware as a sanity check:
18351903

18361904
The following boards are **not** supported:
18371905

1838-
* megaAVR (e.g. Nano Every) using ArduinoCore-megaavr
1839-
(https://github.com/arduino/ArduinoCore-megaavr/)
1840-
* SAMD21 boards (e.g. MKRZero) using ArduinoCore-samd
1841-
(https://github.com/arduino/ArduinoCore-samd) starting with
1842-
`arduino:samd` version >= 1.8.10
1843-
* Raspberry Pi Pico (RP2040) using Arduino-Pico
1844-
(https://github.com/earlephilhower/arduino-pico)
1845-
* Any other platform using the ArduinoCore-API
1846-
(https://github.com/arduino/ArduinoCore-api)
1906+
* Any platform using the ArduinoCore-API
1907+
(https://github.com/arduino/ArduinoCore-api), such as:
1908+
* megaAVR (e.g. Nano Every) using ArduinoCore-megaavr
1909+
(https://github.com/arduino/ArduinoCore-megaavr/)
1910+
* SAMD21 boards (e.g. MKRZero) using ArduinoCore-samd
1911+
(https://github.com/arduino/ArduinoCore-samd) starting with
1912+
`arduino:samd` version >= 1.8.10
1913+
* Raspberry Pi Pico (RP2040) using Arduino-Pico
1914+
(https://github.com/earlephilhower/arduino-pico)
18471915

18481916
<a name="ToolChain"></a>
18491917
### Tool Chain
@@ -1855,15 +1923,18 @@ This library was validated using:
18551923
* [Arduino SAMD Boards 1.8.9](https://github.com/arduino/ArduinoCore-samd)
18561924
* [SparkFun AVR Boards 1.1.13](https://github.com/sparkfun/Arduino_Boards)
18571925
* [SparkFun SAMD Boards 1.8.1](https://github.com/sparkfun/Arduino_Boards)
1858-
* [STM32duino 1.9.0](https://github.com/stm32duino/Arduino_Core_STM32)
1926+
* [STM32duino 2.0.0](https://github.com/stm32duino/Arduino_Core_STM32)
18591927
* [ESP8266 Arduino 2.7.4](https://github.com/esp8266/Arduino)
18601928
* [ESP32 Arduino 1.0.6](https://github.com/espressif/arduino-esp32)
1861-
* [Teensyduino 1.53](https://www.pjrc.com/teensy/td_download.html)
1929+
* [Teensyduino 1.54](https://www.pjrc.com/teensy/td_download.html)
18621930

18631931
This library is *not* compatible with:
1864-
* [Arduino SAMD Boards >=1.8.10](https://github.com/arduino/ArduinoCore-samd)
1865-
* [Arduino megaAVR](https://github.com/arduino/ArduinoCore-megaavr/)
1866-
* [MegaCoreX](https://github.com/MCUdude/MegaCoreX)
1932+
1933+
* Any platform using the
1934+
[ArduinoCore-API](https://github.com/arduino/ArduinoCore-api), for example:
1935+
* [Arduino SAMD Boards >=1.8.10](https://github.com/arduino/ArduinoCore-samd)
1936+
* [Arduino megaAVR](https://github.com/arduino/ArduinoCore-megaavr/)
1937+
* [MegaCoreX](https://github.com/MCUdude/MegaCoreX)
18671938

18681939
(See [Issue #56](https://github.com/bxparks/AUnit/issues/56)
18691940
and [Issue #66](https://github.com/bxparks/AUnit/issues/66)).
@@ -1874,7 +1945,8 @@ not tested it extensively.
18741945
<a name="OperatingSystem"></a>
18751946
### Operating System
18761947

1877-
I used MacOS 10.13.3, Ubuntu 18.04, and Ubuntu 20.04 for most of my development.
1948+
I use Ubuntu 20.04 for the vast majority of my development. I expect that the
1949+
library will work fine under MacOS and Windows, but I have not tested them.
18781950

18791951
<a name="License"></a>
18801952
## License
@@ -1884,18 +1956,14 @@ I used MacOS 10.13.3, Ubuntu 18.04, and Ubuntu 20.04 for most of my development.
18841956
<a name="FeedbackAndSupport"></a>
18851957
## Feedback and Support
18861958

1887-
If you find this library useful, consider starring this project on GitHub. The
1888-
stars will let me prioritize the more popular libraries over the less popular
1889-
ones.
1890-
1891-
If you have any questions, comments and other support questions about how to
1892-
use this library, please use the
1893-
[GitHub Discussions](https://github.com/bxparks/AUnit/discussions)
1894-
for this project. If you have bug reports or feature requests, please file a
1895-
ticket in [GitHub Issues](https://github.com/bxparks/AUnit/issues).
1896-
I'd love to hear about how this software and its documentation can be improved.
1897-
I can't promise that I will incorporate everything, but I will give your ideas
1898-
serious consideration.
1959+
If you have any questions, comments, or feature requests for this library,
1960+
please use the [GitHub
1961+
Discussions](https://github.com/bxparks/AUnit/discussions) for this project. If
1962+
you have bug reports, please file a ticket in [GitHub
1963+
Issues](https://github.com/bxparks/AUnit/issues). Feature requests should go
1964+
into Discussions first because they often have alternative solutions which are
1965+
useful to remain visible, instead of disappearing from the default view of the
1966+
Issue tracker after the ticket is closed.
18991967

19001968
Please refrain from emailing me directly unless the content is sensitive. The
19011969
problem with email is that I cannot reference the email conversation when other

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 = 1.5.5
41+
PROJECT_NUMBER = 1.6.0
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: 3 additions & 3 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">1.5.5</span>
25+
&#160;<span id="projectnumber">1.6.0</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -120,10 +120,10 @@
120120
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
121121
Macros</h2></td></tr>
122122
<tr class="memitem:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memItemLeft" align="right" valign="top"><a id="a87cbb10969eff63f8ae66afc4e9457eb"></a>
123-
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;10505</td></tr>
123+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;10600</td></tr>
124124
<tr class="separator:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
125125
<tr class="memitem:a70ade1487f0d9d7172f24897cd0f2dd5"><td class="memItemLeft" align="right" valign="top"><a id="a70ade1487f0d9d7172f24897cd0f2dd5"></a>
126-
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION_STRING</b>&#160;&#160;&#160;&quot;1.5.5&quot;</td></tr>
126+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION_STRING</b>&#160;&#160;&#160;&quot;1.6.0&quot;</td></tr>
127127
<tr class="separator:a70ade1487f0d9d7172f24897cd0f2dd5"><td class="memSeparator" colspan="2">&#160;</td></tr>
128128
</table>
129129
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>

docs/html/AUnitVerbose_8h_source.html

Lines changed: 3 additions & 3 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">1.5.5</span>
25+
&#160;<span id="projectnumber">1.6.0</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -124,8 +124,8 @@
124124
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="TestMacros_8h.html">aunit/TestMacros.h</a>&quot;</span></div>
125125
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; </div>
126126
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="comment">// Version format: xxyyzz == &quot;xx.yy.zz&quot;</span></div>
127-
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor">#define AUNIT_VERSION 10505</span></div>
128-
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#define AUNIT_VERSION_STRING &quot;1.5.5&quot;</span></div>
127+
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor">#define AUNIT_VERSION 10600</span></div>
128+
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#define AUNIT_VERSION_STRING &quot;1.6.0&quot;</span></div>
129129
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; </div>
130130
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160;<span class="preprocessor">#endif</span></div>
131131
</div><!-- fragment --></div><!-- contents -->

0 commit comments

Comments
 (0)