11# AUnit - Unit Testing Framework for Arduino Platforms
22
3- Version: v0 .3.0 (2018-03-19 )
3+ Version: 0 .3.1 (2018-03-20 )
44
55## Summary
66
@@ -23,7 +23,7 @@ AUnit was created to solve 2 problems with ArduinoUnit:
2323 [ ArduinoUni #54 ] ( https://github.com/mmurdoch/arduinounit/issues/54 ) ).
2424
2525In contrast:
26- * AUnit consumes as much as 66 % * less* flash memory than ArduinoUnit on the
26+ * AUnit consumes as much as 65 % * less* flash memory than ArduinoUnit on the
2727 AVR platform. On Teensy-ARM, the savings can be as much as 30%.
2828* AUnit has been tested on AVR, Teensy-ARM and ESP8266.
2929
@@ -98,6 +98,21 @@ pick up the new library.
9898In this section, information about differences between AUnit and ArduinoUnit
9999will appear in a note marked by *** ArduinoUnit Compatibility*** .
100100
101+ ### Examples
102+
103+ The ` examples/ ` directory has a number of examples:
104+
105+ * ` advanced ` - how to subclass ` Test ` and ` TestOnce ` manually
106+ * ` basic ` - using the ` test() ` macro
107+ * ` continuous ` - using the ` testing() ` macro
108+ * ` filter ` - how to filter tests using ` TestRunner::include() ` and
109+ ` TestRunner::exclude() `
110+ * ` meta_asserts ` - how to use ` assertTestXxx() ` and ` checkTestXxx `
111+
112+ In the ` tests/ ` directory:
113+
114+ * ` AUnitTest ` - the unit test for ` AUnit ` itself has a large number of examples
115+
101116### Header and Namespace
102117
103118To prevent name clashes with other libraries and code, all classes in the AUnit
@@ -121,7 +136,7 @@ in the global namespace, so it is usually not necessary to import the entire
121136` aunit ` namespace.
122137
123138*** ArduinoUnit Compatibility*** : _ I have found that the following macros are
124- useful during the transition: _
139+ useful during the transition from ArduinoUnit to AUnit _
125140```
126141#define USE_AUNIT 1
127142
@@ -356,7 +371,10 @@ returns `false`, and prints assertion messages that look like this:
356371Assertion passed: Test slow_pass is done, file AUnitTest.ino, line 366.
357372Assertion passed: Test slow_pass is not failed, file AUnitTest.ino, line 372.
358373Assertion passed: Test slow_skip is skipped, file AUnitTest.ino, line 448.
374+ Assertion passed: Test slow_skip is not timed out, file AUnitTest.ino, line 451.
359375```
376+ (The human readable version of being ` expired ` will always be ` timed out ` or
377+ ` not timed out ` on the ` Serial ` output.)
360378
361379The following macros define ` extern ` references to test case objects which live
362380in other ` .cpp ` files. These are required for the above meta assertions if the
@@ -509,21 +527,23 @@ The names of the bit field flags are different from ArduinoUnit to avoid name
509527collisions with other ` #define ` macros which have global scope. AUnit uses
510528static constants of the ` Verbosity ` utility class:
511529
512- * ` Verbosity::kTestRunSummary `
513- * ` Verbosity::kTestFailed `
530+ * ` Verbosity::kAssertionPassed `
531+ * ` Verbosity::kAssertionFailed `
514532* ` Verbosity::kTestPassed `
533+ * ` Verbosity::kTestFailed `
515534* ` Verbosity::kTestSkipped `
535+ * ` Verbosity::kTestExpired `
536+ * ` Verbosity::kTestRunSummary `
537+ * ` Verbosity::kAssertionAll ` - enables all assert messages
516538* ` Verbosity::kTestAll `
517- * ` Verbosity::kAssertionFailed `
518- * ` Verbosity::kAssertionPassed `
519- * ` Verbosity::kAssertionAll `
520- * ` Verbosity::kDefault ` , equivalent to setting the following
521- * ` (Verbosity::kAssertionFailed | Verbosity::kTestAll) `
539+ * same as ` (kTestPassed | kTestFailed | kTestSkipped | kTestExpired) `
540+ * ` Verbosity::kDefault `
541+ * same as ` (kAssertionFailed | kTestAll | kTestRunSummary ) `
522542* ` Verbosity::kAll ` - enables all messages
523543* ` Verbosity::kNone ` - disables all messages
524544
525545*** ArduinoUnit Compatibility*** :
526- _ The following ArduinoUnit variables do not exist:_ `
546+ _ The following ArduinoUnit variables do not exist:_
527547* ` Test::verbosity `
528548* ` Test::min_verbosity `
529549* ` Test::max_verbosity `
@@ -543,6 +563,7 @@ The bit field constants have slightly different names:_
543563* ` TEST_VERBOSITY_ALL ` -> ` Verbosity::kAll `
544564* ` TEST_VERBOSITY_NONE ` -> ` Verbosity::kNone `
545565* {no equivalent} <- ` Verbosity::kDefault `
566+ * {no equivalent} <- ` Verbosity::kTestExpired `
546567
547568### Line Number Mismatch
548569
@@ -648,7 +669,7 @@ A timeout value of `0` means an infinite timeout, which means that the
648669
649670## Benchmarks
650671
651- AUnit consumes as much as 66 % less flash memory than ArduinoUnit on an AVR
672+ AUnit consumes as much as 65 % less flash memory than ArduinoUnit on an AVR
652673platform (e.g. Arduino UNO, Nano), and 30% less flash on the Teensy-ARM platform
653674(e.g. Teensy LC ). Here are the resource consumption (flash and static) numbers
654675from an actual unit test sketch containing 26 test cases using 331 ` assertXxx() `
@@ -657,24 +678,24 @@ microcontrollers:
657678```
658679Platform (resource) | Max | ArduinoUnit | AUnit |
659680---------------------------+---------+-------------+-------------|
660- Arduino Nano (flash) | 30720 | 54038 | 18666 |
681+ Arduino Nano (flash) | 30720 | 54038 | 18818 |
661682Arduino Nano (static) | 2048 | 1061 | 918 |
662683---------------------------+---------+-------------+-------------|
663- Teensy LC (flash) | 63488 | 36196 | 25228 |
684+ Teensy LC (flash) | 63488 | 36196 | 25240 |
664685Teensy LC (static) | 8192 | 2980 | 2780 |
665686---------------------------+---------+-------------+-------------|
666- Teensy 3.2 (flash) | 262144 | 51236 | 36300 |
687+ Teensy 3.2 (flash) | 262144 | 51236 | 36236 |
667688Teensy 3.2 (static) | 65536 | 5328 | 5236 |
668689---------------------------+---------+-------------+-------------|
669- ESP8266 - ESP-12E (flash) | 1044464 | does not | 266748 |
690+ ESP8266 - ESP-12E (flash) | 1044464 | does not | 266796 |
670691ESP8266 - ESP-12E (static) | 81920 | compile | 33128 |
671692---------------------------+---------+-------------+-------------|
672- ESP8266 - ESP-01 (flash) | 499696 | does not | 266748 |
693+ ESP8266 - ESP-01 (flash) | 499696 | does not | 266796 |
673694ESP8266 - ESP-01 (static) | 47356 | compile | 33128 |
674695---------------------------+---------+-------------+-------------|
675696```
676697
677- Not all unit test sketches will experience a savings of 66 % of flash memory with
698+ Not all unit test sketches will experience a savings of 65 % of flash memory with
678699AUnit, but a savings of 30-50% seems to be common.
679700
680701## Changelog
0 commit comments