diff --git a/CHANGELOG.md b/CHANGELOG.md index 1de8c3f..58faef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog * Unreleased +* 1.3.3 (2020-09-15) + * Increase maximum allowed `setTimeout()` from 255 seconds to 65535 seconds + (18.2 hours). (See [Issue + #57](https://github.com/bxparks/AUnit/issues/57)). * 1.3.2 (2020-02-29) * Fix typos in README.md. No functional change. * 1.3.1 (2019-07-31) diff --git a/README.md b/README.md index f02b11d..ad6bb7c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ tools to verify, upload and validate the unit tests to the microcontroller, instead of having to go through the Arduino IDE. Both the AUniter and UnixHostDuino tools can be used in a continuous integration system like Jenkins. -Version: 1.3.2 (2020-02-29) +**Version**: 1.3.3 (2020-09-15) + +**Changelog**: [CHANGELOG.md](CHANGELOG.md). [![AUniter Jenkins Badge](https://us-central1-xparks2018.cloudfunctions.net/badge?project=AUnit)](https://github.com/bxparks/AUniter) @@ -1181,10 +1183,14 @@ which accidentally runs forever because the code forgets to call an explicit `pass()`, `fail()` or `skip()`. The `TestRunner` in AUnit applies a time out value to all the test cases that it -runs. The default time out is 10 seconds. Currently, the -time out value is global to all test cases, individual test time out values -cannot be set independently. If a test does not finish before that time, then -the test is marked as `timed out` (internally implemented by the +runs. The default time out is 10 seconds. A timeout value of `0` means an +infinite timeout, which means that the `testing()` test case may run forever. +The value of the timeout is stored as a `uint16_t` type, so the maximum timeout +is 65535 seconds or a bit over 18 hours. + +Currently, the time out value is global to all test cases, individual test time +out values cannot be set independently. If a test does not finish before that +time, then the test is marked as `timed out` (internally implemented by the `Test::expire()` method) and a message is printed like this: ``` Test looping_until timed out. @@ -1201,13 +1207,6 @@ void setup() { } ``` -A timeout value of `0` means an infinite timeout, which means that the -`testing()` test case may run forever. To conserve static memory, the value of -the timeout is stored as a single byte `uint8_t`, so the maximum timeout is 255 -seconds or 4m15s. (It could be argued that a test taking longer than this is not -really a unit test but an integration test, and should probably use a different -framework, but let me know if you truly need a timeout of greater than 4m15s). - ***ArduinoUnit Compatibility***: _Only available in AUnit._ ## GoogleTest Adapter @@ -1216,7 +1215,7 @@ It may be possible to run simple unit tests written using [Google Test](https://github.com/google/googletest/) API on an Arduino platform by using the [aunit/contrib/gtest.h](src/aunit/contrib/gtest.h) adapter. This -adapter layer provides a number of macros Google Test macros which map to +adapter layer provides a number of Google Test macros which map to their equivalent macros in AUnit: * `ASSERT_EQ(e, a)` - `assertEqual()` @@ -1419,7 +1418,7 @@ integer type. ### Testing Private Helper Methods -There is a school of throught which says that unit tests should test only the +There is a school of thought which says that unit tests should test only the publically exposed methods of a class or library. I agree mostly with that sentiment, but not rigidly. I think it is sometimes useful to write unit tests for `protected` or `private` methods. For example, when creating a chain of @@ -1533,10 +1532,6 @@ ESP8266 - ESP-01 (static) | 47356 | compile | 33128 | Not all unit test sketches will experience a savings of 65% of flash memory with AUnit, but a savings of 30-50% seems to be common. -## Changelog - -See [CHANGELOG.md](CHANGELOG.md). - ## System Requirements ### Tool Chain @@ -1592,6 +1587,9 @@ incorporate everything, but I will give your ideas serious consideration. * Created by Brian T. Park (brian@xparks.net). * The Google Test adapter (`gtest.h`) was created by Chris Johnson (chrisjohnsonmail@gmail.com). +* @brewmanz increased the maximum allowed value of `TestRunner::setTimeout()` + from 255 seconds to 65535 seconds (18.2 hours). (See [Issue + #57](https://github.com/bxparks/AUnit/issues/57)). * The design and syntax of many macros (e.g. `test()`, `assertXxx()`) were borrowed from the [ArduinoUnit](https://github.com/mmurdoch/arduinounit) project to allow AUnit to be almost a drop-in replacement. Many thanks to diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..6c998f8 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,5 @@ +html: + doxygen doxygen.cfg > /tmp/doxygen.out + +clean: + rm -rf html diff --git a/docs/doxygen.cfg b/docs/doxygen.cfg index a71ffaa..f58b6a6 100644 --- a/docs/doxygen.cfg +++ b/docs/doxygen.cfg @@ -1,4 +1,4 @@ -# Doxyfile 1.8.13 +# Doxyfile 1.8.17 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -17,11 +17,11 @@ # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -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 = 1.3.2 +PROJECT_NUMBER = 1.3.3 # 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 @@ -93,6 +93,14 @@ ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. @@ -189,6 +197,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -236,7 +254,12 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) ALIASES = @@ -274,17 +297,26 @@ OPTIMIZE_FOR_FORTRAN = NO OPTIMIZE_OUTPUT_VHDL = NO +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is +# Fortran), use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # @@ -295,7 +327,7 @@ EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -307,7 +339,7 @@ MARKDOWN_SUPPORT = YES # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. +# Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 @@ -337,7 +369,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -443,6 +475,12 @@ EXTRACT_ALL = NO EXTRACT_PRIVATE = NO +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -497,8 +535,8 @@ HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO @@ -521,7 +559,7 @@ INTERNAL_DOCS = NO # names in lower-case letters. If set to YES, upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# (including Cygwin) ands Mac users are advised to set this option to NO. # The default value is: system dependent. CASE_SENSE_NAMES = YES @@ -708,7 +746,7 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -753,7 +791,8 @@ WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that # are documented, but have no documentation for their parameters or return # value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. # The default value is: NO. WARN_NO_PARAMDOC = NO @@ -795,7 +834,7 @@ INPUT = ../src # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -812,8 +851,10 @@ INPUT_ENCODING = UTF-8 # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen +# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f, *.for, *.tcl, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.c \ *.cc \ @@ -1011,7 +1052,7 @@ INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. +# entity all documented functions referencing it will be listed. # The default value is: NO. REFERENCED_BY_RELATION = NO @@ -1043,12 +1084,12 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: # - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file # - Make sure the INPUT points to the root of the source tree # - Run doxygen as normal # @@ -1076,7 +1117,7 @@ VERBATIM_HEADERS = YES # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. +# generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO @@ -1089,6 +1130,16 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1207,7 +1258,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1243,6 +1294,17 @@ HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1266,13 +1328,13 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# environment (see: https://developer.apple.com/xcode/), introduced with OSX +# 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1311,7 +1373,7 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output @@ -1387,7 +1449,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1395,7 +1457,7 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- # folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1404,7 +1466,7 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1412,7 +1474,7 @@ QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- # filters). # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1420,7 +1482,7 @@ QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1513,7 +1575,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1524,8 +1586,14 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1552,8 +1620,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1595,7 +1663,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1614,7 +1682,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1627,7 +1695,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1679,21 +1747,35 @@ LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. # -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. +# Note that when not enabling USE_PDFLATEX the default is latex when enabling +# USE_PDFLATEX the default is pdflatex and when in the later case latex is +# chosen this is overwritten by pdflatex. For specific output languages the +# default can have been set differently, this depends on the implementation of +# the output language. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate # index for LaTeX. +# Note: This tag is used in the Makefile / make.bat. +# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file +# (.tex). # The default file is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. MAKEINDEX_CMD_NAME = makeindex +# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. +# Note: This tag is used in the generated output file (.tex). +# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. +# The default value is: makeindex. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_MAKEINDEX_CMD = makeindex + # If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX # documents. This may be useful for small projects and may help to save some # trees in general. @@ -1814,7 +1896,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -1828,6 +1910,14 @@ LATEX_BIB_STYLE = plain LATEX_TIMESTAMP = NO +# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute) +# path from which the emoji images will be read. If a relative path is entered, +# it will be relative to the LATEX_OUTPUT directory. If left blank the +# LATEX_OUTPUT directory will be used. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_EMOJI_DIRECTORY = + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1867,9 +1957,9 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# configuration file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. # # See also section "Doxygen usage" for information on how to generate the # default style sheet that doxygen normally uses. @@ -1878,8 +1968,8 @@ RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. +# similar to doxygen's configuration file. A template extensions file can be +# generated using doxygen -e rtf extensionFile. # This tag requires that the tag GENERATE_RTF is set to YES. RTF_EXTENSIONS_FILE = @@ -1965,6 +2055,13 @@ XML_OUTPUT = xml XML_PROGRAMLISTING = YES +# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include +# namespace members in file scope as well, matching the HTML output. +# The default value is: NO. +# This tag requires that the tag GENERATE_XML is set to YES. + +XML_NS_MEMB_FILE_SCOPE = NO + #--------------------------------------------------------------------------- # Configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- @@ -1997,9 +2094,9 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2166,12 +2263,6 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- @@ -2185,15 +2276,6 @@ PERL_PATH = /usr/bin/perl CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. diff --git a/docs/html/AUnitVerbose_8h.html b/docs/html/AUnitVerbose_8h.html index f71e7da..b6de170 100644 --- a/docs/html/AUnitVerbose_8h.html +++ b/docs/html/AUnitVerbose_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/AUnitVerbose.h File Reference +AUnit: /home/brian/src/AUnit/src/AUnitVerbose.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
AUnitVerbose.h File Reference
- -

Same as AUnit.h except that the verbose versions of the various assertXxx() macros are provided. -More...

#include "aunit/print64.h"
#include "aunit/Verbosity.h"
#include "aunit/Compare.h"
@@ -89,23 +89,28 @@
Include dependency graph for AUnitVerbose.h:
-
- - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + +
@@ -114,15 +119,14 @@

Macros

-#define AUNIT_VERSION   10302 +#define AUNIT_VERSION   10303   -#define AUNIT_VERSION_STRING   "1.3.2" +#define AUNIT_VERSION_STRING   "1.3.3"  

Detailed Description

-

Same as AUnit.h 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.

+

Same as AUnit.h 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.

Definition in file AUnitVerbose.h.

@@ -130,7 +134,7 @@ diff --git a/docs/html/AUnitVerbose_8h__incl.map b/docs/html/AUnitVerbose_8h__incl.map index 1cbba17..e30c9a0 100644 --- a/docs/html/AUnitVerbose_8h__incl.map +++ b/docs/html/AUnitVerbose_8h__incl.map @@ -1,17 +1,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/html/AUnitVerbose_8h__incl.md5 b/docs/html/AUnitVerbose_8h__incl.md5 index ed2f160..b17ed8f 100644 --- a/docs/html/AUnitVerbose_8h__incl.md5 +++ b/docs/html/AUnitVerbose_8h__incl.md5 @@ -1 +1 @@ -47a15b7e98586a9ab2960946b35b7c72 \ No newline at end of file +b93461aba3f04b7397bedda42f9b3e21 \ No newline at end of file diff --git a/docs/html/AUnitVerbose_8h__incl.png b/docs/html/AUnitVerbose_8h__incl.png index 7a62610..121c9cd 100644 Binary files a/docs/html/AUnitVerbose_8h__incl.png and b/docs/html/AUnitVerbose_8h__incl.png differ diff --git a/docs/html/AUnitVerbose_8h_source.html b/docs/html/AUnitVerbose_8h_source.html index 94d63de..c7c2878 100644 --- a/docs/html/AUnitVerbose_8h_source.html +++ b/docs/html/AUnitVerbose_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/AUnitVerbose.h Source File +AUnit: /home/brian/src/AUnit/src/AUnitVerbose.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
AUnitVerbose.h
-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
35 #ifndef AUNIT_AUNIT_VERBOSE_H
36 #define AUNIT_AUNIT_VERBOSE_H
37 
38 #include "aunit/print64.h"
39 #include "aunit/Verbosity.h"
40 #include "aunit/Compare.h"
41 #include "aunit/Printer.h"
42 #include "aunit/Test.h"
43 #include "aunit/Assertion.h"
44 #include "aunit/MetaAssertion.h"
45 #include "aunit/TestOnce.h"
46 #include "aunit/TestAgain.h"
47 #include "aunit/TestRunner.h"
48 #include "aunit/AssertVerboseMacros.h" // verbose assertXxx() macros
49 #include "aunit/MetaAssertMacros.h"
50 #include "aunit/TestMacros.h"
51 
52 // Version format: xxyyzz == "xx.yy.zz"
53 #define AUNIT_VERSION 10302
54 #define AUNIT_VERSION_STRING "1.3.2"
55 
56 #endif
Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header.
-
Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t...
-
Helper routines to print 'long long' and 'unsigned long long' because the Print::print() methods in P...
-
Verbose versions of the macros in AssertMacros.h.
-
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
35 #ifndef AUNIT_AUNIT_VERBOSE_H
+
36 #define AUNIT_AUNIT_VERBOSE_H
+
37 
+
38 #include "aunit/print64.h"
+
39 #include "aunit/Verbosity.h"
+
40 #include "aunit/Compare.h"
+
41 #include "aunit/Printer.h"
+
42 #include "aunit/Test.h"
+
43 #include "aunit/Assertion.h"
+
44 #include "aunit/MetaAssertion.h"
+
45 #include "aunit/TestOnce.h"
+
46 #include "aunit/TestAgain.h"
+
47 #include "aunit/TestRunner.h"
+
48 #include "aunit/AssertVerboseMacros.h" // verbose assertXxx() macros
+
49 #include "aunit/MetaAssertMacros.h"
+
50 #include "aunit/TestMacros.h"
+
51 
+
52 // Version format: xxyyzz == "xx.yy.zz"
+
53 #define AUNIT_VERSION 10303
+
54 #define AUNIT_VERSION_STRING "1.3.3"
+
55 
+
56 #endif
+
+
+
+
+
diff --git a/docs/html/AUnit_8h.html b/docs/html/AUnit_8h.html index 821d74d..1db1bec 100644 --- a/docs/html/AUnit_8h.html +++ b/docs/html/AUnit_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/AUnit.h File Reference +AUnit: /home/brian/src/AUnit/src/AUnit.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
AUnit.h File Reference
- -

Same as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided. -More...

#include "aunit/print64.h"
#include "aunit/Verbosity.h"
#include "aunit/Compare.h"
@@ -89,23 +89,28 @@
Include dependency graph for AUnit.h:
-
- - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + + + + + +
@@ -114,15 +119,14 @@

Macros

-#define AUNIT_VERSION   10302 +#define AUNIT_VERSION   10303   -#define AUNIT_VERSION_STRING   "1.3.2" +#define AUNIT_VERSION_STRING   "1.3.3"  

Detailed Description

-

Same as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided.

-

These versions print only the values of the parameters given in the assert macros. They do not capture the source text of the assert parameters, which can reduce flash memory by 25-35%.

+

Same as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided. These versions print only the values of the parameters given in the assert macros. They do not capture the source text of the assert parameters, which can reduce flash memory by 25-35%.

Definition in file AUnit.h.

@@ -130,7 +134,7 @@ diff --git a/docs/html/AUnit_8h__incl.map b/docs/html/AUnit_8h__incl.map index 5134347..ea97160 100644 --- a/docs/html/AUnit_8h__incl.map +++ b/docs/html/AUnit_8h__incl.map @@ -1,17 +1,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/html/AUnit_8h__incl.md5 b/docs/html/AUnit_8h__incl.md5 index adbf367..4c16a6e 100644 --- a/docs/html/AUnit_8h__incl.md5 +++ b/docs/html/AUnit_8h__incl.md5 @@ -1 +1 @@ -5d7666ff91d03e4011a2f0b25f17f88f \ No newline at end of file +fd697eb76d694a762c54325ef4aeecf6 \ No newline at end of file diff --git a/docs/html/AUnit_8h__incl.png b/docs/html/AUnit_8h__incl.png index 03df1d6..abb2a9d 100644 Binary files a/docs/html/AUnit_8h__incl.png and b/docs/html/AUnit_8h__incl.png differ diff --git a/docs/html/AUnit_8h_source.html b/docs/html/AUnit_8h_source.html index 5215358..c5e5c86 100644 --- a/docs/html/AUnit_8h_source.html +++ b/docs/html/AUnit_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/AUnit.h Source File +AUnit: /home/brian/src/AUnit/src/AUnit.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
AUnit.h
-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
41 #ifndef AUNIT_AUNIT_H
42 #define AUNIT_AUNIT_H
43 
44 #include "aunit/print64.h"
45 #include "aunit/Verbosity.h"
46 #include "aunit/Compare.h"
47 #include "aunit/Printer.h"
48 #include "aunit/Test.h"
49 #include "aunit/Assertion.h"
50 #include "aunit/MetaAssertion.h"
51 #include "aunit/TestOnce.h"
52 #include "aunit/TestAgain.h"
53 #include "aunit/TestRunner.h"
54 #include "aunit/AssertMacros.h" // terse assertXxx() macros
55 #include "aunit/MetaAssertMacros.h"
56 #include "aunit/TestMacros.h"
57 
58 // Version format: xxyyzz == "xx.yy.zz"
59 #define AUNIT_VERSION 10302
60 #define AUNIT_VERSION_STRING "1.3.2"
61 
62 #endif
Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header.
-
Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in t...
-
Helper routines to print 'long long' and 'unsigned long long' because the Print::print() methods in P...
-
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
-
Various assertion macros (assertXxx()) are defined in this header.
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
41 #ifndef AUNIT_AUNIT_H
+
42 #define AUNIT_AUNIT_H
+
43 
+
44 #include "aunit/print64.h"
+
45 #include "aunit/Verbosity.h"
+
46 #include "aunit/Compare.h"
+
47 #include "aunit/Printer.h"
+
48 #include "aunit/Test.h"
+
49 #include "aunit/Assertion.h"
+
50 #include "aunit/MetaAssertion.h"
+
51 #include "aunit/TestOnce.h"
+
52 #include "aunit/TestAgain.h"
+
53 #include "aunit/TestRunner.h"
+
54 #include "aunit/AssertMacros.h" // terse assertXxx() macros
+
55 #include "aunit/MetaAssertMacros.h"
+
56 #include "aunit/TestMacros.h"
+
57 
+
58 // Version format: xxyyzz == "xx.yy.zz"
+
59 #define AUNIT_VERSION 10303
+
60 #define AUNIT_VERSION_STRING "1.3.3"
+
61 
+
62 #endif
+
+
+
+
+
diff --git a/docs/html/AssertMacros_8h.html b/docs/html/AssertMacros_8h.html index 3709c07..dda0cfa 100644 --- a/docs/html/AssertMacros_8h.html +++ b/docs/html/AssertMacros_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/AssertMacros.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/AssertMacros.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
AssertMacros.h File Reference
- -

Various assertion macros (assertXxx()) are defined in this header. -More...

This graph shows which files directly or indirectly include this file:
-
- - +
+ + +
@@ -86,52 +87,61 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - +

Macros

#define assertEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)
 Assert that arg1 is equal to arg2. More...
+#define assertEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)
 Assert that arg1 is equal to arg2.
 
#define assertNotEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
 Assert that arg1 is not equal to arg2. More...
+#define assertNotEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
 Assert that arg1 is not equal to arg2.
 
#define assertLess(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)
 Assert that arg1 is less than arg2. More...
+#define assertLess(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)
 Assert that arg1 is less than arg2.
 
#define assertMore(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)
 Assert that arg1 is more than arg2. More...
+#define assertMore(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)
 Assert that arg1 is more than arg2.
 
#define assertLessOrEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
 Assert that arg1 is less than or equal to arg2. More...
+#define assertLessOrEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
 Assert that arg1 is less than or equal to arg2.
 
#define assertMoreOrEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
 Assert that arg1 is more than or equal to arg2. More...
+#define assertMoreOrEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
 Assert that arg1 is more than or equal to arg2.
 
#define assertStringCaseEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareStringCaseEqual,"==",arg2)
 Assert that string arg1 is equal to string arg2, case-insensitive. More...
+#define assertStringCaseEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareStringCaseEqual,"==",arg2)
 Assert that string arg1 is equal to string arg2, case-insensitive.
 
#define assertStringCaseNotEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareStringCaseNotEqual,"!=",arg2)
 Assert that string arg1 is not equal to string arg2, case-insensitive. More...
+#define assertStringCaseNotEqual(arg1, arg2)   assertOpInternal(arg1,aunit::internal::compareStringCaseNotEqual,"!=",arg2)
 Assert that string arg1 is not equal to string arg2, case-insensitive.
 
#define assertTrue(arg)   assertBoolInternal(arg,true)
 Assert that arg is true. More...
+#define assertTrue(arg)   assertBoolInternal(arg,true)
 Assert that arg is true.
 
#define assertFalse(arg)   assertBoolInternal(arg,false)
 Assert that arg is false. More...
+#define assertFalse(arg)   assertBoolInternal(arg,false)
 Assert that arg is false.
 
#define assertOpInternal(arg1, op, opName, arg2)
 Internal helper macro, shouldn't be called directly by users. More...
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertBoolInternal(arg, value)
 Internal helper macro, shouldn't be called directly by users. More...
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertNear(arg1, arg2, error)
 Assert that arg1 and arg2 are within error of each other. More...
 Assert that arg1 and arg2 are within error of each other. More...
 
#define assertNotNear(arg1, arg2, error)
 Assert that arg1 and arg2 are NOT within error of each other. More...
 Assert that arg1 and arg2 are NOT within error of each other. More...
 

Detailed Description

-

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 test(), testing(), testF() and testingF().

+

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 test(), testing(), testF() and testingF().

Definition in file AssertMacros.h.

Macro Definition Documentation

@@ -160,193 +170,15 @@

-Value:
do {\
if (!assertionBool(__FILE__,__LINE__,(arg),(value)))\
return;\
} while (false)
+Value:
do {\
+
if (!assertionBool(__FILE__,__LINE__,(arg),(value)))\
+
return;\
+
} while (false)
+

Internal helper macro, shouldn't be called directly by users.

Definition at line 84 of file AssertMacros.h.

-

-
- -

◆ assertEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertEqual( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)
-
- -

Assert that arg1 is equal to arg2.

- -

Definition at line 40 of file AssertMacros.h.

- -
-
- -

◆ assertFalse

- -
-
- - - - - - - - -
#define assertFalse( arg)   assertBoolInternal(arg,false)
-
- -

Assert that arg is false.

- -

Definition at line 75 of file AssertMacros.h.

- -
-
- -

◆ assertLess

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertLess( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)
-
- -

Assert that arg1 is less than arg2.

- -

Definition at line 48 of file AssertMacros.h.

- -
-
- -

◆ assertLessOrEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertLessOrEqual( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
-
- -

Assert that arg1 is less than or equal to arg2.

- -

Definition at line 56 of file AssertMacros.h.

- -
-
- -

◆ assertMore

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertMore( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)
-
- -

Assert that arg1 is more than arg2.

- -

Definition at line 52 of file AssertMacros.h.

- -
-
- -

◆ assertMoreOrEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertMoreOrEqual( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
-
- -

Assert that arg1 is more than or equal to arg2.

- -

Definition at line 60 of file AssertMacros.h.

-
@@ -380,43 +212,16 @@

-Value:
do { \
if (!assertionNear(__FILE__, __LINE__, \
arg1, arg2, error, "<=", aunit::internal::compareNear)) \
return;\
} while (false)
+Value:
do { \
+
if (!assertionNear(__FILE__, __LINE__, \
+
arg1, arg2, error, "<=", aunit::internal::compareNear)) \
+
return;\
+
} while (false)
+

Assert that arg1 and arg2 are within error of each other.

Definition at line 90 of file AssertMacros.h.

- - - -

◆ assertNotEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertNotEqual( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
-
- -

Assert that arg1 is not equal to arg2.

- -

Definition at line 44 of file AssertMacros.h.

-
@@ -450,7 +255,12 @@

-Value:
do { \
if (!assertionNear(__FILE__, __LINE__, \
arg1, arg2, error, ">", aunit::internal::compareNotNear)) \
return;\
} while (false)
+Value:
do { \
+
if (!assertionNear(__FILE__, __LINE__, \
+
arg1, arg2, error, ">", aunit::internal::compareNotNear)) \
+
return;\
+
} while (false)
+

Assert that arg1 and arg2 are NOT within error of each other.

Definition at line 97 of file AssertMacros.h.

@@ -494,97 +304,15 @@

-Value:
do {\
if (!assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\
return;\
} while (false)
+Value:
do {\
+
if (!assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\
+
return;\
+
} while (false)
+

Internal helper macro, shouldn't be called directly by users.

Definition at line 78 of file AssertMacros.h.

- - - -

◆ assertStringCaseEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertStringCaseEqual( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareStringCaseEqual,"==",arg2)
-
- -

Assert that string arg1 is equal to string arg2, case-insensitive.

- -

Definition at line 64 of file AssertMacros.h.

- -
-
- -

◆ assertStringCaseNotEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertStringCaseNotEqual( arg1,
 arg2 
)   assertOpInternal(arg1,aunit::internal::compareStringCaseNotEqual,"!=",arg2)
-
- -

Assert that string arg1 is not equal to string arg2, case-insensitive.

- -

Definition at line 68 of file AssertMacros.h.

- -
-
- -

◆ assertTrue

- -
-
- - - - - - - - -
#define assertTrue( arg)   assertBoolInternal(arg,true)
-
- -

Assert that arg is true.

- -

Definition at line 72 of file AssertMacros.h.

-
@@ -592,7 +320,7 @@

diff --git a/docs/html/AssertMacros_8h__dep__incl.map b/docs/html/AssertMacros_8h__dep__incl.map index 35237f3..e352f52 100644 --- a/docs/html/AssertMacros_8h__dep__incl.map +++ b/docs/html/AssertMacros_8h__dep__incl.map @@ -1,3 +1,4 @@ - - + + + diff --git a/docs/html/AssertMacros_8h__dep__incl.md5 b/docs/html/AssertMacros_8h__dep__incl.md5 index ea532ff..a8b1179 100644 --- a/docs/html/AssertMacros_8h__dep__incl.md5 +++ b/docs/html/AssertMacros_8h__dep__incl.md5 @@ -1 +1 @@ -5aba909fc25f9153c2c3ee519883d192 \ No newline at end of file +62f66fde254562db065b29b94dff0d2c \ No newline at end of file diff --git a/docs/html/AssertMacros_8h__dep__incl.png b/docs/html/AssertMacros_8h__dep__incl.png index 565568f..4f30d3e 100644 Binary files a/docs/html/AssertMacros_8h__dep__incl.png and b/docs/html/AssertMacros_8h__dep__incl.png differ diff --git a/docs/html/AssertMacros_8h_source.html b/docs/html/AssertMacros_8h_source.html index e9432ee..29c82ad 100644 --- a/docs/html/AssertMacros_8h_source.html +++ b/docs/html/AssertMacros_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/AssertMacros.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/AssertMacros.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
AssertMacros.h
-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
36 #ifndef AUNIT_ASSERT_MACROS_H
37 #define AUNIT_ASSERT_MACROS_H
38 
40 #define assertEqual(arg1,arg2) \
41  assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)
42 
44 #define assertNotEqual(arg1,arg2) \
45  assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
46 
48 #define assertLess(arg1,arg2) \
49  assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)
50 
52 #define assertMore(arg1,arg2) \
53  assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)
54 
56 #define assertLessOrEqual(arg1,arg2) \
57  assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
58 
60 #define assertMoreOrEqual(arg1,arg2) \
61  assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
62 
64 #define assertStringCaseEqual(arg1,arg2) \
65  assertOpInternal(arg1,aunit::internal::compareStringCaseEqual,"==",arg2)
66 
68 #define assertStringCaseNotEqual(arg1,arg2) \
69  assertOpInternal(arg1,aunit::internal::compareStringCaseNotEqual,"!=",arg2)
70 
72 #define assertTrue(arg) assertBoolInternal(arg,true)
73 
75 #define assertFalse(arg) assertBoolInternal(arg,false)
76 
78 #define assertOpInternal(arg1,op,opName,arg2) do {\
79  if (!assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\
80  return;\
81 } while (false)
82 
84 #define assertBoolInternal(arg,value) do {\
85  if (!assertionBool(__FILE__,__LINE__,(arg),(value)))\
86  return;\
87 } while (false)
88 
90 #define assertNear(arg1, arg2, error) do { \
91  if (!assertionNear(__FILE__, __LINE__, \
92  arg1, arg2, error, "<=", aunit::internal::compareNear)) \
93  return;\
94 } while (false)
95 
97 #define assertNotNear(arg1, arg2, error) do { \
98  if (!assertionNear(__FILE__, __LINE__, \
99  arg1, arg2, error, ">", aunit::internal::compareNotNear)) \
100  return;\
101 } while (false)
102 
103 #endif
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
36 #ifndef AUNIT_ASSERT_MACROS_H
+
37 #define AUNIT_ASSERT_MACROS_H
+
38 
+
40 #define assertEqual(arg1,arg2) \
+
41  assertOpInternal(arg1,aunit::internal::compareEqual,"==",arg2)
+
42 
+
44 #define assertNotEqual(arg1,arg2) \
+
45  assertOpInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
+
46 
+
48 #define assertLess(arg1,arg2) \
+
49  assertOpInternal(arg1,aunit::internal::compareLess,"<",arg2)
+
50 
+
52 #define assertMore(arg1,arg2) \
+
53  assertOpInternal(arg1,aunit::internal::compareMore,">",arg2)
+
54 
+
56 #define assertLessOrEqual(arg1,arg2) \
+
57  assertOpInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
+
58 
+
60 #define assertMoreOrEqual(arg1,arg2) \
+
61  assertOpInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
+
62 
+
64 #define assertStringCaseEqual(arg1,arg2) \
+
65  assertOpInternal(arg1,aunit::internal::compareStringCaseEqual,"==",arg2)
+
66 
+
68 #define assertStringCaseNotEqual(arg1,arg2) \
+
69  assertOpInternal(arg1,aunit::internal::compareStringCaseNotEqual,"!=",arg2)
+
70 
+
72 #define assertTrue(arg) assertBoolInternal(arg,true)
+
73 
+
75 #define assertFalse(arg) assertBoolInternal(arg,false)
+
76 
+
78 #define assertOpInternal(arg1,op,opName,arg2) do {\
+
79  if (!assertion(__FILE__,__LINE__,(arg1),opName,op,(arg2)))\
+
80  return;\
+
81 } while (false)
+
82 
+
84 #define assertBoolInternal(arg,value) do {\
+
85  if (!assertionBool(__FILE__,__LINE__,(arg),(value)))\
+
86  return;\
+
87 } while (false)
+
88 
+
90 #define assertNear(arg1, arg2, error) do { \
+
91  if (!assertionNear(__FILE__, __LINE__, \
+
92  arg1, arg2, error, "<=", aunit::internal::compareNear)) \
+
93  return;\
+
94 } while (false)
+
95 
+
97 #define assertNotNear(arg1, arg2, error) do { \
+
98  if (!assertionNear(__FILE__, __LINE__, \
+
99  arg1, arg2, error, ">", aunit::internal::compareNotNear)) \
+
100  return;\
+
101 } while (false)
+
102 
+
103 #endif
+
diff --git a/docs/html/AssertVerboseMacros_8h.html b/docs/html/AssertVerboseMacros_8h.html index 38be76c..346397e 100644 --- a/docs/html/AssertVerboseMacros_8h.html +++ b/docs/html/AssertVerboseMacros_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/AssertVerboseMacros.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/AssertVerboseMacros.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
AssertVerboseMacros.h File Reference
- -

Verbose versions of the macros in AssertMacros.h. -More...

This graph shows which files directly or indirectly include this file:
-
- - +
+ + +
@@ -86,52 +87,59 @@ - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + + - + - + - + - +

Macros

#define assertEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareEqual,"==",arg2)
 Assert that arg1 is equal to arg2. More...
+#define assertEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareEqual,"==",arg2)
 Assert that arg1 is equal to arg2.
 
#define assertNotEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
 Assert that arg1 is not equal to arg2. More...
+#define assertNotEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
 Assert that arg1 is not equal to arg2.
 
#define assertLess(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareLess,"<",arg2)
 Assert that arg1 is less than arg2. More...
+#define assertLess(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareLess,"<",arg2)
 Assert that arg1 is less than arg2.
 
#define assertMore(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareMore,">",arg2)
 Assert that arg1 is more than arg2. More...
+#define assertMore(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareMore,">",arg2)
 Assert that arg1 is more than arg2.
 
#define assertLessOrEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
 Assert that arg1 is less than or equal to arg2. More...
+#define assertLessOrEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
 Assert that arg1 is less than or equal to arg2.
 
#define assertMoreOrEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
 Assert that arg1 is more than or equal to arg2. More...
+#define assertMoreOrEqual(arg1, arg2)   assertOpVerboseInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
 Assert that arg1 is more than or equal to arg2.
 
#define assertStringCaseEqual(arg1, arg2)
 Assert that string arg1 is equal to string arg2, case-insensitive. More...
 Assert that string arg1 is equal to string arg2, case-insensitive. More...
 
#define assertStringCaseNotEqual(arg1, arg2)
 Assert that string arg1 is not equal to string arg2, case-insensitive. More...
 Assert that string arg1 is not equal to string arg2, case-insensitive. More...
 
#define assertTrue(arg)   assertBoolVerboseInternal(arg,true)
 Assert that arg is true. More...
+#define assertTrue(arg)   assertBoolVerboseInternal(arg,true)
 Assert that arg is true.
 
#define assertFalse(arg)   assertBoolVerboseInternal(arg,false)
 Assert that arg is false. More...
+#define assertFalse(arg)   assertBoolVerboseInternal(arg,false)
 Assert that arg is false.
 
#define assertOpVerboseInternal(arg1, op, opName, arg2)
 Internal helper macro, shouldn't be called directly by users. More...
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertBoolVerboseInternal(arg, value)
 Internal helper macro, shouldn't be called directly by users. More...
 Internal helper macro, shouldn't be called directly by users. More...
 
#define assertNear(arg1, arg2, error)
 Assert that arg1 and arg2 are within error of each other. More...
 Assert that arg1 and arg2 are within error of each other. More...
 
#define assertNotNear(arg1, arg2, error)
 Assert that arg1 and arg2 are NOT within error of each other. More...
 Assert that arg1 and arg2 are NOT within error of each other. More...
 

Detailed Description

-

Verbose versions of the macros in AssertMacros.h.

-

These capture the string of the actual arguments and pass them to the respective assertionVerbose() methods so that verbose messages can be printed.

+

Verbose versions of the macros in AssertMacros.h. These capture the string of the actual arguments and pass them to the respective assertionVerbose() methods so that verbose messages can be printed.

Definition in file AssertVerboseMacros.h.

Macro Definition Documentation

@@ -160,193 +168,15 @@

-Value:
do {\
if (!assertionBoolVerbose(__FILE__,__LINE__,(arg),AUNIT_F(#arg),(value)))\
return;\
} while (false)
+Value:
do {\
+
if (!assertionBoolVerbose(__FILE__,__LINE__,(arg),AUNIT_F(#arg),(value)))\
+
return;\
+
} while (false)
+

Internal helper macro, shouldn't be called directly by users.

Definition at line 87 of file AssertVerboseMacros.h.

-

-
- -

◆ assertEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertEqual( arg1,
 arg2 
)   assertOpVerboseInternal(arg1,aunit::internal::compareEqual,"==",arg2)
-
- -

Assert that arg1 is equal to arg2.

- -

Definition at line 40 of file AssertVerboseMacros.h.

- -
-
- -

◆ assertFalse

- -
-
- - - - - - - - -
#define assertFalse( arg)   assertBoolVerboseInternal(arg,false)
-
- -

Assert that arg is false.

- -

Definition at line 77 of file AssertVerboseMacros.h.

- -
-
- -

◆ assertLess

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertLess( arg1,
 arg2 
)   assertOpVerboseInternal(arg1,aunit::internal::compareLess,"<",arg2)
-
- -

Assert that arg1 is less than arg2.

- -

Definition at line 48 of file AssertVerboseMacros.h.

- -
-
- -

◆ assertLessOrEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertLessOrEqual( arg1,
 arg2 
)   assertOpVerboseInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
-
- -

Assert that arg1 is less than or equal to arg2.

- -

Definition at line 56 of file AssertVerboseMacros.h.

- -
-
- -

◆ assertMore

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertMore( arg1,
 arg2 
)   assertOpVerboseInternal(arg1,aunit::internal::compareMore,">",arg2)
-
- -

Assert that arg1 is more than arg2.

- -

Definition at line 52 of file AssertVerboseMacros.h.

- -
-
- -

◆ assertMoreOrEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertMoreOrEqual( arg1,
 arg2 
)   assertOpVerboseInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
-
- -

Assert that arg1 is more than or equal to arg2.

- -

Definition at line 60 of file AssertVerboseMacros.h.

-
@@ -380,43 +210,17 @@

-Value:
do { \
if (!assertionNearVerbose(__FILE__, __LINE__, \
arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
"<=", aunit::internal::compareNear)) \
return;\
} while (false)
+Value:
do { \
+
if (!assertionNearVerbose(__FILE__, __LINE__, \
+
arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
+
"<=", aunit::internal::compareNear)) \
+
return;\
+
} while (false)
+

Assert that arg1 and arg2 are within error of each other.

Definition at line 93 of file AssertVerboseMacros.h.

- - - -

◆ assertNotEqual

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertNotEqual( arg1,
 arg2 
)   assertOpVerboseInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
-
- -

Assert that arg1 is not equal to arg2.

- -

Definition at line 44 of file AssertVerboseMacros.h.

-
@@ -450,7 +254,13 @@

-Value:
do { \
if (!assertionNearVerbose(__FILE__, __LINE__, \
arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
">", aunit::internal::compareNotNear)) \
return;\
} while (false)
+Value:
do { \
+
if (!assertionNearVerbose(__FILE__, __LINE__, \
+
arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
+
">", aunit::internal::compareNotNear)) \
+
return;\
+
} while (false)
+

Assert that arg1 and arg2 are NOT within error of each other.

Definition at line 101 of file AssertVerboseMacros.h.

@@ -494,7 +304,12 @@

-Value:
do {\
if (!assertionVerbose(__FILE__,__LINE__,\
(arg1),AUNIT_F(#arg1),opName,op,(arg2),AUNIT_F(#arg2)))\
return;\
} while (false)
+Value:
do {\
+
if (!assertionVerbose(__FILE__,__LINE__,\
+
(arg1),AUNIT_F(#arg1),opName,op,(arg2),AUNIT_F(#arg2)))\
+
return;\
+
} while (false)
+

Internal helper macro, shouldn't be called directly by users.

Definition at line 80 of file AssertVerboseMacros.h.

@@ -526,7 +341,8 @@

-Value:
assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseEqual,\
"==",arg2)
#define assertOpVerboseInternal(arg1, op, opName, arg2)
Internal helper macro, shouldn&#39;t be called directly by users.
+Value:
assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseEqual,\
+
"==",arg2)

Assert that string arg1 is equal to string arg2, case-insensitive.

@@ -559,42 +375,22 @@

-Value:
assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseNotEqual,\
"!=",arg2)
#define assertOpVerboseInternal(arg1, op, opName, arg2)
Internal helper macro, shouldn&#39;t be called directly by users.
+Value:
assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseNotEqual,\
+
"!=",arg2)

Assert that string arg1 is not equal to string arg2, case-insensitive.

Definition at line 69 of file AssertVerboseMacros.h.

-
-

- -

◆ assertTrue

- -
-
- - - - - - - - -
#define assertTrue( arg)   assertBoolVerboseInternal(arg,true)
-
- -

Assert that arg is true.

- -

Definition at line 74 of file AssertVerboseMacros.h.

-
+
#define assertOpVerboseInternal(arg1, op, opName, arg2)
Internal helper macro, shouldn't be called directly by users.
diff --git a/docs/html/AssertVerboseMacros_8h__dep__incl.map b/docs/html/AssertVerboseMacros_8h__dep__incl.map index 37ad6a2..34dba02 100644 --- a/docs/html/AssertVerboseMacros_8h__dep__incl.map +++ b/docs/html/AssertVerboseMacros_8h__dep__incl.map @@ -1,3 +1,4 @@ - - + + + diff --git a/docs/html/AssertVerboseMacros_8h__dep__incl.md5 b/docs/html/AssertVerboseMacros_8h__dep__incl.md5 index 88eccc3..c361d93 100644 --- a/docs/html/AssertVerboseMacros_8h__dep__incl.md5 +++ b/docs/html/AssertVerboseMacros_8h__dep__incl.md5 @@ -1 +1 @@ -2ad3a5bfec6bf4f01b2aa31a93833e1f \ No newline at end of file +76ec2543c9b6a2b2a0ad52f1ed85e047 \ No newline at end of file diff --git a/docs/html/AssertVerboseMacros_8h__dep__incl.png b/docs/html/AssertVerboseMacros_8h__dep__incl.png index 22c5203..288cf14 100644 Binary files a/docs/html/AssertVerboseMacros_8h__dep__incl.png and b/docs/html/AssertVerboseMacros_8h__dep__incl.png differ diff --git a/docs/html/AssertVerboseMacros_8h_source.html b/docs/html/AssertVerboseMacros_8h_source.html index ac8f3cc..7b504ef 100644 --- a/docs/html/AssertVerboseMacros_8h_source.html +++ b/docs/html/AssertVerboseMacros_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/AssertVerboseMacros.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/AssertVerboseMacros.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
AssertVerboseMacros.h
-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
36 #ifndef AUNIT_ASSERT_VERBOSE_MACROS_H
37 #define AUNIT_ASSERT_VERBOSE_MACROS_H
38 
40 #define assertEqual(arg1,arg2) \
41  assertOpVerboseInternal(arg1,aunit::internal::compareEqual,"==",arg2)
42 
44 #define assertNotEqual(arg1,arg2) \
45  assertOpVerboseInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
46 
48 #define assertLess(arg1,arg2) \
49  assertOpVerboseInternal(arg1,aunit::internal::compareLess,"<",arg2)
50 
52 #define assertMore(arg1,arg2) \
53  assertOpVerboseInternal(arg1,aunit::internal::compareMore,">",arg2)
54 
56 #define assertLessOrEqual(arg1,arg2) \
57  assertOpVerboseInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
58 
60 #define assertMoreOrEqual(arg1,arg2) \
61  assertOpVerboseInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
62 
64 #define assertStringCaseEqual(arg1,arg2) \
65  assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseEqual,\
66  "==",arg2)
67 
69 #define assertStringCaseNotEqual(arg1,arg2) \
70  assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseNotEqual,\
71  "!=",arg2)
72 
74 #define assertTrue(arg) assertBoolVerboseInternal(arg,true)
75 
77 #define assertFalse(arg) assertBoolVerboseInternal(arg,false)
78 
80 #define assertOpVerboseInternal(arg1,op,opName,arg2) do {\
81  if (!assertionVerbose(__FILE__,__LINE__,\
82  (arg1),AUNIT_F(#arg1),opName,op,(arg2),AUNIT_F(#arg2)))\
83  return;\
84 } while (false)
85 
87 #define assertBoolVerboseInternal(arg,value) do {\
88  if (!assertionBoolVerbose(__FILE__,__LINE__,(arg),AUNIT_F(#arg),(value)))\
89  return;\
90 } while (false)
91 
93 #define assertNear(arg1, arg2, error) do { \
94  if (!assertionNearVerbose(__FILE__, __LINE__, \
95  arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
96  "<=", aunit::internal::compareNear)) \
97  return;\
98 } while (false)
99 
101 #define assertNotNear(arg1, arg2, error) do { \
102  if (!assertionNearVerbose(__FILE__, __LINE__, \
103  arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
104  ">", aunit::internal::compareNotNear)) \
105  return;\
106 } while (false)
107 
108 #endif
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
36 #ifndef AUNIT_ASSERT_VERBOSE_MACROS_H
+
37 #define AUNIT_ASSERT_VERBOSE_MACROS_H
+
38 
+
40 #define assertEqual(arg1,arg2) \
+
41  assertOpVerboseInternal(arg1,aunit::internal::compareEqual,"==",arg2)
+
42 
+
44 #define assertNotEqual(arg1,arg2) \
+
45  assertOpVerboseInternal(arg1,aunit::internal::compareNotEqual,"!=",arg2)
+
46 
+
48 #define assertLess(arg1,arg2) \
+
49  assertOpVerboseInternal(arg1,aunit::internal::compareLess,"<",arg2)
+
50 
+
52 #define assertMore(arg1,arg2) \
+
53  assertOpVerboseInternal(arg1,aunit::internal::compareMore,">",arg2)
+
54 
+
56 #define assertLessOrEqual(arg1,arg2) \
+
57  assertOpVerboseInternal(arg1,aunit::internal::compareLessOrEqual,"<=",arg2)
+
58 
+
60 #define assertMoreOrEqual(arg1,arg2) \
+
61  assertOpVerboseInternal(arg1,aunit::internal::compareMoreOrEqual,">=",arg2)
+
62 
+
64 #define assertStringCaseEqual(arg1,arg2) \
+
65  assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseEqual,\
+
66  "==",arg2)
+
67 
+
69 #define assertStringCaseNotEqual(arg1,arg2) \
+
70  assertOpVerboseInternal(arg1,aunit::internal::compareStringCaseNotEqual,\
+
71  "!=",arg2)
+
72 
+
74 #define assertTrue(arg) assertBoolVerboseInternal(arg,true)
+
75 
+
77 #define assertFalse(arg) assertBoolVerboseInternal(arg,false)
+
78 
+
80 #define assertOpVerboseInternal(arg1,op,opName,arg2) do {\
+
81  if (!assertionVerbose(__FILE__,__LINE__,\
+
82  (arg1),AUNIT_F(#arg1),opName,op,(arg2),AUNIT_F(#arg2)))\
+
83  return;\
+
84 } while (false)
+
85 
+
87 #define assertBoolVerboseInternal(arg,value) do {\
+
88  if (!assertionBoolVerbose(__FILE__,__LINE__,(arg),AUNIT_F(#arg),(value)))\
+
89  return;\
+
90 } while (false)
+
91 
+
93 #define assertNear(arg1, arg2, error) do { \
+
94  if (!assertionNearVerbose(__FILE__, __LINE__, \
+
95  arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
+
96  "<=", aunit::internal::compareNear)) \
+
97  return;\
+
98 } while (false)
+
99 
+
101 #define assertNotNear(arg1, arg2, error) do { \
+
102  if (!assertionNearVerbose(__FILE__, __LINE__, \
+
103  arg1, AUNIT_F(#arg1), arg2, AUNIT_F(#arg2), error, AUNIT_F(#error), \
+
104  ">", aunit::internal::compareNotNear)) \
+
105  return;\
+
106 } while (false)
+
107 
+
108 #endif
+
diff --git a/docs/html/Assertion_8cpp_source.html b/docs/html/Assertion_8cpp_source.html index 378bc8d..528430f 100644 --- a/docs/html/Assertion_8cpp_source.html +++ b/docs/html/Assertion_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Assertion.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/Assertion.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
Assertion.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include <Arduino.h> // definition of Print
26 #include "Flash.h"
27 #include "Printer.h"
28 #include "Assertion.h"
29 #include "print64.h"
30 
31 namespace aunit {
32 
33 using namespace internal;
34 
35 namespace internal {
36 
37 // This can be a template function because it is accessed only through the
38 // various assertXxx() methods. Those assertXxx() methods are explicitly
39 // overloaded for the various types that we want to support.
40 //
41 // Prints something like the following:
42 // Assertion failed: (5) == (6), file Test.ino, line 820.
43 // Assertion passed: (6) == (6), file Test.ino, line 820.
44 template <typename A, typename B>
45 void printAssertionMessage(Print* printer, bool ok, const char* file,
46  uint16_t line, const A& lhs, const char* opName, const B& rhs) {
47 
48  // Don't use F() strings here because flash memory strings are not deduped by
49  // the compiler, so each template instantiation of this method causes a
50  // duplication of all the strings below. See
51  // https://github.com/mmurdoch/arduinounit/issues/70
52  // for more info. Normal (const char*) strings will be deduped by the
53  // compiler/linker.
54  printer->print("Assertion ");
55  printer->print(ok ? "passed" : "failed");
56  printer->print(": (");
57  printer->print(lhs);
58  printer->print(") ");
59  printer->print(opName);
60  printer->print(" (");
61  printer->print(rhs);
62  printer->print(')');
63  // reuse string in MataAssertion::printAssertionTestStatusMessage()
64  printer->print(", file ");
65  printer->print(file);
66  printer->print(", line ");
67  printer->print(line);
68  printer->println('.');
69 }
70 
71 // Special version of (bool, bool) because Arduino Print.h converts
72 // bool into int, which prints out "(1) == (0)", which isn't as useful.
73 // This prints "(true) == (false)".
74 void printAssertionMessage(Print* printer, bool ok, const char* file,
75  uint16_t line, bool lhs, const char* opName, bool rhs) {
76 
77  // Don't use F() strings here. Same reason as above.
78  printer->print("Assertion ");
79  printer->print(ok ? "passed" : "failed");
80  printer->print(": (");
81  printer->print(lhs ? "true" : "false");
82  printer->print(") ");
83  printer->print(opName);
84  printer->print(" (");
85  printer->print(rhs ? "true" : "false");
86  printer->print(')');
87  printer->print(", file ");
88  printer->print(file);
89  printer->print(", line ");
90  printer->print(line);
91  printer->println('.');
92 }
93 
94 // Version for (long long, long long) because Print.h does not support int64.
95 void printAssertionMessage(Print* printer, bool ok, const char* file,
96  uint16_t line, long long& lhs, const char* opName, long long& rhs) {
97 
98  // Don't use F() strings here. Same reason as above.
99  printer->print("Assertion ");
100  printer->print(ok ? "passed" : "failed");
101  printer->print(": (");
102  print64(*printer, lhs);
103  printer->print(") ");
104  printer->print(opName);
105  printer->print(" (");
106  print64(*printer, rhs);
107  printer->print(')');
108  printer->print(", file ");
109  printer->print(file);
110  printer->print(", line ");
111  printer->print(line);
112  printer->println('.');
113 }
114 
115 // Version for (unsigned long long, unsigned long long) because Print.h does
116 // not support int64.
117 void printAssertionMessage(Print* printer, bool ok, const char* file,
118  uint16_t line, unsigned long long& lhs, const char* opName,
119  unsigned long long& rhs) {
120 
121  // Don't use F() strings here. Same reason as above.
122  printer->print("Assertion ");
123  printer->print(ok ? "passed" : "failed");
124  printer->print(": (");
125  print64(*printer, lhs);
126  printer->print(") ");
127  printer->print(opName);
128  printer->print(" (");
129  print64(*printer, rhs);
130  printer->print(')');
131  printer->print(", file ");
132  printer->print(file);
133  printer->print(", line ");
134  printer->print(line);
135  printer->println('.');
136 }
137 
138 // Special version for assertTrue(arg) and assertFalse(arg).
139 // Prints:
140 // "Assertion passed/failed: (arg) is true"
141 // "Assertion passed/failed: (arg) is false"
142 void printAssertionBoolMessage(Print* printer, bool ok, const char* file,
143  uint16_t line, bool arg, bool value) {
144 
145  // Don't use F() strings here. Same reason as above.
146  printer->print("Assertion ");
147  printer->print(ok ? "passed" : "failed");
148  printer->print(": (");
149  printer->print(arg ? "true" : "false");
150  printer->print(") is ");
151  printer->print(value ? "true" : "false");
152  printer->print(", file ");
153  printer->print(file);
154  printer->print(", line ");
155  printer->print(line);
156  printer->println('.');
157 }
158 
159 template <typename A>
160 void printAssertionNearMessage(Print* printer, bool ok, const char* file,
161  uint16_t line, const A& lhs, const A& rhs, const char* opName,
162  const A& error) {
163  printer->print("Assertion ");
164  printer->print(ok ? "passed" : "failed");
165  printer->print(": |(");
166  printer->print(lhs);
167  printer->print(") - (");
168  printer->print(rhs);
169  printer->print(")| ");
170  printer->print(opName);
171  printer->print(" (");
172  printer->print(error);
173  printer->print(')');
174  printer->print(", file ");
175  printer->print(file);
176  printer->print(", line ");
177  printer->print(line);
178  printer->println('.');
179 }
180 
181 } // namespace
182 
183 bool Assertion::isOutputEnabled(bool ok) const {
184  return (ok && isVerbosity(Verbosity::kAssertionPassed)) ||
185  (!ok && isVerbosity(Verbosity::kAssertionFailed));
186 }
187 
188 bool Assertion::assertionBool(const char* file, uint16_t line, bool arg,
189  bool value) {
190  if (isDone()) return false;
191  bool ok = (arg == value);
192  if (isOutputEnabled(ok)) {
193  printAssertionBoolMessage(Printer::getPrinter(), ok, file, line,
194  arg, value);
195  }
196  setPassOrFail(ok);
197  return ok;
198 }
199 
200 bool Assertion::assertion(const char* file, uint16_t line, bool lhs,
201  const char* opName, bool (*op)(bool lhs, bool rhs),
202  bool rhs) {
203  if (isDone()) return false;
204  bool ok = op(lhs, rhs);
205  if (isOutputEnabled(ok)) {
206  printAssertionMessage(Printer::getPrinter(), ok, file, line,
207  lhs, opName, rhs);
208  }
209  setPassOrFail(ok);
210  return ok;
211 }
212 
213 bool Assertion::assertion(const char* file, uint16_t line, char lhs,
214  const char* opName, bool (*op)(char lhs, char rhs),
215  char rhs) {
216  if (isDone()) return false;
217  bool ok = op(lhs, rhs);
218  if (isOutputEnabled(ok)) {
219  printAssertionMessage(Printer::getPrinter(), ok, file, line,
220  lhs, opName, rhs);
221  }
222  setPassOrFail(ok);
223  return ok;
224 }
225 
226 bool Assertion::assertion(const char* file, uint16_t line, int lhs,
227  const char* opName, bool (*op)(int lhs, int rhs),
228  int rhs) {
229  if (isDone()) return false;
230  bool ok = op(lhs, rhs);
231  if (isOutputEnabled(ok)) {
232  printAssertionMessage(Printer::getPrinter(), ok, file, line,
233  lhs, opName, rhs);
234  }
235  setPassOrFail(ok);
236  return ok;
237 }
238 
239 bool Assertion::assertion(const char* file, uint16_t line, unsigned int lhs,
240  const char* opName, bool (*op)(unsigned int lhs, unsigned int rhs),
241  unsigned int rhs) {
242  if (isDone()) return false;
243  bool ok = op(lhs, rhs);
244  if (isOutputEnabled(ok)) {
245  printAssertionMessage(Printer::getPrinter(), ok, file, line,
246  lhs, opName, rhs);
247  }
248  setPassOrFail(ok);
249  return ok;
250 }
251 
252 bool Assertion::assertion(const char* file, uint16_t line, long lhs,
253  const char* opName, bool (*op)(long lhs, long rhs),
254  long rhs) {
255  if (isDone()) return false;
256  bool ok = op(lhs, rhs);
257  if (isOutputEnabled(ok)) {
258  printAssertionMessage(Printer::getPrinter(), ok, file, line,
259  lhs, opName, rhs);
260  }
261  setPassOrFail(ok);
262  return ok;
263 }
264 
265 bool Assertion::assertion(const char* file, uint16_t line, unsigned long lhs,
266  const char* opName, bool (*op)(unsigned long lhs, unsigned long rhs),
267  unsigned long rhs) {
268  if (isDone()) return false;
269  bool ok = op(lhs, rhs);
270  if (isOutputEnabled(ok)) {
271  printAssertionMessage(Printer::getPrinter(), ok, file, line,
272  lhs, opName, rhs);
273  }
274  setPassOrFail(ok);
275  return ok;
276 }
277 
278 bool Assertion::assertion(const char* file, uint16_t line, long long lhs,
279  const char* opName, bool (*op)(long long lhs, long long rhs),
280  long long rhs) {
281  if (isDone()) return false;
282  bool ok = op(lhs, rhs);
283  if (isOutputEnabled(ok)) {
284  printAssertionMessage(Printer::getPrinter(), ok, file, line,
285  lhs, opName, rhs);
286  }
287  setPassOrFail(ok);
288  return ok;
289 }
290 
291 bool Assertion::assertion(const char* file, uint16_t line,
292  unsigned long long lhs, const char* opName,
293  bool (*op)(unsigned long long lhs, unsigned long long rhs),
294  unsigned long long rhs) {
295  if (isDone()) return false;
296  bool ok = op(lhs, rhs);
297  if (isOutputEnabled(ok)) {
298  printAssertionMessage(Printer::getPrinter(), ok, file, line,
299  lhs, opName, rhs);
300  }
301  setPassOrFail(ok);
302  return ok;
303 }
304 
305 bool Assertion::assertion(const char* file, uint16_t line, double lhs,
306  const char* opName, bool (*op)(double lhs, double rhs),
307  double rhs) {
308  if (isDone()) return false;
309  bool ok = op(lhs, rhs);
310  if (isOutputEnabled(ok)) {
311  printAssertionMessage(Printer::getPrinter(), ok, file, line,
312  lhs, opName, rhs);
313  }
314  setPassOrFail(ok);
315  return ok;
316 }
317 
318 bool Assertion::assertion(const char* file, uint16_t line, const char* lhs,
319  const char* opName, bool (*op)(const char* lhs, const char* rhs),
320  const char* rhs) {
321  if (isDone()) return false;
322  bool ok = op(lhs, rhs);
323  if (isOutputEnabled(ok)) {
324  printAssertionMessage(Printer::getPrinter(), ok, file, line,
325  lhs, opName, rhs);
326  }
327  setPassOrFail(ok);
328  return ok;
329 }
330 
331 bool Assertion::assertion(const char* file, uint16_t line, const char* lhs,
332  const char* opName, bool (*op)(const char* lhs, const String& rhs),
333  const String& rhs) {
334  if (isDone()) return false;
335  bool ok = op(lhs, rhs);
336  if (isOutputEnabled(ok)) {
337  printAssertionMessage(Printer::getPrinter(), ok, file, line,
338  lhs, opName, rhs);
339  }
340  setPassOrFail(ok);
341  return ok;
342 }
343 
344 bool Assertion::assertion(const char* file, uint16_t line, const char* lhs,
345  const char* opName,
346  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
347  const __FlashStringHelper* rhs) {
348  if (isDone()) return false;
349  bool ok = op(lhs, rhs);
350  if (isOutputEnabled(ok)) {
351  printAssertionMessage(Printer::getPrinter(), ok, file, line,
352  lhs, opName, rhs);
353  }
354  setPassOrFail(ok);
355  return ok;
356 }
357 
358 bool Assertion::assertion(const char* file, uint16_t line, const String& lhs,
359  const char* opName, bool (*op)(const String& lhs, const char* rhs),
360  const char* rhs) {
361  if (isDone()) return false;
362  bool ok = op(lhs, rhs);
363  if (isOutputEnabled(ok)) {
364  printAssertionMessage(Printer::getPrinter(), ok, file, line,
365  lhs, opName, rhs);
366  }
367  setPassOrFail(ok);
368  return ok;
369 }
370 
371 bool Assertion::assertion(const char* file, uint16_t line, const String& lhs,
372  const char* opName, bool (*op)(const String& lhs, const String& rhs),
373  const String& rhs) {
374  if (isDone()) return false;
375  bool ok = op(lhs, rhs);
376  if (isOutputEnabled(ok)) {
377  printAssertionMessage(Printer::getPrinter(), ok, file, line,
378  lhs, opName, rhs);
379  }
380  setPassOrFail(ok);
381  return ok;
382 }
383 
384 bool Assertion::assertion(const char* file, uint16_t line, const String& lhs,
385  const char* opName,
386  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
387  const __FlashStringHelper* rhs) {
388  if (isDone()) return false;
389  bool ok = op(lhs, rhs);
390  if (isOutputEnabled(ok)) {
391  printAssertionMessage(Printer::getPrinter(), ok, file, line,
392  lhs, opName, rhs);
393  }
394  setPassOrFail(ok);
395  return ok;
396 }
397 
398 bool Assertion::assertion(const char* file, uint16_t line,
399  const __FlashStringHelper* lhs, const char* opName,
400  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
401  const char* rhs) {
402  if (isDone()) return false;
403  bool ok = op(lhs, rhs);
404  if (isOutputEnabled(ok)) {
405  printAssertionMessage(Printer::getPrinter(), ok, file, line,
406  lhs, opName, rhs);
407  }
408  setPassOrFail(ok);
409  return ok;
410 }
411 
412 bool Assertion::assertion(const char* file, uint16_t line,
413  const __FlashStringHelper* lhs, const char* opName,
414  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
415  const String& rhs) {
416  if (isDone()) return false;
417  bool ok = op(lhs, rhs);
418  if (isOutputEnabled(ok)) {
419  printAssertionMessage(Printer::getPrinter(), ok, file, line,
420  lhs, opName, rhs);
421  }
422  setPassOrFail(ok);
423  return ok;
424 }
425 
426 bool Assertion::assertion(const char* file, uint16_t line,
427  const __FlashStringHelper* lhs, const char* opName,
428  bool (*op)(const __FlashStringHelper* lhs, const __FlashStringHelper* rhs),
429  const __FlashStringHelper* rhs) {
430  if (isDone()) return false;
431  bool ok = op(lhs, rhs);
432  if (isOutputEnabled(ok)) {
433  printAssertionMessage(Printer::getPrinter(), ok, file, line,
434  lhs, opName, rhs);
435  }
436  setPassOrFail(ok);
437  return ok;
438 }
439 
440 bool Assertion::assertionNear(const char* file, uint16_t line,
441  int lhs, int rhs, int error, const char* opName,
442  bool (*opNear)(int lhs, int rhs, int error)) {
443  if (isDone()) return false;
444  bool ok = opNear(lhs, rhs, error);
445  if (isOutputEnabled(ok)) {
446  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
447  lhs, rhs, opName, error);
448  }
449  setPassOrFail(ok);
450  return ok;
451 }
452 
453 bool Assertion::assertionNear(const char* file, uint16_t line,
454  unsigned int lhs, unsigned int rhs, unsigned int error, const char* opName,
455  bool (*opNear)(unsigned int lhs, unsigned int rhs, unsigned int error)) {
456  if (isDone()) return false;
457  bool ok = opNear(lhs, rhs, error);
458  if (isOutputEnabled(ok)) {
459  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
460  lhs, rhs, opName, error);
461  }
462  setPassOrFail(ok);
463  return ok;
464 }
465 
466 bool Assertion::assertionNear(const char* file, uint16_t line,
467  long lhs, long rhs, long error, const char* opName,
468  bool (*opNear)(long lhs, long rhs, long error)) {
469  if (isDone()) return false;
470  bool ok = opNear(lhs, rhs, error);
471  if (isOutputEnabled(ok)) {
472  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
473  lhs, rhs, opName, error);
474  }
475  setPassOrFail(ok);
476  return ok;
477 }
478 
479 bool Assertion::assertionNear(const char* file, uint16_t line,
480  unsigned long lhs, unsigned long rhs, unsigned long error,
481  const char* opName,
482  bool (*opNear)(unsigned long lhs, unsigned long rhs, unsigned long error)) {
483  if (isDone()) return false;
484  bool ok = opNear(lhs, rhs, error);
485  if (isOutputEnabled(ok)) {
486  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
487  lhs, rhs, opName, error);
488  }
489  setPassOrFail(ok);
490  return ok;
491 }
492 
493 bool Assertion::assertionNear(const char* file, uint16_t line,
494  double lhs, double rhs, double error, const char* opName,
495  bool (*opNear)(double lhs, double rhs, double error)) {
496  if (isDone()) return false;
497  bool ok = opNear(lhs, rhs, error);
498  if (isOutputEnabled(ok)) {
499  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
500  lhs, rhs, opName, error);
501  }
502  setPassOrFail(ok);
503  return ok;
504 }
505 
506 //---------------------------------------------------------------------------
507 
508 namespace internal {
509 
510 // Verbose versions of above which accept the string arguments of the
511 // assertXxx() macros, so that the error messages are more verbose.
512 //
513 // Prints something like the following:
514 // Assertion failed: (x=5) == (y=6), file Test.ino, line 820.
515 // Assertion passed: (x=6) == (y=6), file Test.ino, line 820.
516 template <typename A, typename B>
517 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
518  uint16_t line, const A& lhs, const __FlashStringHelper* lhsString,
519  const char* opName, const B& rhs, const __FlashStringHelper* rhsString) {
520 
521  // Don't use F() strings here because flash memory strings are not deduped by
522  // the compiler, so each template instantiation of this method causes a
523  // duplication of all the strings below. See
524  // https://github.com/mmurdoch/arduinounit/issues/70
525  // for more info.
526  printer->print("Assertion ");
527  printer->print(ok ? "passed" : "failed");
528  printer->print(": (");
529  printer->print(lhsString);
530  printer->print('=');
531  printer->print(lhs);
532  printer->print(") ");
533  printer->print(opName);
534  printer->print(" (");
535  printer->print(rhsString);
536  printer->print('=');
537  printer->print(rhs);
538  printer->print(')');
539  // reuse string in MataAssertion::printAssertionTestStatusMessage()
540  printer->print(", file ");
541  printer->print(file);
542  printer->print(", line ");
543  printer->print(line);
544  printer->println('.');
545 }
546 
547 // Special version of (bool, bool) because Arduino Print.h converts
548 // bool into int, which prints out "(1) == (0)", which isn't as useful.
549 // This prints "(x=true) == (y=false)".
550 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
551  uint16_t line, bool lhs, const __FlashStringHelper* lhsString,
552  const char* opName, bool rhs, const __FlashStringHelper* rhsString) {
553 
554  // Don't use F() strings here. Same reason as above.
555  printer->print("Assertion ");
556  printer->print(ok ? "passed" : "failed");
557  printer->print(": (");
558  printer->print(lhsString);
559  printer->print('=');
560  printer->print(lhs ? "true" : "false");
561  printer->print(") ");
562  printer->print(opName);
563  printer->print(" (");
564  printer->print(rhsString);
565  printer->print('=');
566  printer->print(rhs ? "true" : "false");
567  printer->print(')');
568  printer->print(", file ");
569  printer->print(file);
570  printer->print(", line ");
571  printer->print(line);
572  printer->println('.');
573 }
574 
575 // Version for (long long, long long) because Print.h does not support int64.
576 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
577  uint16_t line, long long& lhs, const __FlashStringHelper* lhsString,
578  const char* opName, long long& rhs, const __FlashStringHelper* rhsString) {
579 
580  // Don't use F() strings here. Same reason as above.
581  printer->print("Assertion ");
582  printer->print(ok ? "passed" : "failed");
583  printer->print(": (");
584  printer->print(lhsString);
585  printer->print('=');
586  print64(*printer, lhs);
587  printer->print(") ");
588  printer->print(opName);
589  printer->print(" (");
590  printer->print(rhsString);
591  printer->print('=');
592  print64(*printer, rhs);
593  printer->print(')');
594  printer->print(", file ");
595  printer->print(file);
596  printer->print(", line ");
597  printer->print(line);
598  printer->println('.');
599 }
600 
601 // Version for (unsigned long long, unsigned long long) because Print.h does
602 // not support int64.
603 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
604  uint16_t line, unsigned long long& lhs,
605  const __FlashStringHelper* lhsString, const char* opName,
606  unsigned long long& rhs, const __FlashStringHelper* rhsString) {
607 
608  // Don't use F() strings here. Same reason as above.
609  printer->print("Assertion ");
610  printer->print(ok ? "passed" : "failed");
611  printer->print(": (");
612  printer->print(lhsString);
613  printer->print('=');
614  print64(*printer, lhs);
615  printer->print(") ");
616  printer->print(opName);
617  printer->print(" (");
618  printer->print(rhsString);
619  printer->print('=');
620  print64(*printer, rhs);
621  printer->print(')');
622  printer->print(", file ");
623  printer->print(file);
624  printer->print(", line ");
625  printer->print(line);
626  printer->println('.');
627 }
628 
629 // Special version for assertTrue(arg) and assertFalse(arg).
630 // Prints:
631 // "Assertion passed/failed: (x=arg) is true"
632 // "Assertion passed/failed: (x=arg) is false"
633 void printAssertionBoolMessageVerbose(Print* printer, bool ok, const char* file,
634  uint16_t line, bool arg, const __FlashStringHelper* argString, bool value) {
635 
636  // Don't use F() strings here. Same reason as above.
637  printer->print("Assertion ");
638  printer->print(ok ? "passed" : "failed");
639  printer->print(": (");
640  printer->print(argString);
641  printer->print('=');
642  printer->print(arg ? "true" : "false");
643  printer->print(") is ");
644  printer->print(value ? "true" : "false");
645  printer->print(", file ");
646  printer->print(file);
647  printer->print(", line ");
648  printer->print(line);
649  printer->println('.');
650 }
651 
652 template <typename A>
653 void printAssertionNearMessageVerbose(Print* printer, bool ok, const char* file,
654  uint16_t line, const A& lhs, const __FlashStringHelper* lhsString,
655  const A& rhs, const __FlashStringHelper* rhsString,
656  const char* opName,
657  const A& error, const __FlashStringHelper* errorString) {
658  printer->print("Assertion ");
659  printer->print(ok ? "passed" : "failed");
660  printer->print(": |(");
661  printer->print(lhsString);
662  printer->print('=');
663  printer->print(lhs);
664  printer->print(") - (");
665  printer->print(rhsString);
666  printer->print('=');
667  printer->print(rhs);
668  printer->print(")| ");
669  printer->print(opName);
670  printer->print(" (");
671  printer->print(errorString);
672  printer->print('=');
673  printer->print(error);
674  printer->print(')');
675  printer->print(", file ");
676  printer->print(file);
677  printer->print(", line ");
678  printer->print(line);
679  printer->println('.');
680 }
681 
682 } // namespace
683 
684 bool Assertion::assertionBoolVerbose(const char* file, uint16_t line, bool arg,
685  const __FlashStringHelper* argString, bool value) {
686  if (isDone()) return false;
687  bool ok = (arg == value);
688  if (isOutputEnabled(ok)) {
689  printAssertionBoolMessageVerbose(Printer::getPrinter(), ok, file, line,
690  arg, argString, value);
691  }
692  setPassOrFail(ok);
693  return ok;
694 }
695 
696 bool Assertion::assertionVerbose(const char* file, uint16_t line, bool lhs,
697  const __FlashStringHelper* lhsString, const char* opName,
698  bool (*op)(bool lhs, bool rhs), bool rhs,
699  const __FlashStringHelper* rhsString) {
700  if (isDone()) return false;
701  bool ok = op(lhs, rhs);
702  if (isOutputEnabled(ok)) {
703  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
704  lhs, lhsString, opName, rhs, rhsString);
705  }
706  setPassOrFail(ok);
707  return ok;
708 }
709 
710 bool Assertion::assertionVerbose(const char* file, uint16_t line, char lhs,
711  const __FlashStringHelper* lhsString, const char* opName,
712  bool (*op)(char lhs, char rhs), char rhs,
713  const __FlashStringHelper* rhsString) {
714  if (isDone()) return false;
715  bool ok = op(lhs, rhs);
716  if (isOutputEnabled(ok)) {
717  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
718  lhs, lhsString, opName, rhs, rhsString);
719  }
720  setPassOrFail(ok);
721  return ok;
722 }
723 
724 bool Assertion::assertionVerbose(const char* file, uint16_t line, int lhs,
725  const __FlashStringHelper* lhsString, const char* opName,
726  bool (*op)(int lhs, int rhs), int rhs,
727  const __FlashStringHelper* rhsString) {
728  if (isDone()) return false;
729  bool ok = op(lhs, rhs);
730  if (isOutputEnabled(ok)) {
731  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
732  lhs, lhsString, opName, rhs, rhsString);
733  }
734  setPassOrFail(ok);
735  return ok;
736 }
737 
738 bool Assertion::assertionVerbose(const char* file, uint16_t line,
739  unsigned int lhs, const __FlashStringHelper* lhsString, const char* opName,
740  bool (*op)(unsigned int lhs, unsigned int rhs),
741  unsigned int rhs, const __FlashStringHelper* rhsString) {
742  if (isDone()) return false;
743  bool ok = op(lhs, rhs);
744  if (isOutputEnabled(ok)) {
745  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
746  lhs, lhsString, opName, rhs, rhsString);
747  }
748  setPassOrFail(ok);
749  return ok;
750 }
751 
752 bool Assertion::assertionVerbose(const char* file, uint16_t line, long lhs,
753  const __FlashStringHelper* lhsString, const char* opName,
754  bool (*op)(long lhs, long rhs), long rhs,
755  const __FlashStringHelper* rhsString) {
756  if (isDone()) return false;
757  bool ok = op(lhs, rhs);
758  if (isOutputEnabled(ok)) {
759  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
760  lhs, lhsString, opName, rhs, rhsString);
761  }
762  setPassOrFail(ok);
763  return ok;
764 }
765 
766 bool Assertion::assertionVerbose(const char* file, uint16_t line,
767  unsigned long lhs, const __FlashStringHelper* lhsString, const char* opName,
768  bool (*op)(unsigned long lhs, unsigned long rhs),
769  unsigned long rhs, const __FlashStringHelper* rhsString) {
770  if (isDone()) return false;
771  bool ok = op(lhs, rhs);
772  if (isOutputEnabled(ok)) {
773  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
774  lhs, lhsString, opName, rhs, rhsString);
775  }
776  setPassOrFail(ok);
777  return ok;
778 }
779 
780 bool Assertion::assertionVerbose(const char* file, uint16_t line, long long lhs,
781  const __FlashStringHelper* lhsString, const char* opName,
782  bool (*op)(long long lhs, long long rhs), long long rhs,
783  const __FlashStringHelper* rhsString) {
784  if (isDone()) return false;
785  bool ok = op(lhs, rhs);
786  if (isOutputEnabled(ok)) {
787  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
788  lhs, lhsString, opName, rhs, rhsString);
789  }
790  setPassOrFail(ok);
791  return ok;
792 }
793 
794 bool Assertion::assertionVerbose(const char* file, uint16_t line,
795  unsigned long long lhs, const __FlashStringHelper* lhsString,
796  const char* opName,
797  bool (*op)(unsigned long long lhs, unsigned long long rhs),
798  unsigned long long rhs, const __FlashStringHelper* rhsString) {
799  if (isDone()) return false;
800  bool ok = op(lhs, rhs);
801  if (isOutputEnabled(ok)) {
802  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
803  lhs, lhsString, opName, rhs, rhsString);
804  }
805  setPassOrFail(ok);
806  return ok;
807 }
808 
809 bool Assertion::assertionVerbose(const char* file, uint16_t line, double lhs,
810  const __FlashStringHelper* lhsString, const char* opName,
811  bool (*op)(double lhs, double rhs), double rhs,
812  const __FlashStringHelper* rhsString) {
813  if (isDone()) return false;
814  bool ok = op(lhs, rhs);
815  if (isOutputEnabled(ok)) {
816  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
817  lhs, lhsString, opName, rhs, rhsString);
818  }
819  setPassOrFail(ok);
820  return ok;
821 }
822 
823 bool Assertion::assertionVerbose(const char* file, uint16_t line,
824  const char* lhs, const __FlashStringHelper* lhsString, const char* opName,
825  bool (*op)(const char* lhs, const char* rhs),
826  const char* rhs, const __FlashStringHelper* rhsString) {
827  if (isDone()) return false;
828  bool ok = op(lhs, rhs);
829  if (isOutputEnabled(ok)) {
830  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
831  lhs, lhsString, opName, rhs, rhsString);
832  }
833  setPassOrFail(ok);
834  return ok;
835 }
836 
837 bool Assertion::assertionVerbose(const char* file, uint16_t line,
838  const char* lhs, const __FlashStringHelper* lhsString,
839  const char* opName, bool (*op)(const char* lhs, const String& rhs),
840  const String& rhs, const __FlashStringHelper* rhsString) {
841  if (isDone()) return false;
842  bool ok = op(lhs, rhs);
843  if (isOutputEnabled(ok)) {
844  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
845  lhs, lhsString, opName, rhs, rhsString);
846  }
847  setPassOrFail(ok);
848  return ok;
849 }
850 
851 bool Assertion::assertionVerbose(const char* file, uint16_t line,
852  const char* lhs, const __FlashStringHelper* lhsString, const char* opName,
853  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
854  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString) {
855  if (isDone()) return false;
856  bool ok = op(lhs, rhs);
857  if (isOutputEnabled(ok)) {
858  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
859  lhs, lhsString, opName, rhs, rhsString);
860  }
861  setPassOrFail(ok);
862  return ok;
863 }
864 
865 bool Assertion::assertionVerbose(const char* file, uint16_t line,
866  const String& lhs, const __FlashStringHelper* lhsString, const char* opName,
867  bool (*op)(const String& lhs, const char* rhs),
868  const char* rhs, const __FlashStringHelper* rhsString) {
869  if (isDone()) return false;
870  bool ok = op(lhs, rhs);
871  if (isOutputEnabled(ok)) {
872  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
873  lhs, lhsString, opName, rhs, rhsString);
874  }
875  setPassOrFail(ok);
876  return ok;
877 }
878 
879 bool Assertion::assertionVerbose(const char* file, uint16_t line,
880  const String& lhs, const __FlashStringHelper* lhsString, const char* opName,
881  bool (*op)(const String& lhs, const String& rhs),
882  const String& rhs, const __FlashStringHelper* rhsString) {
883  if (isDone()) return false;
884  bool ok = op(lhs, rhs);
885  if (isOutputEnabled(ok)) {
886  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
887  lhs, lhsString, opName, rhs, rhsString);
888  }
889  setPassOrFail(ok);
890  return ok;
891 }
892 
893 bool Assertion::assertionVerbose(const char* file, uint16_t line,
894  const String& lhs, const __FlashStringHelper* lhsString, const char* opName,
895  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
896  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString) {
897  if (isDone()) return false;
898  bool ok = op(lhs, rhs);
899  if (isOutputEnabled(ok)) {
900  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
901  lhs, lhsString, opName, rhs, rhsString);
902  }
903  setPassOrFail(ok);
904  return ok;
905 }
906 
907 bool Assertion::assertionVerbose(const char* file, uint16_t line,
908  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
909  const char* opName,
910  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
911  const char* rhs, const __FlashStringHelper* rhsString) {
912  if (isDone()) return false;
913  bool ok = op(lhs, rhs);
914  if (isOutputEnabled(ok)) {
915  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
916  lhs, lhsString, opName, rhs, rhsString);
917  }
918  setPassOrFail(ok);
919  return ok;
920 }
921 
922 bool Assertion::assertionVerbose(const char* file, uint16_t line,
923  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
924  const char* opName,
925  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
926  const String& rhs, const __FlashStringHelper* rhsString) {
927  if (isDone()) return false;
928  bool ok = op(lhs, rhs);
929  if (isOutputEnabled(ok)) {
930  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
931  lhs, lhsString, opName, rhs, rhsString);
932  }
933  setPassOrFail(ok);
934  return ok;
935 }
936 
937 bool Assertion::assertionVerbose(const char* file, uint16_t line,
938  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
939  const char* opName,
940  bool (*op)(const __FlashStringHelper* lhs, const __FlashStringHelper* rhs),
941  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString) {
942  if (isDone()) return false;
943  bool ok = op(lhs, rhs);
944  if (isOutputEnabled(ok)) {
945  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
946  lhs, lhsString, opName, rhs, rhsString);
947  }
948  setPassOrFail(ok);
949  return ok;
950 }
951 
952 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
953  int lhs, const __FlashStringHelper* lhsString,
954  int rhs, const __FlashStringHelper* rhsString,
955  int error, const __FlashStringHelper* errorString,
956  const char* opName,
957  bool (*opNear)(int lhs, int rhs, int error)) {
958  if (isDone()) return false;
959  bool ok = opNear(lhs, rhs, error);
960  if (isOutputEnabled(ok)) {
961  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
962  lhs, lhsString, rhs, rhsString, opName, error, errorString);
963  }
964  setPassOrFail(ok);
965  return ok;
966 }
967 
968 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
969  unsigned int lhs, const __FlashStringHelper* lhsString,
970  unsigned int rhs, const __FlashStringHelper* rhsString,
971  unsigned int error, const __FlashStringHelper* errorString,
972  const char* opName,
973  bool (*opNear)(unsigned int lhs, unsigned int rhs, unsigned int error)) {
974  if (isDone()) return false;
975  bool ok = opNear(lhs, rhs, error);
976  if (isOutputEnabled(ok)) {
977  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
978  lhs, lhsString, rhs, rhsString, opName, error, errorString);
979  }
980  setPassOrFail(ok);
981  return ok;
982 }
983 
984 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
985  long lhs, const __FlashStringHelper* lhsString,
986  long rhs, const __FlashStringHelper* rhsString,
987  long error, const __FlashStringHelper* errorString,
988  const char* opName,
989  bool (*opNear)(long lhs, long rhs, long error)) {
990  if (isDone()) return false;
991  bool ok = opNear(lhs, rhs, error);
992  if (isOutputEnabled(ok)) {
993  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
994  lhs, lhsString, rhs, rhsString, opName, error, errorString);
995  }
996  setPassOrFail(ok);
997  return ok;
998 }
999 
1000 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
1001  unsigned long lhs, const __FlashStringHelper* lhsString,
1002  unsigned long rhs, const __FlashStringHelper* rhsString,
1003  unsigned long error, const __FlashStringHelper* errorString,
1004  const char* opName,
1005  bool (*opNear)(unsigned long lhs, unsigned long rhs, unsigned long error)) {
1006  if (isDone()) return false;
1007  bool ok = opNear(lhs, rhs, error);
1008  if (isOutputEnabled(ok)) {
1009  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
1010  lhs, lhsString, rhs, rhsString, opName, error, errorString);
1011  }
1012  setPassOrFail(ok);
1013  return ok;
1014 }
1015 
1016 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
1017  double lhs, const __FlashStringHelper* lhsString,
1018  double rhs, const __FlashStringHelper* rhsString,
1019  double error, const __FlashStringHelper* errorString,
1020  const char* opName,
1021  bool (*opNear)(double lhs, double rhs, double error)) {
1022  if (isDone()) return false;
1023  bool ok = opNear(lhs, rhs, error);
1024  if (isOutputEnabled(ok)) {
1025  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
1026  lhs, lhsString, rhs, rhsString, opName, error, errorString);
1027  }
1028  setPassOrFail(ok);
1029  return ok;
1030 }
1031 
1032 }
Helper routines to print &#39;long long&#39; and &#39;unsigned long long&#39; because the Print::print() methods in P...
- -
static const uint8_t kAssertionPassed
Print assertXxx() passed message.
Definition: Verbosity.h:40
-
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
-
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
Definition: Assertion.cpp:183
-
static const uint8_t kAssertionFailed
Print assertXxx() failed message.
Definition: Verbosity.h:43
-
Various macros to smooth over the differences among the various platforms with regards to their suppo...
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include <Arduino.h> // definition of Print
+
26 #include "Flash.h"
+
27 #include "Printer.h"
+
28 #include "Assertion.h"
+
29 #include "print64.h"
+
30 
+
31 namespace aunit {
+
32 
+
33 using namespace internal;
+
34 
+
35 namespace internal {
+
36 
+
37 // This can be a template function because it is accessed only through the
+
38 // various assertXxx() methods. Those assertXxx() methods are explicitly
+
39 // overloaded for the various types that we want to support.
+
40 //
+
41 // Prints something like the following:
+
42 // Assertion failed: (5) == (6), file Test.ino, line 820.
+
43 // Assertion passed: (6) == (6), file Test.ino, line 820.
+
44 template <typename A, typename B>
+
45 void printAssertionMessage(Print* printer, bool ok, const char* file,
+
46  uint16_t line, const A& lhs, const char* opName, const B& rhs) {
+
47 
+
48  // Don't use F() strings here because flash memory strings are not deduped by
+
49  // the compiler, so each template instantiation of this method causes a
+
50  // duplication of all the strings below. See
+
51  // https://github.com/mmurdoch/arduinounit/issues/70
+
52  // for more info. Normal (const char*) strings will be deduped by the
+
53  // compiler/linker.
+
54  printer->print("Assertion ");
+
55  printer->print(ok ? "passed" : "failed");
+
56  printer->print(": (");
+
57  printer->print(lhs);
+
58  printer->print(") ");
+
59  printer->print(opName);
+
60  printer->print(" (");
+
61  printer->print(rhs);
+
62  printer->print(')');
+
63  // reuse string in MataAssertion::printAssertionTestStatusMessage()
+
64  printer->print(", file ");
+
65  printer->print(file);
+
66  printer->print(", line ");
+
67  printer->print(line);
+
68  printer->println('.');
+
69 }
+
70 
+
71 // Special version of (bool, bool) because Arduino Print.h converts
+
72 // bool into int, which prints out "(1) == (0)", which isn't as useful.
+
73 // This prints "(true) == (false)".
+
74 void printAssertionMessage(Print* printer, bool ok, const char* file,
+
75  uint16_t line, bool lhs, const char* opName, bool rhs) {
+
76 
+
77  // Don't use F() strings here. Same reason as above.
+
78  printer->print("Assertion ");
+
79  printer->print(ok ? "passed" : "failed");
+
80  printer->print(": (");
+
81  printer->print(lhs ? "true" : "false");
+
82  printer->print(") ");
+
83  printer->print(opName);
+
84  printer->print(" (");
+
85  printer->print(rhs ? "true" : "false");
+
86  printer->print(')');
+
87  printer->print(", file ");
+
88  printer->print(file);
+
89  printer->print(", line ");
+
90  printer->print(line);
+
91  printer->println('.');
+
92 }
+
93 
+
94 // Version for (long long, long long) because Print.h does not support int64.
+
95 void printAssertionMessage(Print* printer, bool ok, const char* file,
+
96  uint16_t line, long long& lhs, const char* opName, long long& rhs) {
+
97 
+
98  // Don't use F() strings here. Same reason as above.
+
99  printer->print("Assertion ");
+
100  printer->print(ok ? "passed" : "failed");
+
101  printer->print(": (");
+
102  print64(*printer, lhs);
+
103  printer->print(") ");
+
104  printer->print(opName);
+
105  printer->print(" (");
+
106  print64(*printer, rhs);
+
107  printer->print(')');
+
108  printer->print(", file ");
+
109  printer->print(file);
+
110  printer->print(", line ");
+
111  printer->print(line);
+
112  printer->println('.');
+
113 }
+
114 
+
115 // Version for (unsigned long long, unsigned long long) because Print.h does
+
116 // not support int64.
+
117 void printAssertionMessage(Print* printer, bool ok, const char* file,
+
118  uint16_t line, unsigned long long& lhs, const char* opName,
+
119  unsigned long long& rhs) {
+
120 
+
121  // Don't use F() strings here. Same reason as above.
+
122  printer->print("Assertion ");
+
123  printer->print(ok ? "passed" : "failed");
+
124  printer->print(": (");
+
125  print64(*printer, lhs);
+
126  printer->print(") ");
+
127  printer->print(opName);
+
128  printer->print(" (");
+
129  print64(*printer, rhs);
+
130  printer->print(')');
+
131  printer->print(", file ");
+
132  printer->print(file);
+
133  printer->print(", line ");
+
134  printer->print(line);
+
135  printer->println('.');
+
136 }
+
137 
+
138 // Special version for assertTrue(arg) and assertFalse(arg).
+
139 // Prints:
+
140 // "Assertion passed/failed: (arg) is true"
+
141 // "Assertion passed/failed: (arg) is false"
+
142 void printAssertionBoolMessage(Print* printer, bool ok, const char* file,
+
143  uint16_t line, bool arg, bool value) {
+
144 
+
145  // Don't use F() strings here. Same reason as above.
+
146  printer->print("Assertion ");
+
147  printer->print(ok ? "passed" : "failed");
+
148  printer->print(": (");
+
149  printer->print(arg ? "true" : "false");
+
150  printer->print(") is ");
+
151  printer->print(value ? "true" : "false");
+
152  printer->print(", file ");
+
153  printer->print(file);
+
154  printer->print(", line ");
+
155  printer->print(line);
+
156  printer->println('.');
+
157 }
+
158 
+
159 template <typename A>
+
160 void printAssertionNearMessage(Print* printer, bool ok, const char* file,
+
161  uint16_t line, const A& lhs, const A& rhs, const char* opName,
+
162  const A& error) {
+
163  printer->print("Assertion ");
+
164  printer->print(ok ? "passed" : "failed");
+
165  printer->print(": |(");
+
166  printer->print(lhs);
+
167  printer->print(") - (");
+
168  printer->print(rhs);
+
169  printer->print(")| ");
+
170  printer->print(opName);
+
171  printer->print(" (");
+
172  printer->print(error);
+
173  printer->print(')');
+
174  printer->print(", file ");
+
175  printer->print(file);
+
176  printer->print(", line ");
+
177  printer->print(line);
+
178  printer->println('.');
+
179 }
+
180 
+
181 } // namespace
+
182 
+
183 bool Assertion::isOutputEnabled(bool ok) const {
+
184  return (ok && isVerbosity(Verbosity::kAssertionPassed)) ||
+
185  (!ok && isVerbosity(Verbosity::kAssertionFailed));
+
186 }
+
187 
+
188 bool Assertion::assertionBool(const char* file, uint16_t line, bool arg,
+
189  bool value) {
+
190  if (isDone()) return false;
+
191  bool ok = (arg == value);
+
192  if (isOutputEnabled(ok)) {
+
193  printAssertionBoolMessage(Printer::getPrinter(), ok, file, line,
+
194  arg, value);
+
195  }
+
196  setPassOrFail(ok);
+
197  return ok;
+
198 }
+
199 
+
200 bool Assertion::assertion(const char* file, uint16_t line, bool lhs,
+
201  const char* opName, bool (*op)(bool lhs, bool rhs),
+
202  bool rhs) {
+
203  if (isDone()) return false;
+
204  bool ok = op(lhs, rhs);
+
205  if (isOutputEnabled(ok)) {
+
206  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
207  lhs, opName, rhs);
+
208  }
+
209  setPassOrFail(ok);
+
210  return ok;
+
211 }
+
212 
+
213 bool Assertion::assertion(const char* file, uint16_t line, char lhs,
+
214  const char* opName, bool (*op)(char lhs, char rhs),
+
215  char rhs) {
+
216  if (isDone()) return false;
+
217  bool ok = op(lhs, rhs);
+
218  if (isOutputEnabled(ok)) {
+
219  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
220  lhs, opName, rhs);
+
221  }
+
222  setPassOrFail(ok);
+
223  return ok;
+
224 }
+
225 
+
226 bool Assertion::assertion(const char* file, uint16_t line, int lhs,
+
227  const char* opName, bool (*op)(int lhs, int rhs),
+
228  int rhs) {
+
229  if (isDone()) return false;
+
230  bool ok = op(lhs, rhs);
+
231  if (isOutputEnabled(ok)) {
+
232  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
233  lhs, opName, rhs);
+
234  }
+
235  setPassOrFail(ok);
+
236  return ok;
+
237 }
+
238 
+
239 bool Assertion::assertion(const char* file, uint16_t line, unsigned int lhs,
+
240  const char* opName, bool (*op)(unsigned int lhs, unsigned int rhs),
+
241  unsigned int rhs) {
+
242  if (isDone()) return false;
+
243  bool ok = op(lhs, rhs);
+
244  if (isOutputEnabled(ok)) {
+
245  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
246  lhs, opName, rhs);
+
247  }
+
248  setPassOrFail(ok);
+
249  return ok;
+
250 }
+
251 
+
252 bool Assertion::assertion(const char* file, uint16_t line, long lhs,
+
253  const char* opName, bool (*op)(long lhs, long rhs),
+
254  long rhs) {
+
255  if (isDone()) return false;
+
256  bool ok = op(lhs, rhs);
+
257  if (isOutputEnabled(ok)) {
+
258  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
259  lhs, opName, rhs);
+
260  }
+
261  setPassOrFail(ok);
+
262  return ok;
+
263 }
+
264 
+
265 bool Assertion::assertion(const char* file, uint16_t line, unsigned long lhs,
+
266  const char* opName, bool (*op)(unsigned long lhs, unsigned long rhs),
+
267  unsigned long rhs) {
+
268  if (isDone()) return false;
+
269  bool ok = op(lhs, rhs);
+
270  if (isOutputEnabled(ok)) {
+
271  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
272  lhs, opName, rhs);
+
273  }
+
274  setPassOrFail(ok);
+
275  return ok;
+
276 }
+
277 
+
278 bool Assertion::assertion(const char* file, uint16_t line, long long lhs,
+
279  const char* opName, bool (*op)(long long lhs, long long rhs),
+
280  long long rhs) {
+
281  if (isDone()) return false;
+
282  bool ok = op(lhs, rhs);
+
283  if (isOutputEnabled(ok)) {
+
284  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
285  lhs, opName, rhs);
+
286  }
+
287  setPassOrFail(ok);
+
288  return ok;
+
289 }
+
290 
+
291 bool Assertion::assertion(const char* file, uint16_t line,
+
292  unsigned long long lhs, const char* opName,
+
293  bool (*op)(unsigned long long lhs, unsigned long long rhs),
+
294  unsigned long long rhs) {
+
295  if (isDone()) return false;
+
296  bool ok = op(lhs, rhs);
+
297  if (isOutputEnabled(ok)) {
+
298  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
299  lhs, opName, rhs);
+
300  }
+
301  setPassOrFail(ok);
+
302  return ok;
+
303 }
+
304 
+
305 bool Assertion::assertion(const char* file, uint16_t line, double lhs,
+
306  const char* opName, bool (*op)(double lhs, double rhs),
+
307  double rhs) {
+
308  if (isDone()) return false;
+
309  bool ok = op(lhs, rhs);
+
310  if (isOutputEnabled(ok)) {
+
311  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
312  lhs, opName, rhs);
+
313  }
+
314  setPassOrFail(ok);
+
315  return ok;
+
316 }
+
317 
+
318 bool Assertion::assertion(const char* file, uint16_t line, const char* lhs,
+
319  const char* opName, bool (*op)(const char* lhs, const char* rhs),
+
320  const char* rhs) {
+
321  if (isDone()) return false;
+
322  bool ok = op(lhs, rhs);
+
323  if (isOutputEnabled(ok)) {
+
324  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
325  lhs, opName, rhs);
+
326  }
+
327  setPassOrFail(ok);
+
328  return ok;
+
329 }
+
330 
+
331 bool Assertion::assertion(const char* file, uint16_t line, const char* lhs,
+
332  const char* opName, bool (*op)(const char* lhs, const String& rhs),
+
333  const String& rhs) {
+
334  if (isDone()) return false;
+
335  bool ok = op(lhs, rhs);
+
336  if (isOutputEnabled(ok)) {
+
337  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
338  lhs, opName, rhs);
+
339  }
+
340  setPassOrFail(ok);
+
341  return ok;
+
342 }
+
343 
+
344 bool Assertion::assertion(const char* file, uint16_t line, const char* lhs,
+
345  const char* opName,
+
346  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
+
347  const __FlashStringHelper* rhs) {
+
348  if (isDone()) return false;
+
349  bool ok = op(lhs, rhs);
+
350  if (isOutputEnabled(ok)) {
+
351  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
352  lhs, opName, rhs);
+
353  }
+
354  setPassOrFail(ok);
+
355  return ok;
+
356 }
+
357 
+
358 bool Assertion::assertion(const char* file, uint16_t line, const String& lhs,
+
359  const char* opName, bool (*op)(const String& lhs, const char* rhs),
+
360  const char* rhs) {
+
361  if (isDone()) return false;
+
362  bool ok = op(lhs, rhs);
+
363  if (isOutputEnabled(ok)) {
+
364  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
365  lhs, opName, rhs);
+
366  }
+
367  setPassOrFail(ok);
+
368  return ok;
+
369 }
+
370 
+
371 bool Assertion::assertion(const char* file, uint16_t line, const String& lhs,
+
372  const char* opName, bool (*op)(const String& lhs, const String& rhs),
+
373  const String& rhs) {
+
374  if (isDone()) return false;
+
375  bool ok = op(lhs, rhs);
+
376  if (isOutputEnabled(ok)) {
+
377  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
378  lhs, opName, rhs);
+
379  }
+
380  setPassOrFail(ok);
+
381  return ok;
+
382 }
+
383 
+
384 bool Assertion::assertion(const char* file, uint16_t line, const String& lhs,
+
385  const char* opName,
+
386  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
+
387  const __FlashStringHelper* rhs) {
+
388  if (isDone()) return false;
+
389  bool ok = op(lhs, rhs);
+
390  if (isOutputEnabled(ok)) {
+
391  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
392  lhs, opName, rhs);
+
393  }
+
394  setPassOrFail(ok);
+
395  return ok;
+
396 }
+
397 
+
398 bool Assertion::assertion(const char* file, uint16_t line,
+
399  const __FlashStringHelper* lhs, const char* opName,
+
400  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
+
401  const char* rhs) {
+
402  if (isDone()) return false;
+
403  bool ok = op(lhs, rhs);
+
404  if (isOutputEnabled(ok)) {
+
405  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
406  lhs, opName, rhs);
+
407  }
+
408  setPassOrFail(ok);
+
409  return ok;
+
410 }
+
411 
+
412 bool Assertion::assertion(const char* file, uint16_t line,
+
413  const __FlashStringHelper* lhs, const char* opName,
+
414  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
+
415  const String& rhs) {
+
416  if (isDone()) return false;
+
417  bool ok = op(lhs, rhs);
+
418  if (isOutputEnabled(ok)) {
+
419  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
420  lhs, opName, rhs);
+
421  }
+
422  setPassOrFail(ok);
+
423  return ok;
+
424 }
+
425 
+
426 bool Assertion::assertion(const char* file, uint16_t line,
+
427  const __FlashStringHelper* lhs, const char* opName,
+
428  bool (*op)(const __FlashStringHelper* lhs, const __FlashStringHelper* rhs),
+
429  const __FlashStringHelper* rhs) {
+
430  if (isDone()) return false;
+
431  bool ok = op(lhs, rhs);
+
432  if (isOutputEnabled(ok)) {
+
433  printAssertionMessage(Printer::getPrinter(), ok, file, line,
+
434  lhs, opName, rhs);
+
435  }
+
436  setPassOrFail(ok);
+
437  return ok;
+
438 }
+
439 
+
440 bool Assertion::assertionNear(const char* file, uint16_t line,
+
441  int lhs, int rhs, int error, const char* opName,
+
442  bool (*opNear)(int lhs, int rhs, int error)) {
+
443  if (isDone()) return false;
+
444  bool ok = opNear(lhs, rhs, error);
+
445  if (isOutputEnabled(ok)) {
+
446  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
+
447  lhs, rhs, opName, error);
+
448  }
+
449  setPassOrFail(ok);
+
450  return ok;
+
451 }
+
452 
+
453 bool Assertion::assertionNear(const char* file, uint16_t line,
+
454  unsigned int lhs, unsigned int rhs, unsigned int error, const char* opName,
+
455  bool (*opNear)(unsigned int lhs, unsigned int rhs, unsigned int error)) {
+
456  if (isDone()) return false;
+
457  bool ok = opNear(lhs, rhs, error);
+
458  if (isOutputEnabled(ok)) {
+
459  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
+
460  lhs, rhs, opName, error);
+
461  }
+
462  setPassOrFail(ok);
+
463  return ok;
+
464 }
+
465 
+
466 bool Assertion::assertionNear(const char* file, uint16_t line,
+
467  long lhs, long rhs, long error, const char* opName,
+
468  bool (*opNear)(long lhs, long rhs, long error)) {
+
469  if (isDone()) return false;
+
470  bool ok = opNear(lhs, rhs, error);
+
471  if (isOutputEnabled(ok)) {
+
472  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
+
473  lhs, rhs, opName, error);
+
474  }
+
475  setPassOrFail(ok);
+
476  return ok;
+
477 }
+
478 
+
479 bool Assertion::assertionNear(const char* file, uint16_t line,
+
480  unsigned long lhs, unsigned long rhs, unsigned long error,
+
481  const char* opName,
+
482  bool (*opNear)(unsigned long lhs, unsigned long rhs, unsigned long error)) {
+
483  if (isDone()) return false;
+
484  bool ok = opNear(lhs, rhs, error);
+
485  if (isOutputEnabled(ok)) {
+
486  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
+
487  lhs, rhs, opName, error);
+
488  }
+
489  setPassOrFail(ok);
+
490  return ok;
+
491 }
+
492 
+
493 bool Assertion::assertionNear(const char* file, uint16_t line,
+
494  double lhs, double rhs, double error, const char* opName,
+
495  bool (*opNear)(double lhs, double rhs, double error)) {
+
496  if (isDone()) return false;
+
497  bool ok = opNear(lhs, rhs, error);
+
498  if (isOutputEnabled(ok)) {
+
499  printAssertionNearMessage(Printer::getPrinter(), ok, file, line,
+
500  lhs, rhs, opName, error);
+
501  }
+
502  setPassOrFail(ok);
+
503  return ok;
+
504 }
+
505 
+
506 //---------------------------------------------------------------------------
+
507 
+
508 namespace internal {
+
509 
+
510 // Verbose versions of above which accept the string arguments of the
+
511 // assertXxx() macros, so that the error messages are more verbose.
+
512 //
+
513 // Prints something like the following:
+
514 // Assertion failed: (x=5) == (y=6), file Test.ino, line 820.
+
515 // Assertion passed: (x=6) == (y=6), file Test.ino, line 820.
+
516 template <typename A, typename B>
+
517 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
+
518  uint16_t line, const A& lhs, const __FlashStringHelper* lhsString,
+
519  const char* opName, const B& rhs, const __FlashStringHelper* rhsString) {
+
520 
+
521  // Don't use F() strings here because flash memory strings are not deduped by
+
522  // the compiler, so each template instantiation of this method causes a
+
523  // duplication of all the strings below. See
+
524  // https://github.com/mmurdoch/arduinounit/issues/70
+
525  // for more info.
+
526  printer->print("Assertion ");
+
527  printer->print(ok ? "passed" : "failed");
+
528  printer->print(": (");
+
529  printer->print(lhsString);
+
530  printer->print('=');
+
531  printer->print(lhs);
+
532  printer->print(") ");
+
533  printer->print(opName);
+
534  printer->print(" (");
+
535  printer->print(rhsString);
+
536  printer->print('=');
+
537  printer->print(rhs);
+
538  printer->print(')');
+
539  // reuse string in MataAssertion::printAssertionTestStatusMessage()
+
540  printer->print(", file ");
+
541  printer->print(file);
+
542  printer->print(", line ");
+
543  printer->print(line);
+
544  printer->println('.');
+
545 }
+
546 
+
547 // Special version of (bool, bool) because Arduino Print.h converts
+
548 // bool into int, which prints out "(1) == (0)", which isn't as useful.
+
549 // This prints "(x=true) == (y=false)".
+
550 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
+
551  uint16_t line, bool lhs, const __FlashStringHelper* lhsString,
+
552  const char* opName, bool rhs, const __FlashStringHelper* rhsString) {
+
553 
+
554  // Don't use F() strings here. Same reason as above.
+
555  printer->print("Assertion ");
+
556  printer->print(ok ? "passed" : "failed");
+
557  printer->print(": (");
+
558  printer->print(lhsString);
+
559  printer->print('=');
+
560  printer->print(lhs ? "true" : "false");
+
561  printer->print(") ");
+
562  printer->print(opName);
+
563  printer->print(" (");
+
564  printer->print(rhsString);
+
565  printer->print('=');
+
566  printer->print(rhs ? "true" : "false");
+
567  printer->print(')');
+
568  printer->print(", file ");
+
569  printer->print(file);
+
570  printer->print(", line ");
+
571  printer->print(line);
+
572  printer->println('.');
+
573 }
+
574 
+
575 // Version for (long long, long long) because Print.h does not support int64.
+
576 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
+
577  uint16_t line, long long& lhs, const __FlashStringHelper* lhsString,
+
578  const char* opName, long long& rhs, const __FlashStringHelper* rhsString) {
+
579 
+
580  // Don't use F() strings here. Same reason as above.
+
581  printer->print("Assertion ");
+
582  printer->print(ok ? "passed" : "failed");
+
583  printer->print(": (");
+
584  printer->print(lhsString);
+
585  printer->print('=');
+
586  print64(*printer, lhs);
+
587  printer->print(") ");
+
588  printer->print(opName);
+
589  printer->print(" (");
+
590  printer->print(rhsString);
+
591  printer->print('=');
+
592  print64(*printer, rhs);
+
593  printer->print(')');
+
594  printer->print(", file ");
+
595  printer->print(file);
+
596  printer->print(", line ");
+
597  printer->print(line);
+
598  printer->println('.');
+
599 }
+
600 
+
601 // Version for (unsigned long long, unsigned long long) because Print.h does
+
602 // not support int64.
+
603 void printAssertionMessageVerbose(Print* printer, bool ok, const char* file,
+
604  uint16_t line, unsigned long long& lhs,
+
605  const __FlashStringHelper* lhsString, const char* opName,
+
606  unsigned long long& rhs, const __FlashStringHelper* rhsString) {
+
607 
+
608  // Don't use F() strings here. Same reason as above.
+
609  printer->print("Assertion ");
+
610  printer->print(ok ? "passed" : "failed");
+
611  printer->print(": (");
+
612  printer->print(lhsString);
+
613  printer->print('=');
+
614  print64(*printer, lhs);
+
615  printer->print(") ");
+
616  printer->print(opName);
+
617  printer->print(" (");
+
618  printer->print(rhsString);
+
619  printer->print('=');
+
620  print64(*printer, rhs);
+
621  printer->print(')');
+
622  printer->print(", file ");
+
623  printer->print(file);
+
624  printer->print(", line ");
+
625  printer->print(line);
+
626  printer->println('.');
+
627 }
+
628 
+
629 // Special version for assertTrue(arg) and assertFalse(arg).
+
630 // Prints:
+
631 // "Assertion passed/failed: (x=arg) is true"
+
632 // "Assertion passed/failed: (x=arg) is false"
+
633 void printAssertionBoolMessageVerbose(Print* printer, bool ok, const char* file,
+
634  uint16_t line, bool arg, const __FlashStringHelper* argString, bool value) {
+
635 
+
636  // Don't use F() strings here. Same reason as above.
+
637  printer->print("Assertion ");
+
638  printer->print(ok ? "passed" : "failed");
+
639  printer->print(": (");
+
640  printer->print(argString);
+
641  printer->print('=');
+
642  printer->print(arg ? "true" : "false");
+
643  printer->print(") is ");
+
644  printer->print(value ? "true" : "false");
+
645  printer->print(", file ");
+
646  printer->print(file);
+
647  printer->print(", line ");
+
648  printer->print(line);
+
649  printer->println('.');
+
650 }
+
651 
+
652 template <typename A>
+
653 void printAssertionNearMessageVerbose(Print* printer, bool ok, const char* file,
+
654  uint16_t line, const A& lhs, const __FlashStringHelper* lhsString,
+
655  const A& rhs, const __FlashStringHelper* rhsString,
+
656  const char* opName,
+
657  const A& error, const __FlashStringHelper* errorString) {
+
658  printer->print("Assertion ");
+
659  printer->print(ok ? "passed" : "failed");
+
660  printer->print(": |(");
+
661  printer->print(lhsString);
+
662  printer->print('=');
+
663  printer->print(lhs);
+
664  printer->print(") - (");
+
665  printer->print(rhsString);
+
666  printer->print('=');
+
667  printer->print(rhs);
+
668  printer->print(")| ");
+
669  printer->print(opName);
+
670  printer->print(" (");
+
671  printer->print(errorString);
+
672  printer->print('=');
+
673  printer->print(error);
+
674  printer->print(')');
+
675  printer->print(", file ");
+
676  printer->print(file);
+
677  printer->print(", line ");
+
678  printer->print(line);
+
679  printer->println('.');
+
680 }
+
681 
+
682 } // namespace
+
683 
+
684 bool Assertion::assertionBoolVerbose(const char* file, uint16_t line, bool arg,
+
685  const __FlashStringHelper* argString, bool value) {
+
686  if (isDone()) return false;
+
687  bool ok = (arg == value);
+
688  if (isOutputEnabled(ok)) {
+
689  printAssertionBoolMessageVerbose(Printer::getPrinter(), ok, file, line,
+
690  arg, argString, value);
+
691  }
+
692  setPassOrFail(ok);
+
693  return ok;
+
694 }
+
695 
+
696 bool Assertion::assertionVerbose(const char* file, uint16_t line, bool lhs,
+
697  const __FlashStringHelper* lhsString, const char* opName,
+
698  bool (*op)(bool lhs, bool rhs), bool rhs,
+
699  const __FlashStringHelper* rhsString) {
+
700  if (isDone()) return false;
+
701  bool ok = op(lhs, rhs);
+
702  if (isOutputEnabled(ok)) {
+
703  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
704  lhs, lhsString, opName, rhs, rhsString);
+
705  }
+
706  setPassOrFail(ok);
+
707  return ok;
+
708 }
+
709 
+
710 bool Assertion::assertionVerbose(const char* file, uint16_t line, char lhs,
+
711  const __FlashStringHelper* lhsString, const char* opName,
+
712  bool (*op)(char lhs, char rhs), char rhs,
+
713  const __FlashStringHelper* rhsString) {
+
714  if (isDone()) return false;
+
715  bool ok = op(lhs, rhs);
+
716  if (isOutputEnabled(ok)) {
+
717  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
718  lhs, lhsString, opName, rhs, rhsString);
+
719  }
+
720  setPassOrFail(ok);
+
721  return ok;
+
722 }
+
723 
+
724 bool Assertion::assertionVerbose(const char* file, uint16_t line, int lhs,
+
725  const __FlashStringHelper* lhsString, const char* opName,
+
726  bool (*op)(int lhs, int rhs), int rhs,
+
727  const __FlashStringHelper* rhsString) {
+
728  if (isDone()) return false;
+
729  bool ok = op(lhs, rhs);
+
730  if (isOutputEnabled(ok)) {
+
731  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
732  lhs, lhsString, opName, rhs, rhsString);
+
733  }
+
734  setPassOrFail(ok);
+
735  return ok;
+
736 }
+
737 
+
738 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
739  unsigned int lhs, const __FlashStringHelper* lhsString, const char* opName,
+
740  bool (*op)(unsigned int lhs, unsigned int rhs),
+
741  unsigned int rhs, const __FlashStringHelper* rhsString) {
+
742  if (isDone()) return false;
+
743  bool ok = op(lhs, rhs);
+
744  if (isOutputEnabled(ok)) {
+
745  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
746  lhs, lhsString, opName, rhs, rhsString);
+
747  }
+
748  setPassOrFail(ok);
+
749  return ok;
+
750 }
+
751 
+
752 bool Assertion::assertionVerbose(const char* file, uint16_t line, long lhs,
+
753  const __FlashStringHelper* lhsString, const char* opName,
+
754  bool (*op)(long lhs, long rhs), long rhs,
+
755  const __FlashStringHelper* rhsString) {
+
756  if (isDone()) return false;
+
757  bool ok = op(lhs, rhs);
+
758  if (isOutputEnabled(ok)) {
+
759  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
760  lhs, lhsString, opName, rhs, rhsString);
+
761  }
+
762  setPassOrFail(ok);
+
763  return ok;
+
764 }
+
765 
+
766 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
767  unsigned long lhs, const __FlashStringHelper* lhsString, const char* opName,
+
768  bool (*op)(unsigned long lhs, unsigned long rhs),
+
769  unsigned long rhs, const __FlashStringHelper* rhsString) {
+
770  if (isDone()) return false;
+
771  bool ok = op(lhs, rhs);
+
772  if (isOutputEnabled(ok)) {
+
773  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
774  lhs, lhsString, opName, rhs, rhsString);
+
775  }
+
776  setPassOrFail(ok);
+
777  return ok;
+
778 }
+
779 
+
780 bool Assertion::assertionVerbose(const char* file, uint16_t line, long long lhs,
+
781  const __FlashStringHelper* lhsString, const char* opName,
+
782  bool (*op)(long long lhs, long long rhs), long long rhs,
+
783  const __FlashStringHelper* rhsString) {
+
784  if (isDone()) return false;
+
785  bool ok = op(lhs, rhs);
+
786  if (isOutputEnabled(ok)) {
+
787  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
788  lhs, lhsString, opName, rhs, rhsString);
+
789  }
+
790  setPassOrFail(ok);
+
791  return ok;
+
792 }
+
793 
+
794 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
795  unsigned long long lhs, const __FlashStringHelper* lhsString,
+
796  const char* opName,
+
797  bool (*op)(unsigned long long lhs, unsigned long long rhs),
+
798  unsigned long long rhs, const __FlashStringHelper* rhsString) {
+
799  if (isDone()) return false;
+
800  bool ok = op(lhs, rhs);
+
801  if (isOutputEnabled(ok)) {
+
802  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
803  lhs, lhsString, opName, rhs, rhsString);
+
804  }
+
805  setPassOrFail(ok);
+
806  return ok;
+
807 }
+
808 
+
809 bool Assertion::assertionVerbose(const char* file, uint16_t line, double lhs,
+
810  const __FlashStringHelper* lhsString, const char* opName,
+
811  bool (*op)(double lhs, double rhs), double rhs,
+
812  const __FlashStringHelper* rhsString) {
+
813  if (isDone()) return false;
+
814  bool ok = op(lhs, rhs);
+
815  if (isOutputEnabled(ok)) {
+
816  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
817  lhs, lhsString, opName, rhs, rhsString);
+
818  }
+
819  setPassOrFail(ok);
+
820  return ok;
+
821 }
+
822 
+
823 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
824  const char* lhs, const __FlashStringHelper* lhsString, const char* opName,
+
825  bool (*op)(const char* lhs, const char* rhs),
+
826  const char* rhs, const __FlashStringHelper* rhsString) {
+
827  if (isDone()) return false;
+
828  bool ok = op(lhs, rhs);
+
829  if (isOutputEnabled(ok)) {
+
830  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
831  lhs, lhsString, opName, rhs, rhsString);
+
832  }
+
833  setPassOrFail(ok);
+
834  return ok;
+
835 }
+
836 
+
837 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
838  const char* lhs, const __FlashStringHelper* lhsString,
+
839  const char* opName, bool (*op)(const char* lhs, const String& rhs),
+
840  const String& rhs, const __FlashStringHelper* rhsString) {
+
841  if (isDone()) return false;
+
842  bool ok = op(lhs, rhs);
+
843  if (isOutputEnabled(ok)) {
+
844  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
845  lhs, lhsString, opName, rhs, rhsString);
+
846  }
+
847  setPassOrFail(ok);
+
848  return ok;
+
849 }
+
850 
+
851 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
852  const char* lhs, const __FlashStringHelper* lhsString, const char* opName,
+
853  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
+
854  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString) {
+
855  if (isDone()) return false;
+
856  bool ok = op(lhs, rhs);
+
857  if (isOutputEnabled(ok)) {
+
858  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
859  lhs, lhsString, opName, rhs, rhsString);
+
860  }
+
861  setPassOrFail(ok);
+
862  return ok;
+
863 }
+
864 
+
865 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
866  const String& lhs, const __FlashStringHelper* lhsString, const char* opName,
+
867  bool (*op)(const String& lhs, const char* rhs),
+
868  const char* rhs, const __FlashStringHelper* rhsString) {
+
869  if (isDone()) return false;
+
870  bool ok = op(lhs, rhs);
+
871  if (isOutputEnabled(ok)) {
+
872  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
873  lhs, lhsString, opName, rhs, rhsString);
+
874  }
+
875  setPassOrFail(ok);
+
876  return ok;
+
877 }
+
878 
+
879 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
880  const String& lhs, const __FlashStringHelper* lhsString, const char* opName,
+
881  bool (*op)(const String& lhs, const String& rhs),
+
882  const String& rhs, const __FlashStringHelper* rhsString) {
+
883  if (isDone()) return false;
+
884  bool ok = op(lhs, rhs);
+
885  if (isOutputEnabled(ok)) {
+
886  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
887  lhs, lhsString, opName, rhs, rhsString);
+
888  }
+
889  setPassOrFail(ok);
+
890  return ok;
+
891 }
+
892 
+
893 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
894  const String& lhs, const __FlashStringHelper* lhsString, const char* opName,
+
895  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
+
896  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString) {
+
897  if (isDone()) return false;
+
898  bool ok = op(lhs, rhs);
+
899  if (isOutputEnabled(ok)) {
+
900  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
901  lhs, lhsString, opName, rhs, rhsString);
+
902  }
+
903  setPassOrFail(ok);
+
904  return ok;
+
905 }
+
906 
+
907 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
908  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
+
909  const char* opName,
+
910  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
+
911  const char* rhs, const __FlashStringHelper* rhsString) {
+
912  if (isDone()) return false;
+
913  bool ok = op(lhs, rhs);
+
914  if (isOutputEnabled(ok)) {
+
915  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
916  lhs, lhsString, opName, rhs, rhsString);
+
917  }
+
918  setPassOrFail(ok);
+
919  return ok;
+
920 }
+
921 
+
922 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
923  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
+
924  const char* opName,
+
925  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
+
926  const String& rhs, const __FlashStringHelper* rhsString) {
+
927  if (isDone()) return false;
+
928  bool ok = op(lhs, rhs);
+
929  if (isOutputEnabled(ok)) {
+
930  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
931  lhs, lhsString, opName, rhs, rhsString);
+
932  }
+
933  setPassOrFail(ok);
+
934  return ok;
+
935 }
+
936 
+
937 bool Assertion::assertionVerbose(const char* file, uint16_t line,
+
938  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
+
939  const char* opName,
+
940  bool (*op)(const __FlashStringHelper* lhs, const __FlashStringHelper* rhs),
+
941  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString) {
+
942  if (isDone()) return false;
+
943  bool ok = op(lhs, rhs);
+
944  if (isOutputEnabled(ok)) {
+
945  printAssertionMessageVerbose(Printer::getPrinter(), ok, file, line,
+
946  lhs, lhsString, opName, rhs, rhsString);
+
947  }
+
948  setPassOrFail(ok);
+
949  return ok;
+
950 }
+
951 
+
952 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
+
953  int lhs, const __FlashStringHelper* lhsString,
+
954  int rhs, const __FlashStringHelper* rhsString,
+
955  int error, const __FlashStringHelper* errorString,
+
956  const char* opName,
+
957  bool (*opNear)(int lhs, int rhs, int error)) {
+
958  if (isDone()) return false;
+
959  bool ok = opNear(lhs, rhs, error);
+
960  if (isOutputEnabled(ok)) {
+
961  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
+
962  lhs, lhsString, rhs, rhsString, opName, error, errorString);
+
963  }
+
964  setPassOrFail(ok);
+
965  return ok;
+
966 }
+
967 
+
968 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
+
969  unsigned int lhs, const __FlashStringHelper* lhsString,
+
970  unsigned int rhs, const __FlashStringHelper* rhsString,
+
971  unsigned int error, const __FlashStringHelper* errorString,
+
972  const char* opName,
+
973  bool (*opNear)(unsigned int lhs, unsigned int rhs, unsigned int error)) {
+
974  if (isDone()) return false;
+
975  bool ok = opNear(lhs, rhs, error);
+
976  if (isOutputEnabled(ok)) {
+
977  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
+
978  lhs, lhsString, rhs, rhsString, opName, error, errorString);
+
979  }
+
980  setPassOrFail(ok);
+
981  return ok;
+
982 }
+
983 
+
984 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
+
985  long lhs, const __FlashStringHelper* lhsString,
+
986  long rhs, const __FlashStringHelper* rhsString,
+
987  long error, const __FlashStringHelper* errorString,
+
988  const char* opName,
+
989  bool (*opNear)(long lhs, long rhs, long error)) {
+
990  if (isDone()) return false;
+
991  bool ok = opNear(lhs, rhs, error);
+
992  if (isOutputEnabled(ok)) {
+
993  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
+
994  lhs, lhsString, rhs, rhsString, opName, error, errorString);
+
995  }
+
996  setPassOrFail(ok);
+
997  return ok;
+
998 }
+
999 
+
1000 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
+
1001  unsigned long lhs, const __FlashStringHelper* lhsString,
+
1002  unsigned long rhs, const __FlashStringHelper* rhsString,
+
1003  unsigned long error, const __FlashStringHelper* errorString,
+
1004  const char* opName,
+
1005  bool (*opNear)(unsigned long lhs, unsigned long rhs, unsigned long error)) {
+
1006  if (isDone()) return false;
+
1007  bool ok = opNear(lhs, rhs, error);
+
1008  if (isOutputEnabled(ok)) {
+
1009  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
+
1010  lhs, lhsString, rhs, rhsString, opName, error, errorString);
+
1011  }
+
1012  setPassOrFail(ok);
+
1013  return ok;
+
1014 }
+
1015 
+
1016 bool Assertion::assertionNearVerbose(const char* file, uint16_t line,
+
1017  double lhs, const __FlashStringHelper* lhsString,
+
1018  double rhs, const __FlashStringHelper* rhsString,
+
1019  double error, const __FlashStringHelper* errorString,
+
1020  const char* opName,
+
1021  bool (*opNear)(double lhs, double rhs, double error)) {
+
1022  if (isDone()) return false;
+
1023  bool ok = opNear(lhs, rhs, error);
+
1024  if (isOutputEnabled(ok)) {
+
1025  printAssertionNearMessageVerbose(Printer::getPrinter(), ok, file, line,
+
1026  lhs, lhsString, rhs, rhsString, opName, error, errorString);
+
1027  }
+
1028  setPassOrFail(ok);
+
1029  return ok;
+
1030 }
+
1031 
+
1032 }
+
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
+
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
Definition: Assertion.cpp:183
+
static const uint8_t kAssertionPassed
Print assertXxx() passed message.
Definition: Verbosity.h:40
+
static const uint8_t kAssertionFailed
Print assertXxx() failed message.
Definition: Verbosity.h:43
+ + diff --git a/docs/html/Assertion_8h_source.html b/docs/html/Assertion_8h_source.html index df16d11..c9885cd 100644 --- a/docs/html/Assertion_8h_source.html +++ b/docs/html/Assertion_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Assertion.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/Assertion.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Assertion.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_ASSERTION_H
26 #define AUNIT_ASSERTION_H
27 
28 #include "Flash.h"
29 #include "Test.h"
30 
31 class __FlashStringHelper;
32 class String;
33 
34 namespace aunit {
35 
55 class Assertion: public Test {
56  protected:
58  Assertion() {}
59 
61  bool isOutputEnabled(bool ok) const;
62 
63  // Terse assertions. Prints only the argument values.
64 
65  bool assertionBool(const char* file, uint16_t line, bool arg,
66  bool value);
67 
68  bool assertion(const char* file, uint16_t line, bool lhs,
69  const char* opName, bool (*op)(bool lhs, bool rhs),
70  bool rhs);
71 
72  bool assertion(const char* file, uint16_t line, char lhs,
73  const char* opName, bool (*op)(char lhs, char rhs),
74  char rhs);
75 
76  bool assertion(const char* file, uint16_t line, int lhs,
77  const char* opName, bool (*op)(int lhs, int rhs),
78  int rhs);
79 
80  bool assertion(const char* file, uint16_t line, unsigned int lhs,
81  const char* opName, bool (*op)(unsigned int lhs, unsigned int rhs),
82  unsigned int rhs);
83 
84  bool assertion(const char* file, uint16_t line, long lhs,
85  const char* opName, bool (*op)(long lhs, long rhs),
86  long rhs);
87 
88  bool assertion(const char* file, uint16_t line, unsigned long lhs,
89  const char* opName, bool (*op)(unsigned long lhs, unsigned long rhs),
90  unsigned long rhs);
91 
92  bool assertion(const char* file, uint16_t line, long long lhs,
93  const char* opName, bool (*op)(long long lhs, long long rhs),
94  long long rhs);
95 
96  bool assertion(const char* file, uint16_t line, unsigned long long lhs,
97  const char* opName,
98  bool (*op)(unsigned long long lhs, unsigned long long rhs),
99  unsigned long long rhs);
100 
101  bool assertion(const char* file, uint16_t line, double lhs,
102  const char* opName, bool (*op)(double lhs, double rhs),
103  double rhs);
104 
105  bool assertion(const char* file, uint16_t line, const char* lhs,
106  const char* opName, bool (*op)(const char* lhs, const char* rhs),
107  const char* rhs);
108 
109  bool assertion(const char* file, uint16_t line, const char* lhs,
110  const char* opName, bool (*op)(const char* lhs, const String& rhs),
111  const String& rhs);
112 
113  bool assertion(const char* file, uint16_t line, const char* lhs,
114  const char* opName,
115  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
116  const __FlashStringHelper* rhs);
117 
118  bool assertion(const char* file, uint16_t line, const String& lhs,
119  const char* opName, bool (*op)(const String& lhs, const char* rhs),
120  const char* rhs);
121 
122  bool assertion(const char* file, uint16_t line, const String& lhs,
123  const char* opName, bool (*op)(const String& lhs, const String& rhs),
124  const String& rhs);
125 
126  bool assertion(const char* file, uint16_t line, const String& lhs,
127  const char* opName,
128  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
129  const __FlashStringHelper* rhs);
130 
131  bool assertion(const char* file, uint16_t line,
132  const __FlashStringHelper* lhs, const char* opName,
133  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
134  const char* rhs);
135 
136  bool assertion(const char* file, uint16_t line,
137  const __FlashStringHelper* lhs, const char* opName,
138  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
139  const String& rhs);
140 
141  bool assertion(const char* file, uint16_t line,
142  const __FlashStringHelper* lhs, const char* opName,
143  bool (*op)(const __FlashStringHelper* lhs,
144  const __FlashStringHelper* rhs),
145  const __FlashStringHelper* rhs);
146 
147  bool assertionNear(const char* file, uint16_t line,
148  int lhs, int rhs, int error, const char* opName,
149  bool (*compareNear)(int lhs, int rhs, int error));
150 
151  bool assertionNear(const char* file, uint16_t line,
152  unsigned int lhs, unsigned int rhs, unsigned int error,
153  const char* opName,
154  bool (*compareNear)(
155  unsigned int lhs, unsigned int rhs, unsigned int error));
156 
157  bool assertionNear(const char* file, uint16_t line,
158  long lhs, long rhs, long error, const char* opName,
159  bool (*compareNear)(long lhs, long rhs, long error));
160 
161  bool assertionNear(const char* file, uint16_t line,
162  unsigned long lhs, unsigned long rhs, unsigned long error,
163  const char* opName,
164  bool (*compareNear)(
165  unsigned long lhs, unsigned long rhs, unsigned long error));
166 
167  bool assertionNear(const char* file, uint16_t line,
168  double lhs, double rhs, double error, const char* opName,
169  bool (*compareNear)(double lhs, double rhs, double error));
170 
171  // Verbose versions of above.
172 
173  bool assertionBoolVerbose(const char* file, uint16_t line, bool arg,
174  const __FlashStringHelper* argString, bool value);
175 
176  bool assertionVerbose(const char* file, uint16_t line, bool lhs,
177  const __FlashStringHelper* lhsString, const char* opName,
178  bool (*op)(bool lhs, bool rhs),
179  bool rhs, const __FlashStringHelper* rhsString);
180 
181  bool assertionVerbose(const char* file, uint16_t line, char lhs,
182  const __FlashStringHelper* lhsString, const char* opName,
183  bool (*op)(char lhs, char rhs),
184  char rhs, const __FlashStringHelper* rhsString);
185 
186  bool assertionVerbose(const char* file, uint16_t line, int lhs,
187  const __FlashStringHelper* lhsString, const char* opName,
188  bool (*op)(int lhs, int rhs),
189  int rhs, const __FlashStringHelper* rhsString);
190 
191  bool assertionVerbose(const char* file, uint16_t line, unsigned int lhs,
192  const __FlashStringHelper* lhsString, const char* opName,
193  bool (*op)(unsigned int lhs, unsigned int rhs),
194  unsigned int rhs, const __FlashStringHelper* rhsString);
195 
196  bool assertionVerbose(const char* file, uint16_t line, long lhs,
197  const __FlashStringHelper* lhsString, const char* opName,
198  bool (*op)(long lhs, long rhs),
199  long rhs, const __FlashStringHelper* rhsString);
200 
201  bool assertionVerbose(const char* file, uint16_t line, unsigned long lhs,
202  const __FlashStringHelper* lhsString, const char* opName,
203  bool (*op)(unsigned long lhs, unsigned long rhs),
204  unsigned long rhs, const __FlashStringHelper* rhsString);
205 
206  bool assertionVerbose(const char* file, uint16_t line, long long lhs,
207  const __FlashStringHelper* lhsString, const char* opName,
208  bool (*op)(long long lhs, long long rhs),
209  long long rhs, const __FlashStringHelper* rhsString);
210 
211  bool assertionVerbose(const char* file, uint16_t line,
212  unsigned long long lhs,
213  const __FlashStringHelper* lhsString, const char* opName,
214  bool (*op)(unsigned long long lhs, unsigned long long rhs),
215  unsigned long long rhs, const __FlashStringHelper* rhsString);
216 
217  bool assertionVerbose(const char* file, uint16_t line, double lhs,
218  const __FlashStringHelper* lhsString, const char* opName,
219  bool (*op)(double lhs, double rhs),
220  double rhs, const __FlashStringHelper* rhsString);
221 
222  bool assertionVerbose(const char* file, uint16_t line, const char* lhs,
223  const __FlashStringHelper* lhsString, const char* opName,
224  bool (*op)(const char* lhs, const char* rhs),
225  const char* rhs, const __FlashStringHelper* rhsString);
226 
227  bool assertionVerbose(const char* file, uint16_t line, const char* lhs,
228  const __FlashStringHelper* lhsString, const char* opName,
229  bool (*op)(const char* lhs, const String& rhs),
230  const String& rhs, const __FlashStringHelper* rhsString);
231 
232  bool assertionVerbose(const char* file, uint16_t line, const char* lhs,
233  const __FlashStringHelper* lhsString, const char* opName,
234  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
235  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString);
236 
237  bool assertionVerbose(const char* file, uint16_t line, const String& lhs,
238  const __FlashStringHelper* lhsString, const char* opName,
239  bool (*op)(const String& lhs, const char* rhs),
240  const char* rhs, const __FlashStringHelper* rhsString);
241 
242  bool assertionVerbose(const char* file, uint16_t line, const String& lhs,
243  const __FlashStringHelper* lhsString, const char* opName,
244  bool (*op)(const String& lhs, const String& rhs),
245  const String& rhs, const __FlashStringHelper* rhsString);
246 
247  bool assertionVerbose(const char* file, uint16_t line, const String& lhs,
248  const __FlashStringHelper* lhsString, const char* opName,
249  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
250  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString);
251 
252  bool assertionVerbose(const char* file, uint16_t line,
253  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
254  const char* opName,
255  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
256  const char* rhs, const __FlashStringHelper* rhsString);
257 
258  bool assertionVerbose(const char* file, uint16_t line,
259  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
260  const char* opName,
261  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
262  const String& rhs, const __FlashStringHelper* rhsString);
263 
264  bool assertionVerbose(const char* file, uint16_t line,
265  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
266  const char* opName,
267  bool (*op)(const __FlashStringHelper* lhs,
268  const __FlashStringHelper* rhs),
269  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString);
270 
271  bool assertionNearVerbose(const char* file, uint16_t line,
272  int lhs, const __FlashStringHelper* lhsString,
273  int rhs, const __FlashStringHelper* rhsString,
274  int error, const __FlashStringHelper* errorString,
275  const char* opName,
276  bool (*compareNear)(int lhs, int rhs, int error));
277 
278  bool assertionNearVerbose(const char* file, uint16_t line,
279  unsigned int lhs, const __FlashStringHelper* lhsString,
280  unsigned int rhs, const __FlashStringHelper* rhsString,
281  unsigned int error, const __FlashStringHelper* errorString,
282  const char* opName,
283  bool (*compareNear)(
284  unsigned int lhs, unsigned int rhs, unsigned int error));
285 
286  bool assertionNearVerbose(const char* file, uint16_t line,
287  long lhs, const __FlashStringHelper* lhsString,
288  long rhs, const __FlashStringHelper* rhsString,
289  long error, const __FlashStringHelper* errorString,
290  const char* opName,
291  bool (*compareNear)(long lhs, long rhs, long error));
292 
293  bool assertionNearVerbose(const char* file, uint16_t line,
294  unsigned long lhs, const __FlashStringHelper* lhsString,
295  unsigned long rhs, const __FlashStringHelper* rhsString,
296  unsigned long error, const __FlashStringHelper* errorString,
297  const char* opName,
298  bool (*compareNear)(
299  unsigned long lhs, unsigned long rhs, unsigned long error));
300 
301  bool assertionNearVerbose(const char* file, uint16_t line,
302  double lhs, const __FlashStringHelper* lhsString,
303  double rhs, const __FlashStringHelper* rhsString,
304  double error, const __FlashStringHelper* errorString,
305  const char* opName,
306  bool (*compareNear)(double lhs, double rhs, double error));
307 
308  private:
309  // Disable copy-constructor and assignment operator
310  Assertion(const Assertion&) = delete;
311  Assertion& operator=(const Assertion&) = delete;
312 };
313 
314 }
315 
316 #endif
Base class of all test cases.
Definition: Test.h:43
- -
An Assertion class is a subclass of Test and provides various overloaded assertion() functions...
Definition: Assertion.h:55
-
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
Definition: Assertion.cpp:183
-
Various macros to smooth over the differences among the various platforms with regards to their suppo...
-
Assertion()
Empty constructor.
Definition: Assertion.h:58
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_ASSERTION_H
+
26 #define AUNIT_ASSERTION_H
+
27 
+
28 #include "Flash.h"
+
29 #include "Test.h"
+
30 
+
31 class __FlashStringHelper;
+
32 class String;
+
33 
+
34 namespace aunit {
+
35 
+
55 class Assertion: public Test {
+
56  protected:
+
58  Assertion() {}
+
59 
+
61  bool isOutputEnabled(bool ok) const;
+
62 
+
63  // Terse assertions. Prints only the argument values.
+
64 
+
65  bool assertionBool(const char* file, uint16_t line, bool arg,
+
66  bool value);
+
67 
+
68  bool assertion(const char* file, uint16_t line, bool lhs,
+
69  const char* opName, bool (*op)(bool lhs, bool rhs),
+
70  bool rhs);
+
71 
+
72  bool assertion(const char* file, uint16_t line, char lhs,
+
73  const char* opName, bool (*op)(char lhs, char rhs),
+
74  char rhs);
+
75 
+
76  bool assertion(const char* file, uint16_t line, int lhs,
+
77  const char* opName, bool (*op)(int lhs, int rhs),
+
78  int rhs);
+
79 
+
80  bool assertion(const char* file, uint16_t line, unsigned int lhs,
+
81  const char* opName, bool (*op)(unsigned int lhs, unsigned int rhs),
+
82  unsigned int rhs);
+
83 
+
84  bool assertion(const char* file, uint16_t line, long lhs,
+
85  const char* opName, bool (*op)(long lhs, long rhs),
+
86  long rhs);
+
87 
+
88  bool assertion(const char* file, uint16_t line, unsigned long lhs,
+
89  const char* opName, bool (*op)(unsigned long lhs, unsigned long rhs),
+
90  unsigned long rhs);
+
91 
+
92  bool assertion(const char* file, uint16_t line, long long lhs,
+
93  const char* opName, bool (*op)(long long lhs, long long rhs),
+
94  long long rhs);
+
95 
+
96  bool assertion(const char* file, uint16_t line, unsigned long long lhs,
+
97  const char* opName,
+
98  bool (*op)(unsigned long long lhs, unsigned long long rhs),
+
99  unsigned long long rhs);
+
100 
+
101  bool assertion(const char* file, uint16_t line, double lhs,
+
102  const char* opName, bool (*op)(double lhs, double rhs),
+
103  double rhs);
+
104 
+
105  bool assertion(const char* file, uint16_t line, const char* lhs,
+
106  const char* opName, bool (*op)(const char* lhs, const char* rhs),
+
107  const char* rhs);
+
108 
+
109  bool assertion(const char* file, uint16_t line, const char* lhs,
+
110  const char* opName, bool (*op)(const char* lhs, const String& rhs),
+
111  const String& rhs);
+
112 
+
113  bool assertion(const char* file, uint16_t line, const char* lhs,
+
114  const char* opName,
+
115  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
+
116  const __FlashStringHelper* rhs);
+
117 
+
118  bool assertion(const char* file, uint16_t line, const String& lhs,
+
119  const char* opName, bool (*op)(const String& lhs, const char* rhs),
+
120  const char* rhs);
+
121 
+
122  bool assertion(const char* file, uint16_t line, const String& lhs,
+
123  const char* opName, bool (*op)(const String& lhs, const String& rhs),
+
124  const String& rhs);
+
125 
+
126  bool assertion(const char* file, uint16_t line, const String& lhs,
+
127  const char* opName,
+
128  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
+
129  const __FlashStringHelper* rhs);
+
130 
+
131  bool assertion(const char* file, uint16_t line,
+
132  const __FlashStringHelper* lhs, const char* opName,
+
133  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
+
134  const char* rhs);
+
135 
+
136  bool assertion(const char* file, uint16_t line,
+
137  const __FlashStringHelper* lhs, const char* opName,
+
138  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
+
139  const String& rhs);
+
140 
+
141  bool assertion(const char* file, uint16_t line,
+
142  const __FlashStringHelper* lhs, const char* opName,
+
143  bool (*op)(const __FlashStringHelper* lhs,
+
144  const __FlashStringHelper* rhs),
+
145  const __FlashStringHelper* rhs);
+
146 
+
147  bool assertionNear(const char* file, uint16_t line,
+
148  int lhs, int rhs, int error, const char* opName,
+
149  bool (*compareNear)(int lhs, int rhs, int error));
+
150 
+
151  bool assertionNear(const char* file, uint16_t line,
+
152  unsigned int lhs, unsigned int rhs, unsigned int error,
+
153  const char* opName,
+
154  bool (*compareNear)(
+
155  unsigned int lhs, unsigned int rhs, unsigned int error));
+
156 
+
157  bool assertionNear(const char* file, uint16_t line,
+
158  long lhs, long rhs, long error, const char* opName,
+
159  bool (*compareNear)(long lhs, long rhs, long error));
+
160 
+
161  bool assertionNear(const char* file, uint16_t line,
+
162  unsigned long lhs, unsigned long rhs, unsigned long error,
+
163  const char* opName,
+
164  bool (*compareNear)(
+
165  unsigned long lhs, unsigned long rhs, unsigned long error));
+
166 
+
167  bool assertionNear(const char* file, uint16_t line,
+
168  double lhs, double rhs, double error, const char* opName,
+
169  bool (*compareNear)(double lhs, double rhs, double error));
+
170 
+
171  // Verbose versions of above.
+
172 
+
173  bool assertionBoolVerbose(const char* file, uint16_t line, bool arg,
+
174  const __FlashStringHelper* argString, bool value);
+
175 
+
176  bool assertionVerbose(const char* file, uint16_t line, bool lhs,
+
177  const __FlashStringHelper* lhsString, const char* opName,
+
178  bool (*op)(bool lhs, bool rhs),
+
179  bool rhs, const __FlashStringHelper* rhsString);
+
180 
+
181  bool assertionVerbose(const char* file, uint16_t line, char lhs,
+
182  const __FlashStringHelper* lhsString, const char* opName,
+
183  bool (*op)(char lhs, char rhs),
+
184  char rhs, const __FlashStringHelper* rhsString);
+
185 
+
186  bool assertionVerbose(const char* file, uint16_t line, int lhs,
+
187  const __FlashStringHelper* lhsString, const char* opName,
+
188  bool (*op)(int lhs, int rhs),
+
189  int rhs, const __FlashStringHelper* rhsString);
+
190 
+
191  bool assertionVerbose(const char* file, uint16_t line, unsigned int lhs,
+
192  const __FlashStringHelper* lhsString, const char* opName,
+
193  bool (*op)(unsigned int lhs, unsigned int rhs),
+
194  unsigned int rhs, const __FlashStringHelper* rhsString);
+
195 
+
196  bool assertionVerbose(const char* file, uint16_t line, long lhs,
+
197  const __FlashStringHelper* lhsString, const char* opName,
+
198  bool (*op)(long lhs, long rhs),
+
199  long rhs, const __FlashStringHelper* rhsString);
+
200 
+
201  bool assertionVerbose(const char* file, uint16_t line, unsigned long lhs,
+
202  const __FlashStringHelper* lhsString, const char* opName,
+
203  bool (*op)(unsigned long lhs, unsigned long rhs),
+
204  unsigned long rhs, const __FlashStringHelper* rhsString);
+
205 
+
206  bool assertionVerbose(const char* file, uint16_t line, long long lhs,
+
207  const __FlashStringHelper* lhsString, const char* opName,
+
208  bool (*op)(long long lhs, long long rhs),
+
209  long long rhs, const __FlashStringHelper* rhsString);
+
210 
+
211  bool assertionVerbose(const char* file, uint16_t line,
+
212  unsigned long long lhs,
+
213  const __FlashStringHelper* lhsString, const char* opName,
+
214  bool (*op)(unsigned long long lhs, unsigned long long rhs),
+
215  unsigned long long rhs, const __FlashStringHelper* rhsString);
+
216 
+
217  bool assertionVerbose(const char* file, uint16_t line, double lhs,
+
218  const __FlashStringHelper* lhsString, const char* opName,
+
219  bool (*op)(double lhs, double rhs),
+
220  double rhs, const __FlashStringHelper* rhsString);
+
221 
+
222  bool assertionVerbose(const char* file, uint16_t line, const char* lhs,
+
223  const __FlashStringHelper* lhsString, const char* opName,
+
224  bool (*op)(const char* lhs, const char* rhs),
+
225  const char* rhs, const __FlashStringHelper* rhsString);
+
226 
+
227  bool assertionVerbose(const char* file, uint16_t line, const char* lhs,
+
228  const __FlashStringHelper* lhsString, const char* opName,
+
229  bool (*op)(const char* lhs, const String& rhs),
+
230  const String& rhs, const __FlashStringHelper* rhsString);
+
231 
+
232  bool assertionVerbose(const char* file, uint16_t line, const char* lhs,
+
233  const __FlashStringHelper* lhsString, const char* opName,
+
234  bool (*op)(const char* lhs, const __FlashStringHelper* rhs),
+
235  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString);
+
236 
+
237  bool assertionVerbose(const char* file, uint16_t line, const String& lhs,
+
238  const __FlashStringHelper* lhsString, const char* opName,
+
239  bool (*op)(const String& lhs, const char* rhs),
+
240  const char* rhs, const __FlashStringHelper* rhsString);
+
241 
+
242  bool assertionVerbose(const char* file, uint16_t line, const String& lhs,
+
243  const __FlashStringHelper* lhsString, const char* opName,
+
244  bool (*op)(const String& lhs, const String& rhs),
+
245  const String& rhs, const __FlashStringHelper* rhsString);
+
246 
+
247  bool assertionVerbose(const char* file, uint16_t line, const String& lhs,
+
248  const __FlashStringHelper* lhsString, const char* opName,
+
249  bool (*op)(const String& lhs, const __FlashStringHelper* rhs),
+
250  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString);
+
251 
+
252  bool assertionVerbose(const char* file, uint16_t line,
+
253  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
+
254  const char* opName,
+
255  bool (*op)(const __FlashStringHelper* lhs, const char* rhs),
+
256  const char* rhs, const __FlashStringHelper* rhsString);
+
257 
+
258  bool assertionVerbose(const char* file, uint16_t line,
+
259  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
+
260  const char* opName,
+
261  bool (*op)(const __FlashStringHelper* lhs, const String& rhs),
+
262  const String& rhs, const __FlashStringHelper* rhsString);
+
263 
+
264  bool assertionVerbose(const char* file, uint16_t line,
+
265  const __FlashStringHelper* lhs, const __FlashStringHelper* lhsString,
+
266  const char* opName,
+
267  bool (*op)(const __FlashStringHelper* lhs,
+
268  const __FlashStringHelper* rhs),
+
269  const __FlashStringHelper* rhs, const __FlashStringHelper* rhsString);
+
270 
+
271  bool assertionNearVerbose(const char* file, uint16_t line,
+
272  int lhs, const __FlashStringHelper* lhsString,
+
273  int rhs, const __FlashStringHelper* rhsString,
+
274  int error, const __FlashStringHelper* errorString,
+
275  const char* opName,
+
276  bool (*compareNear)(int lhs, int rhs, int error));
+
277 
+
278  bool assertionNearVerbose(const char* file, uint16_t line,
+
279  unsigned int lhs, const __FlashStringHelper* lhsString,
+
280  unsigned int rhs, const __FlashStringHelper* rhsString,
+
281  unsigned int error, const __FlashStringHelper* errorString,
+
282  const char* opName,
+
283  bool (*compareNear)(
+
284  unsigned int lhs, unsigned int rhs, unsigned int error));
+
285 
+
286  bool assertionNearVerbose(const char* file, uint16_t line,
+
287  long lhs, const __FlashStringHelper* lhsString,
+
288  long rhs, const __FlashStringHelper* rhsString,
+
289  long error, const __FlashStringHelper* errorString,
+
290  const char* opName,
+
291  bool (*compareNear)(long lhs, long rhs, long error));
+
292 
+
293  bool assertionNearVerbose(const char* file, uint16_t line,
+
294  unsigned long lhs, const __FlashStringHelper* lhsString,
+
295  unsigned long rhs, const __FlashStringHelper* rhsString,
+
296  unsigned long error, const __FlashStringHelper* errorString,
+
297  const char* opName,
+
298  bool (*compareNear)(
+
299  unsigned long lhs, unsigned long rhs, unsigned long error));
+
300 
+
301  bool assertionNearVerbose(const char* file, uint16_t line,
+
302  double lhs, const __FlashStringHelper* lhsString,
+
303  double rhs, const __FlashStringHelper* rhsString,
+
304  double error, const __FlashStringHelper* errorString,
+
305  const char* opName,
+
306  bool (*compareNear)(double lhs, double rhs, double error));
+
307 
+
308  private:
+
309  // Disable copy-constructor and assignment operator
+
310  Assertion(const Assertion&) = delete;
+
311  Assertion& operator=(const Assertion&) = delete;
+
312 };
+
313 
+
314 }
+
315 
+
316 #endif
+
An Assertion class is a subclass of Test and provides various overloaded assertion() functions.
Definition: Assertion.h:55
+
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
Definition: Assertion.cpp:183
+
Base class of all test cases.
Definition: Test.h:43
+
Assertion()
Empty constructor.
Definition: Assertion.h:58
+ diff --git a/docs/html/Compare_8cpp_source.html b/docs/html/Compare_8cpp_source.html index 76d0e74..5a9f97c 100644 --- a/docs/html/Compare_8cpp_source.html +++ b/docs/html/Compare_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Compare.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/Compare.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Compare.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 /*
26 Design Notes:
27 ============
28 
29 Template Specialization:
30 -----------------------
31 One way to implement the compareEqual() for these types is to use template
32 specialization. The problem with Template specialization is that templates
33 use strict type matching, and does not perform the normal implicit type
34 conversion, including const-casting. Therefore, all of the various c-style
35 string types, for example:
36 
37  - char*
38  - const char*
39  - char[1]
40  - char[N]
41  - const char[1]
42  - const char[N]
43 
44 are considered to be different types under the C++ templating system. This
45 causes a combinatorial explosion of template specialization which produces
46 code that is difficult to understand, test and maintain.
47 An example can be seen in the Compare.h file of the ArduinoUnit project:
48 https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnitUtility/Compare.h
49 
50 Function Overloading:
51 ---------------------
52 In this project, I used function overloading instead of template
53 specialization. Function overloading handles c-style strings (i.e. character
54 arrays) naturally, in the way most users expect. For example, (char*) is
55 automarically cast to (const char*), and (char[N]) is autonmatically
56 cast to (const char*).
57 
58 For the primitive value types (e.g. (char), (int), (unsigned char), etc.) I
59 attempted to use a generic templatized version, using sonmething like:
60 
61  template<typename T>
62  compareEqual(const T& a, const T& b) { ... }
63 
64 However, this template introduced this method:
65 
66  compareEqual(char* const& a, char* const& b);
67 
68 that seemed to take precedence over the explicitly defined overload:
69 
70  compareEqual(const char* a, const char*b);
71 
72 When the compareEqual() method is called with a (char*) or a (char[N]),
73 like this:
74 
75  char a[3] = {...};
76  char b[4] = {...};
77  compareEqual(a, b);
78 
79 this calls compareEqual(char* const&, const* const&), which is the wrong
80 version for a c-style string. The only way I could get this to work was to
81 avoid templates completely and manually define all the function overloads
82 even for primitive integer types.
83 
84 Implicit Conversions:
85 ---------------------
86 For basic primitive types, I depend on some casts to avoid having to define
87 some functions. I assume that signed and unsigned integers smaller or equal
88 to (int) will be converted to an (int) to match compareEqual(int, int).
89 
90 I provided an explicit compareEqual(char, char) overload because in C++, a
91 (char) type is distinct from (signed char) and (unsigned char).
92 
93 Technically, there should be a (long long) version and an (unsigned long
94 long) version of compareEqual(). However, it turns out that the Arduino
95 Print::print() method does not have an overload for these types, so it would
96 not do us much good to provide an assertEqual() or compareEqual() for the
97 (long long) and (unsigned long long) types.
98 
99 Custom Assert and Compare Functions:
100 ------------------------------------
101 Another advantage of using function overloading instead of template
102 specialization is that the user is able to add additional function overloads
103 into the 'aunit' namespace. This should allow the user to define the various
104 comporeXxx() and assertXxx() functions for a custom class. I have not
105 tested this though.
106 
107 Comparing Flash Strings:
108 ------------------------
109 Flash memory must be read using 4-byte alignment on the ESP8266. AVR doesn't
110 care. Teensy-ARM fakes the flash memory API but really just uses the normal
111 static RAM. The following code for comparing two (__FlashStringHelper*)
112 against each other will work for all 3 environments.
113 
114 Inlining:
115 --------
116 Even though most of these functions are one-liners, there is no advantage to
117 inlining them because they are almost always used through a function pointer.
118 */
119 
120 #include <stdint.h>
121 #include <string.h>
122 #include <math.h> // fabs()
123 #include <WString.h>
124 #include "Flash.h"
125 #include "Compare.h"
126 
127 namespace aunit {
128 namespace internal {
129 
130 //---------------------------------------------------------------------------
131 // compareString()
132 //---------------------------------------------------------------------------
133 
134 int compareString(const char* a, const char* b) {
135  if (a == b) { return 0; }
136  if (a == nullptr) { return -1; }
137  if (b == nullptr) { return 1; }
138  return strcmp(a, b);
139 }
140 
141 int compareString(const char* a, const String& b) {
142  if (a == nullptr) { return -1; }
143  return strcmp(a, b.c_str());
144 }
145 
146 int compareString(const char* a, const __FlashStringHelper* b) {
147  if (a == (const char*) b) { return 0; }
148  if (a == nullptr) { return -1; }
149  if (b == nullptr) { return 1; }
150  return strcmp_P(a, (const char*) b);
151 }
152 
153 int compareString(const String& a, const char* b) {
154  return -compareString(b, a);
155 }
156 
157 int compareString(const String& a, const String& b) {
158  return strcmp(a.c_str(), b.c_str());
159 }
160 
161 int compareString(const String& a, const __FlashStringHelper* b) {
162  if (b == nullptr) { return 1; }
163  return strcmp_P(a.c_str(), (const char*) b);
164 }
165 
166 int compareString(const __FlashStringHelper* a, const char* b) {
167  return -compareString(b, a);
168 }
169 
170 int compareString(const __FlashStringHelper* a, const String& b) {
171  return -compareString(b, a);
172 }
173 
174 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
175 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
176 // optimizing for 4-byte alignment here.
177 int compareString(const __FlashStringHelper* a, const __FlashStringHelper* b) {
178  if (a == b) { return 0; }
179  if (a == nullptr) { return -1; }
180  if (b == nullptr) { return 1; }
181  const char* aa = reinterpret_cast<const char*>(a);
182  const char* bb = reinterpret_cast<const char*>(b);
183 
184  while (true) {
185  uint8_t ca = pgm_read_byte(aa);
186  uint8_t cb = pgm_read_byte(bb);
187  if (ca != cb) return (int) ca - (int) cb;
188  if (ca == '\0') return 0;
189  aa++;
190  bb++;
191  }
192 }
193 
194 //---------------------------------------------------------------------------
195 // compareStringCase()
196 //---------------------------------------------------------------------------
197 
198 int compareStringCase(const char* a, const char* b) {
199  if (a == b) { return 0; }
200  if (a == nullptr) { return -1; }
201  if (b == nullptr) { return 1; }
202  return strcasecmp(a, b);
203 }
204 
205 int compareStringCase(const char* a, const String& b) {
206  if (a == nullptr) { return -1; }
207  return strcasecmp(a, b.c_str());
208 }
209 
210 int compareStringCase(const char* a, const __FlashStringHelper* b) {
211  if (a == (const char*) b) { return 0; }
212  if (a == nullptr) { return -1; }
213  if (b == nullptr) { return 1; }
214  return strcasecmp_P(a, (const char*) b);
215 }
216 
217 int compareStringCase(const String& a, const char* b) {
218  return -compareStringCase(b, a);
219 }
220 
221 int compareStringCase(const String& a, const String& b) {
222  return strcasecmp(a.c_str(), b.c_str());
223 }
224 
225 int compareStringCase(const String& a, const __FlashStringHelper* b) {
226  if (b == nullptr) { return 1; }
227  return strcasecmp_P(a.c_str(), (const char*) b);
228 }
229 
230 int compareStringCase(const __FlashStringHelper* a, const char* b) {
231  return -compareStringCase(b, a);
232 }
233 
234 int compareStringCase(const __FlashStringHelper* a, const String& b) {
235  return -compareStringCase(b, a);
236 }
237 
238 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
239 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
240 // optimizing for 4-byte alignment here.
241 int compareStringCase(const __FlashStringHelper* a,
242  const __FlashStringHelper* b) {
243  if (a == b) { return 0; }
244  if (a == nullptr) { return -1; }
245  if (b == nullptr) { return 1; }
246  const char* aa = reinterpret_cast<const char*>(a);
247  const char* bb = reinterpret_cast<const char*>(b);
248 
249  while (true) {
250  uint8_t ca = pgm_read_byte(aa);
251  uint8_t cb = pgm_read_byte(bb);
252  uint8_t la = tolower(ca);
253  uint8_t lb = tolower(cb);
254  if (la != lb) return (int) la - (int) lb;
255  if (ca == '\0') return 0;
256  aa++;
257  bb++;
258  }
259 }
260 
261 //---------------------------------------------------------------------------
262 // compareStringN
263 //---------------------------------------------------------------------------
264 
265 // We need compareStringN() to support only (const char*) and (const
266 // __FlashStringHelper*). And it turns out that compareStringN(a, b, N) ==
267 // -compareString(b, a, N).
268 
269 int compareStringN(const char* a, const char* b, size_t n) {
270  if (a == b) { return 0; }
271  if (a == nullptr) { return -1; }
272  if (b == nullptr) { return 1; }
273  return strncmp(a, b, n);
274 }
275 
276 int compareStringN(const char* a, const __FlashStringHelper* b, size_t n) {
277  if (a == (const char*) b) { return 0; }
278  if (a == nullptr) { return -1; }
279  if (b == nullptr) { return 1; }
280  return strncmp_P(a, (const char*) b, n);
281 }
282 
283 int compareStringN(const __FlashStringHelper* a, const char* b, size_t n) {
284  return -compareStringN(b, a, n);
285 }
286 
287 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
288 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
289 // optimizing for 4-byte alignment here.
290 int compareStringN(const __FlashStringHelper* a, const __FlashStringHelper* b,
291  size_t n) {
292  if (a == b) { return 0; }
293  if (a == nullptr) { return -1; }
294  if (b == nullptr) { return 1; }
295  const char* aa = reinterpret_cast<const char*>(a);
296  const char* bb = reinterpret_cast<const char*>(b);
297 
298  while (n > 0) {
299  uint8_t ca = pgm_read_byte(aa);
300  uint8_t cb = pgm_read_byte(bb);
301  if (ca != cb) return (int) ca - (int) cb;
302  if (ca == '\0') return 0;
303  aa++;
304  bb++;
305  n--;
306  }
307  return 0;
308 }
309 
310 //---------------------------------------------------------------------------
311 // compareEqual()
312 //---------------------------------------------------------------------------
313 
314 bool compareEqual(bool a, bool b) {
315  return (a == b);
316 }
317 
318 bool compareEqual(char a, char b) {
319  return (a == b);
320 }
321 
322 bool compareEqual(int a, int b) {
323  return (a == b);
324 }
325 
326 bool compareEqual(unsigned int a, unsigned int b) {
327  return (a == b);
328 }
329 
330 bool compareEqual(long a, long b) {
331  return (a == b);
332 }
333 
334 bool compareEqual(unsigned long a, unsigned long b) {
335  return (a == b);
336 }
337 
338 bool compareEqual(long long a, long long b) {
339  return (a == b);
340 }
341 
342 bool compareEqual(unsigned long long a, unsigned long long b) {
343  return (a == b);
344 }
345 
346 bool compareEqual(double a, double b) {
347  return (a == b);
348 }
349 
350 bool compareEqual(const char* a, const char* b) {
351  return compareString(a, b) == 0;
352 }
353 
354 bool compareEqual(const char* a, const String& b) {
355  return compareString(a, b) == 0;
356 }
357 
358 bool compareEqual(const char* a, const __FlashStringHelper* b) {
359  return compareString(a, b) == 0;
360 }
361 
362 bool compareEqual(const __FlashStringHelper* a, const char* b) {
363  return compareString(a, b) == 0;
364 }
365 
366 bool compareEqual(const __FlashStringHelper* a, const __FlashStringHelper* b) {
367  return compareString(a, b) == 0;
368 }
369 
370 bool compareEqual(const __FlashStringHelper* a, const String& b) {
371  return compareString(a, b) == 0;
372 }
373 
374 bool compareEqual(const String& a, const char* b) {
375  return compareString(a, b) == 0;
376 }
377 
378 bool compareEqual(const String& a, const String& b) {
379  return compareString(a, b) == 0;
380 }
381 
382 bool compareEqual(const String& a, const __FlashStringHelper* b) {
383  return compareString(a, b) == 0;
384 }
385 
386 //---------------------------------------------------------------------------
387 // compareLess()
388 //---------------------------------------------------------------------------
389 
390 bool compareLess(bool a, bool b) {
391  return (a < b);
392 }
393 
394 bool compareLess(char a, char b) {
395  return (a < b);
396 }
397 
398 bool compareLess(int a, int b) {
399  return (a < b);
400 }
401 
402 bool compareLess(unsigned int a, unsigned int b) {
403  return (a < b);
404 }
405 
406 bool compareLess(long a, long b) {
407  return (a < b);
408 }
409 
410 bool compareLess(unsigned long a, unsigned long b) {
411  return (a < b);
412 }
413 
414 bool compareLess(long long a, long long b) {
415  return (a < b);
416 }
417 
418 bool compareLess(unsigned long long a, unsigned long long b) {
419  return (a < b);
420 }
421 
422 bool compareLess(double a, double b) {
423  return (a < b);
424 }
425 
426 bool compareLess(const char* a, const char* b) {
427  return compareString(a, b) < 0;
428 }
429 
430 bool compareLess(const char* a, const String& b) {
431  return compareString(a, b) < 0;
432 }
433 
434 bool compareLess(const char* a, const __FlashStringHelper* b) {
435  return compareString(a, b) < 0;
436 }
437 
438 bool compareLess(const __FlashStringHelper* a, const char* b) {
439  return compareString(a, b) < 0;
440 }
441 
442 bool compareLess(
443  const __FlashStringHelper* a, const __FlashStringHelper* b) {
444  return compareString(a, b) < 0;
445 }
446 
447 bool compareLess(const __FlashStringHelper* a, const String& b) {
448  return compareString(a, b) < 0;
449 }
450 
451 bool compareLess(const String& a, const char* b) {
452  return compareString(a, b) < 0;
453 }
454 
455 bool compareLess(const String& a, const String& b) {
456  return compareString(a, b) < 0;
457 }
458 
459 bool compareLess(const String& a, const __FlashStringHelper* b) {
460  return compareString(a, b) < 0;
461 }
462 
463 //---------------------------------------------------------------------------
464 // compareMore()
465 //---------------------------------------------------------------------------
466 
467 bool compareMore(bool a, bool b) {
468  return (a > b);
469 }
470 
471 bool compareMore(char a, char b) {
472  return (a > b);
473 }
474 
475 bool compareMore(int a, int b) {
476  return (a > b);
477 }
478 
479 bool compareMore(unsigned int a, unsigned int b) {
480  return (a > b);
481 }
482 
483 bool compareMore(long a, long b) {
484  return (a > b);
485 }
486 
487 bool compareMore(unsigned long a, unsigned long b) {
488  return (a > b);
489 }
490 
491 bool compareMore(long long a, long long b) {
492  return (a > b);
493 }
494 
495 bool compareMore(unsigned long long a, unsigned long long b) {
496  return (a > b);
497 }
498 
499 bool compareMore(double a, double b) {
500  return (a > b);
501 }
502 
503 bool compareMore(const char* a, const char* b) {
504  return compareString(a, b) > 0;
505 }
506 
507 bool compareMore(const char* a, const String& b) {
508  return compareString(a, b) > 0;
509 }
510 
511 bool compareMore(const char* a, const __FlashStringHelper* b) {
512  return compareString(a, b) > 0;
513 }
514 
515 bool compareMore(const __FlashStringHelper* a, const char* b) {
516  return compareString(a, b) > 0;
517 }
518 
519 bool compareMore(const __FlashStringHelper* a, const __FlashStringHelper* b) {
520  return compareString(a, b) > 0;
521 }
522 
523 bool compareMore(const __FlashStringHelper* a, const String& b) {
524  return compareString(a, b) > 0;
525 }
526 
527 bool compareMore(const String& a, const char* b) {
528  return compareString(a, b) > 0;
529 }
530 
531 bool compareMore(const String& a, const String& b) {
532  return compareString(a, b) > 0;
533 }
534 
535 bool compareMore(const String& a, const __FlashStringHelper* b) {
536  return compareString(a, b) > 0;
537 }
538 
539 //---------------------------------------------------------------------------
540 // compareLessOrEqual
541 //---------------------------------------------------------------------------
542 
543 bool compareLessOrEqual(bool a, bool b) {
544  return (a <= b);
545 }
546 
547 bool compareLessOrEqual(char a, char b) {
548  return (a <= b);
549 }
550 
551 bool compareLessOrEqual(int a, int b) {
552  return (a <= b);
553 }
554 
555 bool compareLessOrEqual(unsigned int a, unsigned int b) {
556  return (a <= b);
557 }
558 
559 bool compareLessOrEqual(long a, long b) {
560  return (a <= b);
561 }
562 
563 bool compareLessOrEqual(unsigned long a, unsigned long b) {
564  return (a <= b);
565 }
566 
567 bool compareLessOrEqual(long long a, long long b) {
568  return (a <= b);
569 }
570 
571 bool compareLessOrEqual(unsigned long long a, unsigned long long b) {
572  return (a <= b);
573 }
574 
575 bool compareLessOrEqual(double a, double b) {
576  return (a <= b);
577 }
578 
579 bool compareLessOrEqual(const char* a, const char* b) {
580  return compareString(a, b) <= 0;
581 }
582 
583 bool compareLessOrEqual(const char* a, const String& b) {
584  return compareString(a, b) <= 0;
585 }
586 
587 bool compareLessOrEqual(const char* a, const __FlashStringHelper* b) {
588  return compareString(a, b) <= 0;
589 }
590 
591 bool compareLessOrEqual(const __FlashStringHelper* a, const char* b) {
592  return compareString(a, b) <= 0;
593 }
594 
595 bool compareLessOrEqual(
596  const __FlashStringHelper* a, const __FlashStringHelper* b) {
597  return compareString(a, b) <= 0;
598 }
599 
600 bool compareLessOrEqual(const __FlashStringHelper* a, const String& b) {
601  return compareString(a, b) <= 0;
602 }
603 
604 bool compareLessOrEqual(const String& a, const char* b) {
605  return compareString(a, b) <= 0;
606 }
607 
608 bool compareLessOrEqual(const String& a, const String& b) {
609  return compareString(a, b) <= 0;
610 }
611 
612 bool compareLessOrEqual(const String& a, const __FlashStringHelper* b) {
613  return compareString(a, b) <= 0;
614 }
615 
616 //---------------------------------------------------------------------------
617 // compareMoreOrEqual
618 //---------------------------------------------------------------------------
619 
620 bool compareMoreOrEqual(bool a, bool b) {
621  return (a >= b);
622 }
623 
624 bool compareMoreOrEqual(char a, char b) {
625  return (a >= b);
626 }
627 
628 bool compareMoreOrEqual(int a, int b) {
629  return (a >= b);
630 }
631 
632 bool compareMoreOrEqual(unsigned int a, unsigned int b) {
633  return (a >= b);
634 }
635 
636 bool compareMoreOrEqual(long a, long b) {
637  return (a >= b);
638 }
639 
640 bool compareMoreOrEqual(unsigned long a, unsigned long b) {
641  return (a >= b);
642 }
643 
644 bool compareMoreOrEqual(long long a, long long b) {
645  return (a >= b);
646 }
647 
648 bool compareMoreOrEqual(unsigned long long a, unsigned long long b) {
649  return (a >= b);
650 }
651 
652 bool compareMoreOrEqual(double a, double b) {
653  return (a >= b);
654 }
655 
656 bool compareMoreOrEqual(const char* a, const char* b) {
657  return compareString(a, b) >= 0;
658 }
659 
660 bool compareMoreOrEqual(const char* a, const String& b) {
661  return compareString(a, b) >= 0;
662 }
663 
664 bool compareMoreOrEqual(const char* a, const __FlashStringHelper* b) {
665  return compareString(a, b) >= 0;
666 }
667 
668 bool compareMoreOrEqual(const __FlashStringHelper* a, const char* b) {
669  return compareString(a, b) >= 0;
670 }
671 
672 bool compareMoreOrEqual(
673  const __FlashStringHelper* a, const __FlashStringHelper* b) {
674  return compareString(a, b) >= 0;
675 }
676 
677 bool compareMoreOrEqual(const __FlashStringHelper* a, const String& b) {
678  return compareString(a, b) >= 0;
679 }
680 
681 bool compareMoreOrEqual(const String& a, const char* b) {
682  return compareString(a, b) >= 0;
683 }
684 
685 bool compareMoreOrEqual(const String& a, const String& b) {
686  return compareString(a, b) >= 0;
687 }
688 
689 bool compareMoreOrEqual(const String& a, const __FlashStringHelper* b) {
690  return compareString(a, b) >= 0;
691 }
692 
693 //---------------------------------------------------------------------------
694 // compareNotEqual
695 //---------------------------------------------------------------------------
696 
697 bool compareNotEqual(bool a, bool b) {
698  return (a != b);
699 }
700 
701 bool compareNotEqual(char a, char b) {
702  return (a != b);
703 }
704 
705 bool compareNotEqual(int a, int b) {
706  return (a != b);
707 }
708 
709 bool compareNotEqual(unsigned int a, unsigned int b) {
710  return (a != b);
711 }
712 
713 bool compareNotEqual(long a, long b) {
714  return (a != b);
715 }
716 
717 bool compareNotEqual(unsigned long a, unsigned long b) {
718  return (a != b);
719 }
720 
721 bool compareNotEqual(long long a, long long b) {
722  return (a != b);
723 }
724 
725 bool compareNotEqual(unsigned long long a, unsigned long long b) {
726  return (a != b);
727 }
728 
729 bool compareNotEqual(double a, double b) {
730  return (a != b);
731 }
732 
733 bool compareNotEqual(const char* a, const char* b) {
734  return compareString(a, b) != 0;
735 }
736 
737 bool compareNotEqual(const char* a, const String& b) {
738  return compareString(a, b) != 0;
739 }
740 
741 bool compareNotEqual(const char* a, const __FlashStringHelper* b) {
742  return compareString(a, b) != 0;
743 }
744 
745 bool compareNotEqual(const __FlashStringHelper* a, const char* b) {
746  return compareString(a, b) != 0;
747 }
748 
749 bool compareNotEqual(
750  const __FlashStringHelper* a, const __FlashStringHelper* b) {
751  return compareString(a, b) != 0;
752 }
753 
754 bool compareNotEqual(const __FlashStringHelper* a, const String& b) {
755  return compareString(a, b) != 0;
756 }
757 
758 bool compareNotEqual(const String& a, const char* b) {
759  return compareString(a, b) != 0;
760 }
761 
762 bool compareNotEqual(const String& a, const String& b) {
763  return compareString(a, b) != 0;
764 }
765 
766 bool compareNotEqual(const String& a, const __FlashStringHelper* b) {
767  return compareString(a, b) != 0;
768 }
769 
770 //---------------------------------------------------------------------------
771 // compareStringCaseEqual()
772 //---------------------------------------------------------------------------
773 
774 bool compareStringCaseEqual(const char* a, const char* b) {
775  return compareStringCase(a, b) == 0;
776 }
777 
778 bool compareStringCaseEqual(const char* a, const String& b) {
779  return compareStringCase(a, b) == 0;
780 }
781 
782 bool compareStringCaseEqual(const char* a, const __FlashStringHelper* b) {
783  return compareStringCase(a, b) == 0;
784 }
785 
786 bool compareStringCaseEqual(const __FlashStringHelper* a, const char* b) {
787  return compareStringCase(a, b) == 0;
788 }
789 
790 bool compareStringCaseEqual(const __FlashStringHelper* a,
791  const __FlashStringHelper* b) {
792  return compareStringCase(a, b) == 0;
793 }
794 
795 bool compareStringCaseEqual(const __FlashStringHelper* a, const String& b) {
796  return compareStringCase(a, b) == 0;
797 }
798 
799 bool compareStringCaseEqual(const String& a, const char* b) {
800  return compareStringCase(a, b) == 0;
801 }
802 
803 bool compareStringCaseEqual(const String& a, const String& b) {
804  return compareStringCase(a, b) == 0;
805 }
806 
807 bool compareStringCaseEqual(const String& a, const __FlashStringHelper* b) {
808  return compareStringCase(a, b) == 0;
809 }
810 
811 //---------------------------------------------------------------------------
812 // compareStringCaseNotEqual()
813 //---------------------------------------------------------------------------
814 
815 bool compareStringCaseNotEqual(const char* a, const char* b) {
816  return compareStringCase(a, b) != 0;
817 }
818 
819 bool compareStringCaseNotEqual(const char* a, const String& b) {
820  return compareStringCase(a, b) != 0;
821 }
822 
823 bool compareStringCaseNotEqual(const char* a, const __FlashStringHelper* b) {
824  return compareStringCase(a, b) != 0;
825 }
826 
827 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const char* b) {
828  return compareStringCase(a, b) != 0;
829 }
830 
831 bool compareStringCaseNotEqual(const __FlashStringHelper* a,
832  const __FlashStringHelper* b) {
833  return compareStringCase(a, b) != 0;
834 }
835 
836 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const String& b) {
837  return compareStringCase(a, b) != 0;
838 }
839 
840 bool compareStringCaseNotEqual(const String& a, const char* b) {
841  return compareStringCase(a, b) != 0;
842 }
843 
844 bool compareStringCaseNotEqual(const String& a, const String& b) {
845  return compareStringCase(a, b) != 0;
846 }
847 
848 bool compareStringCaseNotEqual(const String& a, const __FlashStringHelper* b) {
849  return compareStringCase(a, b) != 0;
850 }
851 
852 //---------------------------------------------------------------------------
853 // compareNear()
854 //---------------------------------------------------------------------------
855 
856 bool compareNear(int a, int b, int error) {
857  return abs(a - b) <= error;
858 }
859 
860 bool compareNear(unsigned int a, unsigned int b, unsigned int error) {
861  return (unsigned int) abs((int)(a - b)) <= error;
862 }
863 
864 bool compareNear(long a, long b, long error) {
865  return abs(a - b) <= error;
866 }
867 
868 bool compareNear(unsigned long a, unsigned long b, unsigned long error) {
869  return (unsigned long) abs((long)(a - b)) <= error;
870 }
871 
872 bool compareNear(double a, double b, double error) {
873  return fabs(a - b) <= error;
874 }
875 
876 bool compareNotNear(int a, int b, int error) {
877  return !compareNear(a, b, error);
878 }
879 
880 bool compareNotNear(unsigned int a, unsigned int b, unsigned int error) {
881  return !compareNear(a, b, error);
882 }
883 
884 bool compareNotNear(long a, long b, long error) {
885  return !compareNear(a, b, error);
886 }
887 
888 bool compareNotNear(unsigned long a, unsigned long b, unsigned long error) {
889  return !compareNear(a, b, error);
890 }
891 
892 bool compareNotNear(double a, double b, double error) {
893  return !compareNear(a, b, error);
894 }
895 
896 }
897 }
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
- -
Various macros to smooth over the differences among the various platforms with regards to their suppo...
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 /*
+
26 Design Notes:
+
27 ============
+
28 
+
29 Template Specialization:
+
30 -----------------------
+
31 One way to implement the compareEqual() for these types is to use template
+
32 specialization. The problem with Template specialization is that templates
+
33 use strict type matching, and does not perform the normal implicit type
+
34 conversion, including const-casting. Therefore, all of the various c-style
+
35 string types, for example:
+
36 
+
37  - char*
+
38  - const char*
+
39  - char[1]
+
40  - char[N]
+
41  - const char[1]
+
42  - const char[N]
+
43 
+
44 are considered to be different types under the C++ templating system. This
+
45 causes a combinatorial explosion of template specialization which produces
+
46 code that is difficult to understand, test and maintain.
+
47 An example can be seen in the Compare.h file of the ArduinoUnit project:
+
48 https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnitUtility/Compare.h
+
49 
+
50 Function Overloading:
+
51 ---------------------
+
52 In this project, I used function overloading instead of template
+
53 specialization. Function overloading handles c-style strings (i.e. character
+
54 arrays) naturally, in the way most users expect. For example, (char*) is
+
55 automarically cast to (const char*), and (char[N]) is autonmatically
+
56 cast to (const char*).
+
57 
+
58 For the primitive value types (e.g. (char), (int), (unsigned char), etc.) I
+
59 attempted to use a generic templatized version, using sonmething like:
+
60 
+
61  template<typename T>
+
62  compareEqual(const T& a, const T& b) { ... }
+
63 
+
64 However, this template introduced this method:
+
65 
+
66  compareEqual(char* const& a, char* const& b);
+
67 
+
68 that seemed to take precedence over the explicitly defined overload:
+
69 
+
70  compareEqual(const char* a, const char*b);
+
71 
+
72 When the compareEqual() method is called with a (char*) or a (char[N]),
+
73 like this:
+
74 
+
75  char a[3] = {...};
+
76  char b[4] = {...};
+
77  compareEqual(a, b);
+
78 
+
79 this calls compareEqual(char* const&, const* const&), which is the wrong
+
80 version for a c-style string. The only way I could get this to work was to
+
81 avoid templates completely and manually define all the function overloads
+
82 even for primitive integer types.
+
83 
+
84 Implicit Conversions:
+
85 ---------------------
+
86 For basic primitive types, I depend on some casts to avoid having to define
+
87 some functions. I assume that signed and unsigned integers smaller or equal
+
88 to (int) will be converted to an (int) to match compareEqual(int, int).
+
89 
+
90 I provided an explicit compareEqual(char, char) overload because in C++, a
+
91 (char) type is distinct from (signed char) and (unsigned char).
+
92 
+
93 Technically, there should be a (long long) version and an (unsigned long
+
94 long) version of compareEqual(). However, it turns out that the Arduino
+
95 Print::print() method does not have an overload for these types, so it would
+
96 not do us much good to provide an assertEqual() or compareEqual() for the
+
97 (long long) and (unsigned long long) types.
+
98 
+
99 Custom Assert and Compare Functions:
+
100 ------------------------------------
+
101 Another advantage of using function overloading instead of template
+
102 specialization is that the user is able to add additional function overloads
+
103 into the 'aunit' namespace. This should allow the user to define the various
+
104 comporeXxx() and assertXxx() functions for a custom class. I have not
+
105 tested this though.
+
106 
+
107 Comparing Flash Strings:
+
108 ------------------------
+
109 Flash memory must be read using 4-byte alignment on the ESP8266. AVR doesn't
+
110 care. Teensy-ARM fakes the flash memory API but really just uses the normal
+
111 static RAM. The following code for comparing two (__FlashStringHelper*)
+
112 against each other will work for all 3 environments.
+
113 
+
114 Inlining:
+
115 --------
+
116 Even though most of these functions are one-liners, there is no advantage to
+
117 inlining them because they are almost always used through a function pointer.
+
118 */
+
119 
+
120 #include <stdint.h>
+
121 #include <string.h>
+
122 #include <math.h> // fabs()
+
123 #include <WString.h>
+
124 #include "Flash.h"
+
125 #include "Compare.h"
+
126 
+
127 namespace aunit {
+
128 namespace internal {
+
129 
+
130 //---------------------------------------------------------------------------
+
131 // compareString()
+
132 //---------------------------------------------------------------------------
+
133 
+
134 int compareString(const char* a, const char* b) {
+
135  if (a == b) { return 0; }
+
136  if (a == nullptr) { return -1; }
+
137  if (b == nullptr) { return 1; }
+
138  return strcmp(a, b);
+
139 }
+
140 
+
141 int compareString(const char* a, const String& b) {
+
142  if (a == nullptr) { return -1; }
+
143  return strcmp(a, b.c_str());
+
144 }
+
145 
+
146 int compareString(const char* a, const __FlashStringHelper* b) {
+
147  if (a == (const char*) b) { return 0; }
+
148  if (a == nullptr) { return -1; }
+
149  if (b == nullptr) { return 1; }
+
150  return strcmp_P(a, (const char*) b);
+
151 }
+
152 
+
153 int compareString(const String& a, const char* b) {
+
154  return -compareString(b, a);
+
155 }
+
156 
+
157 int compareString(const String& a, const String& b) {
+
158  return strcmp(a.c_str(), b.c_str());
+
159 }
+
160 
+
161 int compareString(const String& a, const __FlashStringHelper* b) {
+
162  if (b == nullptr) { return 1; }
+
163  return strcmp_P(a.c_str(), (const char*) b);
+
164 }
+
165 
+
166 int compareString(const __FlashStringHelper* a, const char* b) {
+
167  return -compareString(b, a);
+
168 }
+
169 
+
170 int compareString(const __FlashStringHelper* a, const String& b) {
+
171  return -compareString(b, a);
+
172 }
+
173 
+
174 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
+
175 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
+
176 // optimizing for 4-byte alignment here.
+
177 int compareString(const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
178  if (a == b) { return 0; }
+
179  if (a == nullptr) { return -1; }
+
180  if (b == nullptr) { return 1; }
+
181  const char* aa = reinterpret_cast<const char*>(a);
+
182  const char* bb = reinterpret_cast<const char*>(b);
+
183 
+
184  while (true) {
+
185  uint8_t ca = pgm_read_byte(aa);
+
186  uint8_t cb = pgm_read_byte(bb);
+
187  if (ca != cb) return (int) ca - (int) cb;
+
188  if (ca == '\0') return 0;
+
189  aa++;
+
190  bb++;
+
191  }
+
192 }
+
193 
+
194 //---------------------------------------------------------------------------
+
195 // compareStringCase()
+
196 //---------------------------------------------------------------------------
+
197 
+
198 int compareStringCase(const char* a, const char* b) {
+
199  if (a == b) { return 0; }
+
200  if (a == nullptr) { return -1; }
+
201  if (b == nullptr) { return 1; }
+
202  return strcasecmp(a, b);
+
203 }
+
204 
+
205 int compareStringCase(const char* a, const String& b) {
+
206  if (a == nullptr) { return -1; }
+
207  return strcasecmp(a, b.c_str());
+
208 }
+
209 
+
210 int compareStringCase(const char* a, const __FlashStringHelper* b) {
+
211  if (a == (const char*) b) { return 0; }
+
212  if (a == nullptr) { return -1; }
+
213  if (b == nullptr) { return 1; }
+
214  return strcasecmp_P(a, (const char*) b);
+
215 }
+
216 
+
217 int compareStringCase(const String& a, const char* b) {
+
218  return -compareStringCase(b, a);
+
219 }
+
220 
+
221 int compareStringCase(const String& a, const String& b) {
+
222  return strcasecmp(a.c_str(), b.c_str());
+
223 }
+
224 
+
225 int compareStringCase(const String& a, const __FlashStringHelper* b) {
+
226  if (b == nullptr) { return 1; }
+
227  return strcasecmp_P(a.c_str(), (const char*) b);
+
228 }
+
229 
+
230 int compareStringCase(const __FlashStringHelper* a, const char* b) {
+
231  return -compareStringCase(b, a);
+
232 }
+
233 
+
234 int compareStringCase(const __FlashStringHelper* a, const String& b) {
+
235  return -compareStringCase(b, a);
+
236 }
+
237 
+
238 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
+
239 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
+
240 // optimizing for 4-byte alignment here.
+
241 int compareStringCase(const __FlashStringHelper* a,
+
242  const __FlashStringHelper* b) {
+
243  if (a == b) { return 0; }
+
244  if (a == nullptr) { return -1; }
+
245  if (b == nullptr) { return 1; }
+
246  const char* aa = reinterpret_cast<const char*>(a);
+
247  const char* bb = reinterpret_cast<const char*>(b);
+
248 
+
249  while (true) {
+
250  uint8_t ca = pgm_read_byte(aa);
+
251  uint8_t cb = pgm_read_byte(bb);
+
252  uint8_t la = tolower(ca);
+
253  uint8_t lb = tolower(cb);
+
254  if (la != lb) return (int) la - (int) lb;
+
255  if (ca == '\0') return 0;
+
256  aa++;
+
257  bb++;
+
258  }
+
259 }
+
260 
+
261 //---------------------------------------------------------------------------
+
262 // compareStringN
+
263 //---------------------------------------------------------------------------
+
264 
+
265 // We need compareStringN() to support only (const char*) and (const
+
266 // __FlashStringHelper*). And it turns out that compareStringN(a, b, N) ==
+
267 // -compareString(b, a, N).
+
268 
+
269 int compareStringN(const char* a, const char* b, size_t n) {
+
270  if (a == b) { return 0; }
+
271  if (a == nullptr) { return -1; }
+
272  if (b == nullptr) { return 1; }
+
273  return strncmp(a, b, n);
+
274 }
+
275 
+
276 int compareStringN(const char* a, const __FlashStringHelper* b, size_t n) {
+
277  if (a == (const char*) b) { return 0; }
+
278  if (a == nullptr) { return -1; }
+
279  if (b == nullptr) { return 1; }
+
280  return strncmp_P(a, (const char*) b, n);
+
281 }
+
282 
+
283 int compareStringN(const __FlashStringHelper* a, const char* b, size_t n) {
+
284  return -compareStringN(b, a, n);
+
285 }
+
286 
+
287 // On ESP8266, pgm_read_byte() already takes care of 4-byte alignment, and
+
288 // memcpy_P(s, p, 4) makes 4 calls to pgm_read_byte() anyway, so don't bother
+
289 // optimizing for 4-byte alignment here.
+
290 int compareStringN(const __FlashStringHelper* a, const __FlashStringHelper* b,
+
291  size_t n) {
+
292  if (a == b) { return 0; }
+
293  if (a == nullptr) { return -1; }
+
294  if (b == nullptr) { return 1; }
+
295  const char* aa = reinterpret_cast<const char*>(a);
+
296  const char* bb = reinterpret_cast<const char*>(b);
+
297 
+
298  while (n > 0) {
+
299  uint8_t ca = pgm_read_byte(aa);
+
300  uint8_t cb = pgm_read_byte(bb);
+
301  if (ca != cb) return (int) ca - (int) cb;
+
302  if (ca == '\0') return 0;
+
303  aa++;
+
304  bb++;
+
305  n--;
+
306  }
+
307  return 0;
+
308 }
+
309 
+
310 //---------------------------------------------------------------------------
+
311 // compareEqual()
+
312 //---------------------------------------------------------------------------
+
313 
+
314 bool compareEqual(bool a, bool b) {
+
315  return (a == b);
+
316 }
+
317 
+
318 bool compareEqual(char a, char b) {
+
319  return (a == b);
+
320 }
+
321 
+
322 bool compareEqual(int a, int b) {
+
323  return (a == b);
+
324 }
+
325 
+
326 bool compareEqual(unsigned int a, unsigned int b) {
+
327  return (a == b);
+
328 }
+
329 
+
330 bool compareEqual(long a, long b) {
+
331  return (a == b);
+
332 }
+
333 
+
334 bool compareEqual(unsigned long a, unsigned long b) {
+
335  return (a == b);
+
336 }
+
337 
+
338 bool compareEqual(long long a, long long b) {
+
339  return (a == b);
+
340 }
+
341 
+
342 bool compareEqual(unsigned long long a, unsigned long long b) {
+
343  return (a == b);
+
344 }
+
345 
+
346 bool compareEqual(double a, double b) {
+
347  return (a == b);
+
348 }
+
349 
+
350 bool compareEqual(const char* a, const char* b) {
+
351  return compareString(a, b) == 0;
+
352 }
+
353 
+
354 bool compareEqual(const char* a, const String& b) {
+
355  return compareString(a, b) == 0;
+
356 }
+
357 
+
358 bool compareEqual(const char* a, const __FlashStringHelper* b) {
+
359  return compareString(a, b) == 0;
+
360 }
+
361 
+
362 bool compareEqual(const __FlashStringHelper* a, const char* b) {
+
363  return compareString(a, b) == 0;
+
364 }
+
365 
+
366 bool compareEqual(const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
367  return compareString(a, b) == 0;
+
368 }
+
369 
+
370 bool compareEqual(const __FlashStringHelper* a, const String& b) {
+
371  return compareString(a, b) == 0;
+
372 }
+
373 
+
374 bool compareEqual(const String& a, const char* b) {
+
375  return compareString(a, b) == 0;
+
376 }
+
377 
+
378 bool compareEqual(const String& a, const String& b) {
+
379  return compareString(a, b) == 0;
+
380 }
+
381 
+
382 bool compareEqual(const String& a, const __FlashStringHelper* b) {
+
383  return compareString(a, b) == 0;
+
384 }
+
385 
+
386 //---------------------------------------------------------------------------
+
387 // compareLess()
+
388 //---------------------------------------------------------------------------
+
389 
+
390 bool compareLess(bool a, bool b) {
+
391  return (a < b);
+
392 }
+
393 
+
394 bool compareLess(char a, char b) {
+
395  return (a < b);
+
396 }
+
397 
+
398 bool compareLess(int a, int b) {
+
399  return (a < b);
+
400 }
+
401 
+
402 bool compareLess(unsigned int a, unsigned int b) {
+
403  return (a < b);
+
404 }
+
405 
+
406 bool compareLess(long a, long b) {
+
407  return (a < b);
+
408 }
+
409 
+
410 bool compareLess(unsigned long a, unsigned long b) {
+
411  return (a < b);
+
412 }
+
413 
+
414 bool compareLess(long long a, long long b) {
+
415  return (a < b);
+
416 }
+
417 
+
418 bool compareLess(unsigned long long a, unsigned long long b) {
+
419  return (a < b);
+
420 }
+
421 
+
422 bool compareLess(double a, double b) {
+
423  return (a < b);
+
424 }
+
425 
+
426 bool compareLess(const char* a, const char* b) {
+
427  return compareString(a, b) < 0;
+
428 }
+
429 
+
430 bool compareLess(const char* a, const String& b) {
+
431  return compareString(a, b) < 0;
+
432 }
+
433 
+
434 bool compareLess(const char* a, const __FlashStringHelper* b) {
+
435  return compareString(a, b) < 0;
+
436 }
+
437 
+
438 bool compareLess(const __FlashStringHelper* a, const char* b) {
+
439  return compareString(a, b) < 0;
+
440 }
+
441 
+
442 bool compareLess(
+
443  const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
444  return compareString(a, b) < 0;
+
445 }
+
446 
+
447 bool compareLess(const __FlashStringHelper* a, const String& b) {
+
448  return compareString(a, b) < 0;
+
449 }
+
450 
+
451 bool compareLess(const String& a, const char* b) {
+
452  return compareString(a, b) < 0;
+
453 }
+
454 
+
455 bool compareLess(const String& a, const String& b) {
+
456  return compareString(a, b) < 0;
+
457 }
+
458 
+
459 bool compareLess(const String& a, const __FlashStringHelper* b) {
+
460  return compareString(a, b) < 0;
+
461 }
+
462 
+
463 //---------------------------------------------------------------------------
+
464 // compareMore()
+
465 //---------------------------------------------------------------------------
+
466 
+
467 bool compareMore(bool a, bool b) {
+
468  return (a > b);
+
469 }
+
470 
+
471 bool compareMore(char a, char b) {
+
472  return (a > b);
+
473 }
+
474 
+
475 bool compareMore(int a, int b) {
+
476  return (a > b);
+
477 }
+
478 
+
479 bool compareMore(unsigned int a, unsigned int b) {
+
480  return (a > b);
+
481 }
+
482 
+
483 bool compareMore(long a, long b) {
+
484  return (a > b);
+
485 }
+
486 
+
487 bool compareMore(unsigned long a, unsigned long b) {
+
488  return (a > b);
+
489 }
+
490 
+
491 bool compareMore(long long a, long long b) {
+
492  return (a > b);
+
493 }
+
494 
+
495 bool compareMore(unsigned long long a, unsigned long long b) {
+
496  return (a > b);
+
497 }
+
498 
+
499 bool compareMore(double a, double b) {
+
500  return (a > b);
+
501 }
+
502 
+
503 bool compareMore(const char* a, const char* b) {
+
504  return compareString(a, b) > 0;
+
505 }
+
506 
+
507 bool compareMore(const char* a, const String& b) {
+
508  return compareString(a, b) > 0;
+
509 }
+
510 
+
511 bool compareMore(const char* a, const __FlashStringHelper* b) {
+
512  return compareString(a, b) > 0;
+
513 }
+
514 
+
515 bool compareMore(const __FlashStringHelper* a, const char* b) {
+
516  return compareString(a, b) > 0;
+
517 }
+
518 
+
519 bool compareMore(const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
520  return compareString(a, b) > 0;
+
521 }
+
522 
+
523 bool compareMore(const __FlashStringHelper* a, const String& b) {
+
524  return compareString(a, b) > 0;
+
525 }
+
526 
+
527 bool compareMore(const String& a, const char* b) {
+
528  return compareString(a, b) > 0;
+
529 }
+
530 
+
531 bool compareMore(const String& a, const String& b) {
+
532  return compareString(a, b) > 0;
+
533 }
+
534 
+
535 bool compareMore(const String& a, const __FlashStringHelper* b) {
+
536  return compareString(a, b) > 0;
+
537 }
+
538 
+
539 //---------------------------------------------------------------------------
+
540 // compareLessOrEqual
+
541 //---------------------------------------------------------------------------
+
542 
+
543 bool compareLessOrEqual(bool a, bool b) {
+
544  return (a <= b);
+
545 }
+
546 
+
547 bool compareLessOrEqual(char a, char b) {
+
548  return (a <= b);
+
549 }
+
550 
+
551 bool compareLessOrEqual(int a, int b) {
+
552  return (a <= b);
+
553 }
+
554 
+
555 bool compareLessOrEqual(unsigned int a, unsigned int b) {
+
556  return (a <= b);
+
557 }
+
558 
+
559 bool compareLessOrEqual(long a, long b) {
+
560  return (a <= b);
+
561 }
+
562 
+
563 bool compareLessOrEqual(unsigned long a, unsigned long b) {
+
564  return (a <= b);
+
565 }
+
566 
+
567 bool compareLessOrEqual(long long a, long long b) {
+
568  return (a <= b);
+
569 }
+
570 
+
571 bool compareLessOrEqual(unsigned long long a, unsigned long long b) {
+
572  return (a <= b);
+
573 }
+
574 
+
575 bool compareLessOrEqual(double a, double b) {
+
576  return (a <= b);
+
577 }
+
578 
+
579 bool compareLessOrEqual(const char* a, const char* b) {
+
580  return compareString(a, b) <= 0;
+
581 }
+
582 
+
583 bool compareLessOrEqual(const char* a, const String& b) {
+
584  return compareString(a, b) <= 0;
+
585 }
+
586 
+
587 bool compareLessOrEqual(const char* a, const __FlashStringHelper* b) {
+
588  return compareString(a, b) <= 0;
+
589 }
+
590 
+
591 bool compareLessOrEqual(const __FlashStringHelper* a, const char* b) {
+
592  return compareString(a, b) <= 0;
+
593 }
+
594 
+
595 bool compareLessOrEqual(
+
596  const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
597  return compareString(a, b) <= 0;
+
598 }
+
599 
+
600 bool compareLessOrEqual(const __FlashStringHelper* a, const String& b) {
+
601  return compareString(a, b) <= 0;
+
602 }
+
603 
+
604 bool compareLessOrEqual(const String& a, const char* b) {
+
605  return compareString(a, b) <= 0;
+
606 }
+
607 
+
608 bool compareLessOrEqual(const String& a, const String& b) {
+
609  return compareString(a, b) <= 0;
+
610 }
+
611 
+
612 bool compareLessOrEqual(const String& a, const __FlashStringHelper* b) {
+
613  return compareString(a, b) <= 0;
+
614 }
+
615 
+
616 //---------------------------------------------------------------------------
+
617 // compareMoreOrEqual
+
618 //---------------------------------------------------------------------------
+
619 
+
620 bool compareMoreOrEqual(bool a, bool b) {
+
621  return (a >= b);
+
622 }
+
623 
+
624 bool compareMoreOrEqual(char a, char b) {
+
625  return (a >= b);
+
626 }
+
627 
+
628 bool compareMoreOrEqual(int a, int b) {
+
629  return (a >= b);
+
630 }
+
631 
+
632 bool compareMoreOrEqual(unsigned int a, unsigned int b) {
+
633  return (a >= b);
+
634 }
+
635 
+
636 bool compareMoreOrEqual(long a, long b) {
+
637  return (a >= b);
+
638 }
+
639 
+
640 bool compareMoreOrEqual(unsigned long a, unsigned long b) {
+
641  return (a >= b);
+
642 }
+
643 
+
644 bool compareMoreOrEqual(long long a, long long b) {
+
645  return (a >= b);
+
646 }
+
647 
+
648 bool compareMoreOrEqual(unsigned long long a, unsigned long long b) {
+
649  return (a >= b);
+
650 }
+
651 
+
652 bool compareMoreOrEqual(double a, double b) {
+
653  return (a >= b);
+
654 }
+
655 
+
656 bool compareMoreOrEqual(const char* a, const char* b) {
+
657  return compareString(a, b) >= 0;
+
658 }
+
659 
+
660 bool compareMoreOrEqual(const char* a, const String& b) {
+
661  return compareString(a, b) >= 0;
+
662 }
+
663 
+
664 bool compareMoreOrEqual(const char* a, const __FlashStringHelper* b) {
+
665  return compareString(a, b) >= 0;
+
666 }
+
667 
+
668 bool compareMoreOrEqual(const __FlashStringHelper* a, const char* b) {
+
669  return compareString(a, b) >= 0;
+
670 }
+
671 
+
672 bool compareMoreOrEqual(
+
673  const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
674  return compareString(a, b) >= 0;
+
675 }
+
676 
+
677 bool compareMoreOrEqual(const __FlashStringHelper* a, const String& b) {
+
678  return compareString(a, b) >= 0;
+
679 }
+
680 
+
681 bool compareMoreOrEqual(const String& a, const char* b) {
+
682  return compareString(a, b) >= 0;
+
683 }
+
684 
+
685 bool compareMoreOrEqual(const String& a, const String& b) {
+
686  return compareString(a, b) >= 0;
+
687 }
+
688 
+
689 bool compareMoreOrEqual(const String& a, const __FlashStringHelper* b) {
+
690  return compareString(a, b) >= 0;
+
691 }
+
692 
+
693 //---------------------------------------------------------------------------
+
694 // compareNotEqual
+
695 //---------------------------------------------------------------------------
+
696 
+
697 bool compareNotEqual(bool a, bool b) {
+
698  return (a != b);
+
699 }
+
700 
+
701 bool compareNotEqual(char a, char b) {
+
702  return (a != b);
+
703 }
+
704 
+
705 bool compareNotEqual(int a, int b) {
+
706  return (a != b);
+
707 }
+
708 
+
709 bool compareNotEqual(unsigned int a, unsigned int b) {
+
710  return (a != b);
+
711 }
+
712 
+
713 bool compareNotEqual(long a, long b) {
+
714  return (a != b);
+
715 }
+
716 
+
717 bool compareNotEqual(unsigned long a, unsigned long b) {
+
718  return (a != b);
+
719 }
+
720 
+
721 bool compareNotEqual(long long a, long long b) {
+
722  return (a != b);
+
723 }
+
724 
+
725 bool compareNotEqual(unsigned long long a, unsigned long long b) {
+
726  return (a != b);
+
727 }
+
728 
+
729 bool compareNotEqual(double a, double b) {
+
730  return (a != b);
+
731 }
+
732 
+
733 bool compareNotEqual(const char* a, const char* b) {
+
734  return compareString(a, b) != 0;
+
735 }
+
736 
+
737 bool compareNotEqual(const char* a, const String& b) {
+
738  return compareString(a, b) != 0;
+
739 }
+
740 
+
741 bool compareNotEqual(const char* a, const __FlashStringHelper* b) {
+
742  return compareString(a, b) != 0;
+
743 }
+
744 
+
745 bool compareNotEqual(const __FlashStringHelper* a, const char* b) {
+
746  return compareString(a, b) != 0;
+
747 }
+
748 
+
749 bool compareNotEqual(
+
750  const __FlashStringHelper* a, const __FlashStringHelper* b) {
+
751  return compareString(a, b) != 0;
+
752 }
+
753 
+
754 bool compareNotEqual(const __FlashStringHelper* a, const String& b) {
+
755  return compareString(a, b) != 0;
+
756 }
+
757 
+
758 bool compareNotEqual(const String& a, const char* b) {
+
759  return compareString(a, b) != 0;
+
760 }
+
761 
+
762 bool compareNotEqual(const String& a, const String& b) {
+
763  return compareString(a, b) != 0;
+
764 }
+
765 
+
766 bool compareNotEqual(const String& a, const __FlashStringHelper* b) {
+
767  return compareString(a, b) != 0;
+
768 }
+
769 
+
770 //---------------------------------------------------------------------------
+
771 // compareStringCaseEqual()
+
772 //---------------------------------------------------------------------------
+
773 
+
774 bool compareStringCaseEqual(const char* a, const char* b) {
+
775  return compareStringCase(a, b) == 0;
+
776 }
+
777 
+
778 bool compareStringCaseEqual(const char* a, const String& b) {
+
779  return compareStringCase(a, b) == 0;
+
780 }
+
781 
+
782 bool compareStringCaseEqual(const char* a, const __FlashStringHelper* b) {
+
783  return compareStringCase(a, b) == 0;
+
784 }
+
785 
+
786 bool compareStringCaseEqual(const __FlashStringHelper* a, const char* b) {
+
787  return compareStringCase(a, b) == 0;
+
788 }
+
789 
+
790 bool compareStringCaseEqual(const __FlashStringHelper* a,
+
791  const __FlashStringHelper* b) {
+
792  return compareStringCase(a, b) == 0;
+
793 }
+
794 
+
795 bool compareStringCaseEqual(const __FlashStringHelper* a, const String& b) {
+
796  return compareStringCase(a, b) == 0;
+
797 }
+
798 
+
799 bool compareStringCaseEqual(const String& a, const char* b) {
+
800  return compareStringCase(a, b) == 0;
+
801 }
+
802 
+
803 bool compareStringCaseEqual(const String& a, const String& b) {
+
804  return compareStringCase(a, b) == 0;
+
805 }
+
806 
+
807 bool compareStringCaseEqual(const String& a, const __FlashStringHelper* b) {
+
808  return compareStringCase(a, b) == 0;
+
809 }
+
810 
+
811 //---------------------------------------------------------------------------
+
812 // compareStringCaseNotEqual()
+
813 //---------------------------------------------------------------------------
+
814 
+
815 bool compareStringCaseNotEqual(const char* a, const char* b) {
+
816  return compareStringCase(a, b) != 0;
+
817 }
+
818 
+
819 bool compareStringCaseNotEqual(const char* a, const String& b) {
+
820  return compareStringCase(a, b) != 0;
+
821 }
+
822 
+
823 bool compareStringCaseNotEqual(const char* a, const __FlashStringHelper* b) {
+
824  return compareStringCase(a, b) != 0;
+
825 }
+
826 
+
827 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const char* b) {
+
828  return compareStringCase(a, b) != 0;
+
829 }
+
830 
+
831 bool compareStringCaseNotEqual(const __FlashStringHelper* a,
+
832  const __FlashStringHelper* b) {
+
833  return compareStringCase(a, b) != 0;
+
834 }
+
835 
+
836 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const String& b) {
+
837  return compareStringCase(a, b) != 0;
+
838 }
+
839 
+
840 bool compareStringCaseNotEqual(const String& a, const char* b) {
+
841  return compareStringCase(a, b) != 0;
+
842 }
+
843 
+
844 bool compareStringCaseNotEqual(const String& a, const String& b) {
+
845  return compareStringCase(a, b) != 0;
+
846 }
+
847 
+
848 bool compareStringCaseNotEqual(const String& a, const __FlashStringHelper* b) {
+
849  return compareStringCase(a, b) != 0;
+
850 }
+
851 
+
852 //---------------------------------------------------------------------------
+
853 // compareNear()
+
854 //---------------------------------------------------------------------------
+
855 
+
856 bool compareNear(int a, int b, int error) {
+
857  return abs(a - b) <= error;
+
858 }
+
859 
+
860 bool compareNear(unsigned int a, unsigned int b, unsigned int error) {
+
861  return (unsigned int) abs((int)(a - b)) <= error;
+
862 }
+
863 
+
864 bool compareNear(long a, long b, long error) {
+
865  return abs(a - b) <= error;
+
866 }
+
867 
+
868 bool compareNear(unsigned long a, unsigned long b, unsigned long error) {
+
869  return (unsigned long) abs((long)(a - b)) <= error;
+
870 }
+
871 
+
872 bool compareNear(double a, double b, double error) {
+
873  return fabs(a - b) <= error;
+
874 }
+
875 
+
876 bool compareNotNear(int a, int b, int error) {
+
877  return !compareNear(a, b, error);
+
878 }
+
879 
+
880 bool compareNotNear(unsigned int a, unsigned int b, unsigned int error) {
+
881  return !compareNear(a, b, error);
+
882 }
+
883 
+
884 bool compareNotNear(long a, long b, long error) {
+
885  return !compareNear(a, b, error);
+
886 }
+
887 
+
888 bool compareNotNear(unsigned long a, unsigned long b, unsigned long error) {
+
889  return !compareNear(a, b, error);
+
890 }
+
891 
+
892 bool compareNotNear(double a, double b, double error) {
+
893  return !compareNear(a, b, error);
+
894 }
+
895 
+
896 }
+
897 }
+ + diff --git a/docs/html/Compare_8h.html b/docs/html/Compare_8h.html index 1cda50e..3d3afa6 100644 --- a/docs/html/Compare_8h.html +++ b/docs/html/Compare_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Compare.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/Compare.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Compare.h File Reference
- -

This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a, b) macros. -More...

#include <stddef.h>
Include dependency graph for Compare.h:
-
+
+ + + +
This graph shows which files directly or indirectly include this file:
-
- - - - - - - - +
+ + + + + + + + +
@@ -152,17 +157,21 @@ int aunit::internal::compareStringCase (const __FlashStringHelper *a, const String &b)   -int aunit::internal::compareStringN (const char *a, const char *b, size_t n) - Compare only the first n characters of 'a' or 'b'. More...
+ +int aunit::internal::compareStringN (const char *a, const char *b, size_t n) + Compare only the first n characters of 'a' or 'b'.
  -int aunit::internal::compareStringN (const char *a, const __FlashStringHelper *b, size_t n) - Compare only the first n characters of 'a' or 'b'. More...
+ +int aunit::internal::compareStringN (const char *a, const __FlashStringHelper *b, size_t n) + Compare only the first n characters of 'a' or 'b'.
  -int aunit::internal::compareStringN (const __FlashStringHelper *a, const char *b, size_t n) - Compare only the first n characters of 'a' or 'b'. More...
+ +int aunit::internal::compareStringN (const __FlashStringHelper *a, const char *b, size_t n) + Compare only the first n characters of 'a' or 'b'.
  -int aunit::internal::compareStringN (const __FlashStringHelper *a, const __FlashStringHelper *b, size_t n) - Compare only the first n characters of 'a' or 'b'. More...
+ +int aunit::internal::compareStringN (const __FlashStringHelper *a, const __FlashStringHelper *b, size_t n) + Compare only the first n characters of 'a' or 'b'.
  bool aunit::internal::compareEqual (bool a, bool b) @@ -574,8 +583,7 @@  

Detailed Description

-

This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a, b) macros.

-

We wanted to allow users to use the assertXxx() macros with all combinations of the 3 types of strings available in the Arduino platform:

+

This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a, b) macros. We wanted to allow users to use the assertXxx() macros with all combinations of the 3 types of strings available in the Arduino platform:

  • (const char*)
  • (String&)
  • @@ -597,165 +605,12 @@

    All versions of compareString() and compareStringN() accept nullptr arguments (in constrast to strcmp() and strncmp() where their behavior for nullptr are undefined by the C standard.) If both arguments are nullptr, then the strings are considered equal (returns 0). Otherwise, the nullptr is arbitrarily defined to be less than all non-null strings, including the empty string.

    Definition in file Compare.h.

    -

Function Documentation

- -

◆ compareStringN() [1/4]

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int aunit::internal::compareStringN (const char * a,
const char * b,
size_t n 
)
-
- -

Compare only the first n characters of 'a' or 'b'.

- -

Definition at line 269 of file Compare.cpp.

- -
-
- -

◆ compareStringN() [2/4]

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int aunit::internal::compareStringN (const char * a,
const __FlashStringHelper * b,
size_t n 
)
-
- -

Compare only the first n characters of 'a' or 'b'.

- -

Definition at line 276 of file Compare.cpp.

- -
-
- -

◆ compareStringN() [3/4]

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int aunit::internal::compareStringN (const __FlashStringHelper * a,
const char * b,
size_t n 
)
-
- -

Compare only the first n characters of 'a' or 'b'.

- -

Definition at line 283 of file Compare.cpp.

- -
-
- -

◆ compareStringN() [4/4]

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
int aunit::internal::compareStringN (const __FlashStringHelper * a,
const __FlashStringHelper * b,
size_t n 
)
-
- -

Compare only the first n characters of 'a' or 'b'.

- -

Definition at line 290 of file Compare.cpp.

- -
-
-
+
diff --git a/docs/html/Compare_8h__dep__incl.map b/docs/html/Compare_8h__dep__incl.map index e48ca90..85fd6e6 100644 --- a/docs/html/Compare_8h__dep__incl.map +++ b/docs/html/Compare_8h__dep__incl.map @@ -1,9 +1,10 @@ - - - - - - - - + + + + + + + + + diff --git a/docs/html/Compare_8h__dep__incl.md5 b/docs/html/Compare_8h__dep__incl.md5 index 47346b4..62bf38e 100644 --- a/docs/html/Compare_8h__dep__incl.md5 +++ b/docs/html/Compare_8h__dep__incl.md5 @@ -1 +1 @@ -f1af7db182fcd2c98b2893c406509619 \ No newline at end of file +717bec503875478bb8387511e895c26a \ No newline at end of file diff --git a/docs/html/Compare_8h__dep__incl.png b/docs/html/Compare_8h__dep__incl.png index b0a9e37..4169284 100644 Binary files a/docs/html/Compare_8h__dep__incl.png and b/docs/html/Compare_8h__dep__incl.png differ diff --git a/docs/html/Compare_8h__incl.map b/docs/html/Compare_8h__incl.map index aa136b4..e578acd 100644 --- a/docs/html/Compare_8h__incl.map +++ b/docs/html/Compare_8h__incl.map @@ -1,2 +1,4 @@ - + + + diff --git a/docs/html/Compare_8h__incl.md5 b/docs/html/Compare_8h__incl.md5 index 28a9dbd..94c7df8 100644 --- a/docs/html/Compare_8h__incl.md5 +++ b/docs/html/Compare_8h__incl.md5 @@ -1 +1 @@ -22688536d25baaafd41ed616906cb254 \ No newline at end of file +818457bae890d928f290ad166ecfd944 \ No newline at end of file diff --git a/docs/html/Compare_8h__incl.png b/docs/html/Compare_8h__incl.png index 5276a4c..fa6ff42 100644 Binary files a/docs/html/Compare_8h__incl.png and b/docs/html/Compare_8h__incl.png differ diff --git a/docs/html/Compare_8h_source.html b/docs/html/Compare_8h_source.html index da34d43..44fd8e6 100644 --- a/docs/html/Compare_8h_source.html +++ b/docs/html/Compare_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Compare.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/Compare.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
Compare.h
-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnitUtility/Compare.h
27 
70 #ifndef AUNIT_COMPARE_H
71 #define AUNIT_COMPARE_H
72 
73 #include <stddef.h> // size_t
74 
75 class String;
76 class __FlashStringHelper;
77 
78 namespace aunit {
79 namespace internal {
80 
81 // compareString()
82 
83 int compareString(const char* a, const char* b);
84 
85 int compareString(const char* a, const String& b);
86 
87 int compareString(const char* a, const __FlashStringHelper* b);
88 
89 int compareString(const String& a, const char* b);
90 
91 int compareString(const String& a, const String& b);
92 
93 int compareString(const String& a, const __FlashStringHelper* b);
94 
95 int compareString(const __FlashStringHelper* a, const char* b);
96 
97 int compareString(const __FlashStringHelper* a, const __FlashStringHelper* b);
98 
99 int compareString(const __FlashStringHelper* a, const String& b);
100 
101 // compareStringCase() - case insensitive versions of compareString()
102 
103 int compareStringCase(const char* a, const char* b);
104 
105 int compareStringCase(const char* a, const String& b);
106 
107 int compareStringCase(const char* a, const __FlashStringHelper* b);
108 
109 int compareStringCase(const String& a, const char* b);
110 
111 int compareStringCase(const String& a, const String& b);
112 
113 int compareStringCase(const String& a, const __FlashStringHelper* b);
114 
115 int compareStringCase(const __FlashStringHelper* a, const char* b);
116 
117 int compareStringCase(const __FlashStringHelper* a,
118  const __FlashStringHelper* b);
119 
120 int compareStringCase(const __FlashStringHelper* a, const String& b);
121 
122 // compareStringN()
123 //
124 // These functions are used to implement the TestRunner::exclude() and
125 // TestRunner::include() features.
126 
128 int compareStringN(const char* a, const char* b, size_t n);
129 
131 int compareStringN(const char* a, const __FlashStringHelper* b, size_t n);
132 
134 int compareStringN(const __FlashStringHelper* a, const char* b, size_t n);
135 
137 int compareStringN(const __FlashStringHelper* a, const __FlashStringHelper* b,
138  size_t n);
139 
140 // compareEqual()
141 
142 bool compareEqual(bool a, bool b);
143 
144 bool compareEqual(char a, char b);
145 
146 bool compareEqual(int a, int b);
147 
148 bool compareEqual(unsigned int a, unsigned int b);
149 
150 bool compareEqual(long a, long b);
151 
152 bool compareEqual(unsigned long a, unsigned long b);
153 
154 bool compareEqual(long long a, long long b);
155 
156 bool compareEqual(unsigned long long a, unsigned long long b);
157 
158 bool compareEqual(double a, double b);
159 
160 bool compareEqual(const char* a, const char* b);
161 
162 bool compareEqual(const char* a, const String& b);
163 
164 bool compareEqual(const char* a, const __FlashStringHelper* b);
165 
166 bool compareEqual(const __FlashStringHelper* a, const char* b);
167 
168 bool compareEqual( const __FlashStringHelper* a, const __FlashStringHelper* b);
169 
170 bool compareEqual(const __FlashStringHelper* a, const String& b);
171 
172 bool compareEqual(const String& a, const char* b);
173 
174 bool compareEqual(const String& a, const String& b);
175 
176 bool compareEqual(const String& a, const __FlashStringHelper* b);
177 
178 // compareLess()
179 
180 bool compareLess(bool a, bool b);
181 
182 bool compareLess(char a, char b);
183 
184 bool compareLess(int a, int b);
185 
186 bool compareLess(unsigned int a, unsigned int b);
187 
188 bool compareLess(long a, long b);
189 
190 bool compareLess(unsigned long a, unsigned long b);
191 
192 bool compareLess(long long a, long long b);
193 
194 bool compareLess(unsigned long long a, unsigned long long b);
195 
196 bool compareLess(double a, double b);
197 
198 bool compareLess(const char* a, const char* b);
199 
200 bool compareLess(const char* a, const String& b);
201 
202 bool compareLess(const char* a, const __FlashStringHelper* b);
203 
204 bool compareLess(const __FlashStringHelper* a, const char* b);
205 
206 bool compareLess(const __FlashStringHelper* a, const __FlashStringHelper* b);
207 
208 bool compareLess(const __FlashStringHelper* a, const String& b);
209 
210 bool compareLess(const String& a, const char* b);
211 
212 bool compareLess(const String& a, const String& b);
213 
214 bool compareLess(const String& a, const __FlashStringHelper* b);
215 
216 // compareMore()
217 
218 bool compareMore(bool a, bool b);
219 
220 bool compareMore(char a, char b);
221 
222 bool compareMore(int a, int b);
223 
224 bool compareMore(unsigned int a, unsigned int b);
225 
226 bool compareMore(long a, long b);
227 
228 bool compareMore(unsigned long a, unsigned long b);
229 
230 bool compareMore(long long a, long long b);
231 
232 bool compareMore(unsigned long long a, unsigned long long b);
233 
234 bool compareMore(double a, double b);
235 
236 bool compareMore(const char* a, const char* b);
237 
238 bool compareMore(const char* a, const String& b);
239 
240 bool compareMore(const char* a, const __FlashStringHelper* b);
241 
242 bool compareMore(const __FlashStringHelper* a, const char* b);
243 
244 bool compareMore(const __FlashStringHelper* a, const __FlashStringHelper* b);
245 
246 bool compareMore(const __FlashStringHelper* a, const String& b);
247 
248 bool compareMore(const String& a, const char* b);
249 
250 bool compareMore(const String& a, const String& b);
251 
252 bool compareMore(const String& a, const __FlashStringHelper* b);
253 
254 // compareLessOrEqual
255 
256 bool compareLessOrEqual(bool a, bool b);
257 
258 bool compareLessOrEqual(char a, char b);
259 
260 bool compareLessOrEqual(int a, int b);
261 
262 bool compareLessOrEqual(unsigned int a, unsigned int b);
263 
264 bool compareLessOrEqual(long a, long b);
265 
266 bool compareLessOrEqual(unsigned long a, unsigned long b);
267 
268 bool compareLessOrEqual(long long a, long long b);
269 
270 bool compareLessOrEqual(unsigned long long a, unsigned long long b);
271 
272 bool compareLessOrEqual(double a, double b);
273 
274 bool compareLessOrEqual(const char* a, const char* b);
275 
276 bool compareLessOrEqual(const char* a, const String& b);
277 
278 bool compareLessOrEqual(const char* a, const __FlashStringHelper* b);
279 
280 bool compareLessOrEqual(const __FlashStringHelper* a, const char* b);
281 
282 bool compareLessOrEqual(
283  const __FlashStringHelper* a, const __FlashStringHelper* b);
284 
285 bool compareLessOrEqual(const __FlashStringHelper* a, const String& b);
286 
287 bool compareLessOrEqual(const String& a, const char* b);
288 
289 bool compareLessOrEqual(const String& a, const String& b);
290 
291 bool compareLessOrEqual(const String& a, const __FlashStringHelper* b);
292 
293 // compareMoreOrEqual
294 
295 bool compareMoreOrEqual(bool a, bool b);
296 
297 bool compareMoreOrEqual(char a, char b);
298 
299 bool compareMoreOrEqual(int a, int b);
300 
301 bool compareMoreOrEqual(unsigned int a, unsigned int b);
302 
303 bool compareMoreOrEqual(long a, long b);
304 
305 bool compareMoreOrEqual(unsigned long a, unsigned long b);
306 
307 bool compareMoreOrEqual(long long a, long long b);
308 
309 bool compareMoreOrEqual(unsigned long long a, unsigned long long b);
310 
311 bool compareMoreOrEqual(double a, double b);
312 
313 bool compareMoreOrEqual(const char* a, const char* b);
314 
315 bool compareMoreOrEqual(const char* a, const String& b);
316 
317 bool compareMoreOrEqual(const char* a, const __FlashStringHelper* b);
318 
319 bool compareMoreOrEqual(const __FlashStringHelper* a, const char* b);
320 
321 bool compareMoreOrEqual(
322  const __FlashStringHelper* a, const __FlashStringHelper* b);
323 
324 bool compareMoreOrEqual(const __FlashStringHelper* a, const String& b);
325 
326 bool compareMoreOrEqual(const String& a, const char* b);
327 
328 bool compareMoreOrEqual(const String& a, const String& b);
329 
330 bool compareMoreOrEqual(const String& a, const __FlashStringHelper* b);
331 
332 // compareNotEqual
333 
334 bool compareNotEqual(bool a, bool b);
335 
336 bool compareNotEqual(char a, char b);
337 
338 bool compareNotEqual(int a, int b);
339 
340 bool compareNotEqual(unsigned int a, unsigned int b);
341 
342 bool compareNotEqual(long a, long b);
343 
344 bool compareNotEqual(unsigned long a, unsigned long b);
345 
346 bool compareNotEqual(long long a, long long b);
347 
348 bool compareNotEqual(unsigned long long a, unsigned long long b);
349 
350 bool compareNotEqual(double a, double b);
351 
352 bool compareNotEqual(const char* a, const char* b);
353 
354 bool compareNotEqual(const char* a, const String& b);
355 
356 bool compareNotEqual(const char* a, const __FlashStringHelper* b);
357 
358 bool compareNotEqual(const __FlashStringHelper* a, const char* b);
359 
360 bool compareNotEqual(
361  const __FlashStringHelper* a, const __FlashStringHelper* b);
362 
363 bool compareNotEqual(const __FlashStringHelper* a, const String& b);
364 
365 bool compareNotEqual(const String& a, const char* b);
366 
367 bool compareNotEqual(const String& a, const String& b);
368 
369 bool compareNotEqual(const String& a, const __FlashStringHelper* b);
370 
371 // compareStringCaseEqual
372 
373 bool compareStringCaseEqual(const char* a, const char* b);
374 
375 bool compareStringCaseEqual(const char* a, const String& b);
376 
377 bool compareStringCaseEqual(const char* a, const __FlashStringHelper* b);
378 
379 bool compareStringCaseEqual(const __FlashStringHelper* a, const char* b);
380 
381 bool compareStringCaseEqual( const __FlashStringHelper* a,
382  const __FlashStringHelper* b);
383 
384 bool compareStringCaseEqual(const __FlashStringHelper* a, const String& b);
385 
386 bool compareStringCaseEqual(const String& a, const char* b);
387 
388 bool compareStringCaseEqual(const String& a, const String& b);
389 
390 bool compareStringCaseEqual(const String& a, const __FlashStringHelper* b);
391 
392 // compareStringCaseNotEqual
393 
394 bool compareStringCaseNotEqual(const char* a, const char* b);
395 
396 bool compareStringCaseNotEqual(const char* a, const String& b);
397 
398 bool compareStringCaseNotEqual(const char* a, const __FlashStringHelper* b);
399 
400 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const char* b);
401 
402 bool compareStringCaseNotEqual( const __FlashStringHelper* a,
403  const __FlashStringHelper* b);
404 
405 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const String& b);
406 
407 bool compareStringCaseNotEqual(const String& a, const char* b);
408 
409 bool compareStringCaseNotEqual(const String& a, const String& b);
410 
411 bool compareStringCaseNotEqual(const String& a, const __FlashStringHelper* b);
412 
413 // compareNear
414 
415 bool compareNear(int a, int b, int error);
416 
417 bool compareNear(unsigned int a, unsigned int b, unsigned int error);
418 
419 bool compareNear(long a, long b, long error);
420 
421 bool compareNear(unsigned long a, unsigned long b, unsigned long error);
422 
423 bool compareNear(double a, double b, double error);
424 
425 // compareNotNear
426 
427 bool compareNotNear(int a, int b, int error);
428 
429 bool compareNotNear(unsigned int a, unsigned int b, unsigned int error);
430 
431 bool compareNotNear(long a, long b, long error);
432 
433 bool compareNotNear(unsigned long a, unsigned long b, unsigned long error);
434 
435 bool compareNotNear(double a, double b, double error);
436 
437 }
438 }
439 
440 #endif
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnitUtility/Compare.h
+
27 
+
70 #ifndef AUNIT_COMPARE_H
+
71 #define AUNIT_COMPARE_H
+
72 
+
73 #include <stddef.h> // size_t
+
74 
+
75 class String;
+
76 class __FlashStringHelper;
+
77 
+
78 namespace aunit {
+
79 namespace internal {
+
80 
+
81 // compareString()
+
82 
+
83 int compareString(const char* a, const char* b);
+
84 
+
85 int compareString(const char* a, const String& b);
+
86 
+
87 int compareString(const char* a, const __FlashStringHelper* b);
+
88 
+
89 int compareString(const String& a, const char* b);
+
90 
+
91 int compareString(const String& a, const String& b);
+
92 
+
93 int compareString(const String& a, const __FlashStringHelper* b);
+
94 
+
95 int compareString(const __FlashStringHelper* a, const char* b);
+
96 
+
97 int compareString(const __FlashStringHelper* a, const __FlashStringHelper* b);
+
98 
+
99 int compareString(const __FlashStringHelper* a, const String& b);
+
100 
+
101 // compareStringCase() - case insensitive versions of compareString()
+
102 
+
103 int compareStringCase(const char* a, const char* b);
+
104 
+
105 int compareStringCase(const char* a, const String& b);
+
106 
+
107 int compareStringCase(const char* a, const __FlashStringHelper* b);
+
108 
+
109 int compareStringCase(const String& a, const char* b);
+
110 
+
111 int compareStringCase(const String& a, const String& b);
+
112 
+
113 int compareStringCase(const String& a, const __FlashStringHelper* b);
+
114 
+
115 int compareStringCase(const __FlashStringHelper* a, const char* b);
+
116 
+
117 int compareStringCase(const __FlashStringHelper* a,
+
118  const __FlashStringHelper* b);
+
119 
+
120 int compareStringCase(const __FlashStringHelper* a, const String& b);
+
121 
+
122 // compareStringN()
+
123 //
+
124 // These functions are used to implement the TestRunner::exclude() and
+
125 // TestRunner::include() features.
+
126 
+
128 int compareStringN(const char* a, const char* b, size_t n);
+
129 
+
131 int compareStringN(const char* a, const __FlashStringHelper* b, size_t n);
+
132 
+
134 int compareStringN(const __FlashStringHelper* a, const char* b, size_t n);
+
135 
+
137 int compareStringN(const __FlashStringHelper* a, const __FlashStringHelper* b,
+
138  size_t n);
+
139 
+
140 // compareEqual()
+
141 
+
142 bool compareEqual(bool a, bool b);
+
143 
+
144 bool compareEqual(char a, char b);
+
145 
+
146 bool compareEqual(int a, int b);
+
147 
+
148 bool compareEqual(unsigned int a, unsigned int b);
+
149 
+
150 bool compareEqual(long a, long b);
+
151 
+
152 bool compareEqual(unsigned long a, unsigned long b);
+
153 
+
154 bool compareEqual(long long a, long long b);
+
155 
+
156 bool compareEqual(unsigned long long a, unsigned long long b);
+
157 
+
158 bool compareEqual(double a, double b);
+
159 
+
160 bool compareEqual(const char* a, const char* b);
+
161 
+
162 bool compareEqual(const char* a, const String& b);
+
163 
+
164 bool compareEqual(const char* a, const __FlashStringHelper* b);
+
165 
+
166 bool compareEqual(const __FlashStringHelper* a, const char* b);
+
167 
+
168 bool compareEqual( const __FlashStringHelper* a, const __FlashStringHelper* b);
+
169 
+
170 bool compareEqual(const __FlashStringHelper* a, const String& b);
+
171 
+
172 bool compareEqual(const String& a, const char* b);
+
173 
+
174 bool compareEqual(const String& a, const String& b);
+
175 
+
176 bool compareEqual(const String& a, const __FlashStringHelper* b);
+
177 
+
178 // compareLess()
+
179 
+
180 bool compareLess(bool a, bool b);
+
181 
+
182 bool compareLess(char a, char b);
+
183 
+
184 bool compareLess(int a, int b);
+
185 
+
186 bool compareLess(unsigned int a, unsigned int b);
+
187 
+
188 bool compareLess(long a, long b);
+
189 
+
190 bool compareLess(unsigned long a, unsigned long b);
+
191 
+
192 bool compareLess(long long a, long long b);
+
193 
+
194 bool compareLess(unsigned long long a, unsigned long long b);
+
195 
+
196 bool compareLess(double a, double b);
+
197 
+
198 bool compareLess(const char* a, const char* b);
+
199 
+
200 bool compareLess(const char* a, const String& b);
+
201 
+
202 bool compareLess(const char* a, const __FlashStringHelper* b);
+
203 
+
204 bool compareLess(const __FlashStringHelper* a, const char* b);
+
205 
+
206 bool compareLess(const __FlashStringHelper* a, const __FlashStringHelper* b);
+
207 
+
208 bool compareLess(const __FlashStringHelper* a, const String& b);
+
209 
+
210 bool compareLess(const String& a, const char* b);
+
211 
+
212 bool compareLess(const String& a, const String& b);
+
213 
+
214 bool compareLess(const String& a, const __FlashStringHelper* b);
+
215 
+
216 // compareMore()
+
217 
+
218 bool compareMore(bool a, bool b);
+
219 
+
220 bool compareMore(char a, char b);
+
221 
+
222 bool compareMore(int a, int b);
+
223 
+
224 bool compareMore(unsigned int a, unsigned int b);
+
225 
+
226 bool compareMore(long a, long b);
+
227 
+
228 bool compareMore(unsigned long a, unsigned long b);
+
229 
+
230 bool compareMore(long long a, long long b);
+
231 
+
232 bool compareMore(unsigned long long a, unsigned long long b);
+
233 
+
234 bool compareMore(double a, double b);
+
235 
+
236 bool compareMore(const char* a, const char* b);
+
237 
+
238 bool compareMore(const char* a, const String& b);
+
239 
+
240 bool compareMore(const char* a, const __FlashStringHelper* b);
+
241 
+
242 bool compareMore(const __FlashStringHelper* a, const char* b);
+
243 
+
244 bool compareMore(const __FlashStringHelper* a, const __FlashStringHelper* b);
+
245 
+
246 bool compareMore(const __FlashStringHelper* a, const String& b);
+
247 
+
248 bool compareMore(const String& a, const char* b);
+
249 
+
250 bool compareMore(const String& a, const String& b);
+
251 
+
252 bool compareMore(const String& a, const __FlashStringHelper* b);
+
253 
+
254 // compareLessOrEqual
+
255 
+
256 bool compareLessOrEqual(bool a, bool b);
+
257 
+
258 bool compareLessOrEqual(char a, char b);
+
259 
+
260 bool compareLessOrEqual(int a, int b);
+
261 
+
262 bool compareLessOrEqual(unsigned int a, unsigned int b);
+
263 
+
264 bool compareLessOrEqual(long a, long b);
+
265 
+
266 bool compareLessOrEqual(unsigned long a, unsigned long b);
+
267 
+
268 bool compareLessOrEqual(long long a, long long b);
+
269 
+
270 bool compareLessOrEqual(unsigned long long a, unsigned long long b);
+
271 
+
272 bool compareLessOrEqual(double a, double b);
+
273 
+
274 bool compareLessOrEqual(const char* a, const char* b);
+
275 
+
276 bool compareLessOrEqual(const char* a, const String& b);
+
277 
+
278 bool compareLessOrEqual(const char* a, const __FlashStringHelper* b);
+
279 
+
280 bool compareLessOrEqual(const __FlashStringHelper* a, const char* b);
+
281 
+
282 bool compareLessOrEqual(
+
283  const __FlashStringHelper* a, const __FlashStringHelper* b);
+
284 
+
285 bool compareLessOrEqual(const __FlashStringHelper* a, const String& b);
+
286 
+
287 bool compareLessOrEqual(const String& a, const char* b);
+
288 
+
289 bool compareLessOrEqual(const String& a, const String& b);
+
290 
+
291 bool compareLessOrEqual(const String& a, const __FlashStringHelper* b);
+
292 
+
293 // compareMoreOrEqual
+
294 
+
295 bool compareMoreOrEqual(bool a, bool b);
+
296 
+
297 bool compareMoreOrEqual(char a, char b);
+
298 
+
299 bool compareMoreOrEqual(int a, int b);
+
300 
+
301 bool compareMoreOrEqual(unsigned int a, unsigned int b);
+
302 
+
303 bool compareMoreOrEqual(long a, long b);
+
304 
+
305 bool compareMoreOrEqual(unsigned long a, unsigned long b);
+
306 
+
307 bool compareMoreOrEqual(long long a, long long b);
+
308 
+
309 bool compareMoreOrEqual(unsigned long long a, unsigned long long b);
+
310 
+
311 bool compareMoreOrEqual(double a, double b);
+
312 
+
313 bool compareMoreOrEqual(const char* a, const char* b);
+
314 
+
315 bool compareMoreOrEqual(const char* a, const String& b);
+
316 
+
317 bool compareMoreOrEqual(const char* a, const __FlashStringHelper* b);
+
318 
+
319 bool compareMoreOrEqual(const __FlashStringHelper* a, const char* b);
+
320 
+
321 bool compareMoreOrEqual(
+
322  const __FlashStringHelper* a, const __FlashStringHelper* b);
+
323 
+
324 bool compareMoreOrEqual(const __FlashStringHelper* a, const String& b);
+
325 
+
326 bool compareMoreOrEqual(const String& a, const char* b);
+
327 
+
328 bool compareMoreOrEqual(const String& a, const String& b);
+
329 
+
330 bool compareMoreOrEqual(const String& a, const __FlashStringHelper* b);
+
331 
+
332 // compareNotEqual
+
333 
+
334 bool compareNotEqual(bool a, bool b);
+
335 
+
336 bool compareNotEqual(char a, char b);
+
337 
+
338 bool compareNotEqual(int a, int b);
+
339 
+
340 bool compareNotEqual(unsigned int a, unsigned int b);
+
341 
+
342 bool compareNotEqual(long a, long b);
+
343 
+
344 bool compareNotEqual(unsigned long a, unsigned long b);
+
345 
+
346 bool compareNotEqual(long long a, long long b);
+
347 
+
348 bool compareNotEqual(unsigned long long a, unsigned long long b);
+
349 
+
350 bool compareNotEqual(double a, double b);
+
351 
+
352 bool compareNotEqual(const char* a, const char* b);
+
353 
+
354 bool compareNotEqual(const char* a, const String& b);
+
355 
+
356 bool compareNotEqual(const char* a, const __FlashStringHelper* b);
+
357 
+
358 bool compareNotEqual(const __FlashStringHelper* a, const char* b);
+
359 
+
360 bool compareNotEqual(
+
361  const __FlashStringHelper* a, const __FlashStringHelper* b);
+
362 
+
363 bool compareNotEqual(const __FlashStringHelper* a, const String& b);
+
364 
+
365 bool compareNotEqual(const String& a, const char* b);
+
366 
+
367 bool compareNotEqual(const String& a, const String& b);
+
368 
+
369 bool compareNotEqual(const String& a, const __FlashStringHelper* b);
+
370 
+
371 // compareStringCaseEqual
+
372 
+
373 bool compareStringCaseEqual(const char* a, const char* b);
+
374 
+
375 bool compareStringCaseEqual(const char* a, const String& b);
+
376 
+
377 bool compareStringCaseEqual(const char* a, const __FlashStringHelper* b);
+
378 
+
379 bool compareStringCaseEqual(const __FlashStringHelper* a, const char* b);
+
380 
+
381 bool compareStringCaseEqual( const __FlashStringHelper* a,
+
382  const __FlashStringHelper* b);
+
383 
+
384 bool compareStringCaseEqual(const __FlashStringHelper* a, const String& b);
+
385 
+
386 bool compareStringCaseEqual(const String& a, const char* b);
+
387 
+
388 bool compareStringCaseEqual(const String& a, const String& b);
+
389 
+
390 bool compareStringCaseEqual(const String& a, const __FlashStringHelper* b);
+
391 
+
392 // compareStringCaseNotEqual
+
393 
+
394 bool compareStringCaseNotEqual(const char* a, const char* b);
+
395 
+
396 bool compareStringCaseNotEqual(const char* a, const String& b);
+
397 
+
398 bool compareStringCaseNotEqual(const char* a, const __FlashStringHelper* b);
+
399 
+
400 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const char* b);
+
401 
+
402 bool compareStringCaseNotEqual( const __FlashStringHelper* a,
+
403  const __FlashStringHelper* b);
+
404 
+
405 bool compareStringCaseNotEqual(const __FlashStringHelper* a, const String& b);
+
406 
+
407 bool compareStringCaseNotEqual(const String& a, const char* b);
+
408 
+
409 bool compareStringCaseNotEqual(const String& a, const String& b);
+
410 
+
411 bool compareStringCaseNotEqual(const String& a, const __FlashStringHelper* b);
+
412 
+
413 // compareNear
+
414 
+
415 bool compareNear(int a, int b, int error);
+
416 
+
417 bool compareNear(unsigned int a, unsigned int b, unsigned int error);
+
418 
+
419 bool compareNear(long a, long b, long error);
+
420 
+
421 bool compareNear(unsigned long a, unsigned long b, unsigned long error);
+
422 
+
423 bool compareNear(double a, double b, double error);
+
424 
+
425 // compareNotNear
+
426 
+
427 bool compareNotNear(int a, int b, int error);
+
428 
+
429 bool compareNotNear(unsigned int a, unsigned int b, unsigned int error);
+
430 
+
431 bool compareNotNear(long a, long b, long error);
+
432 
+
433 bool compareNotNear(unsigned long a, unsigned long b, unsigned long error);
+
434 
+
435 bool compareNotNear(double a, double b, double error);
+
436 
+
437 }
+
438 }
+
439 
+
440 #endif
diff --git a/docs/html/FCString_8cpp_source.html b/docs/html/FCString_8cpp_source.html index aea06d1..81cac1d 100644 --- a/docs/html/FCString_8cpp_source.html +++ b/docs/html/FCString_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/FCString.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/FCString.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
FCString.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include <Print.h>
26 #include "Compare.h"
27 #include "FCString.h"
28 
29 namespace aunit {
30 namespace internal {
31 
32 void FCString::print(Print* printer) const {
33  if (mString.cstring == nullptr) return;
34 
35  if (mStringType == kCStringType) {
36  printer->print(getCString());
37  } else {
38  printer->print(getFString());
39  }
40 }
41 
42 void FCString::println(Print* printer) const {
43  if (mString.cstring == nullptr) {
44  printer->println();
45  return;
46  }
47 
48  if (mStringType == kCStringType) {
49  printer->println(getCString());
50  } else {
51  printer->println(getFString());
52  }
53 }
54 
55 int FCString::compareTo(const FCString& that) const {
56  if (getType() == FCString::kCStringType) {
57  if (that.getType() == FCString::kCStringType) {
58  return compareString(getCString(), that.getCString());
59  } else {
60  return compareString(getCString(), that.getFString());
61  }
62  } else {
63  if (that.getType() == FCString::kCStringType) {
64  return compareString(getFString(), that.getCString());
65  } else {
66  return compareString(getFString(), that.getFString());
67  }
68  }
69 }
70 
71 int FCString::compareToN(const char* that, size_t n) const {
72  if (getType() == FCString::kCStringType) {
73  return compareStringN(getCString(), that, n);
74  } else {
75  return compareStringN(getFString(), that, n);
76  }
77 }
78 
79 int FCString::compareToN(const __FlashStringHelper* that, size_t n) const {
80  if (getType() == FCString::kCStringType) {
81  return compareStringN(getCString(), that, n);
82  } else {
83  return compareStringN(getFString(), that, n);
84  }
85 }
86 
87 }
88 }
void println(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:42
-
int compareToN(const char *that, size_t n) const
Compare to C-string using the first n characters.
Definition: FCString.cpp:71
-
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
Definition: FCString.h:55
-
const __FlashStringHelper * getFString() const
Get the flash string pointer.
Definition: FCString.h:82
-
const char * getCString() const
Get the c-string pointer.
Definition: FCString.h:79
-
int compareTo(const FCString &that) const
Compare to another FCString.
Definition: FCString.cpp:55
-
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
- -
uint8_t getType() const
Get the internal type of string.
Definition: FCString.h:76
-
void print(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:32
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include <Print.h>
+
26 #include "Compare.h"
+
27 #include "FCString.h"
+
28 
+
29 namespace aunit {
+
30 namespace internal {
+
31 
+
32 void FCString::print(Print* printer) const {
+
33  if (mString.cstring == nullptr) return;
+
34 
+
35  if (mStringType == kCStringType) {
+
36  printer->print(getCString());
+
37  } else {
+
38  printer->print(getFString());
+
39  }
+
40 }
+
41 
+
42 void FCString::println(Print* printer) const {
+
43  if (mString.cstring == nullptr) {
+
44  printer->println();
+
45  return;
+
46  }
+
47 
+
48  if (mStringType == kCStringType) {
+
49  printer->println(getCString());
+
50  } else {
+
51  printer->println(getFString());
+
52  }
+
53 }
+
54 
+
55 int FCString::compareTo(const FCString& that) const {
+
56  if (getType() == FCString::kCStringType) {
+
57  if (that.getType() == FCString::kCStringType) {
+
58  return compareString(getCString(), that.getCString());
+
59  } else {
+
60  return compareString(getCString(), that.getFString());
+
61  }
+
62  } else {
+
63  if (that.getType() == FCString::kCStringType) {
+
64  return compareString(getFString(), that.getCString());
+
65  } else {
+
66  return compareString(getFString(), that.getFString());
+
67  }
+
68  }
+
69 }
+
70 
+
71 int FCString::compareToN(const char* that, size_t n) const {
+
72  if (getType() == FCString::kCStringType) {
+
73  return compareStringN(getCString(), that, n);
+
74  } else {
+
75  return compareStringN(getFString(), that, n);
+
76  }
+
77 }
+
78 
+
79 int FCString::compareToN(const __FlashStringHelper* that, size_t n) const {
+
80  if (getType() == FCString::kCStringType) {
+
81  return compareStringN(getCString(), that, n);
+
82  } else {
+
83  return compareStringN(getFString(), that, n);
+
84  }
+
85 }
+
86 
+
87 }
+
88 }
+ +
void println(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:42
+
int compareToN(const char *that, size_t n) const
Compare to C-string using the first n characters.
Definition: FCString.cpp:71
+
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
Definition: FCString.h:55
+
const __FlashStringHelper * getFString() const
Get the flash string pointer.
Definition: FCString.h:82
+
const char * getCString() const
Get the c-string pointer.
Definition: FCString.h:79
+
int compareTo(const FCString &that) const
Compare to another FCString.
Definition: FCString.cpp:55
+
uint8_t getType() const
Get the internal type of string.
Definition: FCString.h:76
+
void print(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:32
diff --git a/docs/html/FCString_8h_source.html b/docs/html/FCString_8h_source.html index 96b9f16..1b64615 100644 --- a/docs/html/FCString_8h_source.html +++ b/docs/html/FCString_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/FCString.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/FCString.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
FCString.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_FSTRING_H
26 #define AUNIT_FSTRING_H
27 
28 #include <stddef.h> // size_t
29 
30 class Print;
31 class __FlashStringHelper;
32 
33 namespace aunit {
34 namespace internal {
35 
55 class FCString {
56  public:
57  static const uint8_t kCStringType = 0;
58  static const uint8_t kFStringType = 1;
59 
61  FCString() {}
62 
64  explicit FCString(const char* s):
65  mStringType(kCStringType) {
66  mString.cstring = s;
67  }
68 
70  explicit FCString(const __FlashStringHelper* s):
71  mStringType(kFStringType) {
72  mString.fstring = s;
73  }
74 
76  uint8_t getType() const { return mStringType; }
77 
79  const char* getCString() const { return mString.cstring; }
80 
82  const __FlashStringHelper* getFString() const { return mString.fstring; }
83 
85  void print(Print* printer) const;
86 
88  void println(Print* printer) const;
89 
91  int compareTo(const FCString& that) const;
92 
98  int compareToN(const char* that, size_t n) const;
99 
105  int compareToN(const __FlashStringHelper* that, size_t n) const;
106 
107  private:
108  // NOTE: It might be possible just use a (void *) instead of a union.
109  union {
110  const char* cstring;
111  const __FlashStringHelper* fstring;
112  } mString = { nullptr };
113 
114  uint8_t mStringType = kCStringType;
115 };
116 
117 }
118 }
119 
120 #endif
void println(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:42
-
FCString(const char *s)
Construct with a c-string.
Definition: FCString.h:64
-
int compareToN(const char *that, size_t n) const
Compare to C-string using the first n characters.
Definition: FCString.cpp:71
-
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
Definition: FCString.h:55
-
const __FlashStringHelper * getFString() const
Get the flash string pointer.
Definition: FCString.h:82
-
const char * getCString() const
Get the c-string pointer.
Definition: FCString.h:79
-
int compareTo(const FCString &that) const
Compare to another FCString.
Definition: FCString.cpp:55
-
FCString(const __FlashStringHelper *s)
Construct with a flash string.
Definition: FCString.h:70
-
FCString()
Default constructor initializes to a nullptr of kCStringType.
Definition: FCString.h:61
- -
uint8_t getType() const
Get the internal type of string.
Definition: FCString.h:76
-
void print(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:32
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_FSTRING_H
+
26 #define AUNIT_FSTRING_H
+
27 
+
28 #include <stddef.h> // size_t
+
29 
+
30 class Print;
+
31 class __FlashStringHelper;
+
32 
+
33 namespace aunit {
+
34 namespace internal {
+
35 
+
55 class FCString {
+
56  public:
+
57  static const uint8_t kCStringType = 0;
+
58  static const uint8_t kFStringType = 1;
+
59 
+
61  FCString() {}
+
62 
+
64  explicit FCString(const char* s):
+
65  mStringType(kCStringType) {
+
66  mString.cstring = s;
+
67  }
+
68 
+
70  explicit FCString(const __FlashStringHelper* s):
+
71  mStringType(kFStringType) {
+
72  mString.fstring = s;
+
73  }
+
74 
+
76  uint8_t getType() const { return mStringType; }
+
77 
+
79  const char* getCString() const { return mString.cstring; }
+
80 
+
82  const __FlashStringHelper* getFString() const { return mString.fstring; }
+
83 
+
85  void print(Print* printer) const;
+
86 
+
88  void println(Print* printer) const;
+
89 
+
91  int compareTo(const FCString& that) const;
+
92 
+
98  int compareToN(const char* that, size_t n) const;
+
99 
+
105  int compareToN(const __FlashStringHelper* that, size_t n) const;
+
106 
+
107  private:
+
108  // NOTE: It might be possible just use a (void *) instead of a union.
+
109  union {
+
110  const char* cstring;
+
111  const __FlashStringHelper* fstring;
+
112  } mString = { nullptr };
+
113 
+
114  uint8_t mStringType = kCStringType;
+
115 };
+
116 
+
117 }
+
118 }
+
119 
+
120 #endif
+
void println(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:42
+
FCString(const char *s)
Construct with a c-string.
Definition: FCString.h:64
+
int compareToN(const char *that, size_t n) const
Compare to C-string using the first n characters.
Definition: FCString.cpp:71
+
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
Definition: FCString.h:55
+
const __FlashStringHelper * getFString() const
Get the flash string pointer.
Definition: FCString.h:82
+
const char * getCString() const
Get the c-string pointer.
Definition: FCString.h:79
+
int compareTo(const FCString &that) const
Compare to another FCString.
Definition: FCString.cpp:55
+
FCString(const __FlashStringHelper *s)
Construct with a flash string.
Definition: FCString.h:70
+
FCString()
Default constructor initializes to a nullptr of kCStringType.
Definition: FCString.h:61
+
uint8_t getType() const
Get the internal type of string.
Definition: FCString.h:76
+
void print(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:32
diff --git a/docs/html/FakePrint_8h_source.html b/docs/html/FakePrint_8h_source.html index 5740eec..428eafe 100644 --- a/docs/html/FakePrint_8h_source.html +++ b/docs/html/FakePrint_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/fake/FakePrint.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/fake/FakePrint.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
FakePrint.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_FAKE_PRINT_H
26 #define AUNIT_FAKE_PRINT_H
27 
28 #include <stddef.h> // size_t
29 #include <Print.h>
30 
31 namespace aunit {
32 namespace fake {
33 
50 class FakePrint: public Print {
51  public:
58  static const uint8_t kBufSize = 8 * sizeof(long long) + 2 + 1;
59 
60  size_t write(uint8_t c) override {
61  if (mIndex < kBufSize - 1) {
62  mBuf[mIndex] = c;
63  mIndex++;
64  return 1;
65  } else {
66  return 0;
67  }
68  }
69 
70  size_t write(const uint8_t *buffer, size_t size) override {
71  if (buffer == nullptr) return 0;
72 
73  while (size > 0 && mIndex < kBufSize - 1) {
74  write(*buffer++);
75  size--;
76  }
77  return size;
78  }
79 
80 // ESP32 version of Print class does not define a virtual flush() method.
81 #ifdef ESP32
82  void flush() {
83  mIndex = 0;
84  }
85 #else
86  void flush() override {
87  mIndex = 0;
88  }
89 #endif
90 
96  const char* getBuffer() const {
97  mBuf[mIndex] = '\0';
98  return mBuf;
99  }
100 
101  private:
102  mutable char mBuf[kBufSize];
103  uint8_t mIndex = 0;
104 };
105 
106 }
107 }
108 
109 #endif
const char * getBuffer() const
Return the NUL terminated string buffer.
Definition: FakePrint.h:96
-
static const uint8_t kBufSize
Size of the internal buffer.
Definition: FakePrint.h:58
-
An implementation of Print that writes to an in-memory buffer.
Definition: FakePrint.h:50
- +
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_FAKE_PRINT_H
+
26 #define AUNIT_FAKE_PRINT_H
+
27 
+
28 #include <stddef.h> // size_t
+
29 #include <Print.h>
+
30 
+
31 namespace aunit {
+
32 namespace fake {
+
33 
+
50 class FakePrint: public Print {
+
51  public:
+
58  static const uint8_t kBufSize = 8 * sizeof(long long) + 2 + 1;
+
59 
+
60  size_t write(uint8_t c) override {
+
61  if (mIndex < kBufSize - 1) {
+
62  mBuf[mIndex] = c;
+
63  mIndex++;
+
64  return 1;
+
65  } else {
+
66  return 0;
+
67  }
+
68  }
+
69 
+
70  size_t write(const uint8_t *buffer, size_t size) override {
+
71  if (buffer == nullptr) return 0;
+
72 
+
73  while (size > 0 && mIndex < kBufSize - 1) {
+
74  write(*buffer++);
+
75  size--;
+
76  }
+
77  return size;
+
78  }
+
79 
+
80 // ESP32 version of Print class does not define a virtual flush() method.
+
81 #ifdef ESP32
+
82  void flush() {
+
83  mIndex = 0;
+
84  }
+
85 #else
+
86  void flush() override {
+
87  mIndex = 0;
+
88  }
+
89 #endif
+
90 
+
96  const char* getBuffer() const {
+
97  mBuf[mIndex] = '\0';
+
98  return mBuf;
+
99  }
+
100 
+
101  private:
+
102  mutable char mBuf[kBufSize];
+
103  uint8_t mIndex = 0;
+
104 };
+
105 
+
106 }
+
107 }
+
108 
+
109 #endif
+
static const uint8_t kBufSize
Size of the internal buffer.
Definition: FakePrint.h:58
+
const char * getBuffer() const
Return the NUL terminated string buffer.
Definition: FakePrint.h:96
+
An implementation of Print that writes to an in-memory buffer.
Definition: FakePrint.h:50
diff --git a/docs/html/Flash_8h.html b/docs/html/Flash_8h.html index 95b35c1..b8d45fc 100644 --- a/docs/html/Flash_8h.html +++ b/docs/html/Flash_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Flash.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/Flash.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Flash.h File Reference
- -

Various macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them. -More...

This graph shows which files directly or indirectly include this file:
-
- - - - - - - - - - - - - - - - +
+ + + + + + + + + + + + + + + + +
@@ -101,14 +102,14 @@

Macros

#define AUNIT_FPSTR(pstr_pointer)   (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer)) - The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32. More...
+ The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32. More...
 

Detailed Description

-

Various macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them.

+

Various macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them.

On AVR, flash strings are fully supported through the F() and PSTR() macros, and the (const __FlashStringHelper*) pointer. However, the useful FPSTR() macro is not defined.

On Teensy-ARM, flash strings are not supported, but F(), PSTR() and (const __FlashStringHelper*) are defined. The useful FPSTR() macro is not defined.

-

On the ESP8266 platform, flash strings are implemented, and the F(), PSTR() and __FlashStringHelper are defined, but the implementation is brittle and can fail with obscure errors messages. For a single compilation unit, a flash string cannot be defined in both an inline and non-inline contexts (see https://github.com/esp8266/Arduino/issues/3369). In some cases (e.g. TestMacros.h), we were able to move the F() macro into a non-inline context. But in other cases (e.g. AssertVerboseMacros.h), the end-user can choose to use an assertXxx() macro inside an inline function, which breaks the compiler. Therefore, I chose to use normal (const char*) strings instead of flash strings in those assertXxx() macros. In addition, the ESP8266 platform defines a useful FPSTR() macro which converts a (const char*) returned by PSTR() into a (const __FlashStringHelper*) pointer.

+

On the ESP8266 platform, flash strings are implemented, and the F(), PSTR() and __FlashStringHelper are defined, but the implementation is brittle and can fail with obscure errors messages. For a single compilation unit, a flash string cannot be defined in both an inline and non-inline contexts (see https://github.com/esp8266/Arduino/issues/3369). In some cases (e.g. TestMacros.h), we were able to move the F() macro into a non-inline context. But in other cases (e.g. AssertVerboseMacros.h), the end-user can choose to use an assertXxx() macro inside an inline function, which breaks the compiler. Therefore, I chose to use normal (const char*) strings instead of flash strings in those assertXxx() macros. In addition, the ESP8266 platform defines a useful FPSTR() macro which converts a (const char*) returned by PSTR() into a (const __FlashStringHelper*) pointer.

On the ESP32, flash strings are not implemented, but the various F(), PSTR() and __FlashStringHelper symbols are defined for compatibility, similar to Teensy-ARM. However, the implementation of FPSTR() is incorrect, see https://github.com/espressif/arduino-esp32/issues/1371. That macro should return a (const __FlashStringHelper*) pointer, but is defined to return a (const char*) pointer.

To make AUnit work under all of the above platforms, I chose to support flash strings only on the AVR. I create custom versions of the F() and FPSTR() macros below to accomplish this.

@@ -142,7 +143,7 @@

diff --git a/docs/html/Flash_8h__dep__incl.map b/docs/html/Flash_8h__dep__incl.map index 00c5213..9023783 100644 --- a/docs/html/Flash_8h__dep__incl.map +++ b/docs/html/Flash_8h__dep__incl.map @@ -1,17 +1,18 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/docs/html/Flash_8h__dep__incl.md5 b/docs/html/Flash_8h__dep__incl.md5 index 4335448..550a9d1 100644 --- a/docs/html/Flash_8h__dep__incl.md5 +++ b/docs/html/Flash_8h__dep__incl.md5 @@ -1 +1 @@ -d0bfb43f21b625e1b7a6024fd37cd2d8 \ No newline at end of file +9bd510e2a5f82cd5b46274ea9f9d5917 \ No newline at end of file diff --git a/docs/html/Flash_8h__dep__incl.png b/docs/html/Flash_8h__dep__incl.png index f97daa9..9033cca 100644 Binary files a/docs/html/Flash_8h__dep__incl.png and b/docs/html/Flash_8h__dep__incl.png differ diff --git a/docs/html/Flash_8h_source.html b/docs/html/Flash_8h_source.html index 05151f8..027f57e 100644 --- a/docs/html/Flash_8h_source.html +++ b/docs/html/Flash_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Flash.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/Flash.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@

- + +/* @license-end */
Flash.h
-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
64 #ifndef AUNIT_FLASH_H
65 #define AUNIT_FLASH_H
66 
67 class __FlashStringHelper;
68 
75 #define AUNIT_FPSTR(pstr_pointer) \
76  (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
77 
78 #if defined(__AVR__) || defined(__arm__)
79  #include <avr/pgmspace.h>
80 #elif defined(ESP8266) || defined(ESP32)
81  #include <pgmspace.h>
82 #elif defined(__linux__) or defined(__APPLE__)
83  #include <pgmspace.h>
84 #else
85  #error Unsupported platform
86 #endif
87 
88 #if defined(__AVR__)
89  #define AUNIT_F(x) F(x)
90 #elif defined(ESP8266) || defined(ESP32) || defined(__arm__)
91  #define AUNIT_F(x) AUNIT_FPSTR(x)
92 #elif defined(__linux__) or defined(__APPLE__)
93  #define AUNIT_F(x) F(x)
94 #else
95  #error Unsupported platform
96 #endif
97 
98 // Define SERIAL_PORT_MONITOR consistently. We should also rename this file to
99 // something like "compat.h".
100 #if defined(ARDUINO_SAMD_ZERO)
101  // If have a real Arduino Zero and using the "Arduino/Genuino Zero (Native
102  // USB Port)" configuration on the Arduino IDE, you may need to uncomment
103  // the following to clobber SERIAL_PORT_MONITOR to point to the correct
104  // SerialUSB.
105  //
106  // On the other hand, if you are using a SparkFun breakout board, or one of
107  // the "SAMD21 M0 Mini" clones, you should be using the SparkFun SAMD Boards,
108  // and selecting the "SparkFun SAMD21 Dev Breakout" or the "SparkFun SAMD21
109  // Mini Breakout" settings, which will set the SERIAL_PORT_MONITOR macro
110  // correctly to SerialUSB.
111  #if 0
112  #undef SERIAL_PORT_MONITOR
113  #define SERIAL_PORT_MONITOR SerialUSB
114  #endif
115 #elif defined(ESP32)
116  #if ! defined(SERIAL_PORT_MONITOR)
117  #define SERIAL_PORT_MONITOR Serial
118  #endif
119 #elif defined(__linux__) or defined(__APPLE__)
120  #define SERIAL_PORT_MONITOR Serial
121 #endif
122 
123 #endif
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
64 #ifndef AUNIT_FLASH_H
+
65 #define AUNIT_FLASH_H
+
66 
+
67 class __FlashStringHelper;
+
68 
+
75 #define AUNIT_FPSTR(pstr_pointer) \
+
76  (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
+
77 
+
78 #if defined(__AVR__) || defined(__arm__)
+
79  #include <avr/pgmspace.h>
+
80 #elif defined(ESP8266) || defined(ESP32)
+
81  #include <pgmspace.h>
+
82 #elif defined(__linux__) or defined(__APPLE__)
+
83  #include <pgmspace.h>
+
84 #else
+
85  #error Unsupported platform
+
86 #endif
+
87 
+
88 #if defined(__AVR__)
+
89  #define AUNIT_F(x) F(x)
+
90 #elif defined(ESP8266) || defined(ESP32) || defined(__arm__)
+
91  #define AUNIT_F(x) AUNIT_FPSTR(x)
+
92 #elif defined(__linux__) or defined(__APPLE__)
+
93  #define AUNIT_F(x) F(x)
+
94 #else
+
95  #error Unsupported platform
+
96 #endif
+
97 
+
98 // Define SERIAL_PORT_MONITOR consistently. We should also rename this file to
+
99 // something like "compat.h".
+
100 #if defined(ARDUINO_SAMD_ZERO)
+
101  // If have a real Arduino Zero and using the "Arduino/Genuino Zero (Native
+
102  // USB Port)" configuration on the Arduino IDE, you may need to uncomment
+
103  // the following to clobber SERIAL_PORT_MONITOR to point to the correct
+
104  // SerialUSB.
+
105  //
+
106  // On the other hand, if you are using a SparkFun breakout board, or one of
+
107  // the "SAMD21 M0 Mini" clones, you should be using the SparkFun SAMD Boards,
+
108  // and selecting the "SparkFun SAMD21 Dev Breakout" or the "SparkFun SAMD21
+
109  // Mini Breakout" settings, which will set the SERIAL_PORT_MONITOR macro
+
110  // correctly to SerialUSB.
+
111  #if 0
+
112  #undef SERIAL_PORT_MONITOR
+
113  #define SERIAL_PORT_MONITOR SerialUSB
+
114  #endif
+
115 #elif defined(ESP32)
+
116  #if ! defined(SERIAL_PORT_MONITOR)
+
117  #define SERIAL_PORT_MONITOR Serial
+
118  #endif
+
119 #elif defined(__linux__) or defined(__APPLE__)
+
120  #define SERIAL_PORT_MONITOR Serial
+
121 #endif
+
122 
+
123 #endif
+
diff --git a/docs/html/MetaAssertMacros_8h.html b/docs/html/MetaAssertMacros_8h.html index 5ec76ff..39b169a 100644 --- a/docs/html/MetaAssertMacros_8h.html +++ b/docs/html/MetaAssertMacros_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/MetaAssertMacros.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/MetaAssertMacros.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
MetaAssertMacros.h File Reference
- -

Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in this header. -More...

#include "Flash.h"
Include dependency graph for MetaAssertMacros.h:
-
- - +
+ + +
This graph shows which files directly or indirectly include this file:
-
- - - +
+ + + +
@@ -97,7 +99,7 @@

Macros

#define checkTestDone(...) - Return true if test 'name' is done. More...
+ Return true if test 'name' is done. More...
  #define get_checkTestDone(_1, _2, NAME, ...)   NAME @@ -109,7 +111,7 @@ #define checkTestDone2(testSuite, name)   (testSuite##_##name##_instance.isDone())   #define checkTestNotDone(...) - Return true if test 'name' is not done. More...
+ Return true if test 'name' is not done. More...
  #define get_checkTestNotDone(_1, _2, NAME, ...)   NAME @@ -121,7 +123,7 @@ #define checkTestNotDone2(testSuite, name)   (testSuite##_##name##_instance.isNotDone())   #define checkTestPass(...) - Return true if test 'name' has passed. More...
+ Return true if test 'name' has passed. More...
  #define get_checkTestPass(_1, _2, NAME, ...)   NAME @@ -133,7 +135,7 @@ #define checkTestPass2(testSuite, name)   (testSuite##_##name##_instance.isPassed())   #define checkTestNotPass(...) - Return true if test 'name' has not passed. More...
+ Return true if test 'name' has not passed. More...
  #define get_checkTestNotPass(_1, _2, NAME, ...)   NAME @@ -145,7 +147,7 @@ #define checkTestNotPass2(testSuite, name)   (testSuite##_##name##_instance.isNotPassed())   #define checkTestFail(...) - Return true if test 'name' has failed. More...
+ Return true if test 'name' has failed. More...
  #define get_checkTestFail(_1, _2, NAME, ...)   NAME @@ -157,7 +159,7 @@ #define checkTestFail2(testSuite, name)   (testSuite##_##name##_instance.isFailed())   #define checkTestNotFail(...) - Return true if test 'name' has not failed. More...
+ Return true if test 'name' has not failed. More...
  #define get_checkTestNotFail(_1, _2, NAME, ...)   NAME @@ -169,7 +171,7 @@ #define checkTestNotFail2(testSuite, name)   (testSuite##_##name##_instance.isNotFailed())   #define checkTestSkip(...) - Return true if test 'name' has been skipped. More...
+ Return true if test 'name' has been skipped. More...
  #define get_checkTestSkip(_1, _2, NAME, ...)   NAME @@ -181,7 +183,7 @@ #define checkTestSkip2(testSuite, name)   (testSuite##_##name##_instance.isSkipped())   #define checkTestNotSkip(...) - Return true if test 'name' has not been skipped. More...
+ Return true if test 'name' has not been skipped. More...
  #define get_checkTestNotSkip(_1, _2, NAME, ...)   NAME @@ -193,7 +195,7 @@ #define checkTestNotSkip2(testSuite, name)   (testSuite##_##name##_instance.isNotSkipped())   #define checkTestExpire(...) - Return true if test 'name' has timed out. More...
+ Return true if test 'name' has timed out. More...
  #define get_checkTestExpire(_1, _2, NAME, ...)   NAME @@ -205,7 +207,7 @@ #define checkTestExpire2(testSuite, name)   (testSuite##_##name##_instance.isExpired())   #define checkTestNotExpire(...) - Return true if test 'name' has not timed out. More...
+ Return true if test 'name' has not timed out. More...
  #define get_checkTestNotExpire(_1, _2, NAME, ...)   NAME @@ -217,7 +219,7 @@ #define checkTestNotExpire2(testSuite, name)   (testSuite##_##name##_instance.isNotExpired())   #define assertTestDone(...) - Assert that test 'name' is done. More...
+ Assert that test 'name' is done. More...
  #define get_assertTestDone(_1, _2, NAME, ...)   NAME @@ -229,7 +231,7 @@ #define assertTestDone2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isDone, kMessageDone)   #define assertTestNotDone(...) - Assert that test 'name' is not done. More...
+ Assert that test 'name' is not done. More...
  #define get_assertTestNotDone(_1, _2, NAME, ...)   NAME @@ -241,7 +243,7 @@ #define assertTestNotDone2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isNotDone, kMessageNotDone)   #define assertTestPass(...) - Assert that test 'name' has passed. More...
+ Assert that test 'name' has passed. More...
  #define get_assertTestPass(_1, _2, NAME, ...)   NAME @@ -253,7 +255,7 @@ #define assertTestPass2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isPassed, kMessagePassed)   #define assertTestNotPass(...) - Assert that test 'name' has not passed. More...
+ Assert that test 'name' has not passed. More...
  #define get_assertTestNotPass(_1, _2, NAME, ...)   NAME @@ -265,7 +267,7 @@ #define assertTestNotPass2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isNotPassed, kMessageNotPassed)   #define assertTestFail(...) - Assert that test 'name' has failed. More...
+ Assert that test 'name' has failed. More...
  #define get_assertTestFail(_1, _2, NAME, ...)   NAME @@ -277,7 +279,7 @@ #define assertTestFail2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isFailed, kMessageFailed)   #define assertTestNotFail(...) - Assert that test 'name' has not failed. More...
+ Assert that test 'name' has not failed. More...
  #define get_assertTestNotFail(_1, _2, NAME, ...)   NAME @@ -289,7 +291,7 @@ #define assertTestNotFail2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isNotFailed, kMessageNotFailed)   #define assertTestSkip(...) - Assert that test 'name' has been skipped. More...
+ Assert that test 'name' has been skipped. More...
  #define get_assertTestSkip(_1, _2, NAME, ...)   NAME @@ -301,7 +303,7 @@ #define assertTestSkip2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isSkipped, kMessageSkipped)   #define assertTestNotSkip(...) - Assert that test 'name' has not been skipped. More...
+ Assert that test 'name' has not been skipped. More...
  #define get_assertTestNotSkip(_1, _2, NAME, ...)   NAME @@ -313,7 +315,7 @@ #define assertTestNotSkip2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isNotSkipped, kMessageNotSkipped)   #define assertTestExpire(...) - Assert that test 'name' has timed out. More...
+ Assert that test 'name' has timed out. More...
  #define get_assertTestExpire(_1, _2, NAME, ...)   NAME @@ -325,7 +327,7 @@ #define assertTestExpire2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isExpired, kMessageExpired)   #define assertTestNotExpire(...) - Assert that test 'name' has not timed out. More...
+ Assert that test 'name' has not timed out. More...
  #define get_assertTestNotExpire(_1, _2, NAME, ...)   NAME @@ -337,84 +339,102 @@ #define assertTestNotExpire2(testSuite, name)   assertTestStatusInternal2(testSuite, name, isNotExpired, kMessageNotExpired)   #define assertTestStatusInternal1(name, method, message) - Internal helper macro, shouldn't be called directly by users. More...
+ Internal helper macro, shouldn't be called directly by users. More...
  #define assertTestStatusInternal2(testSuite, name, method, message)   -#define checkTestDoneF(testClass, name)   (testClass##_##name##_instance.isDone()) - Return true if test 'name' is done. More...
+ +#define checkTestDoneF(testClass, name)   (testClass##_##name##_instance.isDone()) + Return true if test 'name' is done.
  -#define checkTestNotDoneF(testClass, name)   (testClass##_##name##_instance.isNotDone()) - Return true if test 'name' is not done. More...
+ +#define checkTestNotDoneF(testClass, name)   (testClass##_##name##_instance.isNotDone()) + Return true if test 'name' is not done.
  -#define checkTestPassF(testClass, name)   (testClass##_##name##_instance.isPassed()) - Return true if test 'name' has passed. More...
+ +#define checkTestPassF(testClass, name)   (testClass##_##name##_instance.isPassed()) + Return true if test 'name' has passed.
  -#define checkTestNotPassF(testClass, name)   (testClass##_##name##_instance.isNotPassed()) - Return true if test 'name' has not passed. More...
+ +#define checkTestNotPassF(testClass, name)   (testClass##_##name##_instance.isNotPassed()) + Return true if test 'name' has not passed.
  -#define checkTestFailF(testClass, name)   (testClass##_##name##_instance.isFailed()) - Return true if test 'name' has failed. More...
+ +#define checkTestFailF(testClass, name)   (testClass##_##name##_instance.isFailed()) + Return true if test 'name' has failed.
  -#define checkTestNotFailF(testClass, name)   (testClass##_##name##_instance.isNotFailed()) - Return true if test 'name' has not failed. More...
+ +#define checkTestNotFailF(testClass, name)   (testClass##_##name##_instance.isNotFailed()) + Return true if test 'name' has not failed.
  -#define checkTestSkipF(testClass, name)   (testClass##_##name##_instance.isSkipped()) - Return true if test 'name' has been skipped. More...
+ +#define checkTestSkipF(testClass, name)   (testClass##_##name##_instance.isSkipped()) + Return true if test 'name' has been skipped.
  -#define checkTestNotSkipF(testClass, name)   (testClass##_##name##_instance.isNotSkipped()) - Return true if test 'name' has not been skipped. More...
+ +#define checkTestNotSkipF(testClass, name)   (testClass##_##name##_instance.isNotSkipped()) + Return true if test 'name' has not been skipped.
  -#define checkTestExpireF(testClass, name)   (testClass##_##name##_instance.isExpired()) - Return true if test 'name' has timed out. More...
+ +#define checkTestExpireF(testClass, name)   (testClass##_##name##_instance.isExpired()) + Return true if test 'name' has timed out.
  -#define checkTestNotExpireF(testClass, name)   (testClass##_##name##_instance.isNotExpired()) - Return true if test 'name' has not timed out. More...
+ +#define checkTestNotExpireF(testClass, name)   (testClass##_##name##_instance.isNotExpired()) + Return true if test 'name' has not timed out.
  -#define assertTestDoneF(testClass, name)   assertTestStatusInternalF(testClass, name, isDone, kMessageDone) - Assert that test 'name' is done. More...
+ +#define assertTestDoneF(testClass, name)   assertTestStatusInternalF(testClass, name, isDone, kMessageDone) + Assert that test 'name' is done.
  -#define assertTestNotDoneF(testClass, name)   assertTestStatusInternalF(testClass, name, isNotDone, kMessageNotDone) - Assert that test 'name' is not done. More...
+ +#define assertTestNotDoneF(testClass, name)   assertTestStatusInternalF(testClass, name, isNotDone, kMessageNotDone) + Assert that test 'name' is not done.
  -#define assertTestPassF(testClass, name)   assertTestStatusInternalF(testClass, name, isPassed, kMessagePassed) - Assert that test 'name' has passed. More...
+ +#define assertTestPassF(testClass, name)   assertTestStatusInternalF(testClass, name, isPassed, kMessagePassed) + Assert that test 'name' has passed.
  -#define assertTestNotPassF(testClass, name)   assertTestStatusInternalF(testClass, name, isNotPassed, kMessageNotPassed) - Assert that test 'name' has not passed. More...
+ +#define assertTestNotPassF(testClass, name)   assertTestStatusInternalF(testClass, name, isNotPassed, kMessageNotPassed) + Assert that test 'name' has not passed.
  -#define assertTestFailF(testClass, name)   assertTestStatusInternalF(testClass, name, isFailed, kMessageFailed) - Assert that test 'name' has failed. More...
+ +#define assertTestFailF(testClass, name)   assertTestStatusInternalF(testClass, name, isFailed, kMessageFailed) + Assert that test 'name' has failed.
  -#define assertTestNotFailF(testClass, name)   assertTestStatusInternalF(testClass, name, isNotFailed, kMessageNotFailed) - Assert that test 'name' has not failed. More...
+ +#define assertTestNotFailF(testClass, name)   assertTestStatusInternalF(testClass, name, isNotFailed, kMessageNotFailed) + Assert that test 'name' has not failed.
  -#define assertTestSkipF(testClass, name)   assertTestStatusInternalF(testClass, name, isSkipped, kMessageSkipped) - Assert that test 'name' has been skipped. More...
+ +#define assertTestSkipF(testClass, name)   assertTestStatusInternalF(testClass, name, isSkipped, kMessageSkipped) + Assert that test 'name' has been skipped.
  #define assertTestNotSkipF(testClass, name) - Assert that test 'name' has not been skipped. More...
+ Assert that test 'name' has not been skipped. More...
  -#define assertTestExpireF(testClass, name)   assertTestStatusInternalF(testClass, name, isExpired, kMessageExpired) - Assert that test 'name' has timed out. More...
+ +#define assertTestExpireF(testClass, name)   assertTestStatusInternalF(testClass, name, isExpired, kMessageExpired) + Assert that test 'name' has timed out.
  #define assertTestNotExpireF(testClass, name) - Assert that test 'name' has not timed out. More...
+ Assert that test 'name' has not timed out. More...
  #define assertTestStatusInternalF(testClass, name, method, message) - Internal helper macro, shouldn't be called directly by users. More...
+ Internal helper macro, shouldn't be called directly by users. More...
  #define failTestNow() - Fail the current test, return immediately, and print a status message. More...
+ Fail the current test, return immediately, and print a status message. More...
  #define passTestNow() - Pass the current test, print a status message, and return immediately. More...
+ Pass the current test, print a status message, and return immediately. More...
  #define skipTestNow() - Skip the current test, print a status message, and return immediately. More...
+ Skip the current test, print a status message, and return immediately. More...
  #define expireTestNow() - Expire the current test, print a status message, and return immediately. More...
+ Expire the current test, print a status message, and return immediately. More...
 

Detailed Description

@@ -437,43 +457,13 @@

-Value:
get_assertTestDone(__VA_ARGS__, assertTestDone2, assertTestDone1)\
(__VA_ARGS__)
+Value:
get_assertTestDone(__VA_ARGS__, assertTestDone2, assertTestDone1)\
+
(__VA_ARGS__)
+

Assert that test 'name' is done.

Definition at line 127 of file MetaAssertMacros.h.

-

- - -

◆ assertTestDoneF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestDoneF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isDone, kMessageDone)
-
- -

Assert that test 'name' is done.

- -

Definition at line 288 of file MetaAssertMacros.h.

-
@@ -491,43 +481,13 @@

-Value:
get_assertTestExpire(__VA_ARGS__, assertTestExpire2, assertTestExpire1)\
(__VA_ARGS__)
+Value:
get_assertTestExpire(__VA_ARGS__, assertTestExpire2, assertTestExpire1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has timed out.

Definition at line 207 of file MetaAssertMacros.h.

- - - -

◆ assertTestExpireF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestExpireF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isExpired, kMessageExpired)
-
- -

Assert that test 'name' has timed out.

- -

Definition at line 321 of file MetaAssertMacros.h.

-
@@ -545,43 +505,13 @@

-Value:
get_assertTestFail(__VA_ARGS__, assertTestFail2, assertTestFail1)\
(__VA_ARGS__)
+Value:
get_assertTestFail(__VA_ARGS__, assertTestFail2, assertTestFail1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has failed.

Definition at line 167 of file MetaAssertMacros.h.

- - - -

◆ assertTestFailF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestFailF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isFailed, kMessageFailed)
-
- -

Assert that test 'name' has failed.

- -

Definition at line 304 of file MetaAssertMacros.h.

-
@@ -599,43 +529,13 @@

-Value:
get_assertTestNotDone(__VA_ARGS__, assertTestNotDone2, assertTestNotDone1)\
(__VA_ARGS__)
+Value:
get_assertTestNotDone(__VA_ARGS__, assertTestNotDone2, assertTestNotDone1)\
+
(__VA_ARGS__)
+

Assert that test 'name' is not done.

Definition at line 137 of file MetaAssertMacros.h.

- - - -

◆ assertTestNotDoneF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestNotDoneF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isNotDone, kMessageNotDone)
-
- -

Assert that test 'name' is not done.

- -

Definition at line 292 of file MetaAssertMacros.h.

-
@@ -653,7 +553,9 @@

-Value:
get_assertTestNotExpire(__VA_ARGS__, assertTestNotExpire2, assertTestNotExpire1)\
(__VA_ARGS__)
+Value:
get_assertTestNotExpire(__VA_ARGS__, assertTestNotExpire2, assertTestNotExpire1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has not timed out.

Definition at line 217 of file MetaAssertMacros.h.

@@ -685,7 +587,8 @@

-Value:
assertTestStatusInternalF(testClass, name, isNotExpired, \
kMessageNotExpired)
#define assertTestStatusInternalF(testClass, name, method, message)
Internal helper macro, shouldn&#39;t be called directly by users.
+Value:
assertTestStatusInternalF(testClass, name, isNotExpired, \
+
kMessageNotExpired)

Assert that test 'name' has not timed out.

@@ -708,43 +611,13 @@

-Value:
get_assertTestNotFail(__VA_ARGS__, assertTestNotFail2, assertTestNotFail1)\
(__VA_ARGS__)
+Value:
get_assertTestNotFail(__VA_ARGS__, assertTestNotFail2, assertTestNotFail1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has not failed.

Definition at line 177 of file MetaAssertMacros.h.

-

- - -

◆ assertTestNotFailF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestNotFailF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isNotFailed, kMessageNotFailed)
-
- -

Assert that test 'name' has not failed.

- -

Definition at line 308 of file MetaAssertMacros.h.

-
@@ -762,43 +635,13 @@

-Value:
get_assertTestNotPass(__VA_ARGS__, assertTestNotPass2, assertTestNotPass1)\
(__VA_ARGS__)
+Value:
get_assertTestNotPass(__VA_ARGS__, assertTestNotPass2, assertTestNotPass1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has not passed.

Definition at line 157 of file MetaAssertMacros.h.

- - - -

◆ assertTestNotPassF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestNotPassF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isNotPassed, kMessageNotPassed)
-
- -

Assert that test 'name' has not passed.

- -

Definition at line 300 of file MetaAssertMacros.h.

-
@@ -816,7 +659,9 @@

-Value:
get_assertTestNotSkip(__VA_ARGS__, assertTestNotSkip2, assertTestNotSkip1)\
(__VA_ARGS__)
+Value:
get_assertTestNotSkip(__VA_ARGS__, assertTestNotSkip2, assertTestNotSkip1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has not been skipped.

Definition at line 197 of file MetaAssertMacros.h.

@@ -848,7 +693,8 @@

-Value:
assertTestStatusInternalF(testClass, name, isNotSkipped, \
kMessageNotSkipped)
#define assertTestStatusInternalF(testClass, name, method, message)
Internal helper macro, shouldn&#39;t be called directly by users.
+Value:
assertTestStatusInternalF(testClass, name, isNotSkipped, \
+
kMessageNotSkipped)

Assert that test 'name' has not been skipped.

@@ -871,43 +717,13 @@

-Value:
get_assertTestPass(__VA_ARGS__, assertTestPass2, assertTestPass1)\
(__VA_ARGS__)
+Value:
get_assertTestPass(__VA_ARGS__, assertTestPass2, assertTestPass1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has passed.

Definition at line 147 of file MetaAssertMacros.h.

-

- - -

◆ assertTestPassF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestPassF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isPassed, kMessagePassed)
-
- -

Assert that test 'name' has passed.

- -

Definition at line 296 of file MetaAssertMacros.h.

-
@@ -925,43 +741,13 @@

-Value:
get_assertTestSkip(__VA_ARGS__, assertTestSkip2, assertTestSkip1)\
(__VA_ARGS__)
+Value:
get_assertTestSkip(__VA_ARGS__, assertTestSkip2, assertTestSkip1)\
+
(__VA_ARGS__)
+

Assert that test 'name' has been skipped.

Definition at line 187 of file MetaAssertMacros.h.

- - - -

◆ assertTestSkipF

- -
-
- - - - - - - - - - - - - - - - - - -
#define assertTestSkipF( testClass,
 name 
)   assertTestStatusInternalF(testClass, name, isSkipped, kMessageSkipped)
-
- -

Assert that test 'name' has been skipped.

- -

Definition at line 312 of file MetaAssertMacros.h.

-
@@ -995,7 +781,12 @@

-Value:
do {\
if (!assertionTestStatus(\
test_##name##_instance.method()))\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
if (!assertionTestStatus(\
+
__FILE__,__LINE__,#name,AUNIT_FPSTR(message),\
+
test_##name##_instance.method()))\
+
return;\
+
} while (false)

Internal helper macro, shouldn't be called directly by users.

@@ -1040,7 +831,12 @@

-Value:
do {\
if (!assertionTestStatus(\
testSuite##_##name##_instance.method()))\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
if (!assertionTestStatus(\
+
__FILE__,__LINE__,#testSuite "_" #name,AUNIT_FPSTR(message),\
+
testSuite##_##name##_instance.method()))\
+
return;\
+
} while (false)

Definition at line 234 of file MetaAssertMacros.h.

@@ -1083,7 +879,11 @@

-Value:
do {\
testClass##_##name##_instance.method()))\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
if (!assertionTestStatus(__FILE__, __LINE__, #name, AUNIT_FPSTR(message),\
+
testClass##_##name##_instance.method()))\
+
return;\
+
} while (false)

Internal helper macro, shouldn't be called directly by users.

@@ -1106,43 +906,13 @@

-Value:
get_checkTestDone(__VA_ARGS__, checkTestDone2, checkTestDone1)\
(__VA_ARGS__)
+Value:
get_checkTestDone(__VA_ARGS__, checkTestDone2, checkTestDone1)\
+
(__VA_ARGS__)
+

Return true if test 'name' is done.

Definition at line 44 of file MetaAssertMacros.h.

-

-

- -

◆ checkTestDoneF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestDoneF( testClass,
 name 
)   (testClass##_##name##_instance.isDone())
-
- -

Return true if test 'name' is done.

- -

Definition at line 245 of file MetaAssertMacros.h.

-
@@ -1160,43 +930,13 @@

-Value:
get_checkTestExpire(__VA_ARGS__, checkTestExpire2, checkTestExpire1)\
(__VA_ARGS__)
+Value:
get_checkTestExpire(__VA_ARGS__, checkTestExpire2, checkTestExpire1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has timed out.

Definition at line 108 of file MetaAssertMacros.h.

-

- - -

◆ checkTestExpireF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestExpireF( testClass,
 name 
)   (testClass##_##name##_instance.isExpired())
-
- -

Return true if test 'name' has timed out.

- -

Definition at line 277 of file MetaAssertMacros.h.

-
@@ -1214,43 +954,13 @@

-Value:
get_checkTestFail(__VA_ARGS__, checkTestFail2, checkTestFail1)\
(__VA_ARGS__)
+Value:
get_checkTestFail(__VA_ARGS__, checkTestFail2, checkTestFail1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has failed.

Definition at line 76 of file MetaAssertMacros.h.

- - - -

◆ checkTestFailF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestFailF( testClass,
 name 
)   (testClass##_##name##_instance.isFailed())
-
- -

Return true if test 'name' has failed.

- -

Definition at line 261 of file MetaAssertMacros.h.

-
@@ -1268,43 +978,13 @@

-Value:
get_checkTestNotDone(__VA_ARGS__, checkTestNotDone2, checkTestNotDone1)\
(__VA_ARGS__)
+Value:
get_checkTestNotDone(__VA_ARGS__, checkTestNotDone2, checkTestNotDone1)\
+
(__VA_ARGS__)
+

Return true if test 'name' is not done.

Definition at line 52 of file MetaAssertMacros.h.

- - - -

◆ checkTestNotDoneF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestNotDoneF( testClass,
 name 
)   (testClass##_##name##_instance.isNotDone())
-
- -

Return true if test 'name' is not done.

- -

Definition at line 249 of file MetaAssertMacros.h.

-
@@ -1322,43 +1002,13 @@

-Value:
get_checkTestNotExpire(__VA_ARGS__, checkTestNotExpire2, checkTestNotExpire1)\
(__VA_ARGS__)
+Value:
get_checkTestNotExpire(__VA_ARGS__, checkTestNotExpire2, checkTestNotExpire1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has not timed out.

Definition at line 116 of file MetaAssertMacros.h.

- - - -

◆ checkTestNotExpireF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestNotExpireF( testClass,
 name 
)   (testClass##_##name##_instance.isNotExpired())
-
- -

Return true if test 'name' has not timed out.

- -

Definition at line 281 of file MetaAssertMacros.h.

-
@@ -1376,43 +1026,13 @@

-Value:
get_checkTestNotFail(__VA_ARGS__, checkTestNotFail2, checkTestNotFail1)\
(__VA_ARGS__)
+Value:
get_checkTestNotFail(__VA_ARGS__, checkTestNotFail2, checkTestNotFail1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has not failed.

Definition at line 84 of file MetaAssertMacros.h.

- - - -

◆ checkTestNotFailF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestNotFailF( testClass,
 name 
)   (testClass##_##name##_instance.isNotFailed())
-
- -

Return true if test 'name' has not failed.

- -

Definition at line 265 of file MetaAssertMacros.h.

-
@@ -1430,43 +1050,13 @@

-Value:
get_checkTestNotPass(__VA_ARGS__, checkTestNotPass2, checkTestNotPass1)\
(__VA_ARGS__)
+Value:
get_checkTestNotPass(__VA_ARGS__, checkTestNotPass2, checkTestNotPass1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has not passed.

Definition at line 68 of file MetaAssertMacros.h.

- - - -

◆ checkTestNotPassF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestNotPassF( testClass,
 name 
)   (testClass##_##name##_instance.isNotPassed())
-
- -

Return true if test 'name' has not passed.

- -

Definition at line 257 of file MetaAssertMacros.h.

-
@@ -1484,43 +1074,13 @@

-Value:
get_checkTestNotSkip(__VA_ARGS__, checkTestNotSkip2, checkTestNotSkip1)\
(__VA_ARGS__)
+Value:
get_checkTestNotSkip(__VA_ARGS__, checkTestNotSkip2, checkTestNotSkip1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has not been skipped.

Definition at line 100 of file MetaAssertMacros.h.

- - - -

◆ checkTestNotSkipF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestNotSkipF( testClass,
 name 
)   (testClass##_##name##_instance.isNotSkipped())
-
- -

Return true if test 'name' has not been skipped.

- -

Definition at line 273 of file MetaAssertMacros.h.

-
@@ -1538,43 +1098,13 @@

-Value:
get_checkTestPass(__VA_ARGS__, checkTestPass2, checkTestPass1)\
(__VA_ARGS__)
+Value:
get_checkTestPass(__VA_ARGS__, checkTestPass2, checkTestPass1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has passed.

Definition at line 60 of file MetaAssertMacros.h.

- - - -

◆ checkTestPassF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestPassF( testClass,
 name 
)   (testClass##_##name##_instance.isPassed())
-
- -

Return true if test 'name' has passed.

- -

Definition at line 253 of file MetaAssertMacros.h.

-
@@ -1592,43 +1122,13 @@

-Value:
get_checkTestSkip(__VA_ARGS__, checkTestSkip2, checkTestSkip1)\
(__VA_ARGS__)
+Value:
get_checkTestSkip(__VA_ARGS__, checkTestSkip2, checkTestSkip1)\
+
(__VA_ARGS__)
+

Return true if test 'name' has been skipped.

Definition at line 92 of file MetaAssertMacros.h.

- - - -

◆ checkTestSkipF

- -
-
- - - - - - - - - - - - - - - - - - -
#define checkTestSkipF( testClass,
 name 
)   (testClass##_##name##_instance.isSkipped())
-
- -

Return true if test 'name' has been skipped.

- -

Definition at line 269 of file MetaAssertMacros.h.

-
@@ -1645,7 +1145,11 @@

-Value:
do {\
setStatusNow(__FILE__, __LINE__, kStatusExpired,\
AUNIT_FPSTR(kMessageExpired));\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
setStatusNow(__FILE__, __LINE__, kStatusExpired,\
+
AUNIT_FPSTR(kMessageExpired));\
+
return;\
+
} while (false)

Expire the current test, print a status message, and return immediately.

Similar to Test::expire() except that this prints a status message.

@@ -1668,7 +1172,10 @@

-Value:
do {\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
setStatusNow(__FILE__, __LINE__, kStatusFailed, AUNIT_FPSTR(kMessageFailed));\
+
return;\
+
} while (false)

Fail the current test, return immediately, and print a status message.

Similar to Test::fail() except that this prints a status message.

@@ -1691,7 +1198,10 @@

-Value:
do {\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
setStatusNow(__FILE__, __LINE__, kStatusPassed, AUNIT_FPSTR(kMessagePassed));\
+
return;\
+
} while (false)

Pass the current test, print a status message, and return immediately.

Similar to Test::pass() except that this prints a status message.

@@ -1714,7 +1224,11 @@

-Value:
do {\
setStatusNow(__FILE__, __LINE__, kStatusSkipped,\
AUNIT_FPSTR(kMessageSkipped));\
return;\
} while (false)
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32...
Definition: Flash.h:75
+Value:
do {\
+
setStatusNow(__FILE__, __LINE__, kStatusSkipped,\
+
AUNIT_FPSTR(kMessageSkipped));\
+
return;\
+
} while (false)

Skip the current test, print a status message, and return immediately.

Similar to Test::skip() except that this prints a status message.

@@ -1724,11 +1238,13 @@

#define assertTestStatusInternalF(testClass, name, method, message)
Internal helper macro, shouldn't be called directly by users.

+
#define AUNIT_FPSTR(pstr_pointer)
The FPSTR() macro is defined on ESP8266, not defined on Teensy and AVR, and broken on ESP32.
Definition: Flash.h:75
diff --git a/docs/html/MetaAssertMacros_8h__dep__incl.map b/docs/html/MetaAssertMacros_8h__dep__incl.map index eb9b235..e6fb470 100644 --- a/docs/html/MetaAssertMacros_8h__dep__incl.map +++ b/docs/html/MetaAssertMacros_8h__dep__incl.map @@ -1,4 +1,5 @@ - - - + + + + diff --git a/docs/html/MetaAssertMacros_8h__dep__incl.md5 b/docs/html/MetaAssertMacros_8h__dep__incl.md5 index f737e3c..02f9a8f 100644 --- a/docs/html/MetaAssertMacros_8h__dep__incl.md5 +++ b/docs/html/MetaAssertMacros_8h__dep__incl.md5 @@ -1 +1 @@ -cb6086c17fed0564fbe72b410ea0d45e \ No newline at end of file +7538b8338922c26cd9cbe77dd5c63af4 \ No newline at end of file diff --git a/docs/html/MetaAssertMacros_8h__dep__incl.png b/docs/html/MetaAssertMacros_8h__dep__incl.png index a0fd052..b19b8cb 100644 Binary files a/docs/html/MetaAssertMacros_8h__dep__incl.png and b/docs/html/MetaAssertMacros_8h__dep__incl.png differ diff --git a/docs/html/MetaAssertMacros_8h__incl.map b/docs/html/MetaAssertMacros_8h__incl.map index 3e5c785..d406b38 100644 --- a/docs/html/MetaAssertMacros_8h__incl.map +++ b/docs/html/MetaAssertMacros_8h__incl.map @@ -1,3 +1,4 @@ - - + + + diff --git a/docs/html/MetaAssertMacros_8h__incl.md5 b/docs/html/MetaAssertMacros_8h__incl.md5 index f4f78d1..6d49898 100644 --- a/docs/html/MetaAssertMacros_8h__incl.md5 +++ b/docs/html/MetaAssertMacros_8h__incl.md5 @@ -1 +1 @@ -25d129eafeced6d740df9d596b82fe72 \ No newline at end of file +d20877806d99ec052d967117ef7035fe \ No newline at end of file diff --git a/docs/html/MetaAssertMacros_8h__incl.png b/docs/html/MetaAssertMacros_8h__incl.png index 48a1e3f..9d9bf74 100644 Binary files a/docs/html/MetaAssertMacros_8h__incl.png and b/docs/html/MetaAssertMacros_8h__incl.png differ diff --git a/docs/html/MetaAssertMacros_8h_source.html b/docs/html/MetaAssertMacros_8h_source.html index 6b0f650..090942c 100644 --- a/docs/html/MetaAssertMacros_8h_source.html +++ b/docs/html/MetaAssertMacros_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/MetaAssertMacros.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/MetaAssertMacros.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@

- + +/* @license-end */
MetaAssertMacros.h

-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
35 #ifndef AUNIT_META_ASSERT_MACROS_H
36 #define AUNIT_META_ASSERT_MACROS_H
37 
38 #include "Flash.h"
39 
40 // Meta tests, same syntax as ArduinoUnit for compatibility.
41 // The checkTestXxx() macros return a boolean, and execution continues.
42 
44 #define checkTestDone(...)\
45  get_checkTestDone(__VA_ARGS__, checkTestDone2, checkTestDone1)\
46  (__VA_ARGS__)
47 #define get_checkTestDone(_1, _2, NAME, ...) NAME
48 #define checkTestDone1(name) (test_##name##_instance.isDone())
49 #define checkTestDone2(testSuite, name) (testSuite##_##name##_instance.isDone())
50 
52 #define checkTestNotDone(...)\
53  get_checkTestNotDone(__VA_ARGS__, checkTestNotDone2, checkTestNotDone1)\
54  (__VA_ARGS__)
55 #define get_checkTestNotDone(_1, _2, NAME, ...) NAME
56 #define checkTestNotDone1(name) (test_##name##_instance.isNotDone())
57 #define checkTestNotDone2(testSuite, name) (testSuite##_##name##_instance.isNotDone())
58 
60 #define checkTestPass(...)\
61  get_checkTestPass(__VA_ARGS__, checkTestPass2, checkTestPass1)\
62  (__VA_ARGS__)
63 #define get_checkTestPass(_1, _2, NAME, ...) NAME
64 #define checkTestPass1(name) (test_##name##_instance.isPassed())
65 #define checkTestPass2(testSuite, name) (testSuite##_##name##_instance.isPassed())
66 
68 #define checkTestNotPass(...)\
69  get_checkTestNotPass(__VA_ARGS__, checkTestNotPass2, checkTestNotPass1)\
70  (__VA_ARGS__)
71 #define get_checkTestNotPass(_1, _2, NAME, ...) NAME
72 #define checkTestNotPass1(name) (test_##name##_instance.isNotPassed())
73 #define checkTestNotPass2(testSuite, name) (testSuite##_##name##_instance.isNotPassed())
74 
76 #define checkTestFail(...)\
77  get_checkTestFail(__VA_ARGS__, checkTestFail2, checkTestFail1)\
78  (__VA_ARGS__)
79 #define get_checkTestFail(_1, _2, NAME, ...) NAME
80 #define checkTestFail1(name) (test_##name##_instance.isFailed())
81 #define checkTestFail2(testSuite, name) (testSuite##_##name##_instance.isFailed())
82 
84 #define checkTestNotFail(...)\
85  get_checkTestNotFail(__VA_ARGS__, checkTestNotFail2, checkTestNotFail1)\
86  (__VA_ARGS__)
87 #define get_checkTestNotFail(_1, _2, NAME, ...) NAME
88 #define checkTestNotFail1(name) (test_##name##_instance.isNotFailed())
89 #define checkTestNotFail2(testSuite, name) (testSuite##_##name##_instance.isNotFailed())
90 
92 #define checkTestSkip(...)\
93  get_checkTestSkip(__VA_ARGS__, checkTestSkip2, checkTestSkip1)\
94  (__VA_ARGS__)
95 #define get_checkTestSkip(_1, _2, NAME, ...) NAME
96 #define checkTestSkip1(name) (test_##name##_instance.isSkipped())
97 #define checkTestSkip2(testSuite, name) (testSuite##_##name##_instance.isSkipped())
98 
100 #define checkTestNotSkip(...)\
101  get_checkTestNotSkip(__VA_ARGS__, checkTestNotSkip2, checkTestNotSkip1)\
102  (__VA_ARGS__)
103 #define get_checkTestNotSkip(_1, _2, NAME, ...) NAME
104 #define checkTestNotSkip1(name) (test_##name##_instance.isNotSkipped())
105 #define checkTestNotSkip2(testSuite, name) (testSuite##_##name##_instance.isNotSkipped())
106 
108 #define checkTestExpire(...)\
109  get_checkTestExpire(__VA_ARGS__, checkTestExpire2, checkTestExpire1)\
110  (__VA_ARGS__)
111 #define get_checkTestExpire(_1, _2, NAME, ...) NAME
112 #define checkTestExpire1(name) (test_##name##_instance.isExpired())
113 #define checkTestExpire2(testSuite, name) (testSuite##_##name##_instance.isExpired())
114 
116 #define checkTestNotExpire(...)\
117  get_checkTestNotExpire(__VA_ARGS__, checkTestNotExpire2, checkTestNotExpire1)\
118  (__VA_ARGS__)
119 #define get_checkTestNotExpire(_1, _2, NAME, ...) NAME
120 #define checkTestNotExpire1(name) (test_##name##_instance.isNotExpired())
121 #define checkTestNotExpire2(testSuite, name) (testSuite##_##name##_instance.isNotExpired())
122 
123 // If the assertTestXxx() macros fail, they generate an optional output, calls
124 // fail(), and returns from the current test case.
125 
127 #define assertTestDone(...)\
128  get_assertTestDone(__VA_ARGS__, assertTestDone2, assertTestDone1)\
129  (__VA_ARGS__)
130 #define get_assertTestDone(_1, _2, NAME, ...) NAME
131 #define assertTestDone1(name) \
132  assertTestStatusInternal1(name, isDone, kMessageDone)
133 #define assertTestDone2(testSuite, name) \
134  assertTestStatusInternal2(testSuite, name, isDone, kMessageDone)
135 
137 #define assertTestNotDone(...)\
138  get_assertTestNotDone(__VA_ARGS__, assertTestNotDone2, assertTestNotDone1)\
139  (__VA_ARGS__)
140 #define get_assertTestNotDone(_1, _2, NAME, ...) NAME
141 #define assertTestNotDone1(name) \
142  assertTestStatusInternal1(name, isNotDone, kMessageNotDone)
143 #define assertTestNotDone2(testSuite, name) \
144  assertTestStatusInternal2(testSuite, name, isNotDone, kMessageNotDone)
145 
147 #define assertTestPass(...)\
148  get_assertTestPass(__VA_ARGS__, assertTestPass2, assertTestPass1)\
149  (__VA_ARGS__)
150 #define get_assertTestPass(_1, _2, NAME, ...) NAME
151 #define assertTestPass1(name) \
152  assertTestStatusInternal1(name, isPassed, kMessagePassed)
153 #define assertTestPass2(testSuite, name) \
154  assertTestStatusInternal2(testSuite, name, isPassed, kMessagePassed)
155 
157 #define assertTestNotPass(...)\
158  get_assertTestNotPass(__VA_ARGS__, assertTestNotPass2, assertTestNotPass1)\
159  (__VA_ARGS__)
160 #define get_assertTestNotPass(_1, _2, NAME, ...) NAME
161 #define assertTestNotPass1(name) \
162  assertTestStatusInternal1(name, isNotPassed, kMessageNotPassed)
163 #define assertTestNotPass2(testSuite, name) \
164  assertTestStatusInternal2(testSuite, name, isNotPassed, kMessageNotPassed)
165 
167 #define assertTestFail(...)\
168  get_assertTestFail(__VA_ARGS__, assertTestFail2, assertTestFail1)\
169  (__VA_ARGS__)
170 #define get_assertTestFail(_1, _2, NAME, ...) NAME
171 #define assertTestFail1(name) \
172  assertTestStatusInternal1(name, isFailed, kMessageFailed)
173 #define assertTestFail2(testSuite, name) \
174  assertTestStatusInternal2(testSuite, name, isFailed, kMessageFailed)
175 
177 #define assertTestNotFail(...)\
178  get_assertTestNotFail(__VA_ARGS__, assertTestNotFail2, assertTestNotFail1)\
179  (__VA_ARGS__)
180 #define get_assertTestNotFail(_1, _2, NAME, ...) NAME
181 #define assertTestNotFail1(name) \
182  assertTestStatusInternal1(name, isNotFailed, kMessageNotFailed)
183 #define assertTestNotFail2(testSuite, name) \
184  assertTestStatusInternal2(testSuite, name, isNotFailed, kMessageNotFailed)
185 
187 #define assertTestSkip(...)\
188  get_assertTestSkip(__VA_ARGS__, assertTestSkip2, assertTestSkip1)\
189  (__VA_ARGS__)
190 #define get_assertTestSkip(_1, _2, NAME, ...) NAME
191 #define assertTestSkip1(name) \
192  assertTestStatusInternal1(name, isSkipped, kMessageSkipped)
193 #define assertTestSkip2(testSuite, name) \
194  assertTestStatusInternal2(testSuite, name, isSkipped, kMessageSkipped)
195 
197 #define assertTestNotSkip(...)\
198  get_assertTestNotSkip(__VA_ARGS__, assertTestNotSkip2, assertTestNotSkip1)\
199  (__VA_ARGS__)
200 #define get_assertTestNotSkip(_1, _2, NAME, ...) NAME
201 #define assertTestNotSkip1(name) \
202  assertTestStatusInternal1(name, isNotSkipped, kMessageNotSkipped)
203 #define assertTestNotSkip2(testSuite, name) \
204  assertTestStatusInternal2(testSuite, name, isNotSkipped, kMessageNotSkipped)
205 
207 #define assertTestExpire(...)\
208  get_assertTestExpire(__VA_ARGS__, assertTestExpire2, assertTestExpire1)\
209  (__VA_ARGS__)
210 #define get_assertTestExpire(_1, _2, NAME, ...) NAME
211 #define assertTestExpire1(name) \
212  assertTestStatusInternal1(name, isExpired, kMessageExpired)
213 #define assertTestExpire2(testSuite, name) \
214  assertTestStatusInternal2(testSuite, name, isExpired, kMessageExpired)
215 
217 #define assertTestNotExpire(...)\
218  get_assertTestNotExpire(__VA_ARGS__, assertTestNotExpire2, assertTestNotExpire1)\
219  (__VA_ARGS__)
220 #define get_assertTestNotExpire(_1, _2, NAME, ...) NAME
221 #define assertTestNotExpire1(name) \
222  assertTestStatusInternal1(name, isNotExpired, kMessageNotExpired)
223 #define assertTestNotExpire2(testSuite, name) \
224  assertTestStatusInternal2(testSuite, name, isNotExpired, kMessageNotExpired)
225 
227 #define assertTestStatusInternal1(name,method,message) do {\
228  if (!assertionTestStatus(\
229  __FILE__,__LINE__,#name,AUNIT_FPSTR(message),\
230  test_##name##_instance.method()))\
231  return;\
232 } while (false)
233 
234 #define assertTestStatusInternal2(testSuite,name,method,message) do {\
235  if (!assertionTestStatus(\
236  __FILE__,__LINE__,#testSuite "_" #name,AUNIT_FPSTR(message),\
237  testSuite##_##name##_instance.method()))\
238  return;\
239 } while (false)
240 
241 // Meta tests for testF() and testingF() are slightly different because
242 // the name of the fixture class is appended to the instance name.
243 
245 #define checkTestDoneF(testClass,name) \
246  (testClass##_##name##_instance.isDone())
247 
249 #define checkTestNotDoneF(testClass,name) \
250  (testClass##_##name##_instance.isNotDone())
251 
253 #define checkTestPassF(testClass,name) \
254  (testClass##_##name##_instance.isPassed())
255 
257 #define checkTestNotPassF(testClass,name) \
258  (testClass##_##name##_instance.isNotPassed())
259 
261 #define checkTestFailF(testClass,name) \
262  (testClass##_##name##_instance.isFailed())
263 
265 #define checkTestNotFailF(testClass,name) \
266  (testClass##_##name##_instance.isNotFailed())
267 
269 #define checkTestSkipF(testClass,name) \
270  (testClass##_##name##_instance.isSkipped())
271 
273 #define checkTestNotSkipF(testClass,name) \
274  (testClass##_##name##_instance.isNotSkipped())
275 
277 #define checkTestExpireF(testClass,name) \
278  (testClass##_##name##_instance.isExpired())
279 
281 #define checkTestNotExpireF(testClass,name) \
282  (testClass##_##name##_instance.isNotExpired())
283 
284 // If the assertTestXxx() macros fail, they generate an optional output, calls
285 // fail(), and returns from the current test case.
286 
288 #define assertTestDoneF(testClass,name) \
289  assertTestStatusInternalF(testClass, name, isDone, kMessageDone)
290 
292 #define assertTestNotDoneF(testClass,name) \
293  assertTestStatusInternalF(testClass, name, isNotDone, kMessageNotDone)
294 
296 #define assertTestPassF(testClass,name) \
297  assertTestStatusInternalF(testClass, name, isPassed, kMessagePassed)
298 
300 #define assertTestNotPassF(testClass,name) \
301  assertTestStatusInternalF(testClass, name, isNotPassed, kMessageNotPassed)
302 
304 #define assertTestFailF(testClass,name) \
305  assertTestStatusInternalF(testClass, name, isFailed, kMessageFailed)
306 
308 #define assertTestNotFailF(testClass,name) \
309  assertTestStatusInternalF(testClass, name, isNotFailed, kMessageNotFailed)
310 
312 #define assertTestSkipF(testClass,name) \
313  assertTestStatusInternalF(testClass, name, isSkipped, kMessageSkipped)
314 
316 #define assertTestNotSkipF(testClass,name) \
317  assertTestStatusInternalF(testClass, name, isNotSkipped, \
318  kMessageNotSkipped)
319 
321 #define assertTestExpireF(testClass,name) \
322  assertTestStatusInternalF(testClass, name, isExpired, kMessageExpired)
323 
325 #define assertTestNotExpireF(testClass,name) \
326  assertTestStatusInternalF(testClass, name, isNotExpired, \
327  kMessageNotExpired)
328 
330 #define assertTestStatusInternalF(testClass,name,method,message) do {\
331  if (!assertionTestStatus(__FILE__, __LINE__, #name, AUNIT_FPSTR(message),\
332  testClass##_##name##_instance.method()))\
333  return;\
334 } while (false)
335 
336 // Methods that sets the status of the current test, prints a message, and
337 // exits immediately.
338 
343 #define failTestNow() do {\
344  setStatusNow(__FILE__, __LINE__, kStatusFailed, AUNIT_FPSTR(kMessageFailed));\
345  return;\
346 } while (false)
347 
352 #define passTestNow() do {\
353  setStatusNow(__FILE__, __LINE__, kStatusPassed, AUNIT_FPSTR(kMessagePassed));\
354  return;\
355 } while (false)
356 
361 #define skipTestNow() do {\
362  setStatusNow(__FILE__, __LINE__, kStatusSkipped,\
363  AUNIT_FPSTR(kMessageSkipped));\
364  return;\
365 } while (false)
366 
371 #define expireTestNow() do {\
372  setStatusNow(__FILE__, __LINE__, kStatusExpired,\
373  AUNIT_FPSTR(kMessageExpired));\
374  return;\
375 } while (false)
376 
377 #endif
Various macros to smooth over the differences among the various platforms with regards to their suppo...
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
35 #ifndef AUNIT_META_ASSERT_MACROS_H
+
36 #define AUNIT_META_ASSERT_MACROS_H
+
37 
+
38 #include "Flash.h"
+
39 
+
40 // Meta tests, same syntax as ArduinoUnit for compatibility.
+
41 // The checkTestXxx() macros return a boolean, and execution continues.
+
42 
+
44 #define checkTestDone(...)\
+
45  get_checkTestDone(__VA_ARGS__, checkTestDone2, checkTestDone1)\
+
46  (__VA_ARGS__)
+
47 #define get_checkTestDone(_1, _2, NAME, ...) NAME
+
48 #define checkTestDone1(name) (test_##name##_instance.isDone())
+
49 #define checkTestDone2(testSuite, name) (testSuite##_##name##_instance.isDone())
+
50 
+
52 #define checkTestNotDone(...)\
+
53  get_checkTestNotDone(__VA_ARGS__, checkTestNotDone2, checkTestNotDone1)\
+
54  (__VA_ARGS__)
+
55 #define get_checkTestNotDone(_1, _2, NAME, ...) NAME
+
56 #define checkTestNotDone1(name) (test_##name##_instance.isNotDone())
+
57 #define checkTestNotDone2(testSuite, name) (testSuite##_##name##_instance.isNotDone())
+
58 
+
60 #define checkTestPass(...)\
+
61  get_checkTestPass(__VA_ARGS__, checkTestPass2, checkTestPass1)\
+
62  (__VA_ARGS__)
+
63 #define get_checkTestPass(_1, _2, NAME, ...) NAME
+
64 #define checkTestPass1(name) (test_##name##_instance.isPassed())
+
65 #define checkTestPass2(testSuite, name) (testSuite##_##name##_instance.isPassed())
+
66 
+
68 #define checkTestNotPass(...)\
+
69  get_checkTestNotPass(__VA_ARGS__, checkTestNotPass2, checkTestNotPass1)\
+
70  (__VA_ARGS__)
+
71 #define get_checkTestNotPass(_1, _2, NAME, ...) NAME
+
72 #define checkTestNotPass1(name) (test_##name##_instance.isNotPassed())
+
73 #define checkTestNotPass2(testSuite, name) (testSuite##_##name##_instance.isNotPassed())
+
74 
+
76 #define checkTestFail(...)\
+
77  get_checkTestFail(__VA_ARGS__, checkTestFail2, checkTestFail1)\
+
78  (__VA_ARGS__)
+
79 #define get_checkTestFail(_1, _2, NAME, ...) NAME
+
80 #define checkTestFail1(name) (test_##name##_instance.isFailed())
+
81 #define checkTestFail2(testSuite, name) (testSuite##_##name##_instance.isFailed())
+
82 
+
84 #define checkTestNotFail(...)\
+
85  get_checkTestNotFail(__VA_ARGS__, checkTestNotFail2, checkTestNotFail1)\
+
86  (__VA_ARGS__)
+
87 #define get_checkTestNotFail(_1, _2, NAME, ...) NAME
+
88 #define checkTestNotFail1(name) (test_##name##_instance.isNotFailed())
+
89 #define checkTestNotFail2(testSuite, name) (testSuite##_##name##_instance.isNotFailed())
+
90 
+
92 #define checkTestSkip(...)\
+
93  get_checkTestSkip(__VA_ARGS__, checkTestSkip2, checkTestSkip1)\
+
94  (__VA_ARGS__)
+
95 #define get_checkTestSkip(_1, _2, NAME, ...) NAME
+
96 #define checkTestSkip1(name) (test_##name##_instance.isSkipped())
+
97 #define checkTestSkip2(testSuite, name) (testSuite##_##name##_instance.isSkipped())
+
98 
+
100 #define checkTestNotSkip(...)\
+
101  get_checkTestNotSkip(__VA_ARGS__, checkTestNotSkip2, checkTestNotSkip1)\
+
102  (__VA_ARGS__)
+
103 #define get_checkTestNotSkip(_1, _2, NAME, ...) NAME
+
104 #define checkTestNotSkip1(name) (test_##name##_instance.isNotSkipped())
+
105 #define checkTestNotSkip2(testSuite, name) (testSuite##_##name##_instance.isNotSkipped())
+
106 
+
108 #define checkTestExpire(...)\
+
109  get_checkTestExpire(__VA_ARGS__, checkTestExpire2, checkTestExpire1)\
+
110  (__VA_ARGS__)
+
111 #define get_checkTestExpire(_1, _2, NAME, ...) NAME
+
112 #define checkTestExpire1(name) (test_##name##_instance.isExpired())
+
113 #define checkTestExpire2(testSuite, name) (testSuite##_##name##_instance.isExpired())
+
114 
+
116 #define checkTestNotExpire(...)\
+
117  get_checkTestNotExpire(__VA_ARGS__, checkTestNotExpire2, checkTestNotExpire1)\
+
118  (__VA_ARGS__)
+
119 #define get_checkTestNotExpire(_1, _2, NAME, ...) NAME
+
120 #define checkTestNotExpire1(name) (test_##name##_instance.isNotExpired())
+
121 #define checkTestNotExpire2(testSuite, name) (testSuite##_##name##_instance.isNotExpired())
+
122 
+
123 // If the assertTestXxx() macros fail, they generate an optional output, calls
+
124 // fail(), and returns from the current test case.
+
125 
+
127 #define assertTestDone(...)\
+
128  get_assertTestDone(__VA_ARGS__, assertTestDone2, assertTestDone1)\
+
129  (__VA_ARGS__)
+
130 #define get_assertTestDone(_1, _2, NAME, ...) NAME
+
131 #define assertTestDone1(name) \
+
132  assertTestStatusInternal1(name, isDone, kMessageDone)
+
133 #define assertTestDone2(testSuite, name) \
+
134  assertTestStatusInternal2(testSuite, name, isDone, kMessageDone)
+
135 
+
137 #define assertTestNotDone(...)\
+
138  get_assertTestNotDone(__VA_ARGS__, assertTestNotDone2, assertTestNotDone1)\
+
139  (__VA_ARGS__)
+
140 #define get_assertTestNotDone(_1, _2, NAME, ...) NAME
+
141 #define assertTestNotDone1(name) \
+
142  assertTestStatusInternal1(name, isNotDone, kMessageNotDone)
+
143 #define assertTestNotDone2(testSuite, name) \
+
144  assertTestStatusInternal2(testSuite, name, isNotDone, kMessageNotDone)
+
145 
+
147 #define assertTestPass(...)\
+
148  get_assertTestPass(__VA_ARGS__, assertTestPass2, assertTestPass1)\
+
149  (__VA_ARGS__)
+
150 #define get_assertTestPass(_1, _2, NAME, ...) NAME
+
151 #define assertTestPass1(name) \
+
152  assertTestStatusInternal1(name, isPassed, kMessagePassed)
+
153 #define assertTestPass2(testSuite, name) \
+
154  assertTestStatusInternal2(testSuite, name, isPassed, kMessagePassed)
+
155 
+
157 #define assertTestNotPass(...)\
+
158  get_assertTestNotPass(__VA_ARGS__, assertTestNotPass2, assertTestNotPass1)\
+
159  (__VA_ARGS__)
+
160 #define get_assertTestNotPass(_1, _2, NAME, ...) NAME
+
161 #define assertTestNotPass1(name) \
+
162  assertTestStatusInternal1(name, isNotPassed, kMessageNotPassed)
+
163 #define assertTestNotPass2(testSuite, name) \
+
164  assertTestStatusInternal2(testSuite, name, isNotPassed, kMessageNotPassed)
+
165 
+
167 #define assertTestFail(...)\
+
168  get_assertTestFail(__VA_ARGS__, assertTestFail2, assertTestFail1)\
+
169  (__VA_ARGS__)
+
170 #define get_assertTestFail(_1, _2, NAME, ...) NAME
+
171 #define assertTestFail1(name) \
+
172  assertTestStatusInternal1(name, isFailed, kMessageFailed)
+
173 #define assertTestFail2(testSuite, name) \
+
174  assertTestStatusInternal2(testSuite, name, isFailed, kMessageFailed)
+
175 
+
177 #define assertTestNotFail(...)\
+
178  get_assertTestNotFail(__VA_ARGS__, assertTestNotFail2, assertTestNotFail1)\
+
179  (__VA_ARGS__)
+
180 #define get_assertTestNotFail(_1, _2, NAME, ...) NAME
+
181 #define assertTestNotFail1(name) \
+
182  assertTestStatusInternal1(name, isNotFailed, kMessageNotFailed)
+
183 #define assertTestNotFail2(testSuite, name) \
+
184  assertTestStatusInternal2(testSuite, name, isNotFailed, kMessageNotFailed)
+
185 
+
187 #define assertTestSkip(...)\
+
188  get_assertTestSkip(__VA_ARGS__, assertTestSkip2, assertTestSkip1)\
+
189  (__VA_ARGS__)
+
190 #define get_assertTestSkip(_1, _2, NAME, ...) NAME
+
191 #define assertTestSkip1(name) \
+
192  assertTestStatusInternal1(name, isSkipped, kMessageSkipped)
+
193 #define assertTestSkip2(testSuite, name) \
+
194  assertTestStatusInternal2(testSuite, name, isSkipped, kMessageSkipped)
+
195 
+
197 #define assertTestNotSkip(...)\
+
198  get_assertTestNotSkip(__VA_ARGS__, assertTestNotSkip2, assertTestNotSkip1)\
+
199  (__VA_ARGS__)
+
200 #define get_assertTestNotSkip(_1, _2, NAME, ...) NAME
+
201 #define assertTestNotSkip1(name) \
+
202  assertTestStatusInternal1(name, isNotSkipped, kMessageNotSkipped)
+
203 #define assertTestNotSkip2(testSuite, name) \
+
204  assertTestStatusInternal2(testSuite, name, isNotSkipped, kMessageNotSkipped)
+
205 
+
207 #define assertTestExpire(...)\
+
208  get_assertTestExpire(__VA_ARGS__, assertTestExpire2, assertTestExpire1)\
+
209  (__VA_ARGS__)
+
210 #define get_assertTestExpire(_1, _2, NAME, ...) NAME
+
211 #define assertTestExpire1(name) \
+
212  assertTestStatusInternal1(name, isExpired, kMessageExpired)
+
213 #define assertTestExpire2(testSuite, name) \
+
214  assertTestStatusInternal2(testSuite, name, isExpired, kMessageExpired)
+
215 
+
217 #define assertTestNotExpire(...)\
+
218  get_assertTestNotExpire(__VA_ARGS__, assertTestNotExpire2, assertTestNotExpire1)\
+
219  (__VA_ARGS__)
+
220 #define get_assertTestNotExpire(_1, _2, NAME, ...) NAME
+
221 #define assertTestNotExpire1(name) \
+
222  assertTestStatusInternal1(name, isNotExpired, kMessageNotExpired)
+
223 #define assertTestNotExpire2(testSuite, name) \
+
224  assertTestStatusInternal2(testSuite, name, isNotExpired, kMessageNotExpired)
+
225 
+
227 #define assertTestStatusInternal1(name,method,message) do {\
+
228  if (!assertionTestStatus(\
+
229  __FILE__,__LINE__,#name,AUNIT_FPSTR(message),\
+
230  test_##name##_instance.method()))\
+
231  return;\
+
232 } while (false)
+
233 
+
234 #define assertTestStatusInternal2(testSuite,name,method,message) do {\
+
235  if (!assertionTestStatus(\
+
236  __FILE__,__LINE__,#testSuite "_" #name,AUNIT_FPSTR(message),\
+
237  testSuite##_##name##_instance.method()))\
+
238  return;\
+
239 } while (false)
+
240 
+
241 // Meta tests for testF() and testingF() are slightly different because
+
242 // the name of the fixture class is appended to the instance name.
+
243 
+
245 #define checkTestDoneF(testClass,name) \
+
246  (testClass##_##name##_instance.isDone())
+
247 
+
249 #define checkTestNotDoneF(testClass,name) \
+
250  (testClass##_##name##_instance.isNotDone())
+
251 
+
253 #define checkTestPassF(testClass,name) \
+
254  (testClass##_##name##_instance.isPassed())
+
255 
+
257 #define checkTestNotPassF(testClass,name) \
+
258  (testClass##_##name##_instance.isNotPassed())
+
259 
+
261 #define checkTestFailF(testClass,name) \
+
262  (testClass##_##name##_instance.isFailed())
+
263 
+
265 #define checkTestNotFailF(testClass,name) \
+
266  (testClass##_##name##_instance.isNotFailed())
+
267 
+
269 #define checkTestSkipF(testClass,name) \
+
270  (testClass##_##name##_instance.isSkipped())
+
271 
+
273 #define checkTestNotSkipF(testClass,name) \
+
274  (testClass##_##name##_instance.isNotSkipped())
+
275 
+
277 #define checkTestExpireF(testClass,name) \
+
278  (testClass##_##name##_instance.isExpired())
+
279 
+
281 #define checkTestNotExpireF(testClass,name) \
+
282  (testClass##_##name##_instance.isNotExpired())
+
283 
+
284 // If the assertTestXxx() macros fail, they generate an optional output, calls
+
285 // fail(), and returns from the current test case.
+
286 
+
288 #define assertTestDoneF(testClass,name) \
+
289  assertTestStatusInternalF(testClass, name, isDone, kMessageDone)
+
290 
+
292 #define assertTestNotDoneF(testClass,name) \
+
293  assertTestStatusInternalF(testClass, name, isNotDone, kMessageNotDone)
+
294 
+
296 #define assertTestPassF(testClass,name) \
+
297  assertTestStatusInternalF(testClass, name, isPassed, kMessagePassed)
+
298 
+
300 #define assertTestNotPassF(testClass,name) \
+
301  assertTestStatusInternalF(testClass, name, isNotPassed, kMessageNotPassed)
+
302 
+
304 #define assertTestFailF(testClass,name) \
+
305  assertTestStatusInternalF(testClass, name, isFailed, kMessageFailed)
+
306 
+
308 #define assertTestNotFailF(testClass,name) \
+
309  assertTestStatusInternalF(testClass, name, isNotFailed, kMessageNotFailed)
+
310 
+
312 #define assertTestSkipF(testClass,name) \
+
313  assertTestStatusInternalF(testClass, name, isSkipped, kMessageSkipped)
+
314 
+
316 #define assertTestNotSkipF(testClass,name) \
+
317  assertTestStatusInternalF(testClass, name, isNotSkipped, \
+
318  kMessageNotSkipped)
+
319 
+
321 #define assertTestExpireF(testClass,name) \
+
322  assertTestStatusInternalF(testClass, name, isExpired, kMessageExpired)
+
323 
+
325 #define assertTestNotExpireF(testClass,name) \
+
326  assertTestStatusInternalF(testClass, name, isNotExpired, \
+
327  kMessageNotExpired)
+
328 
+
330 #define assertTestStatusInternalF(testClass,name,method,message) do {\
+
331  if (!assertionTestStatus(__FILE__, __LINE__, #name, AUNIT_FPSTR(message),\
+
332  testClass##_##name##_instance.method()))\
+
333  return;\
+
334 } while (false)
+
335 
+
336 // Methods that sets the status of the current test, prints a message, and
+
337 // exits immediately.
+
338 
+
343 #define failTestNow() do {\
+
344  setStatusNow(__FILE__, __LINE__, kStatusFailed, AUNIT_FPSTR(kMessageFailed));\
+
345  return;\
+
346 } while (false)
+
347 
+
352 #define passTestNow() do {\
+
353  setStatusNow(__FILE__, __LINE__, kStatusPassed, AUNIT_FPSTR(kMessagePassed));\
+
354  return;\
+
355 } while (false)
+
356 
+
361 #define skipTestNow() do {\
+
362  setStatusNow(__FILE__, __LINE__, kStatusSkipped,\
+
363  AUNIT_FPSTR(kMessageSkipped));\
+
364  return;\
+
365 } while (false)
+
366 
+
371 #define expireTestNow() do {\
+
372  setStatusNow(__FILE__, __LINE__, kStatusExpired,\
+
373  AUNIT_FPSTR(kMessageExpired));\
+
374  return;\
+
375 } while (false)
+
376 
+
377 #endif
+ diff --git a/docs/html/MetaAssertion_8cpp_source.html b/docs/html/MetaAssertion_8cpp_source.html index bfaf965..b6cb85b 100644 --- a/docs/html/MetaAssertion_8cpp_source.html +++ b/docs/html/MetaAssertion_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/MetaAssertion.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/MetaAssertion.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
MetaAssertion.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include <Arduino.h> // definition of Print
26 #include "Flash.h"
27 #include "Printer.h"
28 #include "Verbosity.h"
29 #include "Compare.h"
30 #include "TestRunner.h"
31 #include "MetaAssertion.h"
32 
33 namespace aunit {
34 
35 // Moving these strings into PROGMEM saves 162 bytes of flash memory (from
36 // elimination of a function) and 130 bytes of static memory,
37 const char MetaAssertion::kMessageDone[] PROGMEM = "done";
38 const char MetaAssertion::kMessageNotDone[] PROGMEM = "not done";
39 const char MetaAssertion::kMessagePassed[] PROGMEM = "passed";
40 const char MetaAssertion::kMessageNotPassed[] PROGMEM = "not passed";
41 const char MetaAssertion::kMessageFailed[] PROGMEM = "failed";
42 const char MetaAssertion::kMessageNotFailed[] PROGMEM = "not failed";
43 const char MetaAssertion::kMessageSkipped[] PROGMEM = "skipped";
44 const char MetaAssertion::kMessageNotSkipped[] PROGMEM = "not skipped";
45 const char MetaAssertion::kMessageExpired[] PROGMEM = "timed out";
46 const char MetaAssertion::kMessageNotExpired[] PROGMEM = "not timed out";
47 
48 namespace {
49 
50 // Print an assertion message describing whether the given 'testName' has passed
51 // or failed
52 void printAssertionTestStatusMessage(
53  bool ok, const char* file, uint16_t line,
54  const char* testName, const __FlashStringHelper* statusMessage) {
55  // Many of the following strings are duplicated in Assertion.cpp and
56  // the compiler/linker will dedupe them.
57  Print* printer = Printer::getPrinter();
58  printer->print("Assertion ");
59  printer->print(ok ? "passed" : "failed");
60  printer->print(F(": Test "));
61  printer->print(testName);
62  printer->print(" is ");
63  printer->print(statusMessage);
64  printer->print(", file ");
65  printer->print(file);
66  printer->print(", line ");
67  printer->print(line);
68  printer->println('.');
69 }
70 
71 }
72 
73 bool MetaAssertion::assertionTestStatus(const char* file, uint16_t line,
74  const char* testName, const __FlashStringHelper* statusMessage, bool ok) {
75  if (isDone()) return false;
76  if (isOutputEnabled(ok)) {
77  printAssertionTestStatusMessage(ok, file, line, testName, statusMessage);
78  }
79  setPassOrFail(ok);
80  return ok;
81 }
82 
83 namespace {
84 
85 // Print message for failNow() macro.
86 // "Status failed, file xxx, line yyy."
87 void printStatusNowMessage(const char* file, uint16_t line,
88  const __FlashStringHelper* statusString) {
89  // Many of these strings are duplicated in Assertion.cpp and will be deduped
90  // by the compiler/linker.
91  Print* printer = Printer::getPrinter();
92  printer->print(F("Status "));
93  printer->print(statusString);
94  printer->print(", file ");
95  printer->print(file);
96  printer->print(", line ");
97  printer->print(line);
98  printer->println('.');
99 }
100 
101 }
102 
103 bool MetaAssertion::isOutputEnabledForStatus(uint8_t status) const {
104  return (status == kStatusFailed && isVerbosity(Verbosity::kTestFailed))
108 }
109 
110 void MetaAssertion::setStatusNow(const char* file, uint16_t line,
111  uint8_t status, const __FlashStringHelper* statusString) {
112  if (isDone()) return;
113  if (isOutputEnabledForStatus(status)) {
114  printStatusNowMessage(file, line, statusString);
115  }
116  setStatus(status);
117 }
118 
119 }
bool isOutputEnabledForStatus(uint8_t status) const
Return true if setting of status should print a message.
-
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
-
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
-
bool isVerbosity(uint8_t verbosity) const
Determine if any of the given verbosity is enabled.
Definition: Test.h:275
-
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
Definition: Test.cpp:50
-
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
-
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
-
bool assertionTestStatus(const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
Set the status of the current test using the &#39;ok&#39; status from another test, and print the assertion m...
-
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
-
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
- -
void setStatusNow(const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
Set the status of the current test to &#39;status&#39; and print a message.
-
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
-
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
Definition: Assertion.cpp:183
-
bool isDone() const
Return true if test has been asserted.
Definition: Test.h:196
-
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
-
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
-
Various macros to smooth over the differences among the various platforms with regards to their suppo...
-
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
-
void setStatus(uint8_t status)
Set the status of the test.
Definition: Test.h:173
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include <Arduino.h> // definition of Print
+
26 #include "Flash.h"
+
27 #include "Printer.h"
+
28 #include "Verbosity.h"
+
29 #include "Compare.h"
+
30 #include "TestRunner.h"
+
31 #include "MetaAssertion.h"
+
32 
+
33 namespace aunit {
+
34 
+
35 // Moving these strings into PROGMEM saves 162 bytes of flash memory (from
+
36 // elimination of a function) and 130 bytes of static memory,
+
37 const char MetaAssertion::kMessageDone[] PROGMEM = "done";
+
38 const char MetaAssertion::kMessageNotDone[] PROGMEM = "not done";
+
39 const char MetaAssertion::kMessagePassed[] PROGMEM = "passed";
+
40 const char MetaAssertion::kMessageNotPassed[] PROGMEM = "not passed";
+
41 const char MetaAssertion::kMessageFailed[] PROGMEM = "failed";
+
42 const char MetaAssertion::kMessageNotFailed[] PROGMEM = "not failed";
+
43 const char MetaAssertion::kMessageSkipped[] PROGMEM = "skipped";
+
44 const char MetaAssertion::kMessageNotSkipped[] PROGMEM = "not skipped";
+
45 const char MetaAssertion::kMessageExpired[] PROGMEM = "timed out";
+
46 const char MetaAssertion::kMessageNotExpired[] PROGMEM = "not timed out";
+
47 
+
48 namespace {
+
49 
+
50 // Print an assertion message describing whether the given 'testName' has passed
+
51 // or failed
+
52 void printAssertionTestStatusMessage(
+
53  bool ok, const char* file, uint16_t line,
+
54  const char* testName, const __FlashStringHelper* statusMessage) {
+
55  // Many of the following strings are duplicated in Assertion.cpp and
+
56  // the compiler/linker will dedupe them.
+
57  Print* printer = Printer::getPrinter();
+
58  printer->print("Assertion ");
+
59  printer->print(ok ? "passed" : "failed");
+
60  printer->print(F(": Test "));
+
61  printer->print(testName);
+
62  printer->print(" is ");
+
63  printer->print(statusMessage);
+
64  printer->print(", file ");
+
65  printer->print(file);
+
66  printer->print(", line ");
+
67  printer->print(line);
+
68  printer->println('.');
+
69 }
+
70 
+
71 }
+
72 
+
73 bool MetaAssertion::assertionTestStatus(const char* file, uint16_t line,
+
74  const char* testName, const __FlashStringHelper* statusMessage, bool ok) {
+
75  if (isDone()) return false;
+
76  if (isOutputEnabled(ok)) {
+
77  printAssertionTestStatusMessage(ok, file, line, testName, statusMessage);
+
78  }
+
79  setPassOrFail(ok);
+
80  return ok;
+
81 }
+
82 
+
83 namespace {
+
84 
+
85 // Print message for failNow() macro.
+
86 // "Status failed, file xxx, line yyy."
+
87 void printStatusNowMessage(const char* file, uint16_t line,
+
88  const __FlashStringHelper* statusString) {
+
89  // Many of these strings are duplicated in Assertion.cpp and will be deduped
+
90  // by the compiler/linker.
+
91  Print* printer = Printer::getPrinter();
+
92  printer->print(F("Status "));
+
93  printer->print(statusString);
+
94  printer->print(", file ");
+
95  printer->print(file);
+
96  printer->print(", line ");
+
97  printer->print(line);
+
98  printer->println('.');
+
99 }
+
100 
+
101 }
+
102 
+
103 bool MetaAssertion::isOutputEnabledForStatus(uint8_t status) const {
+
104  return (status == kStatusFailed && isVerbosity(Verbosity::kTestFailed))
+ + + +
108 }
+
109 
+
110 void MetaAssertion::setStatusNow(const char* file, uint16_t line,
+
111  uint8_t status, const __FlashStringHelper* statusString) {
+
112  if (isDone()) return;
+
113  if (isOutputEnabledForStatus(status)) {
+
114  printStatusNowMessage(file, line, statusString);
+
115  }
+
116  setStatus(status);
+
117 }
+
118 
+
119 }
+
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
+ +
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
+
bool assertionTestStatus(const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
Set the status of the current test using the 'ok' status from another test, and print the assertion m...
+
bool isOutputEnabledForStatus(uint8_t status) const
Return true if setting of status should print a message.
+
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
+
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
Definition: Test.cpp:50
+
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
+
bool isOutputEnabled(bool ok) const
Returns true if an assertion message should be printed.
Definition: Assertion.cpp:183
+
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
+
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
+
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
+
bool isDone() const
Return true if test has been asserted.
Definition: Test.h:196
+
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
+
void setStatus(uint8_t status)
Set the status of the test.
Definition: Test.h:173
+
bool isVerbosity(uint8_t verbosity) const
Determine if any of the given verbosity is enabled.
Definition: Test.h:275
+
void setStatusNow(const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
Set the status of the current test to 'status' and print a message.
+
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
+ diff --git a/docs/html/MetaAssertion_8h_source.html b/docs/html/MetaAssertion_8h_source.html index b061dda..c832f4b 100644 --- a/docs/html/MetaAssertion_8h_source.html +++ b/docs/html/MetaAssertion_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/MetaAssertion.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/MetaAssertion.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
MetaAssertion.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
28 #ifndef AUNIT_META_ASSERTION_H
29 #define AUNIT_META_ASSERTION_H
30 
31 #include "Printer.h"
32 #include "Assertion.h"
33 
34 class __FlashStringHelper;
35 
36 namespace aunit {
37 
42 class MetaAssertion: public Assertion {
43  protected:
44  // Human-readable strings for various meta-asssertion messages.
45  // They need to be protected, not private, because they are used by
46  // subclasses through the test() and testing() macros.
47  static const char kMessageDone[];
48  static const char kMessageNotDone[];
49  static const char kMessagePassed[];
50  static const char kMessageNotPassed[];
51  static const char kMessageFailed[];
52  static const char kMessageNotFailed[];
53  static const char kMessageSkipped[];
54  static const char kMessageNotSkipped[];
55  static const char kMessageExpired[];
56  static const char kMessageNotExpired[];
57 
60 
65  bool assertionTestStatus(const char* file, uint16_t line,
66  const char* testName, const __FlashStringHelper* statusMessage,
67  bool ok);
68 
70  bool isOutputEnabledForStatus(uint8_t status) const;
71 
73  void setStatusNow(const char* file, uint16_t line, uint8_t status,
74  const __FlashStringHelper* statusString);
75 
76  private:
77  // Disable copy-constructor and assignment operator
78  MetaAssertion(const MetaAssertion&) = delete;
79  MetaAssertion& operator=(const MetaAssertion&) = delete;
80 
81 };
82 
83 }
84 
85 #endif
bool isOutputEnabledForStatus(uint8_t status) const
Return true if setting of status should print a message.
-
Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that ...
Definition: MetaAssertion.h:42
-
bool assertionTestStatus(const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
Set the status of the current test using the &#39;ok&#39; status from another test, and print the assertion m...
-
MetaAssertion()
Empty constructor.
Definition: MetaAssertion.h:59
- -
void setStatusNow(const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
Set the status of the current test to &#39;status&#39; and print a message.
-
An Assertion class is a subclass of Test and provides various overloaded assertion() functions...
Definition: Assertion.h:55
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
28 #ifndef AUNIT_META_ASSERTION_H
+
29 #define AUNIT_META_ASSERTION_H
+
30 
+
31 #include "Printer.h"
+
32 #include "Assertion.h"
+
33 
+
34 class __FlashStringHelper;
+
35 
+
36 namespace aunit {
+
37 
+
42 class MetaAssertion: public Assertion {
+
43  protected:
+
44  // Human-readable strings for various meta-asssertion messages.
+
45  // They need to be protected, not private, because they are used by
+
46  // subclasses through the test() and testing() macros.
+
47  static const char kMessageDone[];
+
48  static const char kMessageNotDone[];
+
49  static const char kMessagePassed[];
+
50  static const char kMessageNotPassed[];
+
51  static const char kMessageFailed[];
+
52  static const char kMessageNotFailed[];
+
53  static const char kMessageSkipped[];
+
54  static const char kMessageNotSkipped[];
+
55  static const char kMessageExpired[];
+
56  static const char kMessageNotExpired[];
+
57 
+ +
60 
+
65  bool assertionTestStatus(const char* file, uint16_t line,
+
66  const char* testName, const __FlashStringHelper* statusMessage,
+
67  bool ok);
+
68 
+
70  bool isOutputEnabledForStatus(uint8_t status) const;
+
71 
+
73  void setStatusNow(const char* file, uint16_t line, uint8_t status,
+
74  const __FlashStringHelper* statusString);
+
75 
+
76  private:
+
77  // Disable copy-constructor and assignment operator
+
78  MetaAssertion(const MetaAssertion&) = delete;
+
79  MetaAssertion& operator=(const MetaAssertion&) = delete;
+
80 
+
81 };
+
82 
+
83 }
+
84 
+
85 #endif
+
An Assertion class is a subclass of Test and provides various overloaded assertion() functions.
Definition: Assertion.h:55
+
Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that ...
Definition: MetaAssertion.h:42
+
bool assertionTestStatus(const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
Set the status of the current test using the 'ok' status from another test, and print the assertion m...
+
bool isOutputEnabledForStatus(uint8_t status) const
Return true if setting of status should print a message.
+
MetaAssertion()
Empty constructor.
Definition: MetaAssertion.h:59
+
void setStatusNow(const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
Set the status of the current test to 'status' and print a message.
diff --git a/docs/html/Printer_8cpp_source.html b/docs/html/Printer_8cpp_source.html index f691927..f292248 100644 --- a/docs/html/Printer_8cpp_source.html +++ b/docs/html/Printer_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Printer.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/Printer.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Printer.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include <Arduino.h> // Serial
26 #include "Flash.h"
27 #include "Printer.h"
28 
29 namespace aunit {
30 
31 Print* Printer::sPrinter = &SERIAL_PORT_MONITOR;
32 
33 }
-
Various macros to smooth over the differences among the various platforms with regards to their suppo...
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include <Arduino.h> // Serial
+
26 #include "Flash.h"
+
27 #include "Printer.h"
+
28 
+
29 namespace aunit {
+
30 
+
31 Print* Printer::sPrinter = &SERIAL_PORT_MONITOR;
+
32 
+
33 }
+ diff --git a/docs/html/Printer_8h_source.html b/docs/html/Printer_8h_source.html index 0906c1e..ee8f35d 100644 --- a/docs/html/Printer_8h_source.html +++ b/docs/html/Printer_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Printer.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/Printer.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Printer.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_PRINTER_H
26 #define AUNIT_PRINTER_H
27 
28 class Print;
29 
30 namespace aunit {
31 
41 class Printer {
42  public:
48  static Print* getPrinter() { return sPrinter; }
49 
51  static void setPrinter(Print* printer) { sPrinter = printer; }
52 
53  private:
54  // Disable copy-constructor and assignment operator
55  Printer(const Printer&) = delete;
56  Printer& operator=(const Printer&) = delete;
57 
58  static Print* sPrinter;
59 };
60 
61 }
62 
63 #endif
static void setPrinter(Print *printer)
Set the printer.
Definition: Printer.h:51
-
Utility class that provides a level of indirection to the Print class where test results can be sent...
Definition: Printer.h:41
- -
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_PRINTER_H
+
26 #define AUNIT_PRINTER_H
+
27 
+
28 class Print;
+
29 
+
30 namespace aunit {
+
31 
+
41 class Printer {
+
42  public:
+
48  static Print* getPrinter() { return sPrinter; }
+
49 
+
51  static void setPrinter(Print* printer) { sPrinter = printer; }
+
52 
+
53  private:
+
54  // Disable copy-constructor and assignment operator
+
55  Printer(const Printer&) = delete;
+
56  Printer& operator=(const Printer&) = delete;
+
57 
+
58  static Print* sPrinter;
+
59 };
+
60 
+
61 }
+
62 
+
63 #endif
+
Utility class that provides a level of indirection to the Print class where test results can be sent.
Definition: Printer.h:41
+
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
+
static void setPrinter(Print *printer)
Set the printer.
Definition: Printer.h:51
diff --git a/docs/html/README_8md_source.html b/docs/html/README_8md_source.html deleted file mode 100644 index 2b1cc97..0000000 --- a/docs/html/README_8md_source.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - -AUnit: /home/brian/dev/AUnit/src/aunit/fake/README.md Source File - - - - - - - - - -
-
- - - - - - -
-
AUnit -  1.3.2 -
-
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
-
-
- - - - - - - -
- -
-
- - -
- -
- -
-
-
/home/brian/dev/AUnit/src/aunit/fake/README.md
-
-
-
1 # Fake Arduino Classes
2 
3 This directory contains fake versions of some Arduino classes for the purposes
4 of unit testing. These header files are *not* included automatically by the
5 `#include <AUnit.h>` preprocessor directive. The various fake classes must be
6 included manually just after the `<AUnit.h>` is included. The fake classes
7 live in the `aunit::fake` namespace.
8 
9 ## FakePrint
10 
11 The `FakePrint` class is an implementation of the
12 [Print](https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/Print.h)
13 class which is the base class of the
14 [HardwareSerial](https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/HardwareSerial.h)
15 and other output classes. The `Serial` global object is an instance of the
16 `HardwareSerial` class. If a user-defined class or method is defined to use an
17 instance of the `Print` object, instead of hardcoding a dependency to the
18 `Serial` instance, then an instance of the `FakePrint` class can be substituted
19 and used to write unit tests for the user-defined class or method.
20 
21 Let's say the user-defined class is called `Greeter` and a method called
22 `greet()` prints something out to `Serial`:
23 
24 ```C++
25 class Greeter {
26  public:
27  Greeter(Print& printer):
28  mPrinter(printer) {}
29 
30  void greet(int n) {
31  mPrinter.print("hello ");
32  mPrinter.print(n);
33  mPrinter.println(" world(s)");
34  }
35 
36  private:
37  Print& mPrinter;
38 };
39 ```
40 
41 If we want to verify that the `Greeter::greet()` method prints what is expected,
42 we inject an instance of `FakePrint` (instead of `Serial`) in a test called
43 `GreeterTest.ino`:
44 
45 ```C++
46 #line 2 "GreeterTest.ino"
47 
48 #include <AUnit.h>
49 #include <aunit/fake/FakePrint.h>
50 
51 using namespace aunit;
52 using namespace aunit::fake;
53 
54 test(GreeterTest, greet) {
55  FakePrint fakePrint;
56  Greeter greeter(fakePrint);
57 
58  greeter.greet(1);
59  assertEqual("hello 1 world(s)\r\n", fakePrint.getBuffer());
60  fakePrint.flush();
61 
62  greeter.greet(2);
63  assertEqual("hello 2 world(s)\r\n", fakePrint.getBuffer());
64  fakePrint.flush();
65 }
66 
67 void setup() {
68  delay(1000);
69  Serial.begin(115200);
70  while (! Serial); // Wait until Serial is ready - Leonardo/Micro
71 }
72 
73 void loop() {
74  TestRunner::run();
75 }
76 ```
- - - - diff --git a/docs/html/TestAgain_8cpp_source.html b/docs/html/TestAgain_8cpp_source.html index 2e8fc58..0acce7a 100644 --- a/docs/html/TestAgain_8cpp_source.html +++ b/docs/html/TestAgain_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestAgain.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestAgain.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestAgain.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include "TestAgain.h"
26 
27 namespace aunit {
28 
30  again();
31 }
32 
33 }
34 
virtual void again()=0
User-provided test case.
- -
void loop() override
Calls the user-provided again() method multiple times until the user code explicitly resolves the tes...
Definition: TestAgain.cpp:29
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include "TestAgain.h"
+
26 
+
27 namespace aunit {
+
28 
+ +
30  again();
+
31 }
+
32 
+
33 }
+
34 
+
void loop() override
Calls the user-provided again() method multiple times until the user code explicitly resolves the tes...
Definition: TestAgain.cpp:29
+
virtual void again()=0
User-provided test case.
diff --git a/docs/html/TestAgain_8h_source.html b/docs/html/TestAgain_8h_source.html index 4150fe2..de4e09e 100644 --- a/docs/html/TestAgain_8h_source.html +++ b/docs/html/TestAgain_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestAgain.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestAgain.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestAgain.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_TEST_AGAIN_H
26 #define AUNIT_TEST_AGAIN_H
27 
28 #include <stdint.h>
29 #include "FCString.h"
30 #include "MetaAssertion.h"
31 
32 class __FlashStringHelper;
33 
34 namespace aunit {
35 
37 class TestAgain: public MetaAssertion {
38  public:
40  TestAgain() {}
41 
47  void loop() override;
48 
50  virtual void again() = 0;
51 
52  private:
53  // Disable copy-constructor and assignment operator
54  TestAgain(const TestAgain&) = delete;
55  TestAgain& operator=(const TestAgain&) = delete;
56 };
57 
58 }
59 
60 #endif
virtual void again()=0
User-provided test case.
-
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
-
Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that ...
Definition: MetaAssertion.h:42
-
TestAgain()
Constructor.
Definition: TestAgain.h:40
- -
void loop() override
Calls the user-provided again() method multiple times until the user code explicitly resolves the tes...
Definition: TestAgain.cpp:29
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_TEST_AGAIN_H
+
26 #define AUNIT_TEST_AGAIN_H
+
27 
+
28 #include <stdint.h>
+
29 #include "FCString.h"
+
30 #include "MetaAssertion.h"
+
31 
+
32 class __FlashStringHelper;
+
33 
+
34 namespace aunit {
+
35 
+
37 class TestAgain: public MetaAssertion {
+
38  public:
+
40  TestAgain() {}
+
41 
+
47  void loop() override;
+
48 
+
50  virtual void again() = 0;
+
51 
+
52  private:
+
53  // Disable copy-constructor and assignment operator
+
54  TestAgain(const TestAgain&) = delete;
+
55  TestAgain& operator=(const TestAgain&) = delete;
+
56 };
+
57 
+
58 }
+
59 
+
60 #endif
+
Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that ...
Definition: MetaAssertion.h:42
+
void loop() override
Calls the user-provided again() method multiple times until the user code explicitly resolves the tes...
Definition: TestAgain.cpp:29
+
virtual void again()=0
User-provided test case.
+
TestAgain()
Constructor.
Definition: TestAgain.h:40
+
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
diff --git a/docs/html/TestMacros_8h.html b/docs/html/TestMacros_8h.html index 86e32f8..3d4d05f 100644 --- a/docs/html/TestMacros_8h.html +++ b/docs/html/TestMacros_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestMacros.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/TestMacros.h File Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestMacros.h File Reference
- -

Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header. -More...

#include <stdint.h>
#include <Arduino.h>
#include "Flash.h"
@@ -82,26 +82,31 @@
Include dependency graph for TestMacros.h:
-
- - - - - - - - - - +
+ + + + + + + + + + + + + +
This graph shows which files directly or indirectly include this file:
-
- - - +
+ + + +
@@ -110,7 +115,7 @@

Macros

#define test(...)   GET_TEST(__VA_ARGS__, TEST2, TEST1)(__VA_ARGS__) - Macro to define a test that will be run only once. More...
+ Macro to define a test that will be run only once. More...
  #define GET_TEST(_1, _2, NAME, ...)   NAME @@ -120,7 +125,7 @@ #define TEST2(suiteName, name)   #define testing(...)   GET_TESTING(__VA_ARGS__, TESTING2, TESTING1)(__VA_ARGS__) - Macro to define a test that will run repeatly upon each iteration of the global loop() method, stopping when the something calls Test::pass(), Test::fail() or Test::skip(). More...
+ Macro to define a test that will run repeatly upon each iteration of the global loop() method, stopping when the something calls Test::pass(), Test::fail() or Test::skip(). More...
  #define GET_TESTING(_1, _2, NAME, ...)   NAME @@ -130,7 +135,7 @@ #define TESTING2(suiteName, name)   #define externTest(...)   GET_EXTERN_TEST(__VA_ARGS__, EXTERN_TEST2, EXTERN_TEST1)(__VA_ARGS__) - Create an extern reference to a test() test case object defined elsewhere. More...
+ Create an extern reference to a test() test case object defined elsewhere. More...
  #define GET_EXTERN_TEST(_1, _2, NAME, ...)   NAME @@ -140,7 +145,7 @@ #define EXTERN_TEST2(suiteName, name)   #define externTesting(...)   GET_EXTERN_TESTING(__VA_ARGS__, EXTERN_TESTING2, EXTERN_TESTING1)(__VA_ARGS__) - Create an extern reference to a testing() test case object defined elsewhere. More...
+ Create an extern reference to a testing() test case object defined elsewhere. More...
  #define GET_EXTERN_TESTING(_1, _2, NAME, ...)   NAME @@ -150,20 +155,20 @@ #define EXTERN_TESTING2(suiteName, name)   #define testF(testClass, name) - Create a test that is derived from a custom TestOnce class. More...
+ Create a test that is derived from a custom TestOnce class. More...
  #define testingF(testClass, name) - Create a test that is derived from a custom TestAgain class. More...
+ Create a test that is derived from a custom TestAgain class. More...
  #define externTestF(testClass, name) - Create an extern reference to a testF() test case object defined elsewhere. More...
+ Create an extern reference to a testF() test case object defined elsewhere. More...
  #define externTestingF(testClass, name) - Create an extern reference to a testingF() test case object defined elsewhere. More...
+ Create an extern reference to a testingF() test case object defined elsewhere. More...
 

Detailed Description

-

Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header.

+

Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header.

Definition in file TestMacros.h.

Macro Definition Documentation

@@ -182,8 +187,12 @@

-Value:
public:\
test_##name();\
void once();\
};\
extern test_##name test_##name##_instance
virtual void once()=0
User-provided test case.
-
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
+Value:
class test_##name : public aunit::TestOnce {\
+
public:\
+
test_##name();\
+
void once();\
+
};\
+
extern test_##name test_##name##_instance

Definition at line 139 of file TestMacros.h.

@@ -214,8 +223,12 @@

-Value:
public:\
suiteName##_##name();\
void once();\
};\
extern suiteName##_##name suiteName##_##name##_instance
virtual void once()=0
User-provided test case.
-
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
+Value:
class suiteName##_##name : public aunit::TestOnce {\
+
public:\
+
suiteName##_##name();\
+
void once();\
+
};\
+
extern suiteName##_##name suiteName##_##name##_instance

Definition at line 147 of file TestMacros.h.

@@ -236,8 +249,12 @@

-Value:
public:\
test_ ## name();\
void again();\
};\
extern test_##name test_##name##_instance
virtual void again()=0
User-provided test case.
-
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
+Value:
class test_ ## name : public aunit::TestAgain {\
+
public:\
+
test_ ## name();\
+
void again();\
+
};\
+
extern test_##name test_##name##_instance

Definition at line 169 of file TestMacros.h.

@@ -268,8 +285,12 @@

-Value:
public:\
suiteName##_ ## name();\
void again();\
};\
extern suiteName##_##name suiteName##_##name##_instance
virtual void again()=0
User-provided test case.
-
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
+Value:
class suiteName##_ ## name : public aunit::TestAgain {\
+
public:\
+
suiteName##_ ## name();\
+
void again();\
+
};\
+
extern suiteName##_##name suiteName##_##name##_instance

Definition at line 177 of file TestMacros.h.

@@ -291,9 +312,9 @@

-

Create an extern reference to a test() test case object defined elsewhere.

+

Create an extern reference to a test() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

-

Two versions are supported: externTest(name) and externTest(suiteName, name). The 2-argument externTest(suiteName, name) is a convenience macro which is identical to externTest(suiteName_name).

+

Two versions are supported: externTest(name) and externTest(suiteName, name). The 2-argument externTest(suiteName, name) is a convenience macro which is identical to externTest(suiteName_name).

Definition at line 134 of file TestMacros.h.

@@ -324,8 +345,14 @@

-Value:
class testClass ## _ ## name : public testClass {\
public:\
testClass ## _ ## name();\
void once() override;\
};\
extern testClass ## _ ## name testClass##_##name##_instance
-

Create an extern reference to a testF() test case object defined elsewhere.

+Value:
class testClass ## _ ## name : public testClass {\
+
public:\
+
testClass ## _ ## name();\
+
void once() override;\
+
};\
+
extern testClass ## _ ## name testClass##_##name##_instance
+
+

Create an extern reference to a testF() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

Definition at line 225 of file TestMacros.h.

@@ -348,9 +375,9 @@

-

Create an extern reference to a testing() test case object defined elsewhere.

+

Create an extern reference to a testing() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

-

Two versions are supported: externTesting(name) and externTesting(suiteName, name).

+

Two versions are supported: externTesting(name) and externTesting(suiteName, name).

Definition at line 164 of file TestMacros.h.

@@ -381,8 +408,14 @@

-Value:
class testClass ## _ ## name : public testClass {\
public:\
testClass ## _ ## name();\
void again() override;\
};\
extern testClass ## _ ## name testClass##_##name##_instance
-

Create an extern reference to a testingF() test case object defined elsewhere.

+Value:
class testClass ## _ ## name : public testClass {\
+
public:\
+
testClass ## _ ## name();\
+
void again() override;\
+
};\
+
extern testClass ## _ ## name testClass##_##name##_instance
+
+

Create an extern reference to a testingF() test case object defined elsewhere.

This is only necessary if you use assertTestXxx() or checkTestXxx() when the test is in another file (or defined after the assertion on it).

Definition at line 239 of file TestMacros.h.

@@ -406,7 +439,7 @@

Macro to define a test that will be run only once.

-

Two versions are supported: test(name) and test(suiteName, name). The 2-argument test(suiteName, name) is a convenience macro which is identical to test(suiteName_name).

+

Two versions are supported: test(name) and test(suiteName, name). The 2-argument test(suiteName, name) is a convenience macro which is identical to test(suiteName_name).

Definition at line 62 of file TestMacros.h.

@@ -427,8 +460,15 @@

-Value:
public:\
test_##name();\
void once() override;\
} test_##name##_instance;\
test_##name :: test_##name() {\
init(AUNIT_F(#name)); \
}\
void test_##name :: once()
virtual void once()=0
User-provided test case.
-
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
+Value:
class test_##name : public aunit::TestOnce {\
+
public:\
+
test_##name();\
+
void once() override;\
+
} test_##name##_instance;\
+
test_##name :: test_##name() {\
+
init(AUNIT_F(#name)); \
+
}\
+
void test_##name :: once()

Definition at line 67 of file TestMacros.h.

@@ -459,8 +499,15 @@

-Value:
public:\
suiteName##_##name();\
void once() override;\
} suiteName##_##name##_instance;\
suiteName##_##name :: suiteName##_##name() {\
init(AUNIT_F(#suiteName "_" #name)); \
}\
void suiteName##_##name :: once()
virtual void once()=0
User-provided test case.
-
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
+Value:
class suiteName##_##name : public aunit::TestOnce {\
+
public:\
+
suiteName##_##name();\
+
void once() override;\
+
} suiteName##_##name##_instance;\
+
suiteName##_##name :: suiteName##_##name() {\
+
init(AUNIT_F(#suiteName "_" #name)); \
+
}\
+
void suiteName##_##name :: once()

Definition at line 78 of file TestMacros.h.

@@ -491,7 +538,16 @@

-Value:
class testClass ## _ ## name : public testClass {\
public:\
testClass ## _ ## name();\
void once() override;\
} testClass ## _ ## name ## _instance;\
testClass ## _ ## name :: testClass ## _ ## name() {\
init(AUNIT_F(#testClass "_" #name));\
}\
void testClass ## _ ## name :: once()
+Value:
class testClass ## _ ## name : public testClass {\
+
public:\
+
testClass ## _ ## name();\
+
void once() override;\
+
} testClass ## _ ## name ## _instance;\
+
testClass ## _ ## name :: testClass ## _ ## name() {\
+
init(AUNIT_F(#testClass "_" #name));\
+
}\
+
void testClass ## _ ## name :: once()
+

Create a test that is derived from a custom TestOnce class.

The name of the instance is prefixed by '{testClass}_' to avoid name collisions with similarly named tests using other fixtures.

@@ -516,7 +572,7 @@

Macro to define a test that will run repeatly upon each iteration of the global loop() method, stopping when the something calls Test::pass(), Test::fail() or Test::skip().

-

Two versions are supported: testing(name) and testing(suiteName, name). The 2-argument testing(suiteName, name) is a convenience macro which is identical to testing(suiteName_name).

+

Two versions are supported: testing(name) and testing(suiteName, name). The 2-argument testing(suiteName, name) is a convenience macro which is identical to testing(suiteName_name).

Definition at line 98 of file TestMacros.h.

@@ -537,8 +593,15 @@

-Value:
public:\
test_##name();\
void again() override;\
} test_##name##_instance;\
test_##name :: test_##name() {\
init(AUNIT_F(#name));\
}\
void test_##name :: again()
virtual void again()=0
User-provided test case.
-
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
+Value:
class test_##name : public aunit::TestAgain {\
+
public:\
+
test_##name();\
+
void again() override;\
+
} test_##name##_instance;\
+
test_##name :: test_##name() {\
+
init(AUNIT_F(#name));\
+
}\
+
void test_##name :: again()

Definition at line 103 of file TestMacros.h.

@@ -569,8 +632,15 @@

-Value:
public:\
suiteName##_##name();\
void again() override;\
} suiteName##_##name##_instance;\
suiteName##_##name :: suiteName##_##name() {\
init(AUNIT_F(#suiteName "_" #name));\
}\
void suiteName##_##name :: again()
virtual void again()=0
User-provided test case.
-
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
+Value:
class suiteName##_##name : public aunit::TestAgain {\
+
public:\
+
suiteName##_##name();\
+
void again() override;\
+
} suiteName##_##name##_instance;\
+
suiteName##_##name :: suiteName##_##name() {\
+
init(AUNIT_F(#suiteName "_" #name));\
+
}\
+
void suiteName##_##name :: again()

Definition at line 114 of file TestMacros.h.

@@ -601,21 +671,34 @@

-Value:
class testClass ## _ ## name : public testClass {\
public:\
testClass ## _ ## name();\
void again() override;\
} testClass ## _ ## name ## _instance;\
testClass ## _ ## name :: testClass ## _ ## name() {\
init(AUNIT_F(#testClass "_" #name));\
}\
void testClass ## _ ## name :: again()
+Value:
class testClass ## _ ## name : public testClass {\
+
public:\
+
testClass ## _ ## name();\
+
void again() override;\
+
} testClass ## _ ## name ## _instance;\
+
testClass ## _ ## name :: testClass ## _ ## name() {\
+
init(AUNIT_F(#testClass "_" #name));\
+
}\
+
void testClass ## _ ## name :: again()
+

Create a test that is derived from a custom TestAgain class.

The name of the instance is prefixed by '{testClass}_' to avoid name collisions with similarly named tests using other fixtures.

-

Note that test(suiteName, name) is different than testF(className, name), but there will be a name collision if suiteName is the same as className.

+

Note that test(suiteName, name) is different than testF(className, name), but there will be a name collision if suiteName is the same as className.

Definition at line 209 of file TestMacros.h.

+
virtual void again()=0
User-provided test case.
+
Similar to TestOnce but performs the user-defined test multiple times.
Definition: TestAgain.h:37
+
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
+
virtual void once()=0
User-provided test case.
diff --git a/docs/html/TestMacros_8h__dep__incl.map b/docs/html/TestMacros_8h__dep__incl.map index 47a86c5..af81d27 100644 --- a/docs/html/TestMacros_8h__dep__incl.map +++ b/docs/html/TestMacros_8h__dep__incl.map @@ -1,4 +1,5 @@ - - - + + + + diff --git a/docs/html/TestMacros_8h__dep__incl.md5 b/docs/html/TestMacros_8h__dep__incl.md5 index 3846c0c..fe5290b 100644 --- a/docs/html/TestMacros_8h__dep__incl.md5 +++ b/docs/html/TestMacros_8h__dep__incl.md5 @@ -1 +1 @@ -96d41fe938e9bd2f41609fc9513de346 \ No newline at end of file +4a610e3832ac4022d1bb988986901048 \ No newline at end of file diff --git a/docs/html/TestMacros_8h__dep__incl.png b/docs/html/TestMacros_8h__dep__incl.png index 9313adb..27a7552 100644 Binary files a/docs/html/TestMacros_8h__dep__incl.png and b/docs/html/TestMacros_8h__dep__incl.png differ diff --git a/docs/html/TestMacros_8h__incl.map b/docs/html/TestMacros_8h__incl.map index a96b809..e01de40 100644 --- a/docs/html/TestMacros_8h__incl.map +++ b/docs/html/TestMacros_8h__incl.map @@ -1,11 +1,15 @@ - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/docs/html/TestMacros_8h__incl.md5 b/docs/html/TestMacros_8h__incl.md5 index f47d5d2..a061aff 100644 --- a/docs/html/TestMacros_8h__incl.md5 +++ b/docs/html/TestMacros_8h__incl.md5 @@ -1 +1 @@ -2c30189d9ba27dee60e99d0cfa06277e \ No newline at end of file +d7cb566ae09c1c94cc1cbf08e3ccaabb \ No newline at end of file diff --git a/docs/html/TestMacros_8h__incl.png b/docs/html/TestMacros_8h__incl.png index 0a73551..7d40b71 100644 Binary files a/docs/html/TestMacros_8h__incl.png and b/docs/html/TestMacros_8h__incl.png differ diff --git a/docs/html/TestMacros_8h_source.html b/docs/html/TestMacros_8h_source.html index 8f6513d..12374ca 100644 --- a/docs/html/TestMacros_8h_source.html +++ b/docs/html/TestMacros_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestMacros.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestMacros.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@

- + +/* @license-end */
TestMacros.h

-Go to the documentation of this file.
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
36 #ifndef AUNIT_TEST_MACROS_H
37 #define AUNIT_TEST_MACROS_H
38 
39 #include <stdint.h>
40 #include <Arduino.h> // F() macro
41 #include "Flash.h" // AUNIT_F() macro
42 #include "FCString.h"
43 #include "TestOnce.h"
44 #include "TestAgain.h"
45 
46 // On the ESP8266 platform, the F() string cannot be placed in an inline
47 // context, because it interferes with other PROGMEM strings. See
48 // https://github.com/esp8266/Arduino/issues/3369. The solution was to move the
49 // constructor definition out from an inline function into a normal function
50 // defined outside of the class declaration. Unfortunately, if the user code
51 // has any other usage of F() in an inline context, those interfere with the
52 // F() used below. I have abandoned supporting the F() macro for these test*()
53 // macros on the ESP8266.
54 
62 #define test(...) \
63  GET_TEST(__VA_ARGS__, TEST2, TEST1)(__VA_ARGS__)
64 
65 #define GET_TEST(_1, _2, NAME, ...) NAME
66 
67 #define TEST1(name) \
68 class test_##name : public aunit::TestOnce {\
69 public:\
70  test_##name();\
71  void once() override;\
72 } test_##name##_instance;\
73 test_##name :: test_##name() {\
74  init(AUNIT_F(#name)); \
75 }\
76 void test_##name :: once()
77 
78 #define TEST2(suiteName, name) \
79 class suiteName##_##name : public aunit::TestOnce {\
80 public:\
81  suiteName##_##name();\
82  void once() override;\
83 } suiteName##_##name##_instance;\
84 suiteName##_##name :: suiteName##_##name() {\
85  init(AUNIT_F(#suiteName "_" #name)); \
86 }\
87 void suiteName##_##name :: once()
88 
98 #define testing(...) \
99  GET_TESTING(__VA_ARGS__, TESTING2, TESTING1)(__VA_ARGS__)
100 
101 #define GET_TESTING(_1, _2, NAME, ...) NAME
102 
103 #define TESTING1(name) \
104 class test_##name : public aunit::TestAgain {\
105 public:\
106  test_##name();\
107  void again() override;\
108 } test_##name##_instance;\
109 test_##name :: test_##name() {\
110  init(AUNIT_F(#name));\
111 }\
112 void test_##name :: again()
113 
114 #define TESTING2(suiteName, name) \
115 class suiteName##_##name : public aunit::TestAgain {\
116 public:\
117  suiteName##_##name();\
118  void again() override;\
119 } suiteName##_##name##_instance;\
120 suiteName##_##name :: suiteName##_##name() {\
121  init(AUNIT_F(#suiteName "_" #name));\
122 }\
123 void suiteName##_##name :: again()
124 
134 #define externTest(...) \
135  GET_EXTERN_TEST(__VA_ARGS__, EXTERN_TEST2, EXTERN_TEST1)(__VA_ARGS__)
136 
137 #define GET_EXTERN_TEST(_1, _2, NAME, ...) NAME
138 
139 #define EXTERN_TEST1(name) \
140 class test_##name : public aunit::TestOnce {\
141 public:\
142  test_##name();\
143  void once();\
144 };\
145 extern test_##name test_##name##_instance
146 
147 #define EXTERN_TEST2(suiteName, name) \
148 class suiteName##_##name : public aunit::TestOnce {\
149 public:\
150  suiteName##_##name();\
151  void once();\
152 };\
153 extern suiteName##_##name suiteName##_##name##_instance
154 
164 #define externTesting(...) \
165  GET_EXTERN_TESTING(__VA_ARGS__, EXTERN_TESTING2, EXTERN_TESTING1)(__VA_ARGS__)
166 
167 #define GET_EXTERN_TESTING(_1, _2, NAME, ...) NAME
168 
169 #define EXTERN_TESTING1(name) \
170 class test_ ## name : public aunit::TestAgain {\
171 public:\
172  test_ ## name();\
173  void again();\
174 };\
175 extern test_##name test_##name##_instance
176 
177 #define EXTERN_TESTING2(suiteName, name) \
178 class suiteName##_ ## name : public aunit::TestAgain {\
179 public:\
180  suiteName##_ ## name();\
181  void again();\
182 };\
183 extern suiteName##_##name suiteName##_##name##_instance
184 
190 #define testF(testClass, name) \
191 class testClass ## _ ## name : public testClass {\
192 public:\
193  testClass ## _ ## name();\
194  void once() override;\
195 } testClass ## _ ## name ## _instance;\
196 testClass ## _ ## name :: testClass ## _ ## name() {\
197  init(AUNIT_F(#testClass "_" #name));\
198 }\
199 void testClass ## _ ## name :: once()
200 
209 #define testingF(testClass, name) \
210 class testClass ## _ ## name : public testClass {\
211 public:\
212  testClass ## _ ## name();\
213  void again() override;\
214 } testClass ## _ ## name ## _instance;\
215 testClass ## _ ## name :: testClass ## _ ## name() {\
216  init(AUNIT_F(#testClass "_" #name));\
217 }\
218 void testClass ## _ ## name :: again()
219 
225 #define externTestF(testClass, name) \
226 class testClass ## _ ## name : public testClass {\
227 public:\
228  testClass ## _ ## name();\
229  void once() override;\
230 };\
231 extern testClass ## _ ## name testClass##_##name##_instance
232 
239 #define externTestingF(testClass, name) \
240 class testClass ## _ ## name : public testClass {\
241 public:\
242  testClass ## _ ## name();\
243  void again() override;\
244 };\
245 extern testClass ## _ ## name testClass##_##name##_instance
246 
247 #endif
Various macros to smooth over the differences among the various platforms with regards to their suppo...
+Go to the documentation of this file.
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
36 #ifndef AUNIT_TEST_MACROS_H
+
37 #define AUNIT_TEST_MACROS_H
+
38 
+
39 #include <stdint.h>
+
40 #include <Arduino.h> // F() macro
+
41 #include "Flash.h" // AUNIT_F() macro
+
42 #include "FCString.h"
+
43 #include "TestOnce.h"
+
44 #include "TestAgain.h"
+
45 
+
46 // On the ESP8266 platform, the F() string cannot be placed in an inline
+
47 // context, because it interferes with other PROGMEM strings. See
+
48 // https://github.com/esp8266/Arduino/issues/3369. The solution was to move the
+
49 // constructor definition out from an inline function into a normal function
+
50 // defined outside of the class declaration. Unfortunately, if the user code
+
51 // has any other usage of F() in an inline context, those interfere with the
+
52 // F() used below. I have abandoned supporting the F() macro for these test*()
+
53 // macros on the ESP8266.
+
54 
+
62 #define test(...) \
+
63  GET_TEST(__VA_ARGS__, TEST2, TEST1)(__VA_ARGS__)
+
64 
+
65 #define GET_TEST(_1, _2, NAME, ...) NAME
+
66 
+
67 #define TEST1(name) \
+
68 class test_##name : public aunit::TestOnce {\
+
69 public:\
+
70  test_##name();\
+
71  void once() override;\
+
72 } test_##name##_instance;\
+
73 test_##name :: test_##name() {\
+
74  init(AUNIT_F(#name)); \
+
75 }\
+
76 void test_##name :: once()
+
77 
+
78 #define TEST2(suiteName, name) \
+
79 class suiteName##_##name : public aunit::TestOnce {\
+
80 public:\
+
81  suiteName##_##name();\
+
82  void once() override;\
+
83 } suiteName##_##name##_instance;\
+
84 suiteName##_##name :: suiteName##_##name() {\
+
85  init(AUNIT_F(#suiteName "_" #name)); \
+
86 }\
+
87 void suiteName##_##name :: once()
+
88 
+
98 #define testing(...) \
+
99  GET_TESTING(__VA_ARGS__, TESTING2, TESTING1)(__VA_ARGS__)
+
100 
+
101 #define GET_TESTING(_1, _2, NAME, ...) NAME
+
102 
+
103 #define TESTING1(name) \
+
104 class test_##name : public aunit::TestAgain {\
+
105 public:\
+
106  test_##name();\
+
107  void again() override;\
+
108 } test_##name##_instance;\
+
109 test_##name :: test_##name() {\
+
110  init(AUNIT_F(#name));\
+
111 }\
+
112 void test_##name :: again()
+
113 
+
114 #define TESTING2(suiteName, name) \
+
115 class suiteName##_##name : public aunit::TestAgain {\
+
116 public:\
+
117  suiteName##_##name();\
+
118  void again() override;\
+
119 } suiteName##_##name##_instance;\
+
120 suiteName##_##name :: suiteName##_##name() {\
+
121  init(AUNIT_F(#suiteName "_" #name));\
+
122 }\
+
123 void suiteName##_##name :: again()
+
124 
+
134 #define externTest(...) \
+
135  GET_EXTERN_TEST(__VA_ARGS__, EXTERN_TEST2, EXTERN_TEST1)(__VA_ARGS__)
+
136 
+
137 #define GET_EXTERN_TEST(_1, _2, NAME, ...) NAME
+
138 
+
139 #define EXTERN_TEST1(name) \
+
140 class test_##name : public aunit::TestOnce {\
+
141 public:\
+
142  test_##name();\
+
143  void once();\
+
144 };\
+
145 extern test_##name test_##name##_instance
+
146 
+
147 #define EXTERN_TEST2(suiteName, name) \
+
148 class suiteName##_##name : public aunit::TestOnce {\
+
149 public:\
+
150  suiteName##_##name();\
+
151  void once();\
+
152 };\
+
153 extern suiteName##_##name suiteName##_##name##_instance
+
154 
+
164 #define externTesting(...) \
+
165  GET_EXTERN_TESTING(__VA_ARGS__, EXTERN_TESTING2, EXTERN_TESTING1)(__VA_ARGS__)
+
166 
+
167 #define GET_EXTERN_TESTING(_1, _2, NAME, ...) NAME
+
168 
+
169 #define EXTERN_TESTING1(name) \
+
170 class test_ ## name : public aunit::TestAgain {\
+
171 public:\
+
172  test_ ## name();\
+
173  void again();\
+
174 };\
+
175 extern test_##name test_##name##_instance
+
176 
+
177 #define EXTERN_TESTING2(suiteName, name) \
+
178 class suiteName##_ ## name : public aunit::TestAgain {\
+
179 public:\
+
180  suiteName##_ ## name();\
+
181  void again();\
+
182 };\
+
183 extern suiteName##_##name suiteName##_##name##_instance
+
184 
+
190 #define testF(testClass, name) \
+
191 class testClass ## _ ## name : public testClass {\
+
192 public:\
+
193  testClass ## _ ## name();\
+
194  void once() override;\
+
195 } testClass ## _ ## name ## _instance;\
+
196 testClass ## _ ## name :: testClass ## _ ## name() {\
+
197  init(AUNIT_F(#testClass "_" #name));\
+
198 }\
+
199 void testClass ## _ ## name :: once()
+
200 
+
209 #define testingF(testClass, name) \
+
210 class testClass ## _ ## name : public testClass {\
+
211 public:\
+
212  testClass ## _ ## name();\
+
213  void again() override;\
+
214 } testClass ## _ ## name ## _instance;\
+
215 testClass ## _ ## name :: testClass ## _ ## name() {\
+
216  init(AUNIT_F(#testClass "_" #name));\
+
217 }\
+
218 void testClass ## _ ## name :: again()
+
219 
+
225 #define externTestF(testClass, name) \
+
226 class testClass ## _ ## name : public testClass {\
+
227 public:\
+
228  testClass ## _ ## name();\
+
229  void once() override;\
+
230 };\
+
231 extern testClass ## _ ## name testClass##_##name##_instance
+
232 
+
239 #define externTestingF(testClass, name) \
+
240 class testClass ## _ ## name : public testClass {\
+
241 public:\
+
242  testClass ## _ ## name();\
+
243  void again() override;\
+
244 };\
+
245 extern testClass ## _ ## name testClass##_##name##_instance
+
246 
+
247 #endif
+ diff --git a/docs/html/TestOnce_8cpp_source.html b/docs/html/TestOnce_8cpp_source.html index 1530e8f..88b19bc 100644 --- a/docs/html/TestOnce_8cpp_source.html +++ b/docs/html/TestOnce_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestOnce.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestOnce.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestOnce.cpp

-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include "TestOnce.h"
26 
27 namespace aunit {
28 
30  once();
31  if (isNotDone()) {
32  pass();
33  }
34 }
35 
36 }
virtual void once()=0
User-provided test case.
-
bool isNotDone() const
Return true if test is not has been asserted.
Definition: Test.h:199
- -
void pass()
Mark the test as passed.
Definition: Test.h:256
-
void loop() override
Calls the user-provided once() method.
Definition: TestOnce.cpp:29
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include "TestOnce.h"
+
26 
+
27 namespace aunit {
+
28 
+ +
30  once();
+
31  if (isNotDone()) {
+
32  pass();
+
33  }
+
34 }
+
35 
+
36 }
+
bool isNotDone() const
Return true if test is not has been asserted.
Definition: Test.h:199
+
void pass()
Mark the test as passed.
Definition: Test.h:256
+
void loop() override
Calls the user-provided once() method.
Definition: TestOnce.cpp:29
+
virtual void once()=0
User-provided test case.
diff --git a/docs/html/TestOnce_8h_source.html b/docs/html/TestOnce_8h_source.html index 429e863..6ecac6f 100644 --- a/docs/html/TestOnce_8h_source.html +++ b/docs/html/TestOnce_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestOnce.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestOnce.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestOnce.h

-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
28 #ifndef AUNIT_TEST_ONCE_H
29 #define AUNIT_TEST_ONCE_H
30 
31 #include <stdint.h>
32 #include "FCString.h"
33 #include "MetaAssertion.h"
34 
35 class __FlashStringHelper;
36 
37 namespace aunit {
38 
40 class TestOnce: public MetaAssertion {
41  public:
43  TestOnce() {}
44 
50  void loop() override;
51 
53  virtual void once() = 0;
54 
55  private:
56  // Disable copy-constructor and assignment operator
57  TestOnce(const TestOnce&) = delete;
58  TestOnce& operator=(const TestOnce&) = delete;
59 };
60 
61 }
62 
63 #endif
virtual void once()=0
User-provided test case.
-
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
-
Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that ...
Definition: MetaAssertion.h:42
- -
TestOnce()
Constructor.
Definition: TestOnce.h:43
-
void loop() override
Calls the user-provided once() method.
Definition: TestOnce.cpp:29
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
28 #ifndef AUNIT_TEST_ONCE_H
+
29 #define AUNIT_TEST_ONCE_H
+
30 
+
31 #include <stdint.h>
+
32 #include "FCString.h"
+
33 #include "MetaAssertion.h"
+
34 
+
35 class __FlashStringHelper;
+
36 
+
37 namespace aunit {
+
38 
+
40 class TestOnce: public MetaAssertion {
+
41  public:
+
43  TestOnce() {}
+
44 
+
50  void loop() override;
+
51 
+
53  virtual void once() = 0;
+
54 
+
55  private:
+
56  // Disable copy-constructor and assignment operator
+
57  TestOnce(const TestOnce&) = delete;
+
58  TestOnce& operator=(const TestOnce&) = delete;
+
59 };
+
60 
+
61 }
+
62 
+
63 #endif
+
Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that ...
Definition: MetaAssertion.h:42
+
TestOnce()
Constructor.
Definition: TestOnce.h:43
+
Similar to TestAgain but performs user-defined test only once.
Definition: TestOnce.h:40
+
void loop() override
Calls the user-provided once() method.
Definition: TestOnce.cpp:29
+
virtual void once()=0
User-provided test case.
diff --git a/docs/html/TestRunner_8cpp_source.html b/docs/html/TestRunner_8cpp_source.html index 76ebb65..5376c6d 100644 --- a/docs/html/TestRunner_8cpp_source.html +++ b/docs/html/TestRunner_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestRunner.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestRunner.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestRunner.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include <Arduino.h> // definition of 'Serial'
26 #include <string.h>
27 #include <stdint.h>
28 #include "FCString.h"
29 #include "Compare.h"
30 #include "Printer.h"
31 #include "Verbosity.h"
32 #include "Test.h"
33 #include "TestRunner.h"
34 #include "string_util.h"
35 
36 namespace aunit {
37 
38 // Use a function static singleton to avoid the static initialization ordering
39 // problem. It's probably not an issue right now, since TestRunner is expected
40 // to be called only after all static initialization, but future refactoring
41 // could change that so this is defensive programming.
42 TestRunner* TestRunner::getRunner() {
43  static TestRunner singletonRunner;
44  return &singletonRunner;
45 }
46 
47 void TestRunner::setPrinter(Print* printer) {
48  Printer::setPrinter(printer);
49 }
50 
51 void TestRunner::setLifeCycleMatchingPattern(const char* pattern,
52  uint8_t lifeCycle) {
53  size_t length = strlen(pattern);
54  if (length > 0 && pattern[length - 1] == '*') {
55  // prefix match
56  length--;
57  } else {
58  // exact match
59  length++;
60  }
61 
62  for (Test** p = Test::getRoot(); *p != nullptr; p = (*p)->getNext()) {
63  if ((*p)->getName().compareToN(pattern, length) == 0) {
64  (*p)->setLifeCycle(lifeCycle);
65  }
66  }
67 }
68 
69 void TestRunner::setLifeCycleMatchingPattern(const char* testClass,
70  const char* pattern, uint8_t lifeCycle) {
71  // The effective pattern is the join of testClass and pattern with a '_'
72  // delimiter. This must match the algorithm used by testF() and testingF().
73  // We use string_join() instead of String so that AUnit can avoid a direct
74  // dependency on the String class. AUnit thus avoids allocating any memory on
75  // the heap.
76  char fullPattern[kMaxPatternLength];
77  bool status = internal::string_join(fullPattern, kMaxPatternLength, '_',
78  testClass, pattern);
79  if (!status) return;
80 
81  setLifeCycleMatchingPattern(fullPattern, lifeCycle);
82 }
83 
84 TestRunner::TestRunner() {}
85 
86 void TestRunner::runTest() {
87  setupRunner();
88 
89  // Print initial header if this is the first run.
90  if (!mIsRunning) {
91  printStartRunner();
92  mIsRunning = true;
93  }
94 
95  // If no more test cases, then print out summary of run.
96  if (*Test::getRoot() == nullptr) {
97  if (!mIsResolved) {
98  mEndTime = millis();
99  resolveRun();
100  mIsResolved = true;
101  #if UNIX_HOST_DUINO
102  exit((mFailedCount || mExpiredCount) ? 1 : 0);
103  #endif
104  }
105  return;
106  }
107 
108  // If reached the end and there are still test cases left, start from the
109  // beginning again.
110  if (*mCurrent == nullptr) {
111  mCurrent = Test::getRoot();
112  }
113 
114  // Implement a finite state machine that calls the (*mCurrent)->setup() or
115  // (*mCurrent)->loop(), then changes the test case's mStatus.
116  switch ((*mCurrent)->getLifeCycle()) {
117  case Test::kLifeCycleNew:
118  // Transfer the verbosity of the TestRunner to the Test.
119  (*mCurrent)->enableVerbosity(mVerbosity);
120  (*mCurrent)->setup();
121 
122  // Support assertXxx() statements inside the setup() method by
123  // moving to the next lifeCycle state if an assertXxx() did not fail
124  // inside the setup().
125  if ((*mCurrent)->getLifeCycle() == Test::kLifeCycleNew) {
126  (*mCurrent)->setLifeCycle(Test::kLifeCycleSetup);
127  }
128  break;
130  // If a test is excluded, go directly to LifeCycleFinished, without
131  // calling setup() or teardown().
132  (*mCurrent)->enableVerbosity(mVerbosity);
133  (*mCurrent)->setStatus(Test::kStatusSkipped);
134  mSkippedCount++;
135  (*mCurrent)->setLifeCycle(Test::kLifeCycleFinished);
136  break;
138  {
139  // Check for timeout. mTimeout == 0 means infinite timeout.
140  // NOTE: It feels like this code should go into the Test::loop() method
141  // (like the extra bit of code in TestOnce::loop()) because it seems
142  // like we could want the timeout to be configurable on a case by case
143  // basis. This would cause the testing() code to move down into a new
144  // again() virtual method dispatched from Test::loop(), analogous to
145  // once(). But let's keep the code here for now.
146  unsigned long now = millis();
147  if (mTimeout > 0 && now >= mStartTime + 1000L * mTimeout) {
148  (*mCurrent)->expire();
149  } else {
150  (*mCurrent)->loop();
151 
152  // If test status is unresolved (i.e. still in kLifeCycleNew state)
153  // after loop(), then this is a continuous testing() test case, so
154  // skip to the next test. Otherwise, stay on the current test so that
155  // the next iteration of runTest() can resolve the current test.
156  if ((*mCurrent)->getLifeCycle() == Test::kLifeCycleSetup) {
157  // skip to the next one, but keep current test in the list
158  mCurrent = (*mCurrent)->getNext();
159  }
160  }
161  }
162  break;
164  switch ((*mCurrent)->getStatus()) {
166  mSkippedCount++;
167  break;
168  case Test::kStatusPassed:
169  mPassedCount++;
170  break;
171  case Test::kStatusFailed:
172  mFailedCount++;
173  break;
175  mExpiredCount++;
176  break;
177  default:
178  // should never get here
179  mStatusErrorCount++;
180  break;
181  }
182  (*mCurrent)->teardown();
183  (*mCurrent)->setLifeCycle(Test::kLifeCycleFinished);
184  break;
186  (*mCurrent)->resolve();
187  // skip to the next one by taking current test out of the list
188  *mCurrent = *(*mCurrent)->getNext();
189  break;
190  }
191 }
192 
193 void TestRunner::setupRunner() {
194  if (!mIsSetup) {
195  mIsSetup = true;
196  mCount = countTests();
197  mCurrent = Test::getRoot();
198  mStartTime = millis();
199  }
200 }
201 
202 // Count the number of tests in TestRunner instead of Test::insert() to avoid
203 // another C++ static initialization ordering problem.
204 uint16_t TestRunner::countTests() {
205  uint16_t count = 0;
206  for (Test** p = Test::getRoot(); *p != nullptr; p = (*p)->getNext()) {
207  count++;
208  }
209  return count;
210 }
211 
212 namespace {
213 
219 void printSeconds(Print* printer, unsigned long timeMillis) {
220  int s = timeMillis / 1000;
221  int ms = timeMillis % 1000;
222  printer->print(s);
223  printer->print('.');
224  if (ms < 100) printer->print('0');
225  if (ms < 10) printer->print('0');
226  printer->print(ms);
227 }
228 
229 }
230 
231 void TestRunner::printStartRunner() const {
233 
234  Print* printer = Printer::getPrinter();
235  printer->print(F("TestRunner started on "));
236  printer->print(mCount);
237  printer->println(F(" test(s)."));
238 }
239 
240 void TestRunner::resolveRun() const {
242  Print* printer = Printer::getPrinter();
243 
244  unsigned long elapsedTime = mEndTime - mStartTime;
245  printer->print(F("TestRunner duration: "));
246  printSeconds(printer, elapsedTime);
247  printer->println(" seconds.");
248 
249  printer->print(F("TestRunner summary: "));
250  printer->print(mPassedCount);
251  printer->print(F(" passed, "));
252  printer->print(mFailedCount);
253  printer->print(F(" failed, "));
254  printer->print(mSkippedCount);
255  printer->print(F(" skipped, "));
256  printer->print(mExpiredCount);
257  printer->print(F(" timed out, out of "));
258  printer->print(mCount);
259  printer->println(F(" test(s)."));
260 }
261 
262 void TestRunner::listTests() {
263  setupRunner();
264 
265  Print* printer = Printer::getPrinter();
266  printer->print(F("TestRunner test count: "));
267  printer->println(mCount);
268  for (Test** p = Test::getRoot(); (*p) != nullptr; p = (*p)->getNext()) {
269  printer->print(F("Test "));
270  (*p)->getName().print(printer);
271  printer->print(F("; lifeCycle: "));
272  printer->println((*p)->getLifeCycle());
273  }
274 }
275 
276 void TestRunner::setRunnerTimeout(TimeoutType timeout) {
277  mTimeout = timeout;
278 }
279 
280 }
Base class of all test cases.
Definition: Test.h:43
-
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
-
static const uint8_t kLifeCycleAsserted
Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determin...
Definition: Test.h:80
-
static void setPrinter(Print *printer)
Set the printer.
Definition: Printer.h:51
-
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
-
uint8_t TimeoutType
Integer type of the timeout parameter.
Definition: TestRunner.h:44
-
Test ** getNext()
Return the next pointer as a pointer to the pointer, similar to getRoot().
Definition: Test.h:188
-
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
-
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
-
static const uint8_t kLifeCycleExcluded
Test is Excluded by an exclude() method.
Definition: Test.h:65
- -
static Test ** getRoot()
Get the pointer to the root pointer.
Definition: Test.cpp:36
-
static const uint8_t kLifeCycleFinished
The test has completed its life cycle.
Definition: Test.h:88
-
static void setPrinter(Print *printer)
Set the output printer.
Definition: TestRunner.cpp:47
-
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
-
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
-
static const uint8_t kLifeCycleSetup
Test has been set up by calling setup() and ready to execute the test code.
Definition: Test.h:74
-
static const uint8_t kTestRunSummary
Print TestRunner summary message.
Definition: Verbosity.h:58
-
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
-
static bool isVerbosity(uint8_t verbosity)
Returns true if ANY of the bit flags of &#39;verbosity&#39; is set.
Definition: TestRunner.h:97
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include <Arduino.h> // definition of 'Serial'
+
26 #include <string.h>
+
27 #include <stdint.h>
+
28 #include "FCString.h"
+
29 #include "Compare.h"
+
30 #include "Printer.h"
+
31 #include "Verbosity.h"
+
32 #include "Test.h"
+
33 #include "TestRunner.h"
+
34 #include "string_util.h"
+
35 
+
36 namespace aunit {
+
37 
+
38 // Use a function static singleton to avoid the static initialization ordering
+
39 // problem. It's probably not an issue right now, since TestRunner is expected
+
40 // to be called only after all static initialization, but future refactoring
+
41 // could change that so this is defensive programming.
+
42 TestRunner* TestRunner::getRunner() {
+
43  static TestRunner singletonRunner;
+
44  return &singletonRunner;
+
45 }
+
46 
+
47 void TestRunner::setPrinter(Print* printer) {
+
48  Printer::setPrinter(printer);
+
49 }
+
50 
+
51 void TestRunner::setLifeCycleMatchingPattern(const char* pattern,
+
52  uint8_t lifeCycle) {
+
53  size_t length = strlen(pattern);
+
54  if (length > 0 && pattern[length - 1] == '*') {
+
55  // prefix match
+
56  length--;
+
57  } else {
+
58  // exact match
+
59  length++;
+
60  }
+
61 
+
62  for (Test** p = Test::getRoot(); *p != nullptr; p = (*p)->getNext()) {
+
63  if ((*p)->getName().compareToN(pattern, length) == 0) {
+
64  (*p)->setLifeCycle(lifeCycle);
+
65  }
+
66  }
+
67 }
+
68 
+
69 void TestRunner::setLifeCycleMatchingPattern(const char* testClass,
+
70  const char* pattern, uint8_t lifeCycle) {
+
71  // The effective pattern is the join of testClass and pattern with a '_'
+
72  // delimiter. This must match the algorithm used by testF() and testingF().
+
73  // We use string_join() instead of String so that AUnit can avoid a direct
+
74  // dependency on the String class. AUnit thus avoids allocating any memory on
+
75  // the heap.
+
76  char fullPattern[kMaxPatternLength];
+
77  bool status = internal::string_join(fullPattern, kMaxPatternLength, '_',
+
78  testClass, pattern);
+
79  if (!status) return;
+
80 
+
81  setLifeCycleMatchingPattern(fullPattern, lifeCycle);
+
82 }
+
83 
+
84 TestRunner::TestRunner() {}
+
85 
+
86 void TestRunner::runTest() {
+
87  setupRunner();
+
88 
+
89  // Print initial header if this is the first run.
+
90  if (!mIsRunning) {
+
91  printStartRunner();
+
92  mIsRunning = true;
+
93  }
+
94 
+
95  // If no more test cases, then print out summary of run.
+
96  if (*Test::getRoot() == nullptr) {
+
97  if (!mIsResolved) {
+
98  mEndTime = millis();
+
99  resolveRun();
+
100  mIsResolved = true;
+
101  #if UNIX_HOST_DUINO
+
102  exit((mFailedCount || mExpiredCount) ? 1 : 0);
+
103  #endif
+
104  }
+
105  return;
+
106  }
+
107 
+
108  // If reached the end and there are still test cases left, start from the
+
109  // beginning again.
+
110  if (*mCurrent == nullptr) {
+
111  mCurrent = Test::getRoot();
+
112  }
+
113 
+
114  // Implement a finite state machine that calls the (*mCurrent)->setup() or
+
115  // (*mCurrent)->loop(), then changes the test case's mStatus.
+
116  switch ((*mCurrent)->getLifeCycle()) {
+
117  case Test::kLifeCycleNew:
+
118  // Transfer the verbosity of the TestRunner to the Test.
+
119  (*mCurrent)->enableVerbosity(mVerbosity);
+
120  (*mCurrent)->setup();
+
121 
+
122  // Support assertXxx() statements inside the setup() method by
+
123  // moving to the next lifeCycle state if an assertXxx() did not fail
+
124  // inside the setup().
+
125  if ((*mCurrent)->getLifeCycle() == Test::kLifeCycleNew) {
+
126  (*mCurrent)->setLifeCycle(Test::kLifeCycleSetup);
+
127  }
+
128  break;
+ +
130  // If a test is excluded, go directly to LifeCycleFinished, without
+
131  // calling setup() or teardown().
+
132  (*mCurrent)->enableVerbosity(mVerbosity);
+
133  (*mCurrent)->setStatus(Test::kStatusSkipped);
+
134  mSkippedCount++;
+
135  (*mCurrent)->setLifeCycle(Test::kLifeCycleFinished);
+
136  break;
+ +
138  {
+
139  // Check for timeout. mTimeout == 0 means infinite timeout.
+
140  // NOTE: It feels like this code should go into the Test::loop() method
+
141  // (like the extra bit of code in TestOnce::loop()) because it seems
+
142  // like we could want the timeout to be configurable on a case by case
+
143  // basis. This would cause the testing() code to move down into a new
+
144  // again() virtual method dispatched from Test::loop(), analogous to
+
145  // once(). But let's keep the code here for now.
+
146  unsigned long now = millis();
+
147  if (mTimeout > 0 && now >= mStartTime + 1000L * mTimeout) {
+
148  (*mCurrent)->expire();
+
149  } else {
+
150  (*mCurrent)->loop();
+
151 
+
152  // If test status is unresolved (i.e. still in kLifeCycleNew state)
+
153  // after loop(), then this is a continuous testing() test case, so
+
154  // skip to the next test. Otherwise, stay on the current test so that
+
155  // the next iteration of runTest() can resolve the current test.
+
156  if ((*mCurrent)->getLifeCycle() == Test::kLifeCycleSetup) {
+
157  // skip to the next one, but keep current test in the list
+
158  mCurrent = (*mCurrent)->getNext();
+
159  }
+
160  }
+
161  }
+
162  break;
+ +
164  switch ((*mCurrent)->getStatus()) {
+ +
166  mSkippedCount++;
+
167  break;
+
168  case Test::kStatusPassed:
+
169  mPassedCount++;
+
170  break;
+
171  case Test::kStatusFailed:
+
172  mFailedCount++;
+
173  break;
+ +
175  mExpiredCount++;
+
176  break;
+
177  default:
+
178  // should never get here
+
179  mStatusErrorCount++;
+
180  break;
+
181  }
+
182  (*mCurrent)->teardown();
+
183  (*mCurrent)->setLifeCycle(Test::kLifeCycleFinished);
+
184  break;
+ +
186  (*mCurrent)->resolve();
+
187  // skip to the next one by taking current test out of the list
+
188  *mCurrent = *(*mCurrent)->getNext();
+
189  break;
+
190  }
+
191 }
+
192 
+
193 void TestRunner::setupRunner() {
+
194  if (!mIsSetup) {
+
195  mIsSetup = true;
+
196  mCount = countTests();
+
197  mCurrent = Test::getRoot();
+
198  mStartTime = millis();
+
199  }
+
200 }
+
201 
+
202 // Count the number of tests in TestRunner instead of Test::insert() to avoid
+
203 // another C++ static initialization ordering problem.
+
204 uint16_t TestRunner::countTests() {
+
205  uint16_t count = 0;
+
206  for (Test** p = Test::getRoot(); *p != nullptr; p = (*p)->getNext()) {
+
207  count++;
+
208  }
+
209  return count;
+
210 }
+
211 
+
212 namespace {
+
213 
+
219 void printSeconds(Print* printer, unsigned long timeMillis) {
+
220  int s = timeMillis / 1000;
+
221  int ms = timeMillis % 1000;
+
222  printer->print(s);
+
223  printer->print('.');
+
224  if (ms < 100) printer->print('0');
+
225  if (ms < 10) printer->print('0');
+
226  printer->print(ms);
+
227 }
+
228 
+
229 }
+
230 
+
231 void TestRunner::printStartRunner() const {
+ +
233 
+
234  Print* printer = Printer::getPrinter();
+
235  printer->print(F("TestRunner started on "));
+
236  printer->print(mCount);
+
237  printer->println(F(" test(s)."));
+
238 }
+
239 
+
240 void TestRunner::resolveRun() const {
+ +
242  Print* printer = Printer::getPrinter();
+
243 
+
244  unsigned long elapsedTime = mEndTime - mStartTime;
+
245  printer->print(F("TestRunner duration: "));
+
246  printSeconds(printer, elapsedTime);
+
247  printer->println(" seconds.");
+
248 
+
249  printer->print(F("TestRunner summary: "));
+
250  printer->print(mPassedCount);
+
251  printer->print(F(" passed, "));
+
252  printer->print(mFailedCount);
+
253  printer->print(F(" failed, "));
+
254  printer->print(mSkippedCount);
+
255  printer->print(F(" skipped, "));
+
256  printer->print(mExpiredCount);
+
257  printer->print(F(" timed out, out of "));
+
258  printer->print(mCount);
+
259  printer->println(F(" test(s)."));
+
260 }
+
261 
+
262 void TestRunner::listTests() {
+
263  setupRunner();
+
264 
+
265  Print* printer = Printer::getPrinter();
+
266  printer->print(F("TestRunner test count: "));
+
267  printer->println(mCount);
+
268  for (Test** p = Test::getRoot(); (*p) != nullptr; p = (*p)->getNext()) {
+
269  printer->print(F("Test "));
+
270  (*p)->getName().print(printer);
+
271  printer->print(F("; lifeCycle: "));
+
272  printer->println((*p)->getLifeCycle());
+
273  }
+
274 }
+
275 
+
276 void TestRunner::setRunnerTimeout(TimeoutType timeout) {
+
277  mTimeout = timeout;
+
278 }
+
279 
+
280 }
+
static const uint8_t kLifeCycleFinished
The test has completed its life cycle.
Definition: Test.h:88
+ +
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
+
static void setPrinter(Print *printer)
Set the output printer.
Definition: TestRunner.cpp:47
+
static const uint8_t kLifeCycleAsserted
Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determin...
Definition: Test.h:80
+
static const uint8_t kLifeCycleExcluded
Test is Excluded by an exclude() method.
Definition: Test.h:65
+
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
+
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
+
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
+
static const uint8_t kTestRunSummary
Print TestRunner summary message.
Definition: Verbosity.h:58
+
static bool isVerbosity(uint8_t verbosity)
Returns true if ANY of the bit flags of 'verbosity' is set.
Definition: TestRunner.h:97
+
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
+
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
+
Test ** getNext()
Return the next pointer as a pointer to the pointer, similar to getRoot().
Definition: Test.h:188
+
static Test ** getRoot()
Get the pointer to the root pointer.
Definition: Test.cpp:36
+
static void setPrinter(Print *printer)
Set the printer.
Definition: Printer.h:51
+
static const uint8_t kLifeCycleSetup
Test has been set up by calling setup() and ready to execute the test code.
Definition: Test.h:74
diff --git a/docs/html/TestRunner_8h_source.html b/docs/html/TestRunner_8h_source.html index 9d6b823..3ea3b99 100644 --- a/docs/html/TestRunner_8h_source.html +++ b/docs/html/TestRunner_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/TestRunner.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/TestRunner.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
TestRunner.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_TEST_RUNNER_H
26 #define AUNIT_TEST_RUNNER_H
27 
28 #include <stdint.h>
29 #include "Test.h"
30 
31 class Print;
32 
33 namespace aunit {
34 
41 class TestRunner {
42  public:
44  typedef uint8_t TimeoutType;
45 
47  static void run() { getRunner()->runTest(); }
48 
50  static void list() { getRunner()->listTests(); }
51 
56  static void exclude(const char* pattern) {
57  getRunner()->setLifeCycleMatchingPattern(
58  pattern, Test::kLifeCycleExcluded);
59  }
60 
67  static void exclude(const char* testClass, const char* pattern) {
68  getRunner()->setLifeCycleMatchingPattern(testClass, pattern,
70  }
71 
76  static void include(const char* pattern) {
77  getRunner()->setLifeCycleMatchingPattern(pattern, Test::kLifeCycleNew);
78  }
79 
86  static void include(const char* testClass, const char* pattern) {
87  getRunner()->setLifeCycleMatchingPattern(testClass, pattern,
89  }
90 
92  static void setVerbosity(uint8_t verbosity) {
93  getRunner()->setVerbosityFlag(verbosity);
94  }
95 
97  static bool isVerbosity(uint8_t verbosity) {
98  return getRunner()->isVerbosityFlag(verbosity);
99  }
100 
102  static void setPrinter(Print* printer);
103 
110  static void setTimeout(TimeoutType seconds) {
111  getRunner()->setRunnerTimeout(seconds);
112  }
113 
114  private:
116  static const TimeoutType kTimeoutDefault = 10;
117 
119  static const uint8_t kMaxPatternLength = 63 + 1;
120 
122  static TestRunner* getRunner();
123 
125  static uint16_t countTests();
126 
127  // Disable copy-constructor and assignment operator
128  TestRunner(const TestRunner&) = delete;
129  TestRunner& operator=(const TestRunner&) = delete;
130 
132  TestRunner();
133 
135  void runTest();
136 
138  void listTests();
139 
141  void printStartRunner() const;
142 
144  void resolveRun() const;
145 
147  void setupRunner();
148 
150  void setVerbosityFlag(uint8_t verbosity) { mVerbosity = verbosity; }
151 
153  bool isVerbosityFlag(uint8_t verbosity) const {
154  return mVerbosity & verbosity;
155  }
156 
158  void setLifeCycleMatchingPattern(const char* pattern, uint8_t lifeCycle);
159 
164  void setLifeCycleMatchingPattern(const char* testClass, const char* pattern,
165  uint8_t lifeCycle);
166 
168  void setRunnerTimeout(TimeoutType seconds);
169 
170  // The current test case is represented by a pointer to a pointer. This
171  // allows treating the root node the same as all the other nodes, and
172  // simplifies the code traversing the singly-linked list significantly.
173  Test** mCurrent = nullptr;
174 
175  bool mIsResolved = false;
176  bool mIsSetup = false;
177  bool mIsRunning = false;
178  uint8_t mVerbosity = Verbosity::kDefault;
179  uint16_t mCount = 0;
180  uint16_t mPassedCount = 0;
181  uint16_t mFailedCount = 0;
182  uint16_t mSkippedCount = 0;
183  uint16_t mExpiredCount = 0;
184  uint16_t mStatusErrorCount = 0;
185  TimeoutType mTimeout = kTimeoutDefault;
186  unsigned long mStartTime;
187  unsigned long mEndTime;
188 };
189 
190 }
191 
192 #endif
The class that runs the various test cases defined by the test() and testing() macros.
Definition: TestRunner.h:41
-
Base class of all test cases.
Definition: Test.h:43
-
static void exclude(const char *pattern)
Exclude the tests which match the pattern.
Definition: TestRunner.h:56
-
static void setTimeout(TimeoutType seconds)
Set test runner timeout across all tests, in seconds.
Definition: TestRunner.h:110
-
static void include(const char *pattern)
Include the tests which match the pattern.
Definition: TestRunner.h:76
-
static void exclude(const char *testClass, const char *pattern)
Exclude the tests which match the pattern given by (testClass + "_" + pattern), the same concatenatio...
Definition: TestRunner.h:67
-
static void setVerbosity(uint8_t verbosity)
Set the verbosity flag.
Definition: TestRunner.h:92
-
uint8_t TimeoutType
Integer type of the timeout parameter.
Definition: TestRunner.h:44
-
static void run()
Run all tests using the current runner.
Definition: TestRunner.h:47
-
static const uint8_t kDefault
The default verbosity.
Definition: Verbosity.h:69
-
static const uint8_t kLifeCycleExcluded
Test is Excluded by an exclude() method.
Definition: Test.h:65
- -
static void list()
Print out the known tests.
Definition: TestRunner.h:50
-
static void setPrinter(Print *printer)
Set the output printer.
Definition: TestRunner.cpp:47
-
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
-
static void include(const char *testClass, const char *pattern)
Include the tests which match the pattern given by (testClass + "_" + pattern), the same concatenatio...
Definition: TestRunner.h:86
-
static bool isVerbosity(uint8_t verbosity)
Returns true if ANY of the bit flags of &#39;verbosity&#39; is set.
Definition: TestRunner.h:97
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_TEST_RUNNER_H
+
26 #define AUNIT_TEST_RUNNER_H
+
27 
+
28 #include <stdint.h>
+
29 #include "Test.h"
+
30 
+
31 class Print;
+
32 
+
33 namespace aunit {
+
34 
+
41 class TestRunner {
+
42  public:
+
44  typedef uint16_t TimeoutType;
+
45 
+
47  static void run() { getRunner()->runTest(); }
+
48 
+
50  static void list() { getRunner()->listTests(); }
+
51 
+
56  static void exclude(const char* pattern) {
+
57  getRunner()->setLifeCycleMatchingPattern(
+
58  pattern, Test::kLifeCycleExcluded);
+
59  }
+
60 
+
67  static void exclude(const char* testClass, const char* pattern) {
+
68  getRunner()->setLifeCycleMatchingPattern(testClass, pattern,
+ +
70  }
+
71 
+
76  static void include(const char* pattern) {
+
77  getRunner()->setLifeCycleMatchingPattern(pattern, Test::kLifeCycleNew);
+
78  }
+
79 
+
86  static void include(const char* testClass, const char* pattern) {
+
87  getRunner()->setLifeCycleMatchingPattern(testClass, pattern,
+ +
89  }
+
90 
+
92  static void setVerbosity(uint8_t verbosity) {
+
93  getRunner()->setVerbosityFlag(verbosity);
+
94  }
+
95 
+
97  static bool isVerbosity(uint8_t verbosity) {
+
98  return getRunner()->isVerbosityFlag(verbosity);
+
99  }
+
100 
+
102  static void setPrinter(Print* printer);
+
103 
+
110  static void setTimeout(TimeoutType seconds) {
+
111  getRunner()->setRunnerTimeout(seconds);
+
112  }
+
113 
+
114  private:
+
116  static const TimeoutType kTimeoutDefault = 10;
+
117 
+
119  static const uint8_t kMaxPatternLength = 63 + 1;
+
120 
+
122  static TestRunner* getRunner();
+
123 
+
125  static uint16_t countTests();
+
126 
+
127  // Disable copy-constructor and assignment operator
+
128  TestRunner(const TestRunner&) = delete;
+
129  TestRunner& operator=(const TestRunner&) = delete;
+
130 
+
132  TestRunner();
+
133 
+
135  void runTest();
+
136 
+
138  void listTests();
+
139 
+
141  void printStartRunner() const;
+
142 
+
144  void resolveRun() const;
+
145 
+
147  void setupRunner();
+
148 
+
150  void setVerbosityFlag(uint8_t verbosity) { mVerbosity = verbosity; }
+
151 
+
153  bool isVerbosityFlag(uint8_t verbosity) const {
+
154  return mVerbosity & verbosity;
+
155  }
+
156 
+
158  void setLifeCycleMatchingPattern(const char* pattern, uint8_t lifeCycle);
+
159 
+
164  void setLifeCycleMatchingPattern(const char* testClass, const char* pattern,
+
165  uint8_t lifeCycle);
+
166 
+
168  void setRunnerTimeout(TimeoutType seconds);
+
169 
+
170  // The current test case is represented by a pointer to a pointer. This
+
171  // allows treating the root node the same as all the other nodes, and
+
172  // simplifies the code traversing the singly-linked list significantly.
+
173  Test** mCurrent = nullptr;
+
174 
+
175  bool mIsResolved = false;
+
176  bool mIsSetup = false;
+
177  bool mIsRunning = false;
+
178  uint8_t mVerbosity = Verbosity::kDefault;
+
179  uint16_t mCount = 0;
+
180  uint16_t mPassedCount = 0;
+
181  uint16_t mFailedCount = 0;
+
182  uint16_t mSkippedCount = 0;
+
183  uint16_t mExpiredCount = 0;
+
184  uint16_t mStatusErrorCount = 0;
+
185  TimeoutType mTimeout = kTimeoutDefault;
+
186  unsigned long mStartTime;
+
187  unsigned long mEndTime;
+
188 };
+
189 
+
190 }
+
191 
+
192 #endif
+
static void setPrinter(Print *printer)
Set the output printer.
Definition: TestRunner.cpp:47
+
static const uint8_t kLifeCycleExcluded
Test is Excluded by an exclude() method.
Definition: Test.h:65
+
static void list()
Print out the known tests.
Definition: TestRunner.h:50
+
static void include(const char *testClass, const char *pattern)
Include the tests which match the pattern given by (testClass + "_" + pattern), the same concatenatio...
Definition: TestRunner.h:86
+
static void exclude(const char *testClass, const char *pattern)
Exclude the tests which match the pattern given by (testClass + "_" + pattern), the same concatenatio...
Definition: TestRunner.h:67
+
static const uint8_t kDefault
The default verbosity.
Definition: Verbosity.h:69
+
static void setVerbosity(uint8_t verbosity)
Set the verbosity flag.
Definition: TestRunner.h:92
+
uint16_t TimeoutType
Integer type of the timeout parameter.
Definition: TestRunner.h:44
+
The class that runs the various test cases defined by the test() and testing() macros.
Definition: TestRunner.h:41
+
static void run()
Run all tests using the current runner.
Definition: TestRunner.h:47
+
static void setTimeout(TimeoutType seconds)
Set test runner timeout across all tests, in seconds.
Definition: TestRunner.h:110
+
static bool isVerbosity(uint8_t verbosity)
Returns true if ANY of the bit flags of 'verbosity' is set.
Definition: TestRunner.h:97
+
static void exclude(const char *pattern)
Exclude the tests which match the pattern.
Definition: TestRunner.h:56
+
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
+
static void include(const char *pattern)
Include the tests which match the pattern.
Definition: TestRunner.h:76
diff --git a/docs/html/Test_8cpp_source.html b/docs/html/Test_8cpp_source.html index b8e32dd..fca4625 100644 --- a/docs/html/Test_8cpp_source.html +++ b/docs/html/Test_8cpp_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Test.cpp Source File +AUnit: /home/brian/src/AUnit/src/aunit/Test.cpp Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Test.cpp
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #include <Arduino.h> // for declaration of 'Serial' on Teensy and others
26 #include "Flash.h"
27 #include "Verbosity.h"
28 #include "Printer.h"
29 #include "Compare.h"
30 #include "Test.h"
31 
32 namespace aunit {
33 
34 // Use a static variable inside a function to solve the static initialization
35 // ordering problem.
37  static Test* root;
38  return &root;
39 }
40 
42  mLifeCycle(kLifeCycleNew),
43  mStatus(kStatusUnknown),
44  mVerbosity(Verbosity::kNone),
45  mNext(nullptr) {
46 }
47 
48 // Resolve the status as kStatusFailed only if ok == false. Otherwise, keep the
49 // status as kStatusSetup to allow testing() test cases to continue.
50 void Test::setPassOrFail(bool ok) {
51  if (!ok) {
53  }
54 }
55 
56 // Insert the current test case into the singly linked list, sorted by
57 // getName(). This is an O(N^2) algorithm, but should be good enough for
58 // small N ~= 100. If N becomes bigger than that, it's probably better to insert
59 // using an O(N) algorithm, then sort the elements later in TestRunner::run().
60 // Also, we don't increment a static counter here, because that would introduce
61 // another static initialization ordering problem.
62 void Test::insert() {
63  // Find the element p whose p->next sorts after the current test
64  Test** p = getRoot();
65  while (*p != nullptr) {
66  if (getName().compareTo((*p)->getName()) < 0) break;
67  p = &(*p)->mNext;
68  }
69  mNext = *p;
70  *p = this;
71 }
72 
73 void Test::resolve() {
74  const __FlashStringHelper* const TEST_STRING = F("Test ");
75 
76  if (!isVerbosity(Verbosity::kTestAll)) return;
77 
78  Print* printer = Printer::getPrinter();
79  if (mStatus == Test::kStatusPassed
81  printer->print(TEST_STRING);
82  mName.print(printer);
83  printer->println(F(" passed."));
84  } else if (mStatus == Test::kStatusFailed
86  printer->print(TEST_STRING);
87  mName.print(printer);
88  printer->println(F(" failed."));
89  } else if (mStatus == Test::kStatusSkipped
91  printer->print(TEST_STRING);
92  mName.print(printer);
93  printer->println(F(" skipped."));
94  } else if (mStatus == Test::kStatusExpired
96  printer->print(TEST_STRING);
97  mName.print(printer);
98  printer->println(F(" timed out."));
99  }
100 }
101 
102 }
Base class of all test cases.
Definition: Test.h:43
-
const internal::FCString & getName() const
Get the name of the test.
Definition: Test.h:158
-
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
-
static const uint8_t kStatusUnknown
Test status is unknown.
Definition: Test.h:96
-
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
-
bool isVerbosity(uint8_t verbosity) const
Determine if any of the given verbosity is enabled.
Definition: Test.h:275
-
Utility class to hold the Verbosity constants.
Definition: Verbosity.h:37
-
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
Definition: Test.cpp:50
-
void resolve()
Print out the summary of the current test.
Definition: Test.cpp:73
-
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
-
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
-
Test()
Empty constructor.
Definition: Test.cpp:41
-
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
-
This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a...
- -
static Test ** getRoot()
Get the pointer to the root pointer.
Definition: Test.cpp:36
-
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
-
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
-
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
-
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
-
Various macros to smooth over the differences among the various platforms with regards to their suppo...
-
static const uint8_t kTestAll
Print all test status messages.
Definition: Verbosity.h:65
-
void print(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:32
-
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
-
void setStatus(uint8_t status)
Set the status of the test.
Definition: Test.h:173
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #include <Arduino.h> // for declaration of 'Serial' on Teensy and others
+
26 #include "Flash.h"
+
27 #include "Verbosity.h"
+
28 #include "Printer.h"
+
29 #include "Compare.h"
+
30 #include "Test.h"
+
31 
+
32 namespace aunit {
+
33 
+
34 // Use a static variable inside a function to solve the static initialization
+
35 // ordering problem.
+ +
37  static Test* root;
+
38  return &root;
+
39 }
+
40 
+ +
42  mLifeCycle(kLifeCycleNew),
+
43  mStatus(kStatusUnknown),
+
44  mVerbosity(Verbosity::kNone),
+
45  mNext(nullptr) {
+
46 }
+
47 
+
48 // Resolve the status as kStatusFailed only if ok == false. Otherwise, keep the
+
49 // status as kStatusSetup to allow testing() test cases to continue.
+
50 void Test::setPassOrFail(bool ok) {
+
51  if (!ok) {
+ +
53  }
+
54 }
+
55 
+
56 // Insert the current test case into the singly linked list, sorted by
+
57 // getName(). This is an O(N^2) algorithm, but should be good enough for
+
58 // small N ~= 100. If N becomes bigger than that, it's probably better to insert
+
59 // using an O(N) algorithm, then sort the elements later in TestRunner::run().
+
60 // Also, we don't increment a static counter here, because that would introduce
+
61 // another static initialization ordering problem.
+
62 void Test::insert() {
+
63  // Find the element p whose p->next sorts after the current test
+
64  Test** p = getRoot();
+
65  while (*p != nullptr) {
+
66  if (getName().compareTo((*p)->getName()) < 0) break;
+
67  p = &(*p)->mNext;
+
68  }
+
69  mNext = *p;
+
70  *p = this;
+
71 }
+
72 
+
73 void Test::resolve() {
+
74  const __FlashStringHelper* const TEST_STRING = F("Test ");
+
75 
+
76  if (!isVerbosity(Verbosity::kTestAll)) return;
+
77 
+
78  Print* printer = Printer::getPrinter();
+
79  if (mStatus == Test::kStatusPassed
+ +
81  printer->print(TEST_STRING);
+
82  mName.print(printer);
+
83  printer->println(F(" passed."));
+
84  } else if (mStatus == Test::kStatusFailed
+ +
86  printer->print(TEST_STRING);
+
87  mName.print(printer);
+
88  printer->println(F(" failed."));
+
89  } else if (mStatus == Test::kStatusSkipped
+ +
91  printer->print(TEST_STRING);
+
92  mName.print(printer);
+
93  printer->println(F(" skipped."));
+
94  } else if (mStatus == Test::kStatusExpired
+ +
96  printer->print(TEST_STRING);
+
97  mName.print(printer);
+
98  printer->println(F(" timed out."));
+
99  }
+
100 }
+
101 
+
102 }
+
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
+ +
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
+
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
+
Utility class to hold the Verbosity constants.
Definition: Verbosity.h:37
+
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
Definition: Test.cpp:50
+
static Print * getPrinter()
Get the output printer used by the various assertion() methods and the TestRunner.
Definition: Printer.h:48
+
const internal::FCString & getName() const
Get the name of the test.
Definition: Test.h:158
+
void resolve()
Print out the summary of the current test.
Definition: Test.cpp:73
+
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
+
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
+
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
+
Test()
Empty constructor.
Definition: Test.cpp:41
+
Base class of all test cases.
Definition: Test.h:43
+
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
+
static const uint8_t kTestAll
Print all test status messages.
Definition: Verbosity.h:65
+
void setStatus(uint8_t status)
Set the status of the test.
Definition: Test.h:173
+
bool isVerbosity(uint8_t verbosity) const
Determine if any of the given verbosity is enabled.
Definition: Test.h:275
+
static Test ** getRoot()
Get the pointer to the root pointer.
Definition: Test.cpp:36
+
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
+ +
void print(Print *printer) const
Convenience method for printing an FCString.
Definition: FCString.cpp:32
diff --git a/docs/html/Test_8h_source.html b/docs/html/Test_8h_source.html index ef5ebe9..abf4afc 100644 --- a/docs/html/Test_8h_source.html +++ b/docs/html/Test_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Test.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/Test.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Test.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 // Significant portions of the design and implementation of this file came from
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
27 
28 #ifndef AUNIT_TEST_H
29 #define AUNIT_TEST_H
30 
31 #include <stdint.h>
32 #include "FCString.h"
33 #include "Verbosity.h"
34 
35 namespace aunit {
36 
43 class Test {
44  public:
45  // The LifeCycle states are used by TestRunner to determine what a Test
46  // should do. Unlike the assertion Status, the LfeCycle is mostly hidden
47  // from client code. The state transition diagram looks like this:
48  //
49  // include()/exclude()
50  // .---------------------> Excluded -----------.
51  // v v
52  // New Finished -> (out of list)
53  // \ setup() assertion() teardown() ^
54  // -------> Setup -------> Asserted ----------'
55 
57  static const uint8_t kLifeCycleNew = 0;
58 
65  static const uint8_t kLifeCycleExcluded = 1;
66 
74  static const uint8_t kLifeCycleSetup = 2;
75 
80  static const uint8_t kLifeCycleAsserted = 3;
81 
88  static const uint8_t kLifeCycleFinished = 4;
89 
90  // The assertion Status is the result of an "assertion()". In addition to
91  // the usual pass() and fail(), there are meta-assertions such as skip()
92  // and expire(). When the Status is changed from kStatusUnknown, the
93  // lifeCycle state changes to kLifeCycleAsserted.
94 
96  static const uint8_t kStatusUnknown = 0;
97 
99  static const uint8_t kStatusPassed = 1;
100 
102  static const uint8_t kStatusFailed = 2;
103 
105  static const uint8_t kStatusSkipped = 3;
106 
108  static const uint8_t kStatusExpired = 4;
109 
115  static Test** getRoot();
116 
118  Test();
119 
120  // NOTE: Don't create a virtual destructor. That's the normal best practice
121  // for classes that will be used polymorphically. However, this class will
122  // never be deleted polymorphically (i.e. through its pointer) so it
123  // doesn't need a virtual destructor. In fact, adding it causes flash and
124  // static memory to increase dramatically because each test() and testing()
125  // macro creates a new subclass. AceButtonTest flash memory increases from
126  // 18928 to 20064 bytes, and static memory increases from 917 to 1055
127  // bytes.
128 
136  virtual void setup() {}
137 
145  virtual void teardown() {}
146 
152  virtual void loop() = 0;
153 
155  void resolve();
156 
158  const internal::FCString& getName() const { return mName; }
159 
161  uint8_t getLifeCycle() const { return mLifeCycle; }
162 
163  void setLifeCycle(uint8_t state) { mLifeCycle = state; }
164 
166  uint8_t getStatus() const { return mStatus; }
167 
173  void setStatus(uint8_t status) {
174  if (status != kStatusUnknown) {
175  setLifeCycle(kLifeCycleAsserted);
176  }
177  mStatus = status;
178  }
179 
181  void setPassOrFail(bool ok);
182 
188  Test** getNext() { return &mNext; }
189 
196  bool isDone() const { return mStatus != kStatusUnknown; }
197 
199  bool isNotDone() const { return !isDone(); }
200 
202  bool isPassed() const { return mStatus == kStatusPassed; }
203 
205  bool isNotPassed() const { return !isPassed(); }
206 
208  bool isFailed() const { return mStatus == kStatusFailed; }
209 
211  bool isNotFailed() const { return !isFailed(); }
212 
214  bool isSkipped() const { return mStatus == kStatusSkipped; }
215 
217  bool isNotSkipped() const { return !isSkipped(); }
218 
220  bool isExpired() const { return mStatus == kStatusExpired; }
221 
223  bool isNotExpired() const { return !isExpired(); }
224 
229  void skip() { setStatus(kStatusSkipped); }
230 
235  void expire() { setStatus(kStatusExpired); }
236 
238  void enableVerbosity(uint8_t verbosity) { mVerbosity |= verbosity; }
239 
241  void disableVerbosity(uint8_t verbosity) { mVerbosity &= ~verbosity; }
242 
243  protected:
248  void fail() { setStatus(kStatusFailed); }
249 
256  void pass() { setStatus(kStatusPassed); }
257 
258  void init(const char* name) {
259  mName = internal::FCString(name);
260  mLifeCycle = kLifeCycleNew;
261  mStatus = kStatusUnknown;
262  mVerbosity = 0;
263  insert();
264  }
265 
266  void init(const __FlashStringHelper* name) {
267  mName = internal::FCString(name);
268  mLifeCycle = kLifeCycleNew;
269  mStatus = kStatusUnknown;
270  mVerbosity = 0;
271  insert();
272  }
273 
275  bool isVerbosity(uint8_t verbosity) const { return mVerbosity & verbosity; }
276 
278  uint8_t getVerbosity() const { return mVerbosity; }
279 
280  private:
281  // Disable copy-constructor and assignment operator
282  Test(const Test&) = delete;
283  Test& operator=(const Test&) = delete;
284 
286  void insert();
287 
288  internal::FCString mName;
289  uint8_t mLifeCycle;
290  uint8_t mStatus;
291  uint8_t mVerbosity;
292  Test* mNext;
293 };
294 
295 }
296 
297 #endif
bool isNotPassed() const
Return true if test is not passed.
Definition: Test.h:205
-
bool isFailed() const
Return true if test is failed.
Definition: Test.h:208
-
void disableVerbosity(uint8_t verbosity)
Disable the given verbosity of the current test.
Definition: Test.h:241
-
Base class of all test cases.
Definition: Test.h:43
-
const internal::FCString & getName() const
Get the name of the test.
Definition: Test.h:158
-
void expire()
Mark the test as expired (i.e.
Definition: Test.h:235
-
static const uint8_t kStatusUnknown
Test status is unknown.
Definition: Test.h:96
-
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
-
bool isVerbosity(uint8_t verbosity) const
Determine if any of the given verbosity is enabled.
Definition: Test.h:275
-
void fail()
Mark the test as failed.
Definition: Test.h:248
-
static const uint8_t kLifeCycleAsserted
Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determin...
Definition: Test.h:80
-
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
Definition: Test.cpp:50
-
void resolve()
Print out the summary of the current test.
Definition: Test.cpp:73
-
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
Definition: FCString.h:55
-
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
-
bool isNotExpired() const
Return true if test is not expired.
Definition: Test.h:223
-
uint8_t getVerbosity() const
Get the verbosity.
Definition: Test.h:278
-
Test()
Empty constructor.
Definition: Test.cpp:41
-
bool isNotDone() const
Return true if test is not has been asserted.
Definition: Test.h:199
-
Test ** getNext()
Return the next pointer as a pointer to the pointer, similar to getRoot().
Definition: Test.h:188
-
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
-
virtual void setup()
Optional method that performs any initialization.
Definition: Test.h:136
-
static const uint8_t kLifeCycleExcluded
Test is Excluded by an exclude() method.
Definition: Test.h:65
-
bool isNotSkipped() const
Return true if test is not skipped.
Definition: Test.h:217
- -
virtual void loop()=0
The user-provided test case function.
-
void pass()
Mark the test as passed.
Definition: Test.h:256
-
void enableVerbosity(uint8_t verbosity)
Enable the given verbosity of the current test.
Definition: Test.h:238
-
static Test ** getRoot()
Get the pointer to the root pointer.
Definition: Test.cpp:36
-
static const uint8_t kLifeCycleFinished
The test has completed its life cycle.
Definition: Test.h:88
-
void skip()
Mark the test as skipped.
Definition: Test.h:229
-
bool isExpired() const
Return true if test is expired.
Definition: Test.h:220
-
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
-
static const uint8_t kLifeCycleSetup
Test has been set up by calling setup() and ready to execute the test code.
Definition: Test.h:74
-
bool isDone() const
Return true if test has been asserted.
Definition: Test.h:196
-
uint8_t getLifeCycle() const
Get the life cycle state of the test.
Definition: Test.h:161
-
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
-
bool isPassed() const
Return true if test is passed.
Definition: Test.h:202
-
bool isNotFailed() const
Return true if test is not failed.
Definition: Test.h:211
-
bool isSkipped() const
Return true if test is skipped.
Definition: Test.h:214
-
virtual void teardown()
Optional method that performs any clean up after the test ends for any reasons, either passing or oth...
Definition: Test.h:145
-
void setStatus(uint8_t status)
Set the status of the test.
Definition: Test.h:173
-
uint8_t getStatus() const
Get the status of the test.
Definition: Test.h:166
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 // Significant portions of the design and implementation of this file came from
+
26 // https://github.com/mmurdoch/arduinounit/blob/master/src/ArduinoUnit.h
+
27 
+
28 #ifndef AUNIT_TEST_H
+
29 #define AUNIT_TEST_H
+
30 
+
31 #include <stdint.h>
+
32 #include "FCString.h"
+
33 #include "Verbosity.h"
+
34 
+
35 namespace aunit {
+
36 
+
43 class Test {
+
44  public:
+
45  // The LifeCycle states are used by TestRunner to determine what a Test
+
46  // should do. Unlike the assertion Status, the LfeCycle is mostly hidden
+
47  // from client code. The state transition diagram looks like this:
+
48  //
+
49  // include()/exclude()
+
50  // .---------------------> Excluded -----------.
+
51  // v v
+
52  // New Finished -> (out of list)
+
53  // \ setup() assertion() teardown() ^
+
54  // -------> Setup -------> Asserted ----------'
+
55 
+
57  static const uint8_t kLifeCycleNew = 0;
+
58 
+
65  static const uint8_t kLifeCycleExcluded = 1;
+
66 
+
74  static const uint8_t kLifeCycleSetup = 2;
+
75 
+
80  static const uint8_t kLifeCycleAsserted = 3;
+
81 
+
88  static const uint8_t kLifeCycleFinished = 4;
+
89 
+
90  // The assertion Status is the result of an "assertion()". In addition to
+
91  // the usual pass() and fail(), there are meta-assertions such as skip()
+
92  // and expire(). When the Status is changed from kStatusUnknown, the
+
93  // lifeCycle state changes to kLifeCycleAsserted.
+
94 
+
96  static const uint8_t kStatusUnknown = 0;
+
97 
+
99  static const uint8_t kStatusPassed = 1;
+
100 
+
102  static const uint8_t kStatusFailed = 2;
+
103 
+
105  static const uint8_t kStatusSkipped = 3;
+
106 
+
108  static const uint8_t kStatusExpired = 4;
+
109 
+
115  static Test** getRoot();
+
116 
+
118  Test();
+
119 
+
120  // NOTE: Don't create a virtual destructor. That's the normal best practice
+
121  // for classes that will be used polymorphically. However, this class will
+
122  // never be deleted polymorphically (i.e. through its pointer) so it
+
123  // doesn't need a virtual destructor. In fact, adding it causes flash and
+
124  // static memory to increase dramatically because each test() and testing()
+
125  // macro creates a new subclass. AceButtonTest flash memory increases from
+
126  // 18928 to 20064 bytes, and static memory increases from 917 to 1055
+
127  // bytes.
+
128 
+
136  virtual void setup() {}
+
137 
+
145  virtual void teardown() {}
+
146 
+
152  virtual void loop() = 0;
+
153 
+
155  void resolve();
+
156 
+
158  const internal::FCString& getName() const { return mName; }
+
159 
+
161  uint8_t getLifeCycle() const { return mLifeCycle; }
+
162 
+
163  void setLifeCycle(uint8_t state) { mLifeCycle = state; }
+
164 
+
166  uint8_t getStatus() const { return mStatus; }
+
167 
+
173  void setStatus(uint8_t status) {
+
174  if (status != kStatusUnknown) {
+
175  setLifeCycle(kLifeCycleAsserted);
+
176  }
+
177  mStatus = status;
+
178  }
+
179 
+
181  void setPassOrFail(bool ok);
+
182 
+
188  Test** getNext() { return &mNext; }
+
189 
+
196  bool isDone() const { return mStatus != kStatusUnknown; }
+
197 
+
199  bool isNotDone() const { return !isDone(); }
+
200 
+
202  bool isPassed() const { return mStatus == kStatusPassed; }
+
203 
+
205  bool isNotPassed() const { return !isPassed(); }
+
206 
+
208  bool isFailed() const { return mStatus == kStatusFailed; }
+
209 
+
211  bool isNotFailed() const { return !isFailed(); }
+
212 
+
214  bool isSkipped() const { return mStatus == kStatusSkipped; }
+
215 
+
217  bool isNotSkipped() const { return !isSkipped(); }
+
218 
+
220  bool isExpired() const { return mStatus == kStatusExpired; }
+
221 
+
223  bool isNotExpired() const { return !isExpired(); }
+
224 
+ +
230 
+ +
236 
+
238  void enableVerbosity(uint8_t verbosity) { mVerbosity |= verbosity; }
+
239 
+
241  void disableVerbosity(uint8_t verbosity) { mVerbosity &= ~verbosity; }
+
242 
+
243  protected:
+ +
249 
+ +
257 
+
258  void init(const char* name) {
+
259  mName = internal::FCString(name);
+
260  mLifeCycle = kLifeCycleNew;
+
261  mStatus = kStatusUnknown;
+
262  mVerbosity = 0;
+
263  insert();
+
264  }
+
265 
+
266  void init(const __FlashStringHelper* name) {
+
267  mName = internal::FCString(name);
+
268  mLifeCycle = kLifeCycleNew;
+
269  mStatus = kStatusUnknown;
+
270  mVerbosity = 0;
+
271  insert();
+
272  }
+
273 
+
275  bool isVerbosity(uint8_t verbosity) const { return mVerbosity & verbosity; }
+
276 
+
278  uint8_t getVerbosity() const { return mVerbosity; }
+
279 
+
280  private:
+
281  // Disable copy-constructor and assignment operator
+
282  Test(const Test&) = delete;
+
283  Test& operator=(const Test&) = delete;
+
284 
+
286  void insert();
+
287 
+
288  internal::FCString mName;
+
289  uint8_t mLifeCycle;
+
290  uint8_t mStatus;
+
291  uint8_t mVerbosity;
+
292  Test* mNext;
+
293 };
+
294 
+
295 }
+
296 
+
297 #endif
+
bool isNotDone() const
Return true if test is not has been asserted.
Definition: Test.h:199
+
static const uint8_t kLifeCycleFinished
The test has completed its life cycle.
Definition: Test.h:88
+
virtual void loop()=0
The user-provided test case function.
+
static const uint8_t kStatusFailed
Test has failed, or fail() was called.
Definition: Test.h:102
+
bool isNotPassed() const
Return true if test is not passed.
Definition: Test.h:205
+
static const uint8_t kLifeCycleAsserted
Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determin...
Definition: Test.h:80
+
virtual void teardown()
Optional method that performs any clean up after the test ends for any reasons, either passing or oth...
Definition: Test.h:145
+
void setPassOrFail(bool ok)
Set the status to Passed or Failed depending on ok.
Definition: Test.cpp:50
+
bool isNotFailed() const
Return true if test is not failed.
Definition: Test.h:211
+
static const uint8_t kLifeCycleExcluded
Test is Excluded by an exclude() method.
Definition: Test.h:65
+
void expire()
Mark the test as expired (i.e.
Definition: Test.h:235
+
void fail()
Mark the test as failed.
Definition: Test.h:248
+
void pass()
Mark the test as passed.
Definition: Test.h:256
+
A union of (const char*) and (const __FlashStringHelper*) with a discriminator.
Definition: FCString.h:55
+
static const uint8_t kStatusUnknown
Test status is unknown.
Definition: Test.h:96
+
const internal::FCString & getName() const
Get the name of the test.
Definition: Test.h:158
+
bool isFailed() const
Return true if test is failed.
Definition: Test.h:208
+
void skip()
Mark the test as skipped.
Definition: Test.h:229
+
bool isExpired() const
Return true if test is expired.
Definition: Test.h:220
+
uint8_t getVerbosity() const
Get the verbosity.
Definition: Test.h:278
+
bool isNotExpired() const
Return true if test is not expired.
Definition: Test.h:223
+
void resolve()
Print out the summary of the current test.
Definition: Test.cpp:73
+
bool isNotSkipped() const
Return true if test is not skipped.
Definition: Test.h:217
+
void disableVerbosity(uint8_t verbosity)
Disable the given verbosity of the current test.
Definition: Test.h:241
+
static const uint8_t kStatusPassed
Test has passed, or pass() was called.
Definition: Test.h:99
+
static const uint8_t kStatusExpired
Test has timed out, or expire() called.
Definition: Test.h:108
+
virtual void setup()
Optional method that performs any initialization.
Definition: Test.h:136
+
Test()
Empty constructor.
Definition: Test.cpp:41
+
bool isDone() const
Return true if test has been asserted.
Definition: Test.h:196
+
Base class of all test cases.
Definition: Test.h:43
+
static const uint8_t kStatusSkipped
Test is skipped through the exclude() method or skip() was called.
Definition: Test.h:105
+
bool isSkipped() const
Return true if test is skipped.
Definition: Test.h:214
+
void setStatus(uint8_t status)
Set the status of the test.
Definition: Test.h:173
+
static const uint8_t kLifeCycleNew
Test is new, needs to be setup.
Definition: Test.h:57
+
bool isVerbosity(uint8_t verbosity) const
Determine if any of the given verbosity is enabled.
Definition: Test.h:275
+
Test ** getNext()
Return the next pointer as a pointer to the pointer, similar to getRoot().
Definition: Test.h:188
+
uint8_t getLifeCycle() const
Get the life cycle state of the test.
Definition: Test.h:161
+
static Test ** getRoot()
Get the pointer to the root pointer.
Definition: Test.cpp:36
+
bool isPassed() const
Return true if test is passed.
Definition: Test.h:202
+
uint8_t getStatus() const
Get the status of the test.
Definition: Test.h:166
+
void enableVerbosity(uint8_t verbosity)
Enable the given verbosity of the current test.
Definition: Test.h:238
+
static const uint8_t kLifeCycleSetup
Test has been set up by calling setup() and ready to execute the test code.
Definition: Test.h:74
diff --git a/docs/html/Verbosity_8h_source.html b/docs/html/Verbosity_8h_source.html index bcb5d3c..730ff27 100644 --- a/docs/html/Verbosity_8h_source.html +++ b/docs/html/Verbosity_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/Verbosity.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/Verbosity.h Source File @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
Verbosity.h
-
1 /*
2 MIT License
3 
4 Copyright (c) 2018 Brian T. Park
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12 
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 SOFTWARE.
23 */
24 
25 #ifndef AUNIT_VERBOSITY_H
26 #define AUNIT_VERBOSITY_H
27 
28 #include <stdint.h>
29 
30 namespace aunit {
31 
37 class Verbosity {
38  public:
40  static const uint8_t kAssertionPassed = 0x01;
41 
43  static const uint8_t kAssertionFailed = 0x02;
44 
46  static const uint8_t kTestPassed = 0x04;
47 
49  static const uint8_t kTestFailed = 0x08;
50 
52  static const uint8_t kTestSkipped = 0x10;
53 
55  static const uint8_t kTestExpired = 0x20;
56 
58  static const uint8_t kTestRunSummary = 0x40;
59 
60  // compound flags
62  static const uint8_t kAssertionAll = (kAssertionPassed | kAssertionFailed);
63 
65  static const uint8_t kTestAll =
66  (kTestPassed | kTestFailed | kTestSkipped | kTestExpired);
67 
69  static const uint8_t kDefault =
70  (kAssertionFailed | kTestAll | kTestRunSummary);
71 
73  static const uint8_t kAll = 0xFF;
74 
76  static const uint8_t kNone = 0x00;
77 
78  private:
79  // Disable constructor, copy-constructor and assignment operator
80  Verbosity() = delete;
81  Verbosity(const Verbosity&) = delete;
82  Verbosity& operator=(const Verbosity&) = delete;
83 };
84 
85 }
86 
87 #endif
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
-
static const uint8_t kAll
Print all messages.
Definition: Verbosity.h:73
-
Utility class to hold the Verbosity constants.
Definition: Verbosity.h:37
-
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
-
static const uint8_t kDefault
The default verbosity.
Definition: Verbosity.h:69
- -
static const uint8_t kAssertionAll
Print all assertXxx() messages.
Definition: Verbosity.h:62
-
static const uint8_t kNone
Print no messages.
Definition: Verbosity.h:76
-
static const uint8_t kAssertionPassed
Print assertXxx() passed message.
Definition: Verbosity.h:40
-
static const uint8_t kTestRunSummary
Print TestRunner summary message.
Definition: Verbosity.h:58
-
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
-
static const uint8_t kAssertionFailed
Print assertXxx() failed message.
Definition: Verbosity.h:43
-
static const uint8_t kTestAll
Print all test status messages.
Definition: Verbosity.h:65
-
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
+
1 /*
+
2 MIT License
+
3 
+
4 Copyright (c) 2018 Brian T. Park
+
5 
+
6 Permission is hereby granted, free of charge, to any person obtaining a copy
+
7 of this software and associated documentation files (the "Software"), to deal
+
8 in the Software without restriction, including without limitation the rights
+
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
10 copies of the Software, and to permit persons to whom the Software is
+
11 furnished to do so, subject to the following conditions:
+
12 
+
13 The above copyright notice and this permission notice shall be included in all
+
14 copies or substantial portions of the Software.
+
15 
+
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
22 SOFTWARE.
+
23 */
+
24 
+
25 #ifndef AUNIT_VERBOSITY_H
+
26 #define AUNIT_VERBOSITY_H
+
27 
+
28 #include <stdint.h>
+
29 
+
30 namespace aunit {
+
31 
+
37 class Verbosity {
+
38  public:
+
40  static const uint8_t kAssertionPassed = 0x01;
+
41 
+
43  static const uint8_t kAssertionFailed = 0x02;
+
44 
+
46  static const uint8_t kTestPassed = 0x04;
+
47 
+
49  static const uint8_t kTestFailed = 0x08;
+
50 
+
52  static const uint8_t kTestSkipped = 0x10;
+
53 
+
55  static const uint8_t kTestExpired = 0x20;
+
56 
+
58  static const uint8_t kTestRunSummary = 0x40;
+
59 
+
60  // compound flags
+
62  static const uint8_t kAssertionAll = (kAssertionPassed | kAssertionFailed);
+
63 
+
65  static const uint8_t kTestAll =
+ +
67 
+
69  static const uint8_t kDefault =
+ +
71 
+
73  static const uint8_t kAll = 0xFF;
+
74 
+
76  static const uint8_t kNone = 0x00;
+
77 
+
78  private:
+
79  // Disable constructor, copy-constructor and assignment operator
+
80  Verbosity() = delete;
+
81  Verbosity(const Verbosity&) = delete;
+
82  Verbosity& operator=(const Verbosity&) = delete;
+
83 };
+
84 
+
85 }
+
86 
+
87 #endif
+
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
+
static const uint8_t kAll
Print all messages.
Definition: Verbosity.h:73
+
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
+
Utility class to hold the Verbosity constants.
Definition: Verbosity.h:37
+
static const uint8_t kDefault
The default verbosity.
Definition: Verbosity.h:69
+
static const uint8_t kNone
Print no messages.
Definition: Verbosity.h:76
+
static const uint8_t kAssertionPassed
Print assertXxx() passed message.
Definition: Verbosity.h:40
+
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
+
static const uint8_t kTestRunSummary
Print TestRunner summary message.
Definition: Verbosity.h:58
+
static const uint8_t kAssertionFailed
Print assertXxx() failed message.
Definition: Verbosity.h:43
+
static const uint8_t kTestAll
Print all test status messages.
Definition: Verbosity.h:65
+
static const uint8_t kAssertionAll
Print all assertXxx() messages.
Definition: Verbosity.h:62
+
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
diff --git a/docs/html/annotated.html b/docs/html/annotated.html index cbeef48..1269223 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -1,9 +1,9 @@ - + - + AUnit: Class List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */ @@ -71,14 +74,14 @@  CFakePrintAn implementation of Print that writes to an in-memory buffer  Ninternal  CFCStringA union of (const char*) and (const __FlashStringHelper*) with a discriminator - CAssertionAn Assertion class is a subclass of Test and provides various overloaded assertion() functions - CMetaAssertionClass that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test + CAssertionAn Assertion class is a subclass of Test and provides various overloaded assertion() functions + CMetaAssertionClass that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test  CPrinterUtility class that provides a level of indirection to the Print class where test results can be sent  CTestBase class of all test cases - CTestAgainSimilar to TestOnce but performs the user-defined test multiple times - CTestOnceSimilar to TestAgain but performs user-defined test only once - CTestRunnerThe class that runs the various test cases defined by the test() and testing() macros - CVerbosityUtility class to hold the Verbosity constants + CTestAgainSimilar to TestOnce but performs the user-defined test multiple times + CTestOnceSimilar to TestAgain but performs user-defined test only once + CTestRunnerThe class that runs the various test cases defined by the test() and testing() macros + CVerbosityUtility class to hold the Verbosity constants @@ -86,7 +89,7 @@ diff --git a/docs/html/classaunit_1_1Assertion-members.html b/docs/html/classaunit_1_1Assertion-members.html index 11da46e..e87fdc8 100644 --- a/docs/html/classaunit_1_1Assertion-members.html +++ b/docs/html/classaunit_1_1Assertion-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */ - + +/* @license-end */
-

An Assertion class is a subclass of Test and provides various overloaded assertion() functions. +

An Assertion class is a subclass of Test and provides various overloaded assertion() functions. More...

#include <Assertion.h>

@@ -81,10 +84,11 @@
Inheritance graph
- - - - + + + + +
[legend]
@@ -92,17 +96,20 @@
Collaboration graph
- + +
[legend]
- - + + - - + + @@ -261,11 +268,13 @@ - - + + - - + +

Protected Member Functions

 Assertion ()
 Empty constructor. More...
Assertion ()
 Empty constructor.
 
bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed. More...
+bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed.
 
bool assertionBool (const char *file, uint16_t line, bool arg, bool value)
void init (const __FlashStringHelper *name)
 
bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled. More...
+bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled.
 
uint8_t getVerbosity () const
 Get the verbosity. More...
+uint8_t getVerbosity () const
 Get the verbosity.
 
- - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -343,126 +366,73 @@ - - + + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + +

@@ -283,59 +292,73 @@

virtual void loop ()=0
 The user-provided test case function. More...
 
void resolve ()
 Print out the summary of the current test. More...
+void resolve ()
 Print out the summary of the current test.
 
const internal::FCStringgetName () const
 Get the name of the test. More...
+const internal::FCStringgetName () const
 Get the name of the test.
 
uint8_t getLifeCycle () const
 Get the life cycle state of the test. More...
+uint8_t getLifeCycle () const
 Get the life cycle state of the test.
 
void setLifeCycle (uint8_t state)
 
uint8_t getStatus () const
 Get the status of the test. More...
+uint8_t getStatus () const
 Get the status of the test.
 
void setStatus (uint8_t status)
 Set the status of the test. More...
 
void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok. More...
+void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok.
 
Test ** getNext ()
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 
bool isDone () const
 Return true if test has been asserted. More...
 
bool isNotDone () const
 Return true if test is not has been asserted. More...
+bool isNotDone () const
 Return true if test is not has been asserted.
 
bool isPassed () const
 Return true if test is passed. More...
+bool isPassed () const
 Return true if test is passed.
 
bool isNotPassed () const
 Return true if test is not passed. More...
+bool isNotPassed () const
 Return true if test is not passed.
 
bool isFailed () const
 Return true if test is failed. More...
+bool isFailed () const
 Return true if test is failed.
 
bool isNotFailed () const
 Return true if test is not failed. More...
+bool isNotFailed () const
 Return true if test is not failed.
 
bool isSkipped () const
 Return true if test is skipped. More...
+bool isSkipped () const
 Return true if test is skipped.
 
bool isNotSkipped () const
 Return true if test is not skipped. More...
+bool isNotSkipped () const
 Return true if test is not skipped.
 
bool isExpired () const
 Return true if test is expired. More...
+bool isExpired () const
 Return true if test is expired.
 
bool isNotExpired () const
 Return true if test is not expired. More...
+bool isNotExpired () const
 Return true if test is not expired.
 
void skip ()
 Mark the test as skipped. More...
void expire ()
 Mark the test as expired (i.e. More...
 
void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test. More...
+void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test.
 
void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test. More...
+void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test.
 
- Static Public Member Functions inherited from aunit::Test
static Test ** getRoot ()
 Get the pointer to the root pointer. More...
 
- Static Public Attributes inherited from aunit::Test
static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup. More...
+static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup.
 
static const uint8_t kLifeCycleExcluded = 1
 Test is Excluded by an exclude() method. More...
 Test is Excluded by an exclude() method. More...
 
static const uint8_t kLifeCycleSetup = 2
 Test has been set up by calling setup() and ready to execute the test code. More...
 Test has been set up by calling setup() and ready to execute the test code. More...
 
static const uint8_t kLifeCycleAsserted = 3
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 
static const uint8_t kLifeCycleFinished = 4
 The test has completed its life cycle. More...
 
static const uint8_t kStatusUnknown = 0
 Test status is unknown. More...
+static const uint8_t kStatusUnknown = 0
 Test status is unknown.
 
static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called. More...
+static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called.
 
static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called. More...
+static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called.
 
static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called. More...
+static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called.
 
static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called. More...
+static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called.
 

Detailed Description

-

An Assertion class is a subclass of Test and provides various overloaded assertion() functions.

-

Having this class inherit from Test allows it to have access to the mVerbosity setting, as well as the test's current mStatus. (An earlier implementation inverted the class hierarchy between Assertion and Test). That allows every assertion() method to bail out early if it detects the result of a previous assertion() in mStatus. This delayed bailout may happen if the assertXxx() macro was called from inside a helper method of a fixture class used by testF() or testingF() macros.

+

An Assertion class is a subclass of Test and provides various overloaded assertion() functions.

+

Having this class inherit from Test allows it to have access to the mVerbosity setting, as well as the test's current mStatus. (An earlier implementation inverted the class hierarchy between Assertion and Test). That allows every assertion() method to bail out early if it detects the result of a previous assertion() in mStatus. This delayed bailout may happen if the assertXxx() macro was called from inside a helper method of a fixture class used by testF() or testingF() macros.

For the same reason as the compareXxx() methods, we use explicit overloaded functions, instead of using template specialization. And just as before, I was unable to use a template function for primitive integer types, because it interfered with the resolution of assertion(char*, char*). The wrong function would be called.

The assertion() methods are internal helpers, they should not be called directly by users.

Definition at line 55 of file Assertion.h.

-

Constructor & Destructor Documentation

- -

◆ Assertion()

- -
-
- - - - - -
- - - - - - - -
aunit::Assertion::Assertion ()
-
-inlineprotected
-
- -

Empty constructor.

- -

Definition at line 58 of file Assertion.h.

- -
-
-

Member Function Documentation

- -

◆ isOutputEnabled()

- -
-
- - - - - -
- - - - - - - - -
bool aunit::Assertion::isOutputEnabled (bool ok) const
-
-protected
-
- -

Returns true if an assertion message should be printed.

- -

Definition at line 183 of file Assertion.cpp.

- -
-
-
The documentation for this class was generated from the following files:

The documentation for this class was generated from the following files:
diff --git a/docs/html/classaunit_1_1Assertion__coll__graph.map b/docs/html/classaunit_1_1Assertion__coll__graph.map index 27996bd..fcc9e69 100644 --- a/docs/html/classaunit_1_1Assertion__coll__graph.map +++ b/docs/html/classaunit_1_1Assertion__coll__graph.map @@ -1,3 +1,4 @@ - + + diff --git a/docs/html/classaunit_1_1Assertion__coll__graph.md5 b/docs/html/classaunit_1_1Assertion__coll__graph.md5 index 5321e44..7301817 100644 --- a/docs/html/classaunit_1_1Assertion__coll__graph.md5 +++ b/docs/html/classaunit_1_1Assertion__coll__graph.md5 @@ -1 +1 @@ -4781a5157937c95605da05c261c69420 \ No newline at end of file +9b2ee4fa3e14431640c59c4b6e95ac38 \ No newline at end of file diff --git a/docs/html/classaunit_1_1Assertion__coll__graph.png b/docs/html/classaunit_1_1Assertion__coll__graph.png index 64c1f6b..11634c2 100644 Binary files a/docs/html/classaunit_1_1Assertion__coll__graph.png and b/docs/html/classaunit_1_1Assertion__coll__graph.png differ diff --git a/docs/html/classaunit_1_1Assertion__inherit__graph.map b/docs/html/classaunit_1_1Assertion__inherit__graph.map index e2155a9..3aed29a 100644 --- a/docs/html/classaunit_1_1Assertion__inherit__graph.map +++ b/docs/html/classaunit_1_1Assertion__inherit__graph.map @@ -1,6 +1,7 @@ - - - - + + + + + diff --git a/docs/html/classaunit_1_1Assertion__inherit__graph.md5 b/docs/html/classaunit_1_1Assertion__inherit__graph.md5 index 3ccdc55..9886a20 100644 --- a/docs/html/classaunit_1_1Assertion__inherit__graph.md5 +++ b/docs/html/classaunit_1_1Assertion__inherit__graph.md5 @@ -1 +1 @@ -c766b45d8de962a4955301094f19d41f \ No newline at end of file +240c2c210ce63de31026dfffdc14026f \ No newline at end of file diff --git a/docs/html/classaunit_1_1Assertion__inherit__graph.png b/docs/html/classaunit_1_1Assertion__inherit__graph.png index efa8186..54fe7e1 100644 Binary files a/docs/html/classaunit_1_1Assertion__inherit__graph.png and b/docs/html/classaunit_1_1Assertion__inherit__graph.png differ diff --git a/docs/html/classaunit_1_1MetaAssertion-members.html b/docs/html/classaunit_1_1MetaAssertion-members.html index 919fa5a..1720110 100644 --- a/docs/html/classaunit_1_1MetaAssertion-members.html +++ b/docs/html/classaunit_1_1MetaAssertion-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */ - + +/* @license-end */
-

Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test. +

Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test. More...

#include <MetaAssertion.h>

@@ -82,10 +85,11 @@
Inheritance graph
- - - - + + + + +
[legend]
@@ -93,32 +97,38 @@
Collaboration graph
- - + + +
[legend]
- - + + - - + + - - + + - - + + - - + + @@ -277,11 +287,13 @@ - - + + - - + +

Protected Member Functions

 MetaAssertion ()
 Empty constructor. More...
MetaAssertion ()
 Empty constructor.
 
bool assertionTestStatus (const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
 Set the status of the current test using the 'ok' status from another test, and print the assertion message if requested.
 
bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message. More...
+bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message.
 
void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message. More...
+void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message.
 
- Protected Member Functions inherited from aunit::Assertion
 Assertion ()
 Empty constructor. More...
Assertion ()
 Empty constructor.
 
bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed. More...
+bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed.
 
bool assertionBool (const char *file, uint16_t line, bool arg, bool value)
void init (const __FlashStringHelper *name)
 
bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled. More...
+bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled.
 
uint8_t getVerbosity () const
 Get the verbosity. More...
+uint8_t getVerbosity () const
 Get the verbosity.
 
- - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -392,175 +418,70 @@ - - + + - - + + - - + + - + - + - + - - + + - - + + - - + + - - + + - - + +

@@ -332,59 +344,73 @@

virtual void loop ()=0
 The user-provided test case function. More...
 
void resolve ()
 Print out the summary of the current test. More...
+void resolve ()
 Print out the summary of the current test.
 
const internal::FCStringgetName () const
 Get the name of the test. More...
+const internal::FCStringgetName () const
 Get the name of the test.
 
uint8_t getLifeCycle () const
 Get the life cycle state of the test. More...
+uint8_t getLifeCycle () const
 Get the life cycle state of the test.
 
void setLifeCycle (uint8_t state)
 
uint8_t getStatus () const
 Get the status of the test. More...
+uint8_t getStatus () const
 Get the status of the test.
 
void setStatus (uint8_t status)
 Set the status of the test. More...
 
void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok. More...
+void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok.
 
Test ** getNext ()
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 
bool isDone () const
 Return true if test has been asserted. More...
 
bool isNotDone () const
 Return true if test is not has been asserted. More...
+bool isNotDone () const
 Return true if test is not has been asserted.
 
bool isPassed () const
 Return true if test is passed. More...
+bool isPassed () const
 Return true if test is passed.
 
bool isNotPassed () const
 Return true if test is not passed. More...
+bool isNotPassed () const
 Return true if test is not passed.
 
bool isFailed () const
 Return true if test is failed. More...
+bool isFailed () const
 Return true if test is failed.
 
bool isNotFailed () const
 Return true if test is not failed. More...
+bool isNotFailed () const
 Return true if test is not failed.
 
bool isSkipped () const
 Return true if test is skipped. More...
+bool isSkipped () const
 Return true if test is skipped.
 
bool isNotSkipped () const
 Return true if test is not skipped. More...
+bool isNotSkipped () const
 Return true if test is not skipped.
 
bool isExpired () const
 Return true if test is expired. More...
+bool isExpired () const
 Return true if test is expired.
 
bool isNotExpired () const
 Return true if test is not expired. More...
+bool isNotExpired () const
 Return true if test is not expired.
 
void skip ()
 Mark the test as skipped. More...
void expire ()
 Mark the test as expired (i.e. More...
 
void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test. More...
+void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test.
 
void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test. More...
+void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test.
 
- Static Public Member Functions inherited from aunit::Test
static Test ** getRoot ()
 Get the pointer to the root pointer. More...
 
- Static Public Attributes inherited from aunit::Test
static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup. More...
+static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup.
 
static const uint8_t kLifeCycleExcluded = 1
 Test is Excluded by an exclude() method. More...
 Test is Excluded by an exclude() method. More...
 
static const uint8_t kLifeCycleSetup = 2
 Test has been set up by calling setup() and ready to execute the test code. More...
 Test has been set up by calling setup() and ready to execute the test code. More...
 
static const uint8_t kLifeCycleAsserted = 3
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 
static const uint8_t kLifeCycleFinished = 4
 The test has completed its life cycle. More...
 
static const uint8_t kStatusUnknown = 0
 Test status is unknown. More...
+static const uint8_t kStatusUnknown = 0
 Test status is unknown.
 
static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called. More...
+static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called.
 
static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called. More...
+static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called.
 
static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called. More...
+static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called.
 
static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called. More...
+static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called.
 

Detailed Description

-

Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test.

+

Class that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test.

Definition at line 42 of file MetaAssertion.h.

-

Constructor & Destructor Documentation

- -

◆ MetaAssertion()

- -
-
- - - - - -
- - - - - - - -
aunit::MetaAssertion::MetaAssertion ()
-
-inlineprotected
-
- -

Empty constructor.

- -

Definition at line 59 of file MetaAssertion.h.

- -
-
-

Member Function Documentation

- -

◆ isOutputEnabledForStatus()

- -
-
- - - - - -
- - - - - - - - -
bool aunit::MetaAssertion::isOutputEnabledForStatus (uint8_t status) const
-
-protected
-
- -

Return true if setting of status should print a message.

- -

Definition at line 103 of file MetaAssertion.cpp.

- -
-
- -

◆ setStatusNow()

- -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void aunit::MetaAssertion::setStatusNow (const char * file,
uint16_t line,
uint8_t status,
const __FlashStringHelper * statusString 
)
-
-protected
-
- -

Set the status of the current test to 'status' and print a message.

- -

Definition at line 110 of file MetaAssertion.cpp.

- -
-
-
The documentation for this class was generated from the following files:

The documentation for this class was generated from the following files:
diff --git a/docs/html/classaunit_1_1MetaAssertion__coll__graph.map b/docs/html/classaunit_1_1MetaAssertion__coll__graph.map index 02a01d5..5dc028f 100644 --- a/docs/html/classaunit_1_1MetaAssertion__coll__graph.map +++ b/docs/html/classaunit_1_1MetaAssertion__coll__graph.map @@ -1,4 +1,5 @@ - - + + + diff --git a/docs/html/classaunit_1_1MetaAssertion__coll__graph.md5 b/docs/html/classaunit_1_1MetaAssertion__coll__graph.md5 index 644fe72..ad14115 100644 --- a/docs/html/classaunit_1_1MetaAssertion__coll__graph.md5 +++ b/docs/html/classaunit_1_1MetaAssertion__coll__graph.md5 @@ -1 +1 @@ -70537cc6cbbab74071e356a6ec65161c \ No newline at end of file +76881b3a6aedd9c62849b5102e76b9c4 \ No newline at end of file diff --git a/docs/html/classaunit_1_1MetaAssertion__coll__graph.png b/docs/html/classaunit_1_1MetaAssertion__coll__graph.png index 0b19bfe..2c18fa4 100644 Binary files a/docs/html/classaunit_1_1MetaAssertion__coll__graph.png and b/docs/html/classaunit_1_1MetaAssertion__coll__graph.png differ diff --git a/docs/html/classaunit_1_1MetaAssertion__inherit__graph.map b/docs/html/classaunit_1_1MetaAssertion__inherit__graph.map index 0c663f1..42e67e6 100644 --- a/docs/html/classaunit_1_1MetaAssertion__inherit__graph.map +++ b/docs/html/classaunit_1_1MetaAssertion__inherit__graph.map @@ -1,6 +1,7 @@ - - - - + + + + + diff --git a/docs/html/classaunit_1_1MetaAssertion__inherit__graph.md5 b/docs/html/classaunit_1_1MetaAssertion__inherit__graph.md5 index f5775ab..939ec67 100644 --- a/docs/html/classaunit_1_1MetaAssertion__inherit__graph.md5 +++ b/docs/html/classaunit_1_1MetaAssertion__inherit__graph.md5 @@ -1 +1 @@ -9dbef0c77c8bb8ed7bdae152753c161c \ No newline at end of file +079fc3ace8859f6f151e215143f07dcd \ No newline at end of file diff --git a/docs/html/classaunit_1_1MetaAssertion__inherit__graph.png b/docs/html/classaunit_1_1MetaAssertion__inherit__graph.png index 1a1e2f8..038d630 100644 Binary files a/docs/html/classaunit_1_1MetaAssertion__inherit__graph.png and b/docs/html/classaunit_1_1MetaAssertion__inherit__graph.png differ diff --git a/docs/html/classaunit_1_1Printer-members.html b/docs/html/classaunit_1_1Printer-members.html index d99a30d..ed1db26 100644 --- a/docs/html/classaunit_1_1Printer-members.html +++ b/docs/html/classaunit_1_1Printer-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */ - + +/* @license-end */

Static Public Member Functions

static Print * getPrinter () - Get the output printer used by the various assertion() methods and the TestRunner. More...
+ Get the output printer used by the various assertion() methods and the TestRunner. More...
  -static void setPrinter (Print *printer) - Set the printer. More...
+ +static void setPrinter (Print *printer) + Set the printer.
 

Detailed Description

Utility class that provides a level of indirection to the Print class where test results can be sent.

-

By default, the Print object will be the Serial object. This can be changed using the setPrinter() method.

+

By default, the Print object will be the Serial object. This can be changed using the setPrinter() method.

This class assumes that it will be used after all static initializations have finished. Because static initialization ordering is undefined, if this utility is used during static initialization, the behaviour is undefined.

Definition at line 41 of file Printer.h.

@@ -116,53 +120,23 @@

-

Get the output printer used by the various assertion() methods and the TestRunner.

-

The default is the predefined Serial object. Can be changed using the setPrinter() method.

+

Get the output printer used by the various assertion() methods and the TestRunner.

+

The default is the predefined Serial object. Can be changed using the setPrinter() method.

Definition at line 48 of file Printer.h.

-

-
- -

◆ setPrinter()

- -
-
- - - - - -
- - - - - - - - -
static void aunit::Printer::setPrinter (Print * printer)
-
-inlinestatic
-
- -

Set the printer.

- -

Definition at line 51 of file Printer.h.

-

The documentation for this class was generated from the following files:
diff --git a/docs/html/classaunit_1_1Test-members.html b/docs/html/classaunit_1_1Test-members.html index 638a810..7f7e111 100644 --- a/docs/html/classaunit_1_1Test-members.html +++ b/docs/html/classaunit_1_1Test-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */ - + +/* @license-end */
Inheritance graph
- - - - + + + + +
[legend]
- + - + - + - + - - + + - - + + - - + + - - + + - + - - + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + +

Public Member Functions

 Test ()
 Empty constructor. More...
 Empty constructor. More...
 
virtual void setup ()
 Optional method that performs any initialization. More...
 Optional method that performs any initialization. More...
 
virtual void teardown ()
 Optional method that performs any clean up after the test ends for any reasons, either passing or otherwise. More...
 Optional method that performs any clean up after the test ends for any reasons, either passing or otherwise. More...
 
virtual void loop ()=0
 The user-provided test case function. More...
 The user-provided test case function. More...
 
void resolve ()
 Print out the summary of the current test. More...
+void resolve ()
 Print out the summary of the current test.
 
const internal::FCStringgetName () const
 Get the name of the test. More...
+const internal::FCStringgetName () const
 Get the name of the test.
 
uint8_t getLifeCycle () const
 Get the life cycle state of the test. More...
+uint8_t getLifeCycle () const
 Get the life cycle state of the test.
 
void setLifeCycle (uint8_t state)
 
uint8_t getStatus () const
 Get the status of the test. More...
+uint8_t getStatus () const
 Get the status of the test.
 
void setStatus (uint8_t status)
 Set the status of the test. More...
 Set the status of the test. More...
 
void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok. More...
+void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok.
 
Test ** getNext ()
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 
bool isDone () const
 Return true if test has been asserted. More...
 Return true if test has been asserted. More...
 
bool isNotDone () const
 Return true if test is not has been asserted. More...
+bool isNotDone () const
 Return true if test is not has been asserted.
 
bool isPassed () const
 Return true if test is passed. More...
+bool isPassed () const
 Return true if test is passed.
 
bool isNotPassed () const
 Return true if test is not passed. More...
+bool isNotPassed () const
 Return true if test is not passed.
 
bool isFailed () const
 Return true if test is failed. More...
+bool isFailed () const
 Return true if test is failed.
 
bool isNotFailed () const
 Return true if test is not failed. More...
+bool isNotFailed () const
 Return true if test is not failed.
 
bool isSkipped () const
 Return true if test is skipped. More...
+bool isSkipped () const
 Return true if test is skipped.
 
bool isNotSkipped () const
 Return true if test is not skipped. More...
+bool isNotSkipped () const
 Return true if test is not skipped.
 
bool isExpired () const
 Return true if test is expired. More...
+bool isExpired () const
 Return true if test is expired.
 
bool isNotExpired () const
 Return true if test is not expired. More...
+bool isNotExpired () const
 Return true if test is not expired.
 
void skip ()
 Mark the test as skipped. More...
 Mark the test as skipped. More...
 
void expire ()
 Mark the test as expired (i.e. More...
 Mark the test as expired (i.e. More...
 
void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test. More...
+void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test.
 
void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test. More...
+void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test.
 
- +

Static Public Member Functions

static Test ** getRoot ()
 Get the pointer to the root pointer. More...
 Get the pointer to the root pointer. More...
 
- - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + +

Static Public Attributes

static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup. More...
+static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup.
 
static const uint8_t kLifeCycleExcluded = 1
 Test is Excluded by an exclude() method. More...
 Test is Excluded by an exclude() method. More...
 
static const uint8_t kLifeCycleSetup = 2
 Test has been set up by calling setup() and ready to execute the test code. More...
 Test has been set up by calling setup() and ready to execute the test code. More...
 
static const uint8_t kLifeCycleAsserted = 3
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 
static const uint8_t kLifeCycleFinished = 4
 The test has completed its life cycle. More...
 The test has completed its life cycle. More...
 
static const uint8_t kStatusUnknown = 0
 Test status is unknown. More...
+static const uint8_t kStatusUnknown = 0
 Test status is unknown.
 
static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called. More...
+static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called.
 
static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called. More...
+static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called.
 
static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called. More...
+static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called.
 
static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called. More...
+static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called.
 
- + - + @@ -225,16 +251,18 @@ - - + + - - + +

Protected Member Functions

void fail ()
 Mark the test as failed. More...
 Mark the test as failed. More...
 
void pass ()
 Mark the test as passed. More...
 Mark the test as passed. More...
 
void init (const char *name)
void init (const __FlashStringHelper *name)
 
bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled. More...
+bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled.
 
uint8_t getVerbosity () const
 Get the verbosity. More...
+uint8_t getVerbosity () const
 Get the verbosity.
 

Detailed Description

Base class of all test cases.

-

The test() and testing() macros define subclasses of Test or TestOnce (respectively), and allow the code following the macros in '{}' to become the body of the loop() and once() methods of the two classes (respectively).

+

The test() and testing() macros define subclasses of Test or TestOnce (respectively), and allow the code following the macros in '{}' to become the body of the loop() and once() methods of the two classes (respectively).

Definition at line 43 of file Test.h.

Constructor & Destructor Documentation

@@ -261,66 +289,6 @@

Member Function Documentation

- -

◆ disableVerbosity()

- -
-
- - - - - -
- - - - - - - - -
void aunit::Test::disableVerbosity (uint8_t verbosity)
-
-inline
-
- -

Disable the given verbosity of the current test.

- -

Definition at line 241 of file Test.h.

- -
-
- -

◆ enableVerbosity()

- -
-
- - - - - -
- - - - - - - - -
void aunit::Test::enableVerbosity (uint8_t verbosity)
-
-inline
-
- -

Enable the given verbosity of the current test.

- -

Definition at line 238 of file Test.h.

- -
-

◆ expire()

@@ -345,7 +313,7 @@

Mark the test as expired (i.e.

-

timed out). Use the expireTestNow() macro in a unit test to print a diagnostic message and exit immediately.

+

timed out). Use the expireTestNow() macro in a unit test to print a diagnostic message and exit immediately.

Definition at line 235 of file Test.h.

@@ -375,68 +343,10 @@

Mark the test as failed.

-

Use the failTestNow() macro in a unit test to print a diagnostic message and exit immediately.

+

Use the failTestNow() macro in a unit test to print a diagnostic message and exit immediately.

Definition at line 248 of file Test.h.

- - - -

◆ getLifeCycle()

- -
-
- - - - - -
- - - - - - - -
uint8_t aunit::Test::getLifeCycle () const
-
-inline
-
- -

Get the life cycle state of the test.

- -

Definition at line 161 of file Test.h.

- -
-
- -

◆ getName()

- -
-
- - - - - -
- - - - - - - -
const internal::FCString& aunit::Test::getName () const
-
-inline
-
- -

Get the name of the test.

- -

Definition at line 158 of file Test.h.

-
@@ -462,7 +372,7 @@

-

Return the next pointer as a pointer to the pointer, similar to getRoot().

+

Return the next pointer as a pointer to the pointer, similar to getRoot().

This makes it much easier to manipulate a singly-linked list. Also makes setNext() method unnecessary.

Definition at line 188 of file Test.h.

@@ -497,64 +407,6 @@

Definition at line 36 of file Test.cpp.

- - - -

◆ getStatus()

- -
-
- - - - - -
- - - - - - - -
uint8_t aunit::Test::getStatus () const
-
-inline
-
- -

Get the status of the test.

- -

Definition at line 166 of file Test.h.

- -
-
- -

◆ getVerbosity()

- -
-
- - - - - -
- - - - - - - -
uint8_t aunit::Test::getVerbosity () const
-
-inlineprotected
-
- -

Get the verbosity.

- -

Definition at line 278 of file Test.h.

-
@@ -581,14 +433,14 @@

Return true if test has been asserted.

-

Note that this is different than the internal LifeCycleFinished state. The name isDone() is a carry-over from ArduinoUnit and might have been named isAsserted() if this library had been built from scratch.

+

Note that this is different than the internal LifeCycleFinished state. The name isDone() is a carry-over from ArduinoUnit and might have been named isAsserted() if this library had been built from scratch.

Definition at line 196 of file Test.h.

- -

◆ isExpired()

+ +

◆ loop()

- -

◆ isFailed()

+ +

◆ pass()

-

Return true if test is failed.

+

Mark the test as passed.

+

Often used to terminate a testing() looping test. The passTestNow() macro can be used in a unit test to print a diagnostic message and exit immediately. It is expected that pass() will be used more often.

-

Definition at line 208 of file Test.h.

+

Definition at line 256 of file Test.h.

- -

◆ isNotDone()

+ +

◆ setStatus()

- -

◆ isNotExpired()

+ +

◆ setup()

-

Return true if test is not expired.

+

Optional method that performs any initialization.

+

The assertXxx() macros, as well as pass(), fail() and skip() functions can be called in here. Subclasses that override this should call the parent's setup() method in the first line so that the setup() methods in the inheritance tree are properly chained.

-

Definition at line 223 of file Test.h.

+

Definition at line 136 of file Test.h.

- -

◆ isNotFailed()

+ +

◆ skip()

@@ -713,10 +570,10 @@

- + - +
bool aunit::Test::isNotFailed void aunit::Test::skip ( ) const
@@ -726,14 +583,15 @@

-

Return true if test is not failed.

+

Mark the test as skipped.

+

Use the skipTestNow() macro in a unit test to print a diagnostic message and exit immediately.

-

Definition at line 211 of file Test.h.

+

Definition at line 229 of file Test.h.

- -

◆ isNotPassed()

+ +

◆ teardown()

- -

◆ isNotSkipped()

+

Member Data Documentation

+ +

◆ kLifeCycleAsserted

-

Return true if test is not skipped.

+

Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined.

+

The teardown() method should be called.

-

Definition at line 217 of file Test.h.

+

Definition at line 80 of file Test.h.

- -

◆ isPassed()

+ +

◆ kLifeCycleExcluded

-

Return true if test is passed.

+

Test is Excluded by an exclude() method.

+

The setup() and teardown() methods are bypassed and the test goes directly to kLifeCycleFinished. For reporting purposes, an excluded test is counted as a "skipped" test. The include() method puts the test back into the kLifeCycleNew state.

-

Definition at line 202 of file Test.h.

+

Definition at line 65 of file Test.h.

- -

◆ isSkipped()

+ +

◆ kLifeCycleFinished

-

Return true if test is skipped.

+

The test has completed its life cycle.

+

It should be resolved using resolve() and removed from the linked list. Note that this is different than isDone() (i.e. kStatusDone) which indicates that an assertion about the test has been made.

-

Definition at line 214 of file Test.h.

+

Definition at line 88 of file Test.h.

- -

◆ isVerbosity()

+ +

◆ kLifeCycleSetup

- -

◆ loop()

- -
-
- - - - - -
- - - - - - - -
virtual void aunit::Test::loop ()
-
-pure virtual
-
- -

The user-provided test case function.

-

Each call to Test::run() makes one call to this loop() method. The assertXxx() macros, as well as pass(), fail() and skip() functions can be called in here.

- -

Implemented in aunit::TestOnce, and aunit::TestAgain.

- -
-
- -

◆ pass()

- -
-
- - - - - -
- - - - - - - -
void aunit::Test::pass ()
-
-inlineprotected
-
- -

Mark the test as passed.

-

Often used to terminate a testing() looping test. The passTestNow() macro can be used in a unit test to print a diagnostic message and exit immediately. It is expected that pass() will be used more often.

- -

Definition at line 256 of file Test.h.

- -
-
- -

◆ resolve()

- -
-
- - - - - - - -
void aunit::Test::resolve ()
-
- -

Print out the summary of the current test.

- -

Definition at line 73 of file Test.cpp.

- -
-
- -

◆ setPassOrFail()

- -
-
- - - - - - - - -
void aunit::Test::setPassOrFail (bool ok)
-
- -

Set the status to Passed or Failed depending on ok.

- -

Definition at line 50 of file Test.cpp.

- -
-
- -

◆ setStatus()

- -
-
- - - - - -
- - - - - - - - -
void aunit::Test::setStatus (uint8_t status)
-
-inline
-
- -

Set the status of the test.

-

All changes to getStatus() should happen through this method because it also changes the getLifeCycle() of the test.

- -

Definition at line 173 of file Test.h.

- -
-
- -

◆ setup()

- -
-
- - - - - -
- - - - - - - -
virtual void aunit::Test::setup ()
-
-inlinevirtual
-
- -

Optional method that performs any initialization.

-

The assertXxx() macros, as well as pass(), fail() and skip() functions can be called in here. Subclasses that override this should call the parent's setup() method in the first line so that the setup() methods in the inheritance tree are properly chained.

- -

Definition at line 136 of file Test.h.

- -
-
- -

◆ skip()

- -
-
- - - - - -
- - - - - - - -
void aunit::Test::skip ()
-
-inline
-
- -

Mark the test as skipped.

-

Use the skipTestNow() macro in a unit test to print a diagnostic message and exit immediately.

- -

Definition at line 229 of file Test.h.

- -
-
- -

◆ teardown()

- -
-
- - - - - -
- - - - - - - -
virtual void aunit::Test::teardown ()
-
-inlinevirtual
-
- -

Optional method that performs any clean up after the test ends for any reasons, either passing or otherwise.

-

Subclasses that override this should call the parent's teardown() method in the last line before returning, so that the teardown() methods in the inheritance tree are properly chained.

- -

Definition at line 145 of file Test.h.

- -
-
-

Member Data Documentation

- -

◆ kLifeCycleAsserted

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kLifeCycleAsserted = 3
-
-static
-
- -

Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined.

-

The teardown() method should be called.

- -

Definition at line 80 of file Test.h.

- -
-
- -

◆ kLifeCycleExcluded

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kLifeCycleExcluded = 1
-
-static
-
- -

Test is Excluded by an exclude() method.

-

The setup() and teardown() methods are bypassed and the test goes directly to kLifeCycleFinished. For reporting purposes, an excluded test is counted as a "skipped" test. The include() method puts the test back into the kLifeCycleNew state.

- -

Definition at line 65 of file Test.h.

- -
-
- -

◆ kLifeCycleFinished

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kLifeCycleFinished = 4
-
-static
-
- -

The test has completed its life cycle.

-

It should be resolved using resolve() and removed from the linked list. Note that this is different than isDone() (i.e. kStatusDone) which indicates that an assertion about the test has been made.

- -

Definition at line 88 of file Test.h.

- -
-
- -

◆ kLifeCycleNew

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kLifeCycleNew = 0
-
-static
-
- -

Test is new, needs to be setup.

- -

Definition at line 57 of file Test.h.

- -
-
- -

◆ kLifeCycleSetup

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kLifeCycleSetup = 2
-
-static
-
- -

Test has been set up by calling setup() and ready to execute the test code.

-

TestOnce tests (i.e. test() or testF()) should be in Setup state only for a single iteration. TestAgain tests (i.e. testing() or testingF()) will stay in Setup state until explicitly moved to a different state by the testing code (or the test times out).

+

Test has been set up by calling setup() and ready to execute the test code.

+

TestOnce tests (i.e. test() or testF()) should be in Setup state only for a single iteration. TestAgain tests (i.e. testing() or testingF()) will stay in Setup state until explicitly moved to a different state by the testing code (or the test times out).

Definition at line 74 of file Test.h.

-
-
- -

◆ kStatusExpired

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kStatusExpired = 4
-
-static
-
- -

Test has timed out, or expire() called.

- -

Definition at line 108 of file Test.h.

- -
-
- -

◆ kStatusFailed

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kStatusFailed = 2
-
-static
-
- -

Test has failed, or fail() was called.

- -

Definition at line 102 of file Test.h.

- -
-
- -

◆ kStatusPassed

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kStatusPassed = 1
-
-static
-
- -

Test has passed, or pass() was called.

- -

Definition at line 99 of file Test.h.

- -
-
- -

◆ kStatusSkipped

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kStatusSkipped = 3
-
-static
-
- -

Test is skipped through the exclude() method or skip() was called.

- -

Definition at line 105 of file Test.h.

- -
-
- -

◆ kStatusUnknown

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Test::kStatusUnknown = 0
-
-static
-
- -

Test status is unknown.

- -

Definition at line 96 of file Test.h.

-

The documentation for this class was generated from the following files:
    -
  • /home/brian/dev/AUnit/src/aunit/Test.h
  • -
  • /home/brian/dev/AUnit/src/aunit/Test.cpp
  • +
  • /home/brian/src/AUnit/src/aunit/Test.h
  • +
  • /home/brian/src/AUnit/src/aunit/Test.cpp
diff --git a/docs/html/classaunit_1_1TestAgain-members.html b/docs/html/classaunit_1_1TestAgain-members.html index 21b7e8f..a96bb84 100644 --- a/docs/html/classaunit_1_1TestAgain-members.html +++ b/docs/html/classaunit_1_1TestAgain-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */ - + +/* @license-end */
-

Similar to TestOnce but performs the user-defined test multiple times. +

Similar to TestOnce but performs the user-defined test multiple times. More...

#include <TestAgain.h>

@@ -81,9 +84,10 @@
Inheritance graph
- - - + + + +
[legend]
@@ -91,23 +95,26 @@
Collaboration graph
- - - + + + +
[legend]
- - + + - + - - + + @@ -119,59 +126,73 @@ - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -179,11 +200,13 @@ - - + + - - + +

Public Member Functions

 TestAgain ()
 Constructor. More...
TestAgain ()
 Constructor.
 
void loop () override
 Calls the user-provided again() method multiple times until the user code explicitly resolves the test using pass(), fail(), skip() or expire().
 Calls the user-provided again() method multiple times until the user code explicitly resolves the test using pass(), fail(), skip() or expire().
 
virtual void again ()=0
 User-provided test case. More...
+virtual void again ()=0
 User-provided test case.
 
- Public Member Functions inherited from aunit::Test
 Test ()
virtual void teardown ()
 Optional method that performs any clean up after the test ends for any reasons, either passing or otherwise. More...
 
void resolve ()
 Print out the summary of the current test. More...
+void resolve ()
 Print out the summary of the current test.
 
const internal::FCStringgetName () const
 Get the name of the test. More...
+const internal::FCStringgetName () const
 Get the name of the test.
 
uint8_t getLifeCycle () const
 Get the life cycle state of the test. More...
+uint8_t getLifeCycle () const
 Get the life cycle state of the test.
 
void setLifeCycle (uint8_t state)
 
uint8_t getStatus () const
 Get the status of the test. More...
+uint8_t getStatus () const
 Get the status of the test.
 
void setStatus (uint8_t status)
 Set the status of the test. More...
 
void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok. More...
+void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok.
 
Test ** getNext ()
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 
bool isDone () const
 Return true if test has been asserted. More...
 
bool isNotDone () const
 Return true if test is not has been asserted. More...
+bool isNotDone () const
 Return true if test is not has been asserted.
 
bool isPassed () const
 Return true if test is passed. More...
+bool isPassed () const
 Return true if test is passed.
 
bool isNotPassed () const
 Return true if test is not passed. More...
+bool isNotPassed () const
 Return true if test is not passed.
 
bool isFailed () const
 Return true if test is failed. More...
+bool isFailed () const
 Return true if test is failed.
 
bool isNotFailed () const
 Return true if test is not failed. More...
+bool isNotFailed () const
 Return true if test is not failed.
 
bool isSkipped () const
 Return true if test is skipped. More...
+bool isSkipped () const
 Return true if test is skipped.
 
bool isNotSkipped () const
 Return true if test is not skipped. More...
+bool isNotSkipped () const
 Return true if test is not skipped.
 
bool isExpired () const
 Return true if test is expired. More...
+bool isExpired () const
 Return true if test is expired.
 
bool isNotExpired () const
 Return true if test is not expired. More...
+bool isNotExpired () const
 Return true if test is not expired.
 
void skip ()
 Mark the test as skipped. More...
void expire ()
 Mark the test as expired (i.e. More...
 
void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test. More...
+void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test.
 
void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test. More...
+void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test.
 
- - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -401,11 +435,13 @@ - - + + - - + +

@@ -193,56 +216,67 @@

 Get the pointer to the root pointer. More...
 
- Static Public Attributes inherited from aunit::Test
static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup. More...
+static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup.
 
static const uint8_t kLifeCycleExcluded = 1
 Test is Excluded by an exclude() method. More...
 Test is Excluded by an exclude() method. More...
 
static const uint8_t kLifeCycleSetup = 2
 Test has been set up by calling setup() and ready to execute the test code. More...
 Test has been set up by calling setup() and ready to execute the test code. More...
 
static const uint8_t kLifeCycleAsserted = 3
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 
static const uint8_t kLifeCycleFinished = 4
 The test has completed its life cycle. More...
 
static const uint8_t kStatusUnknown = 0
 Test status is unknown. More...
+static const uint8_t kStatusUnknown = 0
 Test status is unknown.
 
static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called. More...
+static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called.
 
static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called. More...
+static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called.
 
static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called. More...
+static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called.
 
static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called. More...
+static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called.
 
- Protected Member Functions inherited from aunit::MetaAssertion
 MetaAssertion ()
 Empty constructor. More...
MetaAssertion ()
 Empty constructor.
 
bool assertionTestStatus (const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
 Set the status of the current test using the 'ok' status from another test, and print the assertion message if requested.
 
bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message. More...
+bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message.
 
void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message. More...
+void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message.
 
- Protected Member Functions inherited from aunit::Assertion
 Assertion ()
 Empty constructor. More...
Assertion ()
 Empty constructor.
 
bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed. More...
+bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed.
 
bool assertionBool (const char *file, uint16_t line, bool arg, bool value)
void init (const __FlashStringHelper *name)
 
bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled. More...
+bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled.
 
uint8_t getVerbosity () const
 Get the verbosity. More...
+uint8_t getVerbosity () const
 Get the verbosity.
 
- Static Protected Attributes inherited from aunit::MetaAssertion
@@ -440,77 +476,19 @@
 

Detailed Description

-

Similar to TestOnce but performs the user-defined test multiple times.

+

Similar to TestOnce but performs the user-defined test multiple times.

Definition at line 37 of file TestAgain.h.

-

Constructor & Destructor Documentation

- -

◆ TestAgain()

- -
-
- - - - - -
- - - - - - - -
aunit::TestAgain::TestAgain ()
-
-inline
-
- -

Constructor.

- -

Definition at line 40 of file TestAgain.h.

- -
-
-

Member Function Documentation

- -

◆ again()

- -
-
- - - - - -
- - - - - - - -
virtual void aunit::TestAgain::again ()
-
-pure virtual
-
- -

User-provided test case.

- -
-
-
The documentation for this class was generated from the following files:

The documentation for this class was generated from the following files:
diff --git a/docs/html/classaunit_1_1TestAgain__coll__graph.map b/docs/html/classaunit_1_1TestAgain__coll__graph.map index b077eea..3f88a8d 100644 --- a/docs/html/classaunit_1_1TestAgain__coll__graph.map +++ b/docs/html/classaunit_1_1TestAgain__coll__graph.map @@ -1,5 +1,6 @@ - - - + + + + diff --git a/docs/html/classaunit_1_1TestAgain__coll__graph.md5 b/docs/html/classaunit_1_1TestAgain__coll__graph.md5 index 31ae5dc..dc0b0b0 100644 --- a/docs/html/classaunit_1_1TestAgain__coll__graph.md5 +++ b/docs/html/classaunit_1_1TestAgain__coll__graph.md5 @@ -1 +1 @@ -15e54b809e1ba3f69aaf28cd2375a997 \ No newline at end of file +ca409438b3b738231e84f5ab2b8f815b \ No newline at end of file diff --git a/docs/html/classaunit_1_1TestAgain__coll__graph.png b/docs/html/classaunit_1_1TestAgain__coll__graph.png index 3b74897..f4e55de 100644 Binary files a/docs/html/classaunit_1_1TestAgain__coll__graph.png and b/docs/html/classaunit_1_1TestAgain__coll__graph.png differ diff --git a/docs/html/classaunit_1_1TestAgain__inherit__graph.map b/docs/html/classaunit_1_1TestAgain__inherit__graph.map index b077eea..3f88a8d 100644 --- a/docs/html/classaunit_1_1TestAgain__inherit__graph.map +++ b/docs/html/classaunit_1_1TestAgain__inherit__graph.map @@ -1,5 +1,6 @@ - - - + + + + diff --git a/docs/html/classaunit_1_1TestAgain__inherit__graph.md5 b/docs/html/classaunit_1_1TestAgain__inherit__graph.md5 index 647ee5a..dc0b0b0 100644 --- a/docs/html/classaunit_1_1TestAgain__inherit__graph.md5 +++ b/docs/html/classaunit_1_1TestAgain__inherit__graph.md5 @@ -1 +1 @@ -220ca1b6e68e6f9f719056b14f2c54dc \ No newline at end of file +ca409438b3b738231e84f5ab2b8f815b \ No newline at end of file diff --git a/docs/html/classaunit_1_1TestAgain__inherit__graph.png b/docs/html/classaunit_1_1TestAgain__inherit__graph.png index 3b74897..f4e55de 100644 Binary files a/docs/html/classaunit_1_1TestAgain__inherit__graph.png and b/docs/html/classaunit_1_1TestAgain__inherit__graph.png differ diff --git a/docs/html/classaunit_1_1TestOnce-members.html b/docs/html/classaunit_1_1TestOnce-members.html index d8abc5f..a749207 100644 --- a/docs/html/classaunit_1_1TestOnce-members.html +++ b/docs/html/classaunit_1_1TestOnce-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */ - + +/* @license-end */
-

Similar to TestAgain but performs user-defined test only once. +

Similar to TestAgain but performs user-defined test only once. More...

#include <TestOnce.h>

@@ -81,9 +84,10 @@
Inheritance graph
- - - + + + +
[legend]
@@ -91,22 +95,25 @@
Collaboration graph
- - - + + + +
[legend]
- - + + - + - - + + @@ -118,59 +125,73 @@ - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -178,11 +199,13 @@ - - + + - - + +

Public Member Functions

 TestOnce ()
 Constructor. More...
TestOnce ()
 Constructor.
 
void loop () override
 Calls the user-provided once() method. More...
 Calls the user-provided once() method. More...
 
virtual void once ()=0
 User-provided test case. More...
+virtual void once ()=0
 User-provided test case.
 
- Public Member Functions inherited from aunit::Test
 Test ()
virtual void teardown ()
 Optional method that performs any clean up after the test ends for any reasons, either passing or otherwise. More...
 
void resolve ()
 Print out the summary of the current test. More...
+void resolve ()
 Print out the summary of the current test.
 
const internal::FCStringgetName () const
 Get the name of the test. More...
+const internal::FCStringgetName () const
 Get the name of the test.
 
uint8_t getLifeCycle () const
 Get the life cycle state of the test. More...
+uint8_t getLifeCycle () const
 Get the life cycle state of the test.
 
void setLifeCycle (uint8_t state)
 
uint8_t getStatus () const
 Get the status of the test. More...
+uint8_t getStatus () const
 Get the status of the test.
 
void setStatus (uint8_t status)
 Set the status of the test. More...
 
void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok. More...
+void setPassOrFail (bool ok)
 Set the status to Passed or Failed depending on ok.
 
Test ** getNext ()
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 Return the next pointer as a pointer to the pointer, similar to getRoot(). More...
 
bool isDone () const
 Return true if test has been asserted. More...
 
bool isNotDone () const
 Return true if test is not has been asserted. More...
+bool isNotDone () const
 Return true if test is not has been asserted.
 
bool isPassed () const
 Return true if test is passed. More...
+bool isPassed () const
 Return true if test is passed.
 
bool isNotPassed () const
 Return true if test is not passed. More...
+bool isNotPassed () const
 Return true if test is not passed.
 
bool isFailed () const
 Return true if test is failed. More...
+bool isFailed () const
 Return true if test is failed.
 
bool isNotFailed () const
 Return true if test is not failed. More...
+bool isNotFailed () const
 Return true if test is not failed.
 
bool isSkipped () const
 Return true if test is skipped. More...
+bool isSkipped () const
 Return true if test is skipped.
 
bool isNotSkipped () const
 Return true if test is not skipped. More...
+bool isNotSkipped () const
 Return true if test is not skipped.
 
bool isExpired () const
 Return true if test is expired. More...
+bool isExpired () const
 Return true if test is expired.
 
bool isNotExpired () const
 Return true if test is not expired. More...
+bool isNotExpired () const
 Return true if test is not expired.
 
void skip ()
 Mark the test as skipped. More...
void expire ()
 Mark the test as expired (i.e. More...
 
void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test. More...
+void enableVerbosity (uint8_t verbosity)
 Enable the given verbosity of the current test.
 
void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test. More...
+void disableVerbosity (uint8_t verbosity)
 Disable the given verbosity of the current test.
 
- - + + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -400,11 +434,13 @@ - - + + - - + +

@@ -192,56 +215,67 @@

 Get the pointer to the root pointer. More...
 
- Static Public Attributes inherited from aunit::Test
static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup. More...
+static const uint8_t kLifeCycleNew = 0
 Test is new, needs to be setup.
 
static const uint8_t kLifeCycleExcluded = 1
 Test is Excluded by an exclude() method. More...
 Test is Excluded by an exclude() method. More...
 
static const uint8_t kLifeCycleSetup = 2
 Test has been set up by calling setup() and ready to execute the test code. More...
 Test has been set up by calling setup() and ready to execute the test code. More...
 
static const uint8_t kLifeCycleAsserted = 3
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 Test is asserted (using pass(), fail(), expired() or skipped()) and the getStatus() has been determined. More...
 
static const uint8_t kLifeCycleFinished = 4
 The test has completed its life cycle. More...
 
static const uint8_t kStatusUnknown = 0
 Test status is unknown. More...
+static const uint8_t kStatusUnknown = 0
 Test status is unknown.
 
static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called. More...
+static const uint8_t kStatusPassed = 1
 Test has passed, or pass() was called.
 
static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called. More...
+static const uint8_t kStatusFailed = 2
 Test has failed, or fail() was called.
 
static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called. More...
+static const uint8_t kStatusSkipped = 3
 Test is skipped through the exclude() method or skip() was called.
 
static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called. More...
+static const uint8_t kStatusExpired = 4
 Test has timed out, or expire() called.
 
- Protected Member Functions inherited from aunit::MetaAssertion
 MetaAssertion ()
 Empty constructor. More...
MetaAssertion ()
 Empty constructor.
 
bool assertionTestStatus (const char *file, uint16_t line, const char *testName, const __FlashStringHelper *statusMessage, bool ok)
 Set the status of the current test using the 'ok' status from another test, and print the assertion message if requested.
 
bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message. More...
+bool isOutputEnabledForStatus (uint8_t status) const
 Return true if setting of status should print a message.
 
void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message. More...
+void setStatusNow (const char *file, uint16_t line, uint8_t status, const __FlashStringHelper *statusString)
 Set the status of the current test to 'status' and print a message.
 
- Protected Member Functions inherited from aunit::Assertion
 Assertion ()
 Empty constructor. More...
Assertion ()
 Empty constructor.
 
bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed. More...
+bool isOutputEnabled (bool ok) const
 Returns true if an assertion message should be printed.
 
bool assertionBool (const char *file, uint16_t line, bool arg, bool value)
void init (const __FlashStringHelper *name)
 
bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled. More...
+bool isVerbosity (uint8_t verbosity) const
 Determine if any of the given verbosity is enabled.
 
uint8_t getVerbosity () const
 Get the verbosity. More...
+uint8_t getVerbosity () const
 Get the verbosity.
 
- Static Protected Attributes inherited from aunit::MetaAssertion
@@ -439,40 +475,10 @@
 

Detailed Description

-

Similar to TestAgain but performs user-defined test only once.

+

Similar to TestAgain but performs user-defined test only once.

Definition at line 40 of file TestOnce.h.

-

Constructor & Destructor Documentation

- -

◆ TestOnce()

- -
-
- - - - - -
- - - - - - - -
aunit::TestOnce::TestOnce ()
-
-inline
-
- -

Constructor.

- -

Definition at line 43 of file TestOnce.h.

- -
-
-

Member Function Documentation

+

Member Function Documentation

◆ loop()

@@ -496,52 +502,25 @@

-

Calls the user-provided once() method.

-

If no other assertXxx() macros set the internal status, then this calls pass() to make sure that this test case will be called only once from Test::run().

+

Calls the user-provided once() method.

+

If no other assertXxx() macros set the internal status, then this calls pass() to make sure that this test case will be called only once from Test::run().

Implements aunit::Test.

Definition at line 29 of file TestOnce.cpp.

-

-
- -

◆ once()

- -
-
- - - - - -
- - - - - - - -
virtual void aunit::TestOnce::once ()
-
-pure virtual
-
- -

User-provided test case.

-

The documentation for this class was generated from the following files:
diff --git a/docs/html/classaunit_1_1TestOnce__coll__graph.map b/docs/html/classaunit_1_1TestOnce__coll__graph.map index ae66927..da79f7b 100644 --- a/docs/html/classaunit_1_1TestOnce__coll__graph.map +++ b/docs/html/classaunit_1_1TestOnce__coll__graph.map @@ -1,5 +1,6 @@ - - - + + + + diff --git a/docs/html/classaunit_1_1TestOnce__coll__graph.md5 b/docs/html/classaunit_1_1TestOnce__coll__graph.md5 index ea4fdd4..06432e2 100644 --- a/docs/html/classaunit_1_1TestOnce__coll__graph.md5 +++ b/docs/html/classaunit_1_1TestOnce__coll__graph.md5 @@ -1 +1 @@ -7ad05c6e349cde3e016517fe77dd608a \ No newline at end of file +3928bacff90106dd4a90f0c31f280d41 \ No newline at end of file diff --git a/docs/html/classaunit_1_1TestOnce__coll__graph.png b/docs/html/classaunit_1_1TestOnce__coll__graph.png index 0958318..e0936e7 100644 Binary files a/docs/html/classaunit_1_1TestOnce__coll__graph.png and b/docs/html/classaunit_1_1TestOnce__coll__graph.png differ diff --git a/docs/html/classaunit_1_1TestOnce__inherit__graph.map b/docs/html/classaunit_1_1TestOnce__inherit__graph.map index ae66927..da79f7b 100644 --- a/docs/html/classaunit_1_1TestOnce__inherit__graph.map +++ b/docs/html/classaunit_1_1TestOnce__inherit__graph.map @@ -1,5 +1,6 @@ - - - + + + + diff --git a/docs/html/classaunit_1_1TestOnce__inherit__graph.md5 b/docs/html/classaunit_1_1TestOnce__inherit__graph.md5 index af27a0a..06432e2 100644 --- a/docs/html/classaunit_1_1TestOnce__inherit__graph.md5 +++ b/docs/html/classaunit_1_1TestOnce__inherit__graph.md5 @@ -1 +1 @@ -fee723305f4b5dfa587354949eaf8984 \ No newline at end of file +3928bacff90106dd4a90f0c31f280d41 \ No newline at end of file diff --git a/docs/html/classaunit_1_1TestOnce__inherit__graph.png b/docs/html/classaunit_1_1TestOnce__inherit__graph.png index 0958318..e0936e7 100644 Binary files a/docs/html/classaunit_1_1TestOnce__inherit__graph.png and b/docs/html/classaunit_1_1TestOnce__inherit__graph.png differ diff --git a/docs/html/classaunit_1_1TestRunner-members.html b/docs/html/classaunit_1_1TestRunner-members.html index f2d8e7a..65a751f 100644 --- a/docs/html/classaunit_1_1TestRunner-members.html +++ b/docs/html/classaunit_1_1TestRunner-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@
- + +/* @license-end */
setPrinter(Print *printer)aunit::TestRunnerstatic setTimeout(TimeoutType seconds)aunit::TestRunnerinlinestatic setVerbosity(uint8_t verbosity)aunit::TestRunnerinlinestatic - TimeoutType typedefaunit::TestRunner + TimeoutType typedefaunit::TestRunner
diff --git a/docs/html/classaunit_1_1TestRunner.html b/docs/html/classaunit_1_1TestRunner.html index 0ca0524..4870ba6 100644 --- a/docs/html/classaunit_1_1TestRunner.html +++ b/docs/html/classaunit_1_1TestRunner.html @@ -1,9 +1,9 @@ - + - + AUnit: aunit::TestRunner Class Reference @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */
-

The class that runs the various test cases defined by the test() and testing() macros. +

The class that runs the various test cases defined by the test() and testing() macros. More...

#include <TestRunner.h>

- - - + + +

Public Types

typedef uint8_t TimeoutType
 Integer type of the timeout parameter. More...
 
typedef uint16_t TimeoutType
 Integer type of the timeout parameter. More...
 
- - + + - + - + - + - + - + - - + + - - + + - - + + - - + +

Static Public Member Functions

static void run ()
 Run all tests using the current runner. More...
+static void run ()
 Run all tests using the current runner.
 
static void list ()
 Print out the known tests. More...
 Print out the known tests. More...
 
static void exclude (const char *pattern)
 Exclude the tests which match the pattern. More...
 Exclude the tests which match the pattern. More...
 
static void exclude (const char *testClass, const char *pattern)
 Exclude the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro. More...
 Exclude the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro. More...
 
static void include (const char *pattern)
 Include the tests which match the pattern. More...
 Include the tests which match the pattern. More...
 
static void include (const char *testClass, const char *pattern)
 Include the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro. More...
 Include the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro. More...
 
static void setVerbosity (uint8_t verbosity)
 Set the verbosity flag. More...
+static void setVerbosity (uint8_t verbosity)
 Set the verbosity flag.
 
static bool isVerbosity (uint8_t verbosity)
 Returns true if ANY of the bit flags of 'verbosity' is set. More...
+static bool isVerbosity (uint8_t verbosity)
 Returns true if ANY of the bit flags of 'verbosity' is set.
 
static void setPrinter (Print *printer)
 Set the output printer. More...
+static void setPrinter (Print *printer)
 Set the output printer.
 
static void setTimeout (TimeoutType seconds)
 Set test runner timeout across all tests, in seconds. More...
static void setTimeout (TimeoutType seconds)
 Set test runner timeout across all tests, in seconds. More...
 

Detailed Description

-

The class that runs the various test cases defined by the test() and testing() macros.

-

It prints the summary of each test as well as the final summary of the entire run at the end. In the future, it may be possible to allow a different TestRunner to be used.

+

The class that runs the various test cases defined by the test() and testing() macros.

+

It prints the summary of each test as well as the final summary of the entire run at the end. In the future, it may be possible to allow a different TestRunner to be used.

Definition at line 41 of file TestRunner.h.

Member Typedef Documentation

- -

◆ TimeoutType

+ +

◆ TimeoutType

Integer type of the timeout parameter.

-

Seconds.

+

Seconds. Default is kTimeoutDefault = 10

Definition at line 44 of file TestRunner.h.

@@ -208,7 +215,7 @@

-

Exclude the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro.

+

Exclude the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro.

Currently supports only a trailing '*'. For example, exclude("CustomTest", "flash*").

Definition at line 67 of file TestRunner.h.

@@ -280,41 +287,11 @@

-

Include the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro.

+

Include the tests which match the pattern given by (testClass + "_" + pattern), the same concatenation rule used by the testF() macro.

Currently supports only a trailing '*'. For example, include("CustomTest", "flash*").

Definition at line 86 of file TestRunner.h.

-

-
- -

◆ isVerbosity()

- -
-
- - - - - -
- - - - - - - - -
static bool aunit::TestRunner::isVerbosity (uint8_t verbosity)
-
-inlinestatic
-
- -

Returns true if ANY of the bit flags of 'verbosity' is set.

- -

Definition at line 97 of file TestRunner.h.

-
@@ -345,65 +322,6 @@

Definition at line 50 of file TestRunner.h.

-

-
- -

◆ run()

- -
-
- - - - - -
- - - - - - - -
static void aunit::TestRunner::run ()
-
-inlinestatic
-
- -

Run all tests using the current runner.

- -

Definition at line 47 of file TestRunner.h.

- -
-
- -

◆ setPrinter()

- -
-
- - - - - -
- - - - - - - - -
void aunit::TestRunner::setPrinter (Print * printer)
-
-static
-
- -

Set the output printer.

- -

Definition at line 47 of file TestRunner.cpp.

-
@@ -418,7 +336,7 @@

static void aunit::TestRunner::setTimeout ( - TimeoutType  + TimeoutType  seconds) @@ -431,52 +349,22 @@

Set test runner timeout across all tests, in seconds.

-

Set to 0 for infinite timeout. Useful for preventing testing() test cases that never end. This is a timeout for the TestRunner itself, not for individual tests.

+

Set to 0 for infinite timeout. Useful for preventing testing() test cases that never end. This is a timeout for the TestRunner itself, not for individual tests. Upper limit is 65535 seconds (just over 18 hours).

Definition at line 110 of file TestRunner.h.

-

- - -

◆ setVerbosity()

- -
-
- - - - - -
- - - - - - - - -
static void aunit::TestRunner::setVerbosity (uint8_t verbosity)
-
-inlinestatic
-
- -

Set the verbosity flag.

- -

Definition at line 92 of file TestRunner.h.

-

The documentation for this class was generated from the following files: diff --git a/docs/html/classaunit_1_1Test__inherit__graph.map b/docs/html/classaunit_1_1Test__inherit__graph.map index 5b0de87..b096e15 100644 --- a/docs/html/classaunit_1_1Test__inherit__graph.map +++ b/docs/html/classaunit_1_1Test__inherit__graph.map @@ -1,6 +1,7 @@ - - - - + + + + + diff --git a/docs/html/classaunit_1_1Test__inherit__graph.md5 b/docs/html/classaunit_1_1Test__inherit__graph.md5 index 9cfd02e..5958a35 100644 --- a/docs/html/classaunit_1_1Test__inherit__graph.md5 +++ b/docs/html/classaunit_1_1Test__inherit__graph.md5 @@ -1 +1 @@ -eab3a793be72981df48a45ffec4412a9 \ No newline at end of file +b885875d0bdffd7223c458a3215f961e \ No newline at end of file diff --git a/docs/html/classaunit_1_1Test__inherit__graph.png b/docs/html/classaunit_1_1Test__inherit__graph.png index bb25d39..683a5b1 100644 Binary files a/docs/html/classaunit_1_1Test__inherit__graph.png and b/docs/html/classaunit_1_1Test__inherit__graph.png differ diff --git a/docs/html/classaunit_1_1Verbosity-members.html b/docs/html/classaunit_1_1Verbosity-members.html index 27a6fb8..8a22d5f 100644 --- a/docs/html/classaunit_1_1Verbosity-members.html +++ b/docs/html/classaunit_1_1Verbosity-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */ - + +/* @license-end */
-

Utility class to hold the Verbosity constants. +

Utility class to hold the Verbosity constants. More...

#include <Verbosity.h>

- - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - + +

Static Public Attributes

static const uint8_t kAssertionPassed = 0x01
 Print assertXxx() passed message. More...
+static const uint8_t kAssertionPassed = 0x01
 Print assertXxx() passed message.
 
static const uint8_t kAssertionFailed = 0x02
 Print assertXxx() failed message. More...
+static const uint8_t kAssertionFailed = 0x02
 Print assertXxx() failed message.
 
static const uint8_t kTestPassed = 0x04
 Print test passed message. More...
+static const uint8_t kTestPassed = 0x04
 Print test passed message.
 
static const uint8_t kTestFailed = 0x08
 Print test failed message. More...
+static const uint8_t kTestFailed = 0x08
 Print test failed message.
 
static const uint8_t kTestSkipped = 0x10
 Print test skipped message. More...
+static const uint8_t kTestSkipped = 0x10
 Print test skipped message.
 
static const uint8_t kTestExpired = 0x20
 Print test timed out message. More...
+static const uint8_t kTestExpired = 0x20
 Print test timed out message.
 
static const uint8_t kTestRunSummary = 0x40
 Print TestRunner summary message. More...
+static const uint8_t kTestRunSummary = 0x40
 Print TestRunner summary message.
 
static const uint8_t kAssertionAll = (kAssertionPassed | kAssertionFailed)
 Print all assertXxx() messages. More...
+static const uint8_t kAssertionAll = (kAssertionPassed | kAssertionFailed)
 Print all assertXxx() messages.
 
static const uint8_t kTestAll
 Print all test status messages. More...
 Print all test status messages. More...
 
static const uint8_t kDefault
 The default verbosity. More...
 The default verbosity. More...
 
static const uint8_t kAll = 0xFF
 Print all messages. More...
+static const uint8_t kAll = 0xFF
 Print all messages.
 
static const uint8_t kNone = 0x00
 Print no messages. More...
+static const uint8_t kNone = 0x00
 Print no messages.
 

Detailed Description

-

Utility class to hold the Verbosity constants.

-

Current used only by TestRunner but potentially could be used by Test and TestOnce in the future, so it seemed better to pull these out into a separate file.

+

Utility class to hold the Verbosity constants.

+

Current used only by TestRunner but potentially could be used by Test and TestOnce in the future, so it seemed better to pull these out into a separate file.

Definition at line 37 of file Verbosity.h.

Member Data Documentation

- -

◆ kAll

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kAll = 0xFF
-
-static
-
- -

Print all messages.

- -

Definition at line 73 of file Verbosity.h.

- -
-
- -

◆ kAssertionAll

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kAssertionAll = (kAssertionPassed | kAssertionFailed)
-
-static
-
- -

Print all assertXxx() messages.

- -

Definition at line 62 of file Verbosity.h.

- -
-
- -

◆ kAssertionFailed

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kAssertionFailed = 0x02
-
-static
-
- -

Print assertXxx() failed message.

- -

Definition at line 43 of file Verbosity.h.

- -
-
- -

◆ kAssertionPassed

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kAssertionPassed = 0x01
-
-static
-
- -

Print assertXxx() passed message.

- -

Definition at line 40 of file Verbosity.h.

- -
-

◆ kDefault

@@ -245,37 +154,13 @@

-Initial value: +Initial value:

The default verbosity.

Definition at line 69 of file Verbosity.h.

-

-
- -

◆ kNone

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kNone = 0x00
-
-static
-
- -

Print no messages.

- -

Definition at line 76 of file Verbosity.h.

-
@@ -297,152 +182,31 @@

-Initial value: +Initial value:

Print all test status messages.

Definition at line 65 of file Verbosity.h.

-

- - -

◆ kTestExpired

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kTestExpired = 0x20
-
-static
-
- -

Print test timed out message.

- -

Definition at line 55 of file Verbosity.h.

- -
-
- -

◆ kTestFailed

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kTestFailed = 0x08
-
-static
-
- -

Print test failed message.

- -

Definition at line 49 of file Verbosity.h.

- -
-
- -

◆ kTestPassed

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kTestPassed = 0x04
-
-static
-
- -

Print test passed message.

- -

Definition at line 46 of file Verbosity.h.

- -
-
- -

◆ kTestRunSummary

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kTestRunSummary = 0x40
-
-static
-
- -

Print TestRunner summary message.

- -

Definition at line 58 of file Verbosity.h.

- -
-
- -

◆ kTestSkipped

- -
-
- - - - - -
- - - - -
const uint8_t aunit::Verbosity::kTestSkipped = 0x10
-
-static
-
- -

Print test skipped message.

- -

Definition at line 52 of file Verbosity.h.

-

The documentation for this class was generated from the following file: +
static const uint8_t kTestSkipped
Print test skipped message.
Definition: Verbosity.h:52
+
static const uint8_t kTestFailed
Print test failed message.
Definition: Verbosity.h:49
+
static const uint8_t kTestPassed
Print test passed message.
Definition: Verbosity.h:46
+
static const uint8_t kTestRunSummary
Print TestRunner summary message.
Definition: Verbosity.h:58
+
static const uint8_t kAssertionFailed
Print assertXxx() failed message.
Definition: Verbosity.h:43
+
static const uint8_t kTestAll
Print all test status messages.
Definition: Verbosity.h:65
+
static const uint8_t kTestExpired
Print test timed out message.
Definition: Verbosity.h:55
diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint-members.html b/docs/html/classaunit_1_1fake_1_1FakePrint-members.html index 51f9773..59dd450 100644 --- a/docs/html/classaunit_1_1fake_1_1FakePrint-members.html +++ b/docs/html/classaunit_1_1fake_1_1FakePrint-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
AUnit -  1.3.2 +  1.3.3
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
@@ -31,18 +31,21 @@ - + +/* @license-end */ - + +/* @license-end */
Inheritance graph
+ + + +
[legend]
Collaboration diagram for aunit::fake::FakePrint:
Collaboration graph
+ + + +
[legend]
- +

@@ -100,18 +111,18 @@ void 

flush () override
 
const char * getBuffer () const
 Return the NUL terminated string buffer. More...
 Return the NUL terminated string buffer. More...
 
- +

Static Public Attributes

static const uint8_t kBufSize = 8 * sizeof(long long) + 2 + 1
 Size of the internal buffer. More...
 Size of the internal buffer. More...
 

Detailed Description

An implementation of Print that writes to an in-memory buffer.

-

The buffer can be retrieved using getBuffer() to verify that the expected string was written to the Print object.

+

The buffer can be retrieved using getBuffer() to verify that the expected string was written to the Print object.

Usage:

* {
 *   FakePrint fakePrint;
 *   object.printTo(fakePrint);
@@ -181,14 +192,14 @@ 

FakePrint.h +
  • /home/brian/src/AUnit/src/aunit/fake/FakePrint.h
  • diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.map b/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.map index d4781a8..12eb023 100644 --- a/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.map +++ b/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.map @@ -1,2 +1,4 @@ + + diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.md5 b/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.md5 index 599892d..401812f 100644 --- a/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.md5 +++ b/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.md5 @@ -1 +1 @@ -d1e1d0ed1153bbeacbcad7678499e5da \ No newline at end of file +7f9a4355611bf7383a6b06edd3548930 \ No newline at end of file diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.png b/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.png index 0763d21..f8b5106 100644 Binary files a/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.png and b/docs/html/classaunit_1_1fake_1_1FakePrint__coll__graph.png differ diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.map b/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.map index d4781a8..12eb023 100644 --- a/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.map +++ b/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.map @@ -1,2 +1,4 @@ + + diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.md5 b/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.md5 index a61f57b..401812f 100644 --- a/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.md5 +++ b/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.md5 @@ -1 +1 @@ -7b09428fb32458c73955d9dd55f20c9f \ No newline at end of file +7f9a4355611bf7383a6b06edd3548930 \ No newline at end of file diff --git a/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.png b/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.png index 0763d21..f8b5106 100644 Binary files a/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.png and b/docs/html/classaunit_1_1fake_1_1FakePrint__inherit__graph.png differ diff --git a/docs/html/classaunit_1_1internal_1_1FCString-members.html b/docs/html/classaunit_1_1internal_1_1FCString-members.html index c9033e6..cd7cf9c 100644 --- a/docs/html/classaunit_1_1internal_1_1FCString-members.html +++ b/docs/html/classaunit_1_1internal_1_1FCString-members.html @@ -1,9 +1,9 @@ - + - + AUnit: Member List @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@
    - + +/* @license-end */ - + +/* @license-end */

    Public Member Functions

    FCString () - Default constructor initializes to a nullptr of kCStringType. More...
    +FCString () + Default constructor initializes to a nullptr of kCStringType.
      - FCString (const char *s) - Construct with a c-string. More...
    +FCString (const char *s) + Construct with a c-string.
      - FCString (const __FlashStringHelper *s) - Construct with a flash string. More...
    +FCString (const __FlashStringHelper *s) + Construct with a flash string.
      -uint8_t getType () const - Get the internal type of string. More...
    + +uint8_t getType () const + Get the internal type of string.
      -const char * getCString () const - Get the c-string pointer. More...
    + +const char * getCString () const + Get the c-string pointer.
      -const __FlashStringHelper * getFString () const - Get the flash string pointer. More...
    + +const __FlashStringHelper * getFString () const + Get the flash string pointer.
      -void print (Print *printer) const - Convenience method for printing an FCString. More...
    + +void print (Print *printer) const + Convenience method for printing an FCString.
      -void println (Print *printer) const - Convenience method for printing an FCString. More...
    + +void println (Print *printer) const + Convenience method for printing an FCString.
      -int compareTo (const FCString &that) const - Compare to another FCString. More...
    + +int compareTo (const FCString &that) const + Compare to another FCString.
      int compareToN (const char *that, size_t n) const - Compare to C-string using the first n characters. More...
    + Compare to C-string using the first n characters. More...
      int compareToN (const __FlashStringHelper *that, size_t n) const - Compare to a flash string using the first n characters. More...
    + Compare to a flash string using the first n characters. More...
     

    @@ -125,126 +137,14 @@

    Detailed Description

    A union of (const char*) and (const __FlashStringHelper*) with a discriminator.

    -

    This allows us to treat these 2 strings like a single object. The major reason this class is needed is because the F() cannot be used outside a function, it can only be used inside a function, so we are forced to use normal c-strings instead of F() strings when manually creating Test or TestOnce instances.

    +

    This allows us to treat these 2 strings like a single object. The major reason this class is needed is because the F() cannot be used outside a function, it can only be used inside a function, so we are forced to use normal c-strings instead of F() strings when manually creating Test or TestOnce instances.

    I deliberately decided not to inherit from Printable. While it is convenient to be able to call Print::print() with an instance of this class, the cost is 2 (AVR) or 4 (Teensy-ARM or ESP8266) extra bytes of static memory for the v-table pointer for each instance. But each instance is only 3 (AVR) or 5 (Teensy-ARM or ESP8266) bytes big, so the cost of 50-100 bytes of static memory for a large suite of 25 unit tests does not seem worth the minor convenience.

    -

    Instead, the print() and println() methods invert the dependency and accept a pointer to 'Print'.

    +

    Instead, the print() and println() methods invert the dependency and accept a pointer to 'Print'.

    Definition at line 55 of file FCString.h.

    -

    Constructor & Destructor Documentation

    - -

    ◆ FCString() [1/3]

    - -
    -
    - - - - - -
    - - - - - - - -
    aunit::internal::FCString::FCString ()
    -
    -inline
    -
    - -

    Default constructor initializes to a nullptr of kCStringType.

    - -

    Definition at line 61 of file FCString.h.

    - -
    -
    - -

    ◆ FCString() [2/3]

    - -
    -
    - - - - - -
    - - - - - - - - -
    aunit::internal::FCString::FCString (const char * s)
    -
    -inlineexplicit
    -
    - -

    Construct with a c-string.

    - -

    Definition at line 64 of file FCString.h.

    - -
    -
    - -

    ◆ FCString() [3/3]

    - -
    -
    - - - - - -
    - - - - - - - - -
    aunit::internal::FCString::FCString (const __FlashStringHelper * s)
    -
    -inlineexplicit
    -
    - -

    Construct with a flash string.

    - -

    Definition at line 70 of file FCString.h.

    - -
    -
    -

    Member Function Documentation

    - -

    ◆ compareTo()

    - -
    -
    - - - - - - - - -
    int aunit::internal::FCString::compareTo (const FCStringthat) const
    -
    - -

    Compare to another FCString.

    - -

    Definition at line 55 of file FCString.cpp.

    - -
    -
    - -

    ◆ compareToN() [1/2]

    +

    Member Function Documentation

    + +

    ◆ compareToN() [1/2]

    - -

    ◆ compareToN() [2/2]

    + +

    ◆ compareToN() [2/2]

    - -

    ◆ getCString()

    - -
    -
    - - - - - -
    - - - - - - - -
    const char* aunit::internal::FCString::getCString () const
    -
    -inline
    -
    - -

    Get the c-string pointer.

    - -

    Definition at line 79 of file FCString.h.

    - -
    -
    - -

    ◆ getFString()

    - -
    -
    - - - - - -
    - - - - - - - -
    const __FlashStringHelper* aunit::internal::FCString::getFString () const
    -
    -inline
    -
    - -

    Get the flash string pointer.

    - -

    Definition at line 82 of file FCString.h.

    - -
    -
    - -

    ◆ getType()

    - -
    -
    - - - - - -
    - - - - - - - -
    uint8_t aunit::internal::FCString::getType () const
    -
    -inline
    -
    - -

    Get the internal type of string.

    - -

    Definition at line 76 of file FCString.h.

    - -
    -
    - -

    ◆ print()

    - -
    -
    - - - - - - - - -
    void aunit::internal::FCString::print (Print * printer) const
    -
    - -

    Convenience method for printing an FCString.

    - -

    Definition at line 32 of file FCString.cpp.

    - -
    -
    - -

    ◆ println()

    - -
    -
    - - - - - - - - -
    void aunit::internal::FCString::println (Print * printer) const
    -
    - -

    Convenience method for printing an FCString.

    +

    Compare to C-string using the first n characters.

    +

    This is expected to be used only for TestRunner::exclude() and TestRunner::include().

    -

    Definition at line 42 of file FCString.cpp.

    +

    Definition at line 71 of file FCString.cpp.


    The documentation for this class was generated from the following files: diff --git a/docs/html/classes.html b/docs/html/classes.html index 29295d6..0258aa2 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Index @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -67,18 +70,34 @@
    a | f | m | p | t | v
    + + + + + - + + + + + + + + + + + - - + + + + + + +
      a  
    -
    FCString (aunit::internal)   
      t  
    -
    TestRunner (aunit)   
    FCString (aunit::internal)   
      t  
    +
    TestRunner (aunit)   
      m  
    -
      v  
    -
    Assertion (aunit)   Test (aunit)   
      v  
    +
    Assertion (aunit)   Test (aunit)   
      f  
    -
    MetaAssertion (aunit)   TestAgain (aunit)   Verbosity (aunit)   
    MetaAssertion (aunit)   TestAgain (aunit)   Verbosity (aunit)   
      p  
    -
    TestOnce (aunit)   
    FakePrint (aunit::fake)   
    Printer (aunit)   
    TestOnce (aunit)   
    FakePrint (aunit::fake)   
    Printer (aunit)   
    a | f | m | p | t | v
    @@ -87,7 +106,7 @@ diff --git a/docs/html/dir_000000_000001.html b/docs/html/dir_000000_000001.html index b026f9e..1838905 100644 --- a/docs/html/dir_000000_000001.html +++ b/docs/html/dir_000000_000001.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src -> aunit Relation +AUnit: /home/brian/src/AUnit/src -> aunit Relation @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@ - + +/* @license-end */
    src → aunit Relation

    @@ -31,18 +31,21 @@
    diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html index f32cce0..adda4bb 100644 --- a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html +++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src Directory Reference +AUnit: /home/brian/src/AUnit/src Directory Reference @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    - + +/* @license-end */
    Directory dependency graph for src:
    -
    /home/brian/dev/AUnit/src
    +
    /home/brian/src/AUnit/src
    - - - + + +
    @@ -85,10 +88,8 @@ - -

    Files

    file  AUnit.h [code]
     Same as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided.
     
    file  AUnitVerbose.h [code]
     Same as AUnit.h except that the verbose versions of the various assertXxx() macros are provided.
     
    @@ -96,7 +97,7 @@ diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map index 00b205e..0e58d45 100644 --- a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map +++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map @@ -1,5 +1,5 @@ - + - + diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 index d4c727d..fa6af2f 100644 --- a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 +++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 @@ -1 +1 @@ -56537ff05fa01a9a1c71ea3176f8028d \ No newline at end of file +b58d27153930886270f345234e916105 \ No newline at end of file diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png index 46e43a0..7acf34f 100644 Binary files a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png and b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png differ diff --git a/docs/html/dir_81cd3825682eb05918933587e078c005.html b/docs/html/dir_81cd3825682eb05918933587e078c005.html index 60c9778..2ce5156 100644 --- a/docs/html/dir_81cd3825682eb05918933587e078c005.html +++ b/docs/html/dir_81cd3825682eb05918933587e078c005.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit Directory Reference +AUnit: /home/brian/src/AUnit/src/aunit Directory Reference @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@ - + +/* @license-end */

    Files

    file  AssertMacros.h [code] - Various assertion macros (assertXxx()) are defined in this header.
      file  AssertVerboseMacros.h [code] - Verbose versions of the macros in AssertMacros.h.
      file  Compare.h [code] - This file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a, b) macros.
      file  Flash.h [code] - Various macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them.
      file  MetaAssertMacros.h [code] - Various assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in this header.
      file  print64.h [code] - Helper routines to print 'long long' and 'unsigned long long' because the Print::print() methods in Print.h do not suport 64-bit integers.
      file  TestMacros.h [code] - Various macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header.
     
    @@ -101,7 +97,7 @@ diff --git a/docs/html/dir_9268cfe6e304750d3a96b29cda140489.html b/docs/html/dir_9268cfe6e304750d3a96b29cda140489.html index 4b8a3ec..de0baf8 100644 --- a/docs/html/dir_9268cfe6e304750d3a96b29cda140489.html +++ b/docs/html/dir_9268cfe6e304750d3a96b29cda140489.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/contrib Directory Reference +AUnit: /home/brian/src/AUnit/src/aunit/contrib Directory Reference @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@ - + +/* @license-end */

    Files

    file  gtest.h [code] - A simple adapter which allows basic unit tests written using Google Test API (https://github.com/google/googletest) to run on Arduino platforms using AUnit.
     
    @@ -80,7 +82,7 @@ diff --git a/docs/html/dir_dc26540604d17911199600d9c2812a4e.html b/docs/html/dir_dc26540604d17911199600d9c2812a4e.html index 7e950be..e92ed3f 100644 --- a/docs/html/dir_dc26540604d17911199600d9c2812a4e.html +++ b/docs/html/dir_dc26540604d17911199600d9c2812a4e.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/fake Directory Reference +AUnit: /home/brian/src/AUnit/src/aunit/fake Directory Reference @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@ - + +/* @license-end */ - + +/* @license-end */ @@ -69,23 +72,23 @@   src   aunit   contrib - gtest.hA simple adapter which allows basic unit tests written using Google Test API (https://github.com/google/googletest) to run on Arduino platforms using AUnit + gtest.h   fake  FakePrint.h  Assertion.cpp  Assertion.h - AssertMacros.hVarious assertion macros (assertXxx()) are defined in this header - AssertVerboseMacros.hVerbose versions of the macros in AssertMacros.h + AssertMacros.h + AssertVerboseMacros.h  Compare.cpp - Compare.hThis file provides overloaded compareXxx(a, b) functions which are used by the various assertXxx(a, b) macros + Compare.h  FCString.cpp  FCString.h - Flash.hVarious macros to smooth over the differences among the various platforms with regards to their support for flash strings and the various macros used to create and access them + Flash.h  MetaAssertion.cpp  MetaAssertion.h - MetaAssertMacros.hVarious assertTestXxx(), checkTestXxx(), assertTestXxxF() and checkTestXxxF() macros are defined in this header + MetaAssertMacros.h  print64.cpp - print64.hHelper routines to print 'long long' and 'unsigned long long' because the Print::print() methods in Print.h do not suport 64-bit integers + print64.h  Printer.cpp  Printer.h  string_util.cpp @@ -94,14 +97,14 @@  Test.h  TestAgain.cpp  TestAgain.h - TestMacros.hVarious macros (test(), testF(), testing(), testingF(), externTest(), externTestF(), externTesting(), externTestingF()) are defined in this header + TestMacros.h  TestOnce.cpp  TestOnce.h  TestRunner.cpp  TestRunner.h  Verbosity.h - AUnit.hSame as AUnitVerbose.h except that the terse versions of the various assertXxx() macros are provided - AUnitVerbose.hSame as AUnit.h except that the verbose versions of the various assertXxx() macros are provided + AUnit.h + AUnitVerbose.h @@ -109,7 +112,7 @@ diff --git a/docs/html/functions.html b/docs/html/functions.html index b9ba4c3..c2f8528 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Members @@ -22,7 +22,7 @@
    AUnit -  1.3.2 +  1.3.3
    Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
    @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -364,7 +367,7 @@

    - t -

    @@ -372,7 +375,7 @@

    - t -

      diff --git a/docs/html/functions_func.html b/docs/html/functions_func.html index 0d27c30..264f22e 100644 --- a/docs/html/functions_func.html +++ b/docs/html/functions_func.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Members - Functions @@ -22,7 +22,7 @@
      AUnit -  1.3.2 +  1.3.3
      Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
      @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -296,7 +299,7 @@

      - t -

        diff --git a/docs/html/functions_type.html b/docs/html/functions_type.html index 21faff5..1b98b57 100644 --- a/docs/html/functions_type.html +++ b/docs/html/functions_type.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Members - Typedefs @@ -22,7 +22,7 @@
        AUnit -  1.3.2 +  1.3.3
        Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
        @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -62,7 +65,7 @@
         
        @@ -70,7 +73,7 @@ diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html index ae04974..686bb00 100644 --- a/docs/html/functions_vars.html +++ b/docs/html/functions_vars.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Members - Variables @@ -22,7 +22,7 @@
        AUnit -  1.3.2 +  1.3.3
        Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
        @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -136,7 +139,7 @@ diff --git a/docs/html/globals.html b/docs/html/globals.html index b111bd2..7dd0702 100644 --- a/docs/html/globals.html +++ b/docs/html/globals.html @@ -1,9 +1,9 @@ - + - + AUnit: File Members @@ -22,7 +22,7 @@
        AUnit -  1.3.2 +  1.3.3
        Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
        @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -318,7 +321,7 @@

        - t -

          diff --git a/docs/html/globals_defs.html b/docs/html/globals_defs.html index a58ed7e..722217e 100644 --- a/docs/html/globals_defs.html +++ b/docs/html/globals_defs.html @@ -1,9 +1,9 @@ - + - + AUnit: File Members @@ -22,7 +22,7 @@
          AUnit -  1.3.2 +  1.3.3
          Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
          @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -318,7 +321,7 @@

          - t -

            diff --git a/docs/html/graph_legend.html b/docs/html/graph_legend.html index 4cdc3ad..32ed912 100644 --- a/docs/html/graph_legend.html +++ b/docs/html/graph_legend.html @@ -1,9 +1,9 @@ - + - + AUnit: Graph Legend @@ -22,7 +22,7 @@
            AUnit -  1.3.2 +  1.3.3
            Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
            @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -65,11 +68,42 @@

            This page explains how to interpret the graphs that are generated by doxygen.

            -

            Consider the following example:

            /*! Invisible class because of truncation */
            class Invisible { };
            /*! Truncated class, inheritance relation is hidden */
            class Truncated : public Invisible { };
            /* Class not documented with doxygen comments */
            class Undocumented { };
            /*! Class that is inherited using public inheritance */
            class PublicBase : public Truncated { };
            /*! A template class */
            template<class T> class Templ { };
            /*! Class that is inherited using protected inheritance */
            class ProtectedBase { };
            /*! Class that is inherited using private inheritance */
            class PrivateBase { };
            /*! Class that is used by the Inherited class */
            class Used { };
            /*! Super class that inherits a number of other classes */
            class Inherited : public PublicBase,
            protected ProtectedBase,
            private PrivateBase,
            public Undocumented,
            public Templ<int>
            {
            private:
            Used *m_usedClass;
            };

            This will result in the following graph:

            -
            - -
            -

            The boxes in the above graph have the following meaning:

            +

            Consider the following example:

            /*! Invisible class because of truncation */
            +
            class Invisible { };
            +
            +
            /*! Truncated class, inheritance relation is hidden */
            +
            class Truncated : public Invisible { };
            +
            +
            /* Class not documented with doxygen comments */
            +
            class Undocumented { };
            +
            +
            /*! Class that is inherited using public inheritance */
            +
            class PublicBase : public Truncated { };
            +
            +
            /*! A template class */
            +
            template<class T> class Templ { };
            +
            +
            /*! Class that is inherited using protected inheritance */
            +
            class ProtectedBase { };
            +
            +
            /*! Class that is inherited using private inheritance */
            +
            class PrivateBase { };
            +
            +
            /*! Class that is used by the Inherited class */
            +
            class Used { };
            +
            +
            /*! Super class that inherits a number of other classes */
            +
            class Inherited : public PublicBase,
            +
            protected ProtectedBase,
            +
            private PrivateBase,
            +
            public Undocumented,
            +
            public Templ<int>
            +
            {
            +
            private:
            +
            Used *m_usedClass;
            +
            };
            +

            This will result in the following graph:

            +

            The boxes in the above graph have the following meaning:

            • A filled gray box represents the struct or class for which the graph is generated.
            • @@ -98,7 +132,7 @@ diff --git a/docs/html/graph_legend.md5 b/docs/html/graph_legend.md5 index a06ed05..8fcdccd 100644 --- a/docs/html/graph_legend.md5 +++ b/docs/html/graph_legend.md5 @@ -1 +1 @@ -387ff8eb65306fa251338d3c9bd7bfff \ No newline at end of file +f51bf6e9a10430aafef59831b08dcbfe \ No newline at end of file diff --git a/docs/html/graph_legend.png b/docs/html/graph_legend.png index 81788d8..7e2cbcf 100644 Binary files a/docs/html/graph_legend.png and b/docs/html/graph_legend.png differ diff --git a/docs/html/gtest_8h.html b/docs/html/gtest_8h.html index 66f8ef4..be5a6b2 100644 --- a/docs/html/gtest_8h.html +++ b/docs/html/gtest_8h.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/contrib/gtest.h File Reference +AUnit: /home/brian/src/AUnit/src/aunit/contrib/gtest.h File Reference @@ -22,7 +22,7 @@
              AUnit -  1.3.2 +  1.3.3
              Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
              @@ -31,18 +31,21 @@
            - + +/* @license-end */
            -

            A simple adapter which allows basic unit tests written using Google Test API (https://github.com/google/googletest) to run on Arduino platforms using AUnit. -More...

            -

            Go to the source code of this file.

            @@ -122,18 +122,25 @@

             

            Detailed Description

            -

            A simple adapter which allows basic unit tests written using Google Test API (https://github.com/google/googletest) to run on Arduino platforms using AUnit.

            +

            A simple adapter which allows basic unit tests written using Google Test API (https://github.com/google/googletest) to run on Arduino platforms using AUnit.

            This is not a comprehensive mapping layer. Only the TEST() macro is supported, TEST_F() is not supported. Many of the ASSERT_Xxx() macros are missing. Over time, more mapping macros may be added.

            Usage:

            -
            #include <AUnit.h>

            or

            - +
            #include <AUnit.h>
            + +

            or

            +
            #include <AUnitVerbose.h>
            + +

            Definition in file gtest.h.

            + + + diff --git a/docs/html/gtest_8h_source.html b/docs/html/gtest_8h_source.html index c4dc700..a1e8fa2 100644 --- a/docs/html/gtest_8h_source.html +++ b/docs/html/gtest_8h_source.html @@ -1,11 +1,11 @@ - + - + -AUnit: /home/brian/dev/AUnit/src/aunit/contrib/gtest.h Source File +AUnit: /home/brian/src/AUnit/src/aunit/contrib/gtest.h Source File @@ -22,7 +22,7 @@
            AUnit -  1.3.2 +  1.3.3
            Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
            @@ -31,18 +31,21 @@
            - + +/* @license-end */
            gtest.h
            -Go to the documentation of this file.
            1 /*
            2 MIT License
            3 
            4 Copyright (c) 2018 Chris Johnson
            5 
            6 Permission is hereby granted, free of charge, to any person obtaining a copy
            7 of this software and associated documentation files (the "Software"), to deal
            8 in the Software without restriction, including without limitation the rights
            9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
            10 copies of the Software, and to permit persons to whom the Software is
            11 furnished to do so, subject to the following conditions:
            12 
            13 The above copyright notice and this permission notice shall be included in all
            14 copies or substantial portions of the Software.
            15 
            16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
            17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
            18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
            19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
            20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
            21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
            22 SOFTWARE.
            23 */
            24 
            51 #ifndef AUNIT_CONTRIB_GTEST_H
            52 #define AUNIT_CONTRIB_GTEST_H
            53 
            54 #define TEST(category, name) test(category##_##name)
            55 
            56 #define ASSERT_EQ(e, a) assertEqual(static_cast<decltype(a)>(e), a)
            57 #define ASSERT_NE(e, a) assertNotEqual(static_cast<decltype(a)>(e), a)
            58 #define ASSERT_LT(e, a) assertLess(static_cast<decltype(a)>(e), a)
            59 #define ASSERT_GT(e, a) assertMore(static_cast<decltype(a)>(e), a)
            60 #define ASSERT_LE(e, a) assertLessOrEqual(static_cast<decltype(a)>(e), a)
            61 #define ASSERT_GE(e, a) assertMoreOrEqual(static_cast<decltype(a)>(e), a)
            62 
            63 #define ASSERT_STREQ(e, a) assertEqual(static_cast<decltype(a)>(e), a)
            64 #define ASSERT_STRNE(e, a) assertNotEqual(static_cast<decltype(a)>(e), a)
            65 #define ASSERT_STRCASEEQ(e, a) \
            66  assertStringCaseEqual(static_cast<decltype(a)>(e), a)
            67 #define ASSERT_STRCASENE(e, a) \
            68  assertStringCaseNotEqual(static_cast<decltype(a)>(e), a)
            69 
            70 #define ASSERT_TRUE(x) assertTrue(x)
            71 #define ASSERT_FALSE(x) assertFalse(x)
            72 
            73 #define ASSERT_NEAR(e, a, error) assertNear(static_cast<decltype(a)>(e), a, static_cast<decltype(a)>(error))
            74 
            75 #endif
            +Go to the documentation of this file.
            1 /*
            +
            2 MIT License
            +
            3 
            +
            4 Copyright (c) 2018 Chris Johnson
            +
            5 
            +
            6 Permission is hereby granted, free of charge, to any person obtaining a copy
            +
            7 of this software and associated documentation files (the "Software"), to deal
            +
            8 in the Software without restriction, including without limitation the rights
            +
            9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
            +
            10 copies of the Software, and to permit persons to whom the Software is
            +
            11 furnished to do so, subject to the following conditions:
            +
            12 
            +
            13 The above copyright notice and this permission notice shall be included in all
            +
            14 copies or substantial portions of the Software.
            +
            15 
            +
            16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
            +
            17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
            +
            18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
            +
            19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
            +
            20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
            +
            21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
            +
            22 SOFTWARE.
            +
            23 */
            +
            24 
            +
            51 #ifndef AUNIT_CONTRIB_GTEST_H
            +
            52 #define AUNIT_CONTRIB_GTEST_H
            +
            53 
            +
            54 #define TEST(category, name) test(category##_##name)
            +
            55 
            +
            56 #define ASSERT_EQ(e, a) assertEqual(static_cast<decltype(a)>(e), a)
            +
            57 #define ASSERT_NE(e, a) assertNotEqual(static_cast<decltype(a)>(e), a)
            +
            58 #define ASSERT_LT(e, a) assertLess(static_cast<decltype(a)>(e), a)
            +
            59 #define ASSERT_GT(e, a) assertMore(static_cast<decltype(a)>(e), a)
            +
            60 #define ASSERT_LE(e, a) assertLessOrEqual(static_cast<decltype(a)>(e), a)
            +
            61 #define ASSERT_GE(e, a) assertMoreOrEqual(static_cast<decltype(a)>(e), a)
            +
            62 
            +
            63 #define ASSERT_STREQ(e, a) assertEqual(static_cast<decltype(a)>(e), a)
            +
            64 #define ASSERT_STRNE(e, a) assertNotEqual(static_cast<decltype(a)>(e), a)
            +
            65 #define ASSERT_STRCASEEQ(e, a) \
            +
            66  assertStringCaseEqual(static_cast<decltype(a)>(e), a)
            +
            67 #define ASSERT_STRCASENE(e, a) \
            +
            68  assertStringCaseNotEqual(static_cast<decltype(a)>(e), a)
            +
            69 
            +
            70 #define ASSERT_TRUE(x) assertTrue(x)
            +
            71 #define ASSERT_FALSE(x) assertFalse(x)
            +
            72 
            +
            73 #define ASSERT_NEAR(e, a, error) assertNear(static_cast<decltype(a)>(e), a, static_cast<decltype(a)>(error))
            +
            74 
            +
            75 #endif
            +
            diff --git a/docs/html/hierarchy.html b/docs/html/hierarchy.html index abc41b5..039524f 100644 --- a/docs/html/hierarchy.html +++ b/docs/html/hierarchy.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Hierarchy @@ -22,7 +22,7 @@
            AUnit -  1.3.2 +  1.3.3
            Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
            @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -73,12 +76,12 @@  Caunit::fake::FakePrintAn implementation of Print that writes to an in-memory buffer  Caunit::PrinterUtility class that provides a level of indirection to the Print class where test results can be sent  Caunit::TestBase class of all test cases - Caunit::AssertionAn Assertion class is a subclass of Test and provides various overloaded assertion() functions - Caunit::MetaAssertionClass that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test - Caunit::TestAgainSimilar to TestOnce but performs the user-defined test multiple times - Caunit::TestOnceSimilar to TestAgain but performs user-defined test only once - Caunit::TestRunnerThe class that runs the various test cases defined by the test() and testing() macros - Caunit::VerbosityUtility class to hold the Verbosity constants + Caunit::AssertionAn Assertion class is a subclass of Test and provides various overloaded assertion() functions + Caunit::MetaAssertionClass that extends the Assertion class to support the checkTestXxx() and assertTestXxx() macros that look at the status of the named test + Caunit::TestAgainSimilar to TestOnce but performs the user-defined test multiple times + Caunit::TestOnceSimilar to TestAgain but performs user-defined test only once + Caunit::TestRunnerThe class that runs the various test cases defined by the test() and testing() macros + Caunit::VerbosityUtility class to hold the Verbosity constants @@ -86,7 +89,7 @@ diff --git a/docs/html/index.html b/docs/html/index.html index a4b1ab8..7bb842a 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -1,9 +1,9 @@ - + - + AUnit: AUnit Library @@ -22,7 +22,7 @@
            AUnit -  1.3.2 +  1.3.3
            Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
            @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -59,18 +62,19 @@ -
            +
            AUnit Library

            This is the Doxygen documentation for the AUnit Library.

            -
            +
            + diff --git a/docs/html/inherit_graph_0.map b/docs/html/inherit_graph_0.map index 3853877..de0d347 100644 --- a/docs/html/inherit_graph_0.map +++ b/docs/html/inherit_graph_0.map @@ -1,3 +1,4 @@ - + + diff --git a/docs/html/inherit_graph_0.md5 b/docs/html/inherit_graph_0.md5 index eea42fe..107f88f 100644 --- a/docs/html/inherit_graph_0.md5 +++ b/docs/html/inherit_graph_0.md5 @@ -1 +1 @@ -0c93a68ed43ee67149b68c0781e64da7 \ No newline at end of file +28ad49f9caf1729a0f9ce2d7e63d1d1c \ No newline at end of file diff --git a/docs/html/inherit_graph_0.png b/docs/html/inherit_graph_0.png index 30fb278..341e796 100644 Binary files a/docs/html/inherit_graph_0.png and b/docs/html/inherit_graph_0.png differ diff --git a/docs/html/inherit_graph_1.map b/docs/html/inherit_graph_1.map index 697fce5..07a46f7 100644 --- a/docs/html/inherit_graph_1.map +++ b/docs/html/inherit_graph_1.map @@ -1,3 +1,3 @@ - + diff --git a/docs/html/inherit_graph_1.md5 b/docs/html/inherit_graph_1.md5 index f29c801..9faa51e 100644 --- a/docs/html/inherit_graph_1.md5 +++ b/docs/html/inherit_graph_1.md5 @@ -1 +1 @@ -43f405a8da6b72d437c1596f2981b525 \ No newline at end of file +e7bec55e99eefe42113d98bb469039a3 \ No newline at end of file diff --git a/docs/html/inherit_graph_1.png b/docs/html/inherit_graph_1.png index 15699cb..6dcc155 100644 Binary files a/docs/html/inherit_graph_1.png and b/docs/html/inherit_graph_1.png differ diff --git a/docs/html/inherit_graph_2.map b/docs/html/inherit_graph_2.map index 212ac1c..bb3c429 100644 --- a/docs/html/inherit_graph_2.map +++ b/docs/html/inherit_graph_2.map @@ -1,3 +1,3 @@ - + diff --git a/docs/html/inherit_graph_2.md5 b/docs/html/inherit_graph_2.md5 index cf3abe4..f25bdd7 100644 --- a/docs/html/inherit_graph_2.md5 +++ b/docs/html/inherit_graph_2.md5 @@ -1 +1 @@ -74f50b49df31ad0675dc58b139f5a320 \ No newline at end of file +f8fa4685a5e6d538c3c7f3b36401e641 \ No newline at end of file diff --git a/docs/html/inherit_graph_2.png b/docs/html/inherit_graph_2.png index 61f759e..449e820 100644 Binary files a/docs/html/inherit_graph_2.png and b/docs/html/inherit_graph_2.png differ diff --git a/docs/html/inherit_graph_3.map b/docs/html/inherit_graph_3.map index 541c003..b5c787b 100644 --- a/docs/html/inherit_graph_3.map +++ b/docs/html/inherit_graph_3.map @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/docs/html/inherit_graph_3.md5 b/docs/html/inherit_graph_3.md5 index d81eb67..f4b69a9 100644 --- a/docs/html/inherit_graph_3.md5 +++ b/docs/html/inherit_graph_3.md5 @@ -1 +1 @@ -a7d251270d8f3205951981d1451fa604 \ No newline at end of file +acc51aa2e98814db97ac181fa5e6460c \ No newline at end of file diff --git a/docs/html/inherit_graph_3.png b/docs/html/inherit_graph_3.png index 85e23a5..612b872 100644 Binary files a/docs/html/inherit_graph_3.png and b/docs/html/inherit_graph_3.png differ diff --git a/docs/html/inherit_graph_4.map b/docs/html/inherit_graph_4.map index 8b6c389..1c0b834 100644 --- a/docs/html/inherit_graph_4.map +++ b/docs/html/inherit_graph_4.map @@ -1,3 +1,3 @@ - + diff --git a/docs/html/inherit_graph_4.md5 b/docs/html/inherit_graph_4.md5 index 6d947af..bbbd1db 100644 --- a/docs/html/inherit_graph_4.md5 +++ b/docs/html/inherit_graph_4.md5 @@ -1 +1 @@ -f9f005a0aba5364bf2a878bdb1e2270c \ No newline at end of file +ee9deb13a820262a1147c3807fdcf4ef \ No newline at end of file diff --git a/docs/html/inherit_graph_4.png b/docs/html/inherit_graph_4.png index abe49a3..89e3cc9 100644 Binary files a/docs/html/inherit_graph_4.png and b/docs/html/inherit_graph_4.png differ diff --git a/docs/html/inherit_graph_5.map b/docs/html/inherit_graph_5.map index c54a8a0..563d4ad 100644 --- a/docs/html/inherit_graph_5.map +++ b/docs/html/inherit_graph_5.map @@ -1,3 +1,3 @@ - + diff --git a/docs/html/inherit_graph_5.md5 b/docs/html/inherit_graph_5.md5 index cf9efaa..e708ade 100644 --- a/docs/html/inherit_graph_5.md5 +++ b/docs/html/inherit_graph_5.md5 @@ -1 +1 @@ -f0d2e2b29c188ef3c14e47ec58e78038 \ No newline at end of file +ab1e63245655f4917e281e8f2d96f6fb \ No newline at end of file diff --git a/docs/html/inherit_graph_5.png b/docs/html/inherit_graph_5.png index 2238456..67067cd 100644 Binary files a/docs/html/inherit_graph_5.png and b/docs/html/inherit_graph_5.png differ diff --git a/docs/html/inherits.html b/docs/html/inherits.html index 43a4541..642c583 100644 --- a/docs/html/inherits.html +++ b/docs/html/inherits.html @@ -1,9 +1,9 @@ - + - + AUnit: Class Hierarchy @@ -22,7 +22,7 @@
            AUnit -  1.3.2 +  1.3.3
            Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
            @@ -31,18 +31,21 @@ - + +/* @license-end */ @@ -67,38 +70,39 @@ - - - - - -
            +
            - + +
            +
            - +
            +
            - +
            +
            - - - - - + + + + +
            +
            - +
            +
            - +
            @@ -107,7 +111,7 @@ diff --git a/docs/html/jquery.js b/docs/html/jquery.js index f5343ed..103c32d 100644 --- a/docs/html/jquery.js +++ b/docs/html/jquery.js @@ -1,71 +1,26 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
            "],col:[2,"","
            "],tr:[2,"","
            "],td:[3,"","
            "],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
            ",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0a;a++)for(i in o[a])n=o[a][i],o[a].hasOwnProperty(i)&&void 0!==n&&(e[i]=t.isPlainObject(n)?t.isPlainObject(e[i])?t.widget.extend({},e[i],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,i){var n=i.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=s.call(arguments,1),h=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(h=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(h=i&&i.jquery?h.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):h=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new i(o,this))})),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
            ",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+o.eventNamespace,c=h[2];c?n.on(l,c,r):i.on(l,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,h=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("
            "),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widthi?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};l>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),h.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-r-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-r-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.ui.focusable=function(i,s){var n,o,a,r,h,l=i.nodeName.toLowerCase();return"area"===l?(n=i.parentNode,o=n.name,i.href&&o&&"map"===n.nodeName.toLowerCase()?(a=t("img[usemap='#"+o+"']"),a.length>0&&a.is(":visible")):!1):(/^(input|select|textarea|button|object)$/.test(l)?(r=!i.disabled,r&&(h=t(i).closest("fieldset")[0],h&&(r=!h.disabled))):r="a"===l?i.href||s:s,r&&t(i).is(":visible")&&e(t(i)))},t.extend(t.expr[":"],{focusable:function(e){return t.ui.focusable(e,null!=t.attr(e,"tabindex"))}}),t.ui.focusable,t.fn.form=function(){return"string"==typeof this[0].form?this.closest("form"):t(this[0].form)},t.ui.formResetMixin={_formResetHandler:function(){var e=t(this);setTimeout(function(){var i=e.data("ui-form-reset-instances");t.each(i,function(){this.refresh()})})},_bindFormResetHandler:function(){if(this.form=this.element.form(),this.form.length){var t=this.form.data("ui-form-reset-instances")||[];t.length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t)}},_unbindFormResetHandler:function(){if(this.form.length){var e=this.form.data("ui-form-reset-instances");e.splice(t.inArray(this,e),1),e.length?this.form.data("ui-form-reset-instances",e):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset")}}},"1.7"===t.fn.jquery.substring(0,3)&&(t.each(["Width","Height"],function(e,i){function s(e,i,s,o){return t.each(n,function(){i-=parseFloat(t.css(e,"padding"+this))||0,s&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),o&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],o=i.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+i]=function(e){return void 0===e?a["inner"+i].call(this):this.each(function(){t(this).css(o,s(this,e)+"px")})},t.fn["outer"+i]=function(e,n){return"number"!=typeof e?a["outer"+i].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,n)+"px")})}}),t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.ui.escapeSelector=function(){var t=/([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;return function(e){return e.replace(t,"\\$1")}}(),t.fn.labels=function(){var e,i,s,n,o;return this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(n=this.eq(0).parents("label"),s=this.attr("id"),s&&(e=this.eq(0).parents().last(),o=e.add(e.length?e.siblings():this.siblings()),i="label[for='"+t.ui.escapeSelector(s)+"']",n=n.add(o.find(i).addBack(i))),this.pushStack(n))},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.extend(t.expr[":"],{tabbable:function(e){var i=t.attr(e,"tabindex"),s=null!=i;return(!s||i>=0)&&t.ui.focusable(e,s)}}),t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var n=!1;t(document).on("mouseup",function(){n=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!n){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.widget("ui.resizable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
            ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show())}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
            "),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,h=this._change[o];return this._updatePrevProperties(),h?(i=h.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,h,l=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,h=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,l.animate||this.element.css(t.extend(a,{top:h,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!l.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,h=this.originalPosition.top+this.originalSize.height,l=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=r-e.minWidth),s&&l&&(t.left=r-e.maxWidth),a&&c&&(t.top=h-e.minHeight),n&&c&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
            "),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element +},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-a},l=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(h,c&&l?{top:c,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,h=t(this).resizable("instance"),l=h.options,c=h.element,u=l.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(h.containerElement=t(d),/document/.test(u)||u===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=h._num(e.css("padding"+s))}),h.containerOffset=e.offset(),h.containerPosition=e.position(),h.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,o=h.containerSize.width,a=h._hasScroll(d,"left")?d.scrollWidth:o,r=h._hasScroll(d)?d.scrollHeight:n,h.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,h=a.containerOffset,l=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=h),l.left<(a._helper?h.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-h.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?h.left:0),l.top<(a._helper?h.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-h.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?h.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-h.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-h.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),h=a.outerWidth()-e.sizeDiff.width,l=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,c=h[1]||1,u=Math.round((n.width-o.width)/l)*l,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=h,_&&(p+=l),v&&(f+=c),m&&(p-=l),g&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-l)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-l>0?(i.size.width=p,i.position.left=a.left-u):(p=l-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable});/** + * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler + * Licensed under MIT + * @author Ariel Flesler + * @version 2.1.2 + */ +;(function(f){"use strict";"function"===typeof define&&define.amd?define(["jquery"],f):"undefined"!==typeof module&&module.exports?module.exports=f(require("jquery")):f(jQuery)})(function($){"use strict";function n(a){return!a.nodeName||-1!==$.inArray(a.nodeName.toLowerCase(),["iframe","#document","html","body"])}function h(a){return $.isFunction(a)||$.isPlainObject(a)?a:{top:a,left:a}}var p=$.scrollTo=function(a,d,b){return $(window).scrollTo(a,d,b)};p.defaults={axis:"xy",duration:0,limit:!0};$.fn.scrollTo=function(a,d,b){"object"=== typeof d&&(b=d,d=0);"function"===typeof b&&(b={onAfter:b});"max"===a&&(a=9E9);b=$.extend({},p.defaults,b);d=d||b.duration;var u=b.queue&&1=f[g]?0:Math.min(f[g],n));!a&&1)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
            a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
            ";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
            t
            ";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
            ";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bRe[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="

            ";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="
            ";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT0){for(bB=bA;bB=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/",""],legend:[1,"
            ","
            "],thead:[1,"","
            "],tr:[2,"","
            "],td:[3,"","
            "],col:[2,"","
            "],area:[1,"",""],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div
            ","
            "]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1>");try{for(var bw=0,bv=this.length;bw1&&bw0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]===""&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("
            ").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"":"")+"");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);/*! - * jQuery UI 1.8.18 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.18",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));f.offsetHeight;a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);/*! - * jQuery UI Widget 1.8.18 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Widget - */ -(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(e,f,g){var j,i,h=this.options[e];g=g||{};f=b.Event(f);f.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase();f.target=this.element[0];i=f.originalEvent;if(i){for(j in i){if(!(j in f)){f[j]=i[j]}}}this.element.trigger(f,g);return !(b.isFunction(h)&&h.call(this.element[0],f,g)===false||f.isDefaultPrevented())}}})(jQuery);/*! - * jQuery UI Mouse 1.8.18 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Mouse - * - * Depends: - * jquery.ui.widget.js - */ -(function(b,c){var a=false;b(document).mouseup(function(d){a=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var d=this;this.element.bind("mousedown."+this.widgetName,function(e){return d._mouseDown(e)}).bind("click."+this.widgetName,function(e){if(true===b.data(e.target,d.widgetName+".preventClickEvent")){b.removeData(e.target,d.widgetName+".preventClickEvent");e.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(f){if(a){return}(this._mouseStarted&&this._mouseUp(f));this._mouseDownEvent=f;var e=this,g=(f.which==1),d=(typeof this.options.cancel=="string"&&f.target.nodeName?b(f.target).closest(this.options.cancel).length:false);if(!g||d||!this._mouseCapture(f)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(f)&&this._mouseDelayMet(f)){this._mouseStarted=(this._mouseStart(f)!==false);if(!this._mouseStarted){f.preventDefault();return true}}if(true===b.data(f.target,this.widgetName+".preventClickEvent")){b.removeData(f.target,this.widgetName+".preventClickEvent")}this._mouseMoveDelegate=function(h){return e._mouseMove(h)};this._mouseUpDelegate=function(h){return e._mouseUp(h)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);f.preventDefault();a=true;return true},_mouseMove:function(d){if(b.browser.msie&&!(document.documentMode>=9)&&!d.button){return this._mouseUp(d)}if(this._mouseStarted){this._mouseDrag(d);return d.preventDefault()}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,d)!==false);(this._mouseStarted?this._mouseDrag(d):this._mouseUp(d))}return !this._mouseStarted},_mouseUp:function(d){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;if(d.target==this._mouseDownEvent.target){b.data(d.target,this.widgetName+".preventClickEvent",true)}this._mouseStop(d)}return false},_mouseDistanceMet:function(d){return(Math.max(Math.abs(this._mouseDownEvent.pageX-d.pageX),Math.abs(this._mouseDownEvent.pageY-d.pageY))>=this.options.distance)},_mouseDelayMet:function(d){return this.mouseDelayMet},_mouseStart:function(d){},_mouseDrag:function(d){},_mouseStop:function(d){},_mouseCapture:function(d){return true}})})(jQuery);(function(c,d){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var f=this,k=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(k.aspectRatio),aspectRatio:k.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:k.helper||k.ghost||k.animate?k.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){this.element.wrap(c('
            ').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=k.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var l=this.handles.split(",");this.handles={};for(var g=0;g
            ');if(/sw|se|ne|nw/.test(j)){h.css({zIndex:++k.zIndex})}if("se"==j){h.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[j]=".ui-resizable-"+j;this.element.append(h)}}this._renderAxis=function(q){q=q||this.element;for(var n in this.handles){if(this.handles[n].constructor==String){this.handles[n]=c(this.handles[n],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var o=c(this.handles[n],this.element),p=0;p=/sw|ne|nw|se|n|s/.test(n)?o.outerHeight():o.outerWidth();var m=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");q.css(m,p);this._proportionallyResize()}if(!c(this.handles[n]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!f.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}f.axis=i&&i[1]?i[1]:"se"}});if(k.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){if(k.disabled){return}c(this).removeClass("ui-resizable-autohide");f._handles.show()},function(){if(k.disabled){return}if(!f.resizing){c(this).addClass("ui-resizable-autohide");f._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var e=function(g){c(g).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){e(this.element);var f=this.element;f.after(this.originalElement.css({position:f.css("position"),width:f.outerWidth(),height:f.outerHeight(),top:f.css("top"),left:f.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);e(this.originalElement);return this},_mouseCapture:function(f){var g=false;for(var e in this.handles){if(c(this.handles[e])[0]==f.target){g=true}}return !this.options.disabled&&g},_mouseStart:function(g){var j=this.options,f=this.element.position(),e=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(e.is(".ui-draggable")||(/absolute/).test(e.css("position"))){e.css({position:"absolute",top:f.top,left:f.left})}this._renderProxy();var k=b(this.helper.css("left")),h=b(this.helper.css("top"));if(j.containment){k+=c(j.containment).scrollLeft()||0;h+=c(j.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:k,top:h};this.size=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalSize=this._helper?{width:e.outerWidth(),height:e.outerHeight()}:{width:e.width(),height:e.height()};this.originalPosition={left:k,top:h};this.sizeDiff={width:e.outerWidth()-e.width(),height:e.outerHeight()-e.height()};this.originalMousePosition={left:g.pageX,top:g.pageY};this.aspectRatio=(typeof j.aspectRatio=="number")?j.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var i=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",i=="auto"?this.axis+"-resize":i);e.addClass("ui-resizable-resizing");this._propagate("start",g);return true},_mouseDrag:function(e){var h=this.helper,g=this.options,m={},q=this,j=this.originalMousePosition,n=this.axis;var r=(e.pageX-j.left)||0,p=(e.pageY-j.top)||0;var i=this._change[n];if(!i){return false}var l=i.apply(this,[e,r,p]),k=c.browser.msie&&c.browser.version<7,f=this.sizeDiff;this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey){l=this._updateRatio(l,e)}l=this._respectSize(l,e);this._propagate("resize",e);h.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(l);this._trigger("resize",e,this.ui());return false},_mouseStop:function(h){this.resizing=false;var i=this.options,m=this;if(this._helper){var g=this._proportionallyResizeElements,e=g.length&&(/textarea/i).test(g[0].nodeName),f=e&&c.ui.hasScroll(g[0],"left")?0:m.sizeDiff.height,k=e?0:m.sizeDiff.width;var n={width:(m.helper.width()-k),height:(m.helper.height()-f)},j=(parseInt(m.element.css("left"),10)+(m.position.left-m.originalPosition.left))||null,l=(parseInt(m.element.css("top"),10)+(m.position.top-m.originalPosition.top))||null;if(!i.animate){this.element.css(c.extend(n,{top:l,left:j}))}m.helper.height(m.size.height);m.helper.width(m.size.width);if(this._helper&&!i.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",h);if(this._helper){this.helper.remove()}return false},_updateVirtualBoundaries:function(g){var j=this.options,i,h,f,k,e;e={minWidth:a(j.minWidth)?j.minWidth:0,maxWidth:a(j.maxWidth)?j.maxWidth:Infinity,minHeight:a(j.minHeight)?j.minHeight:0,maxHeight:a(j.maxHeight)?j.maxHeight:Infinity};if(this._aspectRatio||g){i=e.minHeight*this.aspectRatio;f=e.minWidth/this.aspectRatio;h=e.maxHeight*this.aspectRatio;k=e.maxWidth/this.aspectRatio;if(i>e.minWidth){e.minWidth=i}if(f>e.minHeight){e.minHeight=f}if(hl.width),s=a(l.height)&&i.minHeight&&(i.minHeight>l.height);if(h){l.width=i.minWidth}if(s){l.height=i.minHeight}if(t){l.width=i.maxWidth}if(m){l.height=i.maxHeight}var f=this.originalPosition.left+this.originalSize.width,p=this.position.top+this.size.height;var k=/sw|nw|w/.test(q),e=/nw|ne|n/.test(q);if(h&&k){l.left=f-i.minWidth}if(t&&k){l.left=f-i.maxWidth}if(s&&e){l.top=p-i.minHeight}if(m&&e){l.top=p-i.maxHeight}var n=!l.width&&!l.height;if(n&&!l.left&&l.top){l.top=null}else{if(n&&!l.top&&l.left){l.left=null}}return l},_proportionallyResize:function(){var k=this.options;if(!this._proportionallyResizeElements.length){return}var g=this.helper||this.element;for(var f=0;f');var e=c.browser.msie&&c.browser.version<7,g=(e?1:0),h=(e?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+h,height:this.element.outerHeight()+h,position:"absolute",left:this.elementOffset.left-g+"px",top:this.elementOffset.top-g+"px",zIndex:++i.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(g,f,e){return{width:this.originalSize.width+f}},w:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{left:i.left+f,width:g.width-f}},n:function(h,f,e){var j=this.options,g=this.originalSize,i=this.originalPosition;return{top:i.top+e,height:g.height-e}},s:function(g,f,e){return{height:this.originalSize.height+e}},se:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},sw:function(g,f,e){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[g,f,e]))},ne:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[g,f,e]))},nw:function(g,f,e){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[g,f,e]))}},_propagate:function(f,e){c.ui.plugin.call(this,f,[e,this.ui()]);(f!="resize"&&this._trigger(f,e,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.18"});c.ui.plugin.add("resizable","alsoResize",{start:function(f,g){var e=c(this).data("resizable"),i=e.options;var h=function(j){c(j).each(function(){var k=c(this);k.data("resizable-alsoresize",{width:parseInt(k.width(),10),height:parseInt(k.height(),10),left:parseInt(k.css("left"),10),top:parseInt(k.css("top"),10)})})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.parentNode){if(i.alsoResize.length){i.alsoResize=i.alsoResize[0];h(i.alsoResize)}else{c.each(i.alsoResize,function(j){h(j)})}}else{h(i.alsoResize)}},resize:function(g,i){var f=c(this).data("resizable"),j=f.options,h=f.originalSize,l=f.originalPosition;var k={height:(f.size.height-h.height)||0,width:(f.size.width-h.width)||0,top:(f.position.top-l.top)||0,left:(f.position.left-l.left)||0},e=function(m,n){c(m).each(function(){var q=c(this),r=c(this).data("resizable-alsoresize"),p={},o=n&&n.length?n:q.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];c.each(o,function(s,u){var t=(r[u]||0)+(k[u]||0);if(t&&t>=0){p[u]=t||null}});q.css(p)})};if(typeof(j.alsoResize)=="object"&&!j.alsoResize.nodeType){c.each(j.alsoResize,function(m,n){e(m,n)})}else{e(j.alsoResize)}},stop:function(e,f){c(this).removeData("resizable-alsoresize")}});c.ui.plugin.add("resizable","animate",{stop:function(i,n){var p=c(this).data("resizable"),j=p.options;var h=p._proportionallyResizeElements,e=h.length&&(/textarea/i).test(h[0].nodeName),f=e&&c.ui.hasScroll(h[0],"left")?0:p.sizeDiff.height,l=e?0:p.sizeDiff.width;var g={width:(p.size.width-l),height:(p.size.height-f)},k=(parseInt(p.element.css("left"),10)+(p.position.left-p.originalPosition.left))||null,m=(parseInt(p.element.css("top"),10)+(p.position.top-p.originalPosition.top))||null;p.element.animate(c.extend(g,m&&k?{top:m,left:k}:{}),{duration:j.animateDuration,easing:j.animateEasing,step:function(){var o={width:parseInt(p.element.css("width"),10),height:parseInt(p.element.css("height"),10),top:parseInt(p.element.css("top"),10),left:parseInt(p.element.css("left"),10)};if(h&&h.length){c(h[0]).css({width:o.width,height:o.height})}p._updateCache(o);p._propagate("resize",i)}})}});c.ui.plugin.add("resizable","containment",{start:function(f,r){var t=c(this).data("resizable"),j=t.options,l=t.element;var g=j.containment,k=(g instanceof c)?g.get(0):(/parent/.test(g))?l.parent().get(0):g;if(!k){return}t.containerElement=c(k);if(/document/.test(g)||g==document){t.containerOffset={left:0,top:0};t.containerPosition={left:0,top:0};t.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var n=c(k),i=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){i[p]=b(n.css("padding"+o))});t.containerOffset=n.offset();t.containerPosition=n.position();t.containerSize={height:(n.innerHeight()-i[3]),width:(n.innerWidth()-i[1])};var q=t.containerOffset,e=t.containerSize.height,m=t.containerSize.width,h=(c.ui.hasScroll(k,"left")?k.scrollWidth:m),s=(c.ui.hasScroll(k)?k.scrollHeight:e);t.parentData={element:k,left:q.left,top:q.top,width:h,height:s}}},resize:function(g,q){var t=c(this).data("resizable"),i=t.options,f=t.containerSize,p=t.containerOffset,m=t.size,n=t.position,r=t._aspectRatio||g.shiftKey,e={top:0,left:0},h=t.containerElement;if(h[0]!=document&&(/static/).test(h.css("position"))){e=p}if(n.left<(t._helper?p.left:0)){t.size.width=t.size.width+(t._helper?(t.position.left-p.left):(t.position.left-e.left));if(r){t.size.height=t.size.width/i.aspectRatio}t.position.left=i.helper?p.left:0}if(n.top<(t._helper?p.top:0)){t.size.height=t.size.height+(t._helper?(t.position.top-p.top):t.position.top);if(r){t.size.width=t.size.height*i.aspectRatio}t.position.top=t._helper?p.top:0}t.offset.left=t.parentData.left+t.position.left;t.offset.top=t.parentData.top+t.position.top;var l=Math.abs((t._helper?t.offset.left-e.left:(t.offset.left-e.left))+t.sizeDiff.width),s=Math.abs((t._helper?t.offset.top-e.top:(t.offset.top-p.top))+t.sizeDiff.height);var k=t.containerElement.get(0)==t.element.parent().get(0),j=/relative|absolute/.test(t.containerElement.css("position"));if(k&&j){l-=t.parentData.left}if(l+t.size.width>=t.parentData.width){t.size.width=t.parentData.width-l;if(r){t.size.height=t.size.width/t.aspectRatio}}if(s+t.size.height>=t.parentData.height){t.size.height=t.parentData.height-s;if(r){t.size.width=t.size.height*t.aspectRatio}}},stop:function(f,n){var q=c(this).data("resizable"),g=q.options,l=q.position,m=q.containerOffset,e=q.containerPosition,i=q.containerElement;var j=c(q.helper),r=j.offset(),p=j.outerWidth()-q.sizeDiff.width,k=j.outerHeight()-q.sizeDiff.height;if(q._helper&&!g.animate&&(/relative/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}if(q._helper&&!g.animate&&(/static/).test(i.css("position"))){c(this).css({left:r.left-e.left-m.left,width:p,height:k})}}});c.ui.plugin.add("resizable","ghost",{start:function(g,h){var e=c(this).data("resizable"),i=e.options,f=e.size;e.ghost=e.originalElement.clone();e.ghost.css({opacity:0.25,display:"block",position:"relative",height:f.height,width:f.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:"");e.ghost.appendTo(e.helper)},resize:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost){e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})}},stop:function(f,g){var e=c(this).data("resizable"),h=e.options;if(e.ghost&&e.helper){e.helper.get(0).removeChild(e.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(e,m){var p=c(this).data("resizable"),h=p.options,k=p.size,i=p.originalSize,j=p.originalPosition,n=p.axis,l=h._aspectRatio||e.shiftKey;h.grid=typeof h.grid=="number"?[h.grid,h.grid]:h.grid;var g=Math.round((k.width-i.width)/(h.grid[0]||1))*(h.grid[0]||1),f=Math.round((k.height-i.height)/(h.grid[1]||1))*(h.grid[1]||1);if(/^(se|s|e)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f}else{if(/^(ne)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f}else{if(/^(sw)$/.test(n)){p.size.width=i.width+g;p.size.height=i.height+f;p.position.left=j.left-g}else{p.size.width=i.width+g;p.size.height=i.height+f;p.position.top=j.top-f;p.position.left=j.left-g}}}}});var b=function(e){return parseInt(e,10)||0};var a=function(e){return !isNaN(parseInt(e,10))}})(jQuery);/*! - * jQuery hashchange event - v1.3 - 7/21/2010 - * http://benalman.com/projects/jquery-hashchange-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('