Skip to content

Commit 154a906

Browse files
authored
Merge pull request #71 from bxparks/develop
merge v1.5.4 into master
2 parents 659275a + 923c4a5 commit 154a906

File tree

149 files changed

+586
-492
lines changed

Some content is hidden

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

149 files changed

+586
-492
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Changelog
22

33
* Unreleased
4+
* 1.5.4 (2021-03-02)
5+
* Implement `assertNoFatalFailure(statement)` macro to prevent continued
6+
execution if `statement` contains assertion failures. Fixes
7+
[Issue #11](https://github.com/bxparks/AUnit/issues/11).
48
* 1.5.3 (2021-02-23)
59
* I botched the 1.5.2 release. Try again as 1.5.3.
610
* 1.5.2 (2021-02-23)
711
* Convert `examples/AUnitPlatformIO/src/AUnitPlatformIO.ino` from
812
a symlink to a regular file. The Arduino Library Manager apparently does
913
not allow symlinks (see
1014
https://github.com/arduino/Arduino/wiki/Library-Manager-FAQ). So when I
11-
created the symlink at v1.3 on 2019-06-05, the Library Manager stopped
15+
created the symlink at v1.3.1 on 2019-07-31, the Library Manager stopped
1216
updating the library for almost 2 years, until I removed the symlink at
1317
v1.5.2.
1418
* No functional change in this release.

README.md

Lines changed: 22 additions & 33 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.5.3 (2021-02-23)
23+
**Version**: 1.5.4 (2021-03-02)
2424

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

@@ -862,57 +862,46 @@ method only. The statement after the `assertCustomStuff()` will continue to
862862
execute.
863863

864864
In other words, in the following example, if the `assertCustomStuff()` fails,
865-
then `doStuff()` inside `testF()` will execute:
865+
then `assertMoreStuff()` inside `testF()` will execute:
866866

867867
```C++
868868
class CustomTestOnce: public TestOnce {
869869
protected:
870-
// optional
871-
void setup() override {
872-
TestOnce::setup();
873-
...setup code...
874-
}
875-
876-
// optional
877-
void teardown() override {
878-
...teardown code...
879-
TestOnce::teardown();
880-
}
881-
882870
void assertCustomStuff() {
883871
assertEqual(sharedValue, 3);
884872

885-
// This will not execute if the assertEqual() failed.
873+
// This will not execute if the assertEqual() above fails.
886874
assertLess(...);
887875
}
888876

877+
void assertMoreStuff() {
878+
assertEqual(...);
879+
}
880+
889881
int sharedValue;
890882
};
891883

892-
testF(CustomTestOnce, calculate) {
884+
// DON'T DO THIS
885+
testF(CustomTestOnce, dontDoThis) {
893886
assertCustomStuff();
894887

895-
// This will execute even if assertCustomStuff() failed.
896-
doStuff();
897-
898-
// This will immediately exit this method if assertCustomStuff() failed.
899-
assertTrue(true);
888+
// This will execute even if assertCustomStuff() fails.
889+
assertMoreStuff();
890+
}
900891

901-
// This will NOT execute if assertCustomStuff() failed.
902-
doMoreStuff();
892+
// DO THIS INSTEAD
893+
testF(CustomTestOnce, doThis) {
894+
assertNoFatalFailure(assertCustomStuff());
895+
assertNoFatalFailure(assertMoreStuff());
903896
}
904897
```
905898
906-
AUnit tries to mitigate this problem by having every `assertXxx()` macro
907-
perform a check to see if a previous assert statement raise an error condition
908-
for the test. If so, then the assert macro immediately exits. In the code above,
909-
`doMoreStuff()` will not execute, because the `assertNotEqual()` will immidately
910-
exit upon detecting the failure of `assertCustomStuff()`.
911-
912-
Google Test has a
913-
[ASSERT_NO_FATAL_FAILURE( statement)](https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md)
914-
macro that can guard against this possibility. AUnit does not have that macro,
915-
but we get the equivalent effect by doing a `assertTrue(true)` shown above.
899+
The solution is to use the `assertNoFatalFailure(statement)` macro which checks
900+
whether the inner `statement` returned with a fatal assertion. If so, then it
901+
returns immediately, preventing execution from continuing to the code that
902+
follows. This macro is modeled after the
903+
[ASSERT_NO_FATAL_FAILURE(statement)](https://github.com/google/googletest/blob/master/docs/advanced.md)
904+
macro in Google Test that provides the same functionality.
916905
917906
<a name="MetaAssertions"></a>
918907
### Meta Assertions

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.3
41+
PROJECT_NUMBER = 1.5.4
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.3</span>
25+
&#160;<span id="projectnumber">1.5.4</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;10503</td></tr>
123+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;10504</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.3&quot;</td></tr>
126+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION_STRING</b>&#160;&#160;&#160;&quot;1.5.4&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.3</span>
25+
&#160;<span id="projectnumber">1.5.4</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -122,8 +122,8 @@
122122
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="TestMacros_8h.html">aunit/TestMacros.h</a>&quot;</span></div>
123123
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; </div>
124124
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="comment">// Version format: xxyyzz == &quot;xx.yy.zz&quot;</span></div>
125-
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="preprocessor">#define AUNIT_VERSION 10503</span></div>
126-
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor">#define AUNIT_VERSION_STRING &quot;1.5.3&quot;</span></div>
125+
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="preprocessor">#define AUNIT_VERSION 10504</span></div>
126+
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor">#define AUNIT_VERSION_STRING &quot;1.5.4&quot;</span></div>
127127
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; </div>
128128
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#endif</span></div>
129129
</div><!-- fragment --></div><!-- contents -->

docs/html/AUnit_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.3</span>
25+
&#160;<span id="projectnumber">1.5.4</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;10503</td></tr>
123+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION</b>&#160;&#160;&#160;10504</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.3&quot;</td></tr>
126+
#define&#160;</td><td class="memItemRight" valign="bottom"><b>AUNIT_VERSION_STRING</b>&#160;&#160;&#160;&quot;1.5.4&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/AUnit_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.3</span>
25+
&#160;<span id="projectnumber">1.5.4</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -122,8 +122,8 @@
122122
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="TestMacros_8h.html">aunit/TestMacros.h</a>&quot;</span></div>
123123
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; </div>
124124
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="comment">// Version format: xxyyzz == &quot;xx.yy.zz&quot;</span></div>
125-
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor">#define AUNIT_VERSION 10503</span></div>
126-
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor">#define AUNIT_VERSION_STRING &quot;1.5.3&quot;</span></div>
125+
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor">#define AUNIT_VERSION 10504</span></div>
126+
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160;<span class="preprocessor">#define AUNIT_VERSION_STRING &quot;1.5.4&quot;</span></div>
127127
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; </div>
128128
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="preprocessor">#endif</span></div>
129129
</div><!-- fragment --></div><!-- contents -->

docs/html/AssertMacros_8h.html

Lines changed: 31 additions & 1 deletion
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.3</span>
25+
&#160;<span id="projectnumber">1.5.4</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -139,6 +139,9 @@
139139
<tr class="memitem:a780f10370d41f109377629af76c84f78"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="AssertMacros_8h.html#a780f10370d41f109377629af76c84f78">assertNotNear</a>(arg1, arg2, error)</td></tr>
140140
<tr class="memdesc:a780f10370d41f109377629af76c84f78"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assert that arg1 and arg2 are NOT within error of each other. <a href="AssertMacros_8h.html#a780f10370d41f109377629af76c84f78">More...</a><br /></td></tr>
141141
<tr class="separator:a780f10370d41f109377629af76c84f78"><td class="memSeparator" colspan="2">&#160;</td></tr>
142+
<tr class="memitem:a9d2a603b6fbf3bcee3ce0a74c77c06b3"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="AssertMacros_8h.html#a9d2a603b6fbf3bcee3ce0a74c77c06b3">assertNoFatalFailure</a>(statement)</td></tr>
143+
<tr class="memdesc:a9d2a603b6fbf3bcee3ce0a74c77c06b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assert that the inner 'statement' returns with no fatal assertions. <a href="AssertMacros_8h.html#a9d2a603b6fbf3bcee3ce0a74c77c06b3">More...</a><br /></td></tr>
144+
<tr class="separator:a9d2a603b6fbf3bcee3ce0a74c77c06b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
142145
</table>
143146
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
144147
<div class="textblock"><p>Various assertion macros (assertXxx()) are defined in this header. These macros can be used only in a subclass of TestOnce or TestAgain, which is true for all tests created by <a class="el" href="TestMacros_8h.html#a152fb8fe682506b1b08ddda59abce668" title="Macro to define a test that will be run only once.">test()</a>, <a class="el" href="TestMacros_8h.html#a1f7b0603fa6951be1f019586eafc6e6b" title="Macro to define a test that will run repeatly upon each iteration of the global loop() method,...">testing()</a>, <a class="el" href="TestMacros_8h.html#a4f2798c22904efe9442ce65eb6932a9c" title="Create a test that is derived from a custom TestOnce class.">testF()</a> and <a class="el" href="TestMacros_8h.html#a648c8cb704b9d942b36d8c4646645c2c" title="Create a test that is derived from a custom TestAgain class.">testingF()</a>. </p>
@@ -222,6 +225,33 @@ <h2 class="memtitle"><span class="permalink"><a href="#ab37dc3ab85b61bad53032bde
222225

223226
<p class="definition">Definition at line <a class="el" href="AssertMacros_8h_source.html#l00090">90</a> of file <a class="el" href="AssertMacros_8h_source.html">AssertMacros.h</a>.</p>
224227

228+
</div>
229+
</div>
230+
<a id="a9d2a603b6fbf3bcee3ce0a74c77c06b3"></a>
231+
<h2 class="memtitle"><span class="permalink"><a href="#a9d2a603b6fbf3bcee3ce0a74c77c06b3">&#9670;&nbsp;</a></span>assertNoFatalFailure</h2>
232+
233+
<div class="memitem">
234+
<div class="memproto">
235+
<table class="memname">
236+
<tr>
237+
<td class="memname">#define assertNoFatalFailure</td>
238+
<td>(</td>
239+
<td class="paramtype">&#160;</td>
240+
<td class="paramname">statement</td><td>)</td>
241+
<td></td>
242+
</tr>
243+
</table>
244+
</div><div class="memdoc">
245+
<b>Value:</b><div class="fragment"><div class="line"> <span class="keywordflow">do</span> { \</div>
246+
<div class="line"> statement; \</div>
247+
<div class="line"> if (isDone()) return; \</div>
248+
<div class="line">} while (false)</div>
249+
</div><!-- fragment -->
250+
<p>Assert that the inner 'statement' returns with no fatal assertions. </p>
251+
<p>This is required because AUnit does not use exceptions, so we have to check the assertion state after calling an inner function. This macro is similar to the <code>ASSERT_NO_FATAL_FAILURE(statement)</code> in GoogleTest. </p>
252+
253+
<p class="definition">Definition at line <a class="el" href="AssertMacros_8h_source.html#l00109">109</a> of file <a class="el" href="AssertMacros_8h_source.html">AssertMacros.h</a>.</p>
254+
225255
</div>
226256
</div>
227257
<a id="a780f10370d41f109377629af76c84f78"></a>

docs/html/AssertMacros_8h_source.html

Lines changed: 7 additions & 2 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.3</span>
25+
&#160;<span id="projectnumber">1.5.4</span>
2626
</div>
2727
<div id="projectbrief">Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.</div>
2828
</td>
@@ -151,7 +151,12 @@
151151
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>&#160;<span class="preprocessor"> return;\</span></div>
152152
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor">} while (false)</span></div>
153153
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; </div>
154-
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>&#160;<span class="preprocessor">#endif</span></div>
154+
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="AssertMacros_8h.html#a9d2a603b6fbf3bcee3ce0a74c77c06b3"> 109</a></span>&#160;<span class="preprocessor">#define assertNoFatalFailure(statement) do { \</span></div>
155+
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>&#160;<span class="preprocessor"> statement; \</span></div>
156+
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>&#160;<span class="preprocessor"> if (isDone()) return; \</span></div>
157+
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160;<span class="preprocessor">} while (false)</span></div>
158+
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; </div>
159+
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;<span class="preprocessor">#endif</span></div>
155160
</div><!-- fragment --></div><!-- contents -->
156161
<!-- start footer part -->
157162
<hr class="footer"/><address class="footer"><small>

0 commit comments

Comments
 (0)