Skip to content

Commit e2858c6

Browse files
authored
Merge pull request #94 from bxparks/develop
merge 1.7.0 into master
2 parents df1fb40 + 354f4e2 commit e2858c6

File tree

248 files changed

+4147
-3747
lines changed

Some content is hidden

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

248 files changed

+4147
-3747
lines changed

.github/workflows/aunit_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ on: [push]
55
jobs:
66
build:
77

8-
runs-on: ubuntu-20.04
8+
runs-on: ubuntu-latest
99

1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v3
1212

1313
- name: Setup
1414
run: |

CHANGELOG.md

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

33
* Unreleased
4+
* 1.7.0 (2022-12-08)
5+
* **Potentially Breaking** Change format of assertion failure message from:
6+
* "Assertion failed: (expected=3) == (counter=4), file AUnitTest.ino,
7+
line 134.", to
8+
* "AUnitTest.ino:134: Assertion failed: (expected=3) == (counter=4)."
9+
* This format is compatible with various Linux/MacOS/Unix command line
10+
tools, in particular, the `vim` editor.
11+
* When used with EpoxyDuino, this message format allows the `vim` editor
12+
to jump directly to the file and line where the assertion failure
13+
occurred.
414
* 1.6.1 (2022-02-02)
515
* Upgrade tool chain.
616
* Arduino IDE from 1.8.13 to 1.8.19

README.md

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ instead of having to go through the Arduino IDE. Both the AUniter and
2020
EpoxyDuino tools can be used in a continuous integration system like Jenkins,
2121
or with [GitHub Actions](https://github.com/features/actions).
2222

23-
**Version**: 1.6.1 (2022-02-02)
23+
**Version**: 1.7.0 (2022-12-08)
2424

2525
**Changelog**: [CHANGELOG.md](CHANGELOG.md)
2626

@@ -40,6 +40,7 @@ or with [GitHub Actions](https://github.com/features/actions).
4040
* [Defining the Tests](#DefiningTests)
4141
* [Generated Class and Instance Names](#GeneratedClass)
4242
* [Binary Assertions](#BinaryAssertions)
43+
* [Assertion Message Format](#AssertionMessageFormat)
4344
* [Supported Parameter Types](#SupportedParameterTypes)
4445
* [Parameter Types Must Match](#ParameterTypesMustMatch)
4546
* [Pointer Comparisons](#PointerComparisons)
@@ -501,6 +502,35 @@ are available. These are essentially identical to ArduinoUnit:
501502
* `assertLessOrEqual(a, b)`
502503
* `assertMoreOrEqual(a, b)`
503504
505+
<a name="AssertionMessageFormat"></a>
506+
#### Assertion Message Format
507+
508+
When the assertion passes, nothing is printed by default. This can be controlled
509+
by the `TestRunner::setVerbosity()` method. See [Controlling
510+
Verbosity](#ControllingVerbosity).
511+
512+
When the assertion fails, an error message of the following format is printed:
513+
514+
```
515+
SampleTest.ino:10: Assertion failed: (2) == (1)
516+
```
517+
518+
The format of the assertion failure messages was changed in v1.7 to the
519+
following:
520+
```
521+
{filName}:{lineNumber}: Assertion failed: {expression}
522+
```
523+
524+
This format is a widely used in many other programs, for example, the C compiler
525+
`gcc`, the C++ compiler `g++`, the Python 3 interpreter `python3`, `grep`, and
526+
the GNU Make program `make`. In particular, the
527+
[quickfix](https://vimhelp.org/quickfix.txt.html) feature in the `vim` text
528+
editor can parse this error format and jump directly to the `fileName` and
529+
`lineNumber` indicated by the error message. See the instructions in
530+
[EpoxyDuino](https://github.com/bxparks/EpoxyDuino) to see how to run unit tests
531+
on a Linux or MacOS machine inside the `vim` editor so that the editor jumps
532+
directly to the files and line numbers where the assertion failure occurred.
533+
504534
<a name="SupportedParameterTypes"></a>
505535
#### Supported Parameter Types
506536
@@ -527,7 +557,7 @@ following 18 combinations for their parameter types:
527557
* `(const __FlashStringHelper*, const String&)`
528558
* `(const __FlashStringHelper*, const __FlashStringHelper*)`
529559
530-
The `assertEqual()` and `assertNotEqual()` support arbitary pointer types
560+
The `assertEqual()` and `assertNotEqual()` support arbitrary pointer types
531561
through implicit casts to `const void*`:
532562
533563
* `(const void*, const void*)` (since v1.4)
@@ -643,7 +673,7 @@ test(voidPointer) {
643673

644674
This test will fail with the following error message:
645675
```
646-
Assertion failed: (aa=0x3FFFFF38) == (bb=0x3FFFFF30), file AUnitTest.ino, line 338.
676+
AUnitTest.ino:338: Assertion failed: (aa=0x3FFFFF38) == (bb=0x3FFFFF30).
647677
Test voidPointer failed.
648678
```
649679

@@ -659,7 +689,7 @@ test(nullPointer) {
659689
This will print the following:
660690
661691
```
662-
Assertion failed: (aa=0x3FFFFF58) == (nullptr=0x0), file AUnitTest.ino, line 348.
692+
AUnitTest.ino:348: Assertion failed: (aa=0x3FFFFF58) == (nullptr=0x0).
663693
Test nullPointer failed.
664694
```
665695
@@ -721,8 +751,8 @@ AUnit offers only the equivalent of `ASSERT_NEAR()` function:
721751

722752
Upon failure, the error messages will look something like:
723753
```
724-
Assertion failed: |(1.00) - (1.10)| > (0.20), file AUnitTest.ino, line 517.
725-
Assertion failed: |(4.00) - (1.10)| <= (0.20), file AUnitTest.ino, line 527.
754+
AUnitTest.ino:517: Assertion failed: |(1.00) - (1.10)| > (0.20).
755+
AUnitTest.ino:527: Assertion failed: |(4.00) - (1.10)| <= (0.20).
726756
```
727757

728758
Unlike Google Test where `ASSERT_NEAR()` supports only the `double` type, both
@@ -944,10 +974,10 @@ and returns a `bool`. The execution continues even if `false`.
944974
The `assertTestXxx()` methods stops the unit test if the status check
945975
returns `false`, and prints assertion messages that look like this:
946976
```
947-
Assertion passed: Test slow_pass is done, file AUnitTest.ino, line 366.
948-
Assertion passed: Test slow_pass is not failed, file AUnitTest.ino, line 372.
949-
Assertion passed: Test slow_skip is skipped, file AUnitTest.ino, line 448.
950-
Assertion passed: Test slow_skip is not timed out, file AUnitTest.ino, line 451.
977+
AUnitTest.ino:366: Assertion passed: Test slow_pass is done.
978+
AUnitTest.ino:372: Assertion passed: Test slow_pass is not failed.
979+
AUnitTest.ino:448: Assertion passed: Test slow_skip is skipped.
980+
AUnitTest.ino:451: Assertion passed: Test slow_skip is not timed out.
951981
```
952982
(The human readable version of being `expired` will always be `timed out` or
953983
`not timed out` on the `Serial` output.)
@@ -966,8 +996,7 @@ available in AUnit. Also, the assertion messages are different. ArduinoUnit
966996
reuses the format used by the `assertXxx()` macros, so prints something like
967997
the following:_
968998
```
969-
Assertion passed: (test_slow_skip_instance.state=2) >= (Test::DONE_SKIP=2), file
970-
AUnitTest.ino, line 439.
999+
AUnitTest.ino:439: Assertion passed: (test_slow_skip_instance.state=2) >= (Test::DONE_SKIP=2).
9711000
```
9721001
9731002
_AUnit has a separate message handler to print a customized message for the
@@ -988,10 +1017,10 @@ fails.
9881017
9891018
The messages look like:
9901019
```
991-
Status passed, file AUnitTest.ino, line 360.
992-
Status failed, file AUnitTest.ino, line 378.
993-
Status skipped, file AUnitTest.ino, line 380.
994-
Status timed out, file AUnitTest.ino, line 391.
1020+
AUnitTest.ino:360: Status passed.
1021+
AUnitTest.ino:378: Status failed.
1022+
AUnitTest.ino:380: Status skipped.
1023+
AUnitTest.ino:391: Status timed out.
9951024
```
9961025
9971026
The following methods on the `Test` class also set the `status` of the test, but
@@ -1242,15 +1271,15 @@ assertEquals(expected, counter);
12421271
12431272
The error message (if enabled, which is the default) is:
12441273
```
1245-
Assertion failed: (3) == (4), file AUnitTest.ino, line 134.
1274+
AUnitTest.ino:134: Assertion failed: (3) == (4).
12461275
```
12471276
12481277
Asserts with `bool` values produce customized messages, printing "true" or
12491278
"false" instead of using the Print class default conversion to `int`:
12501279
```C++
12511280
assertEquals(true, false);
12521281
1253-
Assertion failed: (true) == (false), file AUnitTest.ino, line 134.
1282+
AUnitTest.ino:134: Assertion failed: (true) == (false).
12541283
```
12551284

12561285
Similarly, the `assertTrue()` and `assertFalse()` macros provide more customized
@@ -1259,23 +1288,23 @@ messages:
12591288
bool ok = false;
12601289
assertTrue(ok);
12611290

1262-
Assertion failed: (false) is true, file AUnitTest.ino, line 134.
1291+
AUnitTest.ino:134: Assertion failed: (false) is true.
12631292
```
12641293
12651294
and
12661295
```C++
12671296
bool ok = true;
12681297
assertFalse(ok);
12691298
1270-
Assertion failed: (true) is false, file AUnitTest.ino, line 134.
1299+
AUnitTest.ino:134: Assertion failed: (true) is false.
12711300
```
12721301

12731302
***ArduinoUnit Compatibility***:
12741303
_ArduinoUnit captures the arguments of the `assertEqual()` macro
12751304
and prints:_
12761305

12771306
```
1278-
Assertion failed: (expected=3) == (counter=4), file AUnitTest.ino, line 134.
1307+
AUnitTest.ino:134: Assertion failed: (expected=3) == (counter=4).
12791308
```
12801309

12811310
_Each capture of the parameter string consumes flash memory space. If the unit
@@ -1297,13 +1326,20 @@ the assertion message will contain the string fragments of the arguments
12971326
passed into the `assertXxx()` macros, like this:
12981327

12991328
```
1300-
Assertion failed: (expected=3) == (counter=4), file AUnitTest.ino, line 134.
1301-
Assertion failed: (ok=false) is true, file AUnitTest.ino, line 134.
1329+
AUnitTest.ino:134: Assertion failed: (expected=3) == (counter=4).
1330+
AUnitTest.ino:134: Assertion failed: (ok=false) is true.
1331+
```
1332+
1333+
instead of:
1334+
1335+
```
1336+
AUnitTest.ino:134: Assertion failed: (3) == (4).
1337+
AUnitTest.ino:134: Assertion failed: (false) is true.
13021338
```
13031339

13041340
***ArduinoUnit Compatibility***:
1305-
_The verbose mode produces the same messages as ArduinoUnit, at the cost of
1306-
increased flash memory usage._
1341+
_As of v1.7, the assertion message format is compatible with the vim editor
1342+
and other Linux/MacOS/Unix tools, and no longer compatible with ArduinoUnit
13071343

13081344
<a name="TestCaseSummary"></a>
13091345
#### Test Case Summary

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.6.1
41+
PROJECT_NUMBER = 1.7.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: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
55
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6-
<meta name="generator" content="Doxygen 1.8.17"/>
6+
<meta name="generator" content="Doxygen 1.9.1"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
88
<title>AUnit: /home/brian/src/AUnit/src/AUnitVerbose.h File Reference</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
@@ -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.6.0</span>
25+
&#160;<span id="projectnumber">1.7.0</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -31,10 +31,10 @@
3131
</table>
3232
</div>
3333
<!-- end header part -->
34-
<!-- Generated by Doxygen 1.8.17 -->
34+
<!-- Generated by Doxygen 1.9.1 -->
3535
<script type="text/javascript">
3636
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
37-
var searchBox = new SearchBox("searchBox", "search",false,'Search');
37+
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
3838
/* @license-end */
3939
</script>
4040
<script type="text/javascript" src="menudata.js"></script>
@@ -73,6 +73,9 @@
7373
<div class="title">AUnitVerbose.h File Reference</div> </div>
7474
</div><!--header-->
7575
<div class="contents">
76+
77+
<p>Same as <a class="el" href="AUnit_8h.html" title="Same as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided.">AUnit.h</a> except that the verbose versions of the various assertXxx() macros are provided.
78+
<a href="#details">More...</a></p>
7679
<div class="textblock"><code>#include &quot;<a class="el" href="print64_8h_source.html">aunit/print64.h</a>&quot;</code><br />
7780
<code>#include &quot;aunit/Verbosity.h&quot;</code><br />
7881
<code>#include &quot;<a class="el" href="Compare_8h_source.html">aunit/Compare.h</a>&quot;</code><br />
@@ -89,27 +92,27 @@
8992
</div><div class="textblock"><div class="dynheader">
9093
Include dependency graph for AUnitVerbose.h:</div>
9194
<div class="dyncontent">
92-
<div class="center"><img src="AUnitVerbose_8h__incl.png" border="0" usemap="#_2home_2brian_2src_2AUnit_2src_2AUnitVerbose_8h" alt=""/></div>
93-
<map name="_2home_2brian_2src_2AUnit_2src_2AUnitVerbose_8h" id="_2home_2brian_2src_2AUnit_2src_2AUnitVerbose_8h">
94-
<area shape="rect" title=" " alt="" coords="436,5,599,47"/>
95-
<area shape="rect" href="print64_8h.html" title=" " alt="" coords="5,95,123,121"/>
95+
<div class="center"><img src="AUnitVerbose_8h__incl.png" border="0" usemap="#a_2home_2brian_2src_2AUnit_2src_2AUnitVerbose_8h" alt=""/></div>
96+
<map name="a_2home_2brian_2src_2AUnit_2src_2AUnitVerbose_8h" id="a_2home_2brian_2src_2AUnit_2src_2AUnitVerbose_8h">
97+
<area shape="rect" title="Same as AUnit.h except that the verbose versions of the various assertXxx() macros are provided." alt="" coords="436,5,599,47"/>
98+
<area shape="rect" href="print64_8h.html" title="Helper routines to print &#39;long long&#39; and &#39;unsigned long long&#39; because the Print::print() methods in P..." alt="" coords="5,95,123,121"/>
9699
<area shape="rect" href="Verbosity_8h_source.html" title=" " alt="" coords="512,468,643,495"/>
97-
<area shape="rect" href="Compare_8h.html" title=" " alt="" coords="197,244,328,271"/>
100+
<area shape="rect" href="Compare_8h.html" title="This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a,..." alt="" coords="197,244,328,271"/>
98101
<area shape="rect" href="Printer_8h_source.html" title=" " alt="" coords="390,319,503,345"/>
99102
<area shape="rect" href="Test_8h_source.html" title=" " alt="" coords="563,393,661,420"/>
100103
<area shape="rect" href="Assertion_8h_source.html" title=" " alt="" coords="579,319,711,345"/>
101104
<area shape="rect" href="MetaAssertion_8h_source.html" title=" " alt="" coords="555,244,720,271"/>
102105
<area shape="rect" href="TestOnce_8h_source.html" title=" " alt="" coords="765,169,896,196"/>
103106
<area shape="rect" href="TestAgain_8h_source.html" title=" " alt="" coords="921,169,1055,196"/>
104107
<area shape="rect" href="TestRunner_8h_source.html" title=" " alt="" coords="555,95,698,121"/>
105-
<area shape="rect" href="AssertVerboseMacros_8h.html" title=" " alt="" coords="824,95,1035,121"/>
106-
<area shape="rect" href="MetaAssertMacros_8h.html" title=" " alt="" coords="997,244,1189,271"/>
107-
<area shape="rect" href="TestMacros_8h.html" title=" " alt="" coords="1131,95,1275,121"/>
108+
<area shape="rect" href="AssertVerboseMacros_8h.html" title="Verbose versions of the macros in AssertMacros.h." alt="" coords="824,95,1035,121"/>
109+
<area shape="rect" href="MetaAssertMacros_8h.html" title="Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t..." alt="" coords="997,244,1189,271"/>
110+
<area shape="rect" href="TestMacros_8h.html" title="Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(),..." alt="" coords="1131,95,1275,121"/>
108111
<area shape="rect" title=" " alt="" coords="225,543,300,569"/>
109112
<area shape="rect" title=" " alt="" coords="8,169,72,196"/>
110113
<area shape="rect" title=" " alt="" coords="778,543,849,569"/>
111114
<area shape="rect" href="FCString_8h_source.html" title=" " alt="" coords="769,468,858,495"/>
112-
<area shape="rect" href="Flash_8h.html" title=" " alt="" coords="1059,393,1128,420"/>
115+
<area shape="rect" href="Flash_8h.html" title="Various macros to smooth over the differences among the various platforms with regards to their suppo..." alt="" coords="1059,393,1128,420"/>
113116
<area shape="rect" title=" " alt="" coords="1030,468,1157,495"/>
114117
<area shape="rect" title=" " alt="" coords="657,169,741,196"/>
115118
</map>
@@ -120,22 +123,21 @@
120123
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
121124
Macros</h2></td></tr>
122125
<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;10600</td></tr>
126+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;10700</td></tr>
124127
<tr class="separator:a87cbb10969eff63f8ae66afc4e9457eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
125128
<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.6.0&quot;</td></tr>
129+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION_STRING</b>&#160;&#160;&#160;&quot;1.7.0&quot;</td></tr>
127130
<tr class="separator:a70ade1487f0d9d7172f24897cd0f2dd5"><td class="memSeparator" colspan="2">&#160;</td></tr>
128131
</table>
129132
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
130-
<div class="textblock"><p>Same as <a class="el" href="AUnit_8h.html">AUnit.h</a> except that the verbose versions of the various assertXxx() macros are provided. These capture the strings of the actual arguments in the assert macros and print more verbose and helpful messages in the same format used by ArduinoUnit. The cost is 20-25% increase in flash memory to hold those strings for medium to large unit tests. </p>
133+
<div class="textblock"><p>Same as <a class="el" href="AUnit_8h.html" title="Same as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided.">AUnit.h</a> except that the verbose versions of the various assertXxx() macros are provided. </p>
134+
<p>These capture the strings of the actual arguments in the assert macros and print more verbose and helpful messages in the same format used by ArduinoUnit. The cost is 20-25% increase in flash memory to hold those strings for medium to large unit tests. </p>
131135

132136
<p class="definition">Definition in file <a class="el" href="AUnitVerbose_8h_source.html">AUnitVerbose.h</a>.</p>
133137
</div></div><!-- contents -->
134138
<!-- start footer part -->
135139
<hr class="footer"/><address class="footer"><small>
136-
Generated by &#160;<a href="http://www.doxygen.org/index.html">
137-
<img class="footer" src="doxygen.png" alt="doxygen"/>
138-
</a> 1.8.17
140+
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
139141
</small></address>
140142
</body>
141143
</html>

0 commit comments

Comments
 (0)