]> git.mdlowis.com Git - projs/opts.git/commitdiff
Initial Commit
authorMike D. Lowis <mike@mdlowis.com>
Thu, 31 May 2012 13:53:50 +0000 (09:53 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Thu, 31 May 2012 13:53:50 +0000 (09:53 -0400)
75 files changed:
.gitignore [new file with mode: 0644]
Doxyfile [new file with mode: 0644]
LICENSE.md [new file with mode: 0644]
Makefile [new file with mode: 0644]
README.md [new file with mode: 0644]
docs/DUMMY [new file with mode: 0644]
tests/main.cpp [new file with mode: 0644]
tools/UnitTest++/COPYING [new file with mode: 0644]
tools/UnitTest++/Makefile [new file with mode: 0644]
tools/UnitTest++/README [new file with mode: 0644]
tools/UnitTest++/docs/UnitTest++.html [new file with mode: 0644]
tools/UnitTest++/src/AssertException.cpp [new file with mode: 0644]
tools/UnitTest++/src/AssertException.h [new file with mode: 0644]
tools/UnitTest++/src/CheckMacros.h [new file with mode: 0644]
tools/UnitTest++/src/Checks.cpp [new file with mode: 0644]
tools/UnitTest++/src/Checks.h [new file with mode: 0644]
tools/UnitTest++/src/Config.h [new file with mode: 0644]
tools/UnitTest++/src/CurrentTest.cpp [new file with mode: 0644]
tools/UnitTest++/src/CurrentTest.h [new file with mode: 0644]
tools/UnitTest++/src/DeferredTestReporter.cpp [new file with mode: 0644]
tools/UnitTest++/src/DeferredTestReporter.h [new file with mode: 0644]
tools/UnitTest++/src/DeferredTestResult.cpp [new file with mode: 0644]
tools/UnitTest++/src/DeferredTestResult.h [new file with mode: 0644]
tools/UnitTest++/src/ExecuteTest.h [new file with mode: 0644]
tools/UnitTest++/src/MemoryOutStream.cpp [new file with mode: 0644]
tools/UnitTest++/src/MemoryOutStream.h [new file with mode: 0644]
tools/UnitTest++/src/Posix/SignalTranslator.cpp [new file with mode: 0644]
tools/UnitTest++/src/Posix/SignalTranslator.h [new file with mode: 0644]
tools/UnitTest++/src/Posix/TimeHelpers.cpp [new file with mode: 0644]
tools/UnitTest++/src/Posix/TimeHelpers.h [new file with mode: 0644]
tools/UnitTest++/src/ReportAssert.cpp [new file with mode: 0644]
tools/UnitTest++/src/ReportAssert.h [new file with mode: 0644]
tools/UnitTest++/src/Test.cpp [new file with mode: 0644]
tools/UnitTest++/src/Test.h [new file with mode: 0644]
tools/UnitTest++/src/TestDetails.cpp [new file with mode: 0644]
tools/UnitTest++/src/TestDetails.h [new file with mode: 0644]
tools/UnitTest++/src/TestList.cpp [new file with mode: 0644]
tools/UnitTest++/src/TestList.h [new file with mode: 0644]
tools/UnitTest++/src/TestMacros.h [new file with mode: 0644]
tools/UnitTest++/src/TestReporter.cpp [new file with mode: 0644]
tools/UnitTest++/src/TestReporter.h [new file with mode: 0644]
tools/UnitTest++/src/TestReporterStdout.cpp [new file with mode: 0644]
tools/UnitTest++/src/TestReporterStdout.h [new file with mode: 0644]
tools/UnitTest++/src/TestResults.cpp [new file with mode: 0644]
tools/UnitTest++/src/TestResults.h [new file with mode: 0644]
tools/UnitTest++/src/TestRunner.cpp [new file with mode: 0644]
tools/UnitTest++/src/TestRunner.h [new file with mode: 0644]
tools/UnitTest++/src/TestSuite.h [new file with mode: 0644]
tools/UnitTest++/src/TimeConstraint.cpp [new file with mode: 0644]
tools/UnitTest++/src/TimeConstraint.h [new file with mode: 0644]
tools/UnitTest++/src/TimeHelpers.h [new file with mode: 0644]
tools/UnitTest++/src/UnitTest++.h [new file with mode: 0644]
tools/UnitTest++/src/Win32/TimeHelpers.cpp [new file with mode: 0644]
tools/UnitTest++/src/Win32/TimeHelpers.h [new file with mode: 0644]
tools/UnitTest++/src/XmlTestReporter.cpp [new file with mode: 0644]
tools/UnitTest++/src/XmlTestReporter.h [new file with mode: 0644]
tools/UnitTest++/src/tests/Main.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/RecordingReporter.h [new file with mode: 0644]
tools/UnitTest++/src/tests/ScopedCurrentTest.h [new file with mode: 0644]
tools/UnitTest++/src/tests/TestAssertHandler.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestCheckMacros.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestChecks.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestCurrentTest.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestDeferredTestReporter.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestMemoryOutStream.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTest.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTestList.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTestMacros.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTestResults.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTestRunner.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTestSuite.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTimeConstraint.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestTimeConstraintMacro.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestUnitTest++.cpp [new file with mode: 0644]
tools/UnitTest++/src/tests/TestXmlTestReporter.cpp [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..95a9afb
--- /dev/null
@@ -0,0 +1,9 @@
+build/*
+tags
+cscope.out
+project.vim
+*.o
+*.exe
+*.a
+*.lib
+*~
diff --git a/Doxyfile b/Doxyfile
new file mode 100644 (file)
index 0000000..c31f22e
--- /dev/null
+++ b/Doxyfile
@@ -0,0 +1,1719 @@
+# Doxyfile 1.7.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# 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.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = "Opts"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = v0.1a
+
+# 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 quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = "A lightweight option parsing library for C/C++"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = docs/doxygen
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) 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.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = 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 comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" 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.
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = 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, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. 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 that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip 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.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+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 (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file 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.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.  This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# The 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 (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = source
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. 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.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS          = *.c \
+                         *.cc \
+                         *.cxx \
+                         *.cpp \
+                         *.c++ \
+                         *.d \
+                         *.java \
+                         *.ii \
+                         *.ixx \
+                         *.ipp \
+                         *.i++ \
+                         *.inl \
+                         *.h \
+                         *.hh \
+                         *.hxx \
+                         *.hpp \
+                         *.h++ \
+                         *.idl \
+                         *.odl \
+                         *.cs \
+                         *.php \
+                         *.php3 \
+                         *.inc \
+                         *.m \
+                         *.mm \
+                         *.dox \
+                         *.py \
+                         *.f90 \
+                         *.f \
+                         *.for \
+                         *.vhd \
+                         *.vhdl
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.  Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.  The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+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.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.  Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = 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 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet 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 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = 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. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# 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, 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.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+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
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [0,1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+# Note that a value of 0 will completely suppress the enum values from
+# appearing in the overview section.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT 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.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered 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 also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the
+# mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = YES
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# 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.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = 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.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+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.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see 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.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.  This is useful
+# if you want to understand what is going on.  On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#   TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#   TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS         = NO
+
+# 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            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in all dot files that doxygen generates.
+# When you want a differently looking font you can specify the font name
+# using DOT_FONTNAME. You need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = YES
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = YES
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, svg, gif or svg.
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644 (file)
index 0000000..8de46c8
--- /dev/null
@@ -0,0 +1,24 @@
+
+Copyright (c) 2012, Michael D. Lowis
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this 
+  list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice, 
+  this list of conditions and the following disclaimer in the documentation 
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..64dd79a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,94 @@
+###############################################################################
+#
+# Name:    Opts
+# Type:    Library
+# Author:  Mike Lowis
+# License: BSD 2-Clause
+#
+###############################################################################
+
+# Utility Function Definitions
+#-----------------------------
+# Function for generating an file list
+flist = $(shell env find $(1) -name *.$(strip $(2)) -print)
+
+# Function for generating an file list
+dlist = $(shell env find $(1) -type d -print)
+
+# Function for generating an include list
+incdirs = $(addprefix -I, $(call dlist, $(1)))
+
+# Project and Artifact Names
+#---------------------------
+PROJ_NAME   = opts
+TEST_RUNNER = test_runner
+SHARED_NAME = lib$(PROJ_NAME).lib
+STATIC_NAME = lib$(PROJ_NAME).a
+
+# File and Directory Settings
+#----------------------------
+# Root Directories
+SRC_ROOT   = source/
+TESTS_ROOT = tests/
+
+# File Extensions
+SRC_EXT    = c
+TEST_EXT   = cpp
+
+# Libraries to Link Against
+TEST_LIBS = tools/UnitTest++/libUnitTest++.a
+
+# Source File Lists
+SRC_FILES  = $(call flist, $(SRC_ROOT), $(SRC_EXT))
+TEST_FILES = $(call flist, $(TESTS_ROOT), $(TEST_EXT))
+
+# Object File Lists
+SRC_OBJS  = $(SRC_FILES:%.$(SRC_EXT)=%.o)
+TEST_OBJS = $(TEST_FILES:%.$(TEST_EXT)=%.o)
+
+# Include Directories
+INC_DIRS = $(call incdirs, $(SRC_ROOT)) \
+           $(call incdirs, deps/parse-utils/source) \
+           $(call incdirs, tools/UnitTest++/src)
+
+# Compiler and Linker Options
+#----------------------------
+CXXFLAGS      = -c $(INC_DIRS) -Wall -Werror -fPIC
+TEST_CXXFLAGS = -c $(INC_DIRS) -Wall
+
+# Build Rules
+#------------
+all: release test
+
+release: $(PROJ_NAME)
+
+test: $(TEST_RUNNER)
+       ./$(TEST_RUNNER)
+
+# Binaries
+$(SHARED_NAME): $(SRC_OBJS)
+       $(CXX) -o $@ $(SRC_OBJS) $(LIBS)
+
+$(STATIC_NAME): $(SRC_OBJS)
+       $(CXX) -o $@ $(SRC_OBJS) $(LIBS)
+
+$(TEST_RUNNER): unit_test_pp $(SRC_OBJS) $(TEST_OBJS)
+       $(CXX) -o $@ $(SRC_OBJS) $(TEST_OBJS) $(TEST_LIBS)
+
+# Libraries
+unit_test_pp:
+       $(MAKE) -C tools/UnitTest++
+
+# Object Files
+$(SRC_OBJS): %.o : %.$(SRC_EXT)
+       $(CXX) $(CXXFLAGS) -o $@ $<
+
+$(TEST_OBJS): %.o : %.$(TEST_EXT)
+       $(CXX) $(TEST_CXXFLAGS) -o $@ $<
+
+# Cleanup
+clean:
+       $(MAKE) -C tools/UnitTest++ clean
+       $(RM) $(SRC_OBJS)
+       $(RM) $(TEST_OBJS)
+
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..86a677d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,108 @@
+DLang
+==============================================
+
+    Version:    0.3
+    Created By: Michael D. Lowis
+    Email:      mike@mdlowis.com
+
+About This Project
+----------------------------------------------
+
+DLang is an experimental new programming language with arbitrarily extensible
+syntax. The core of the language provides you the tools you need to get things
+done while the flexible syntax allows YOU to decide how you want to get it done.
+New domain specific languages can be invented on the fly with ease to solve any
+problem you encounter.
+
+License
+----------------------------------------------
+
+Unless explicitly stated otherwise, all code and documentation in this project
+is released under the BSD 2-Clause License. You can find a copy of the license
+text in the LICENSE.md file.
+
+Requirements For Building
+----------------------------------------------
+
+* Ruby
+* Rake (>= 0.9.2)
+* Chicken Scheme Compiler
+* Chicken Scheme vector-lib Egg
+* A C++ compiler (Tested with gcc)
+
+Build Instructions
+----------------------------------------------
+
+You build dlang with the following command:
+
+    rake release
+
+The resulting binary is placed in 'build/bin'. You can test it with the
+following commands:
+
+    build/release/bin/dlang example.dl
+    ./example
+
+Installation
+----------------------------------------------
+
+There are no installation instructions at the moment. The binary is self
+contained and can be placed anywhere you want it.
+
+Project Files and Directories
+----------------------------------------------
+
+    build/         Output directory for artifacts created during the build.
+    deps/          Libraries and other dependencies the source code may have.
+    docs/          Documentation for the language and the source code.
+    res/           Submodules and files that aren't part of DLang source but it still needs
+    source/        The source for the DLang parser
+    tests/         Unit test and mock files.
+    tools/         Tools required by the build system.
+    Doxyfile       Doxygen documentation generator configuration.
+    example.dl     An example DLang source file.
+    LICENSE.md     The software license notification.
+    rakefile.rb    Script containing the build configuration and tasks.
+    README.md      You're reading this file right now!
+
+Known Issues or Bugs
+----------------------------------------------
+
+This is a non-comprehensive list of known issues and bugs that I intend to fix.
+
+* The debug build segfaults on \*nix systems due to freeing invalid pointers and other memory management issues
+* Error messages are obtuse and unfriendly.
+* Parser and Lexer have 0 error recovery.
+
+Version History
+----------------------------------------------
+
+### Version 0.3
+
+### Version 0.2
+
+This version includes a much improved macro syntax with support for multiple
+patterns similar to scheme macros. There is also a map data type and a cleaner
+syntax for list literals. See example.dl for an example of the updated syntax.
+
+### Version 0.1a
+
+Very first version ever. Its buggy, has obtuse error messages, and supports
+about 1/20 of what I would like to see. Lets call it a proof of concept.
+
+Feature Wish List
+----------------------------------------------
+
+This is a list of features are not yet supported, but may be at some point in
+the future.
+
+* Command line options
+* Multi-file support
+* UTF-8 Support
+
+More Info
+----------------------------------------------
+
+For more info or general questions shoot me an email and I'll try to get back
+to you in a timely manner.
+
diff --git a/docs/DUMMY b/docs/DUMMY
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/tests/main.cpp b/tests/main.cpp
new file mode 100644 (file)
index 0000000..b73af6f
--- /dev/null
@@ -0,0 +1,8 @@
+#include "UnitTest++.h"
+#include "TestReporterStdout.h"
+
+
+int main(int, char const *[])
+{
+    return UnitTest::RunAllTests();
+}
diff --git a/tools/UnitTest++/COPYING b/tools/UnitTest++/COPYING
new file mode 100644 (file)
index 0000000..9f96308
--- /dev/null
@@ -0,0 +1,20 @@
+Copyright (c) 2006 Noel Llopis and Charles Nicholson
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/tools/UnitTest++/Makefile b/tools/UnitTest++/Makefile
new file mode 100644 (file)
index 0000000..b00041d
--- /dev/null
@@ -0,0 +1,96 @@
+CXX = g++
+CXXFLAGS ?= -g -Wall -W -ansi # -pedantic
+LDFLAGS ?=
+SED = sed
+MV = mv
+RM = rm
+
+.SUFFIXES: .o .cpp
+
+lib = libUnitTest++.a
+test = TestUnitTest++
+
+src = src/AssertException.cpp \
+       src/Test.cpp \
+       src/Checks.cpp \
+       src/TestRunner.cpp \
+       src/TestResults.cpp \
+       src/TestReporter.cpp \
+       src/TestReporterStdout.cpp \
+       src/ReportAssert.cpp \
+       src/TestList.cpp \
+       src/TimeConstraint.cpp \
+       src/TestDetails.cpp \
+       src/MemoryOutStream.cpp \
+       src/DeferredTestReporter.cpp \
+       src/DeferredTestResult.cpp \
+       src/XmlTestReporter.cpp \
+       src/CurrentTest.cpp
+
+ifeq ($(MSYSTEM), MINGW32)
+  src += src/Win32/TimeHelpers.cpp
+else
+  src += src/Posix/SignalTranslator.cpp \
+       src/Posix/TimeHelpers.cpp
+endif
+
+test_src = src/tests/Main.cpp \
+       src/tests/TestAssertHandler.cpp \
+       src/tests/TestChecks.cpp \
+       src/tests/TestUnitTest++.cpp \
+       src/tests/TestTest.cpp \
+       src/tests/TestTestResults.cpp \
+       src/tests/TestTestRunner.cpp \
+       src/tests/TestCheckMacros.cpp \
+       src/tests/TestTestList.cpp \
+       src/tests/TestTestMacros.cpp \
+       src/tests/TestTimeConstraint.cpp \
+       src/tests/TestTimeConstraintMacro.cpp \
+       src/tests/TestMemoryOutStream.cpp \
+       src/tests/TestDeferredTestReporter.cpp \
+       src/tests/TestXmlTestReporter.cpp \
+       src/tests/TestCurrentTest.cpp
+
+objects = $(patsubst %.cpp, %.o, $(src))
+test_objects = $(patsubst %.cpp, %.o, $(test_src))
+dependencies = $(subst .o,.d,$(objects))
+test_dependencies = $(subst .o,.d,$(test_objects))
+
+define make-depend
+  $(CXX) $(CXXFLAGS) -M $1 | \
+  $(SED) -e 's,\($(notdir $2)\) *:,$(dir $2)\1: ,' > $3.tmp
+  $(SED) -e 's/#.*//' \
+      -e 's/^[^:]*: *//' \
+      -e 's/ *\\$$//' \
+      -e '/^$$/ d' \
+      -e 's/$$/ :/' $3.tmp >> $3.tmp
+  $(MV) $3.tmp $3
+endef
+
+
+all: $(test)
+
+
+$(lib): $(objects)
+       @echo Creating $(lib) library...
+       @ar cr $(lib) $(objects)
+
+$(test): $(lib) $(test_objects)
+       @echo Linking $(test)...
+       @$(CXX) $(LDFLAGS) -o $(test) $(test_objects) $(lib)
+       @echo Running unit tests...
+       @./$(test)
+
+clean:
+       -@$(RM) -f $(objects) $(test_objects) $(dependencies) $(test_dependencies) $(test) $(lib) 2> /dev/null
+
+%.o : %.cpp
+       @echo $<
+       @$(call make-depend,$<,$@,$(subst .o,.d,$@))
+       @$(CXX) $(CXXFLAGS) -c $< -o $(patsubst %.cpp, %.o, $<)
+
+
+ifneq "$(MAKECMDGOALS)" "clean"
+-include $(dependencies)
+-include $(test_dependencies)
+endif
diff --git a/tools/UnitTest++/README b/tools/UnitTest++/README
new file mode 100644 (file)
index 0000000..e0a5192
--- /dev/null
@@ -0,0 +1,68 @@
+UnitTest++ README
+Version: v1.4
+Last update: 2008-10-30
+
+UnitTest++ is free software. You may copy, distribute, and modify it under
+the terms of the License contained in the file COPYING distributed
+with this package. This license is the same as the MIT/X Consortium
+license.
+
+See src/tests/TestUnitTest++.cpp for usage.
+
+Authors:
+Noel Llopis (llopis@convexhull.com) 
+Charles Nicholson (charles.nicholson@gmail.com)
+
+Contributors:
+Jim Tilander
+Kim Grasman
+Jonathan Jansson
+Dirck Blaskey
+Rory Driscoll
+Dan Lind
+Matt Kimmel -- Submitted with permission from Blue Fang Games
+Anthony Moralez
+Jeff Dixon
+Randy Coulman
+Lieven van der Heide
+
+Release notes:
+--------------
+Version 1.4 (2008-10-30)
+- CHECK macros work at arbitrary stack depth from inside TESTs.
+- Remove obsolete TEST_UTILITY macros
+- Predicated test execution (via TestRunner::RunTestsIf)
+- Better exception handling for fixture ctors/dtors.
+- VC6/7/8/9 support
+
+Version 1.3 (2007-4-22)
+- Removed dynamic memory allocations (other than streams)
+- MinGW support
+- Consistent (native) line endings
+- Minor bug fixing
+
+Version 1.2 (2006-10-29)
+- First pass at documentation.
+- More detailed error crash catching in fixtures.
+- Standard streams used for printing objects under check. This should allow the
+  use of standard class types such as std::string or other custom classes with
+  stream operators to ostream.
+- Standard streams can be optionally compiled off by defining UNITTEST_USE_CUSTOM_STREAMS
+  in Config.h
+- Added named test suites
+- Added CHECK_ARRAY2D_CLOSE 
+- Posix library name is libUnitTest++.a now
+- Floating point numbers are postfixed with f in the failure reports
+
+Version 1.1 (2006-04-18)
+- CHECK macros do not have side effects even if one of the parameters changes state
+- Removed CHECK_ARRAY_EQUAL (too similar to CHECK_ARRAY_CLOSE)
+- Added local and global time constraints
+- Removed dependencies on strstream
+- Improved Posix signal to exception translator
+- Failing tests are added to Visual Studio's error list
+- Fixed Visual Studio projects to work with spaces in directories
+
+Version 1.0 (2006-03-15)
+- Initial release
+
diff --git a/tools/UnitTest++/docs/UnitTest++.html b/tools/UnitTest++/docs/UnitTest++.html
new file mode 100644 (file)
index 0000000..cd40400
--- /dev/null
@@ -0,0 +1,260 @@
+<html>
+<head>
+       <title>UnitTest++ in brief</title>
+</head>
+<body>
+<h1>UnitTest++ in brief</h1>
+<h2>Introduction</h2>
+<p>This little document serves as bare-bones documentation for UnitTest++.</p>
+
+<p>For background, goals and license details, see:</p>
+
+<ul>
+  <li><a href="http://unittest-cpp.sourceforge.net/">The UnitTest++ home page</a></li>
+  <li><a href="http://www.gamesfromwithin.com/articles/0603/000108.html">Noel Llopis' announcement</a></li>
+</ul>
+
+<p>The documentation, while sparse, aims to be practical, so it should give you enough info to get started using UnitTest++ as fast as possible.</p>
+
+<h2>Building UnitTest++</h2>
+<p>Building UnitTest++ will be specific to each platform and build environment, but it should be straightforward.</p>
+
+<h3>Building with Visual Studio</h3>
+<p>If you are using Visual Studio, go for either of the provided .sln files, depending on version. There are no prefabricated solutions for versions earlier than VS.NET 2003, but we have had reports of people building UnitTest++ with at least VS.NET 2002.</p>
+
+<h3>Building with Make</h3>
+<p>The bundled makefile is written to build with g++. It also needs <code>sed</code> installed in the path, and to be able to use the <code>mv</code> and <code>rm</code> shell commands. The makefile should be usable on most Posix-like platforms.</p>
+
+<p>Do "make all" to generate a library and test executable. A final build step runs all unit tests to make sure that the result works as expected.</p>
+
+<h3>Packaging</h3>
+<p>You'll probably want to keep the generated library in a shared space in source control, so you can reuse it for multiple test projects. A redistributable package of UnitTest++ would consist of the generated library file, and all of the header files in <code>UnitTest++/src/</code> and its per-platform subfolders. The <code>tests</code> directory only contains the unit tests for the library, and need not be included.</p>
+
+<h2>Using UnitTest++</h2>
+<p>The source code for UnitTest++ comes with a full test suite written <em>using</em> UnitTest++. This is a great place to learn techniques for testing. There is one sample .cpp file: <code>UnitTest++/src/tests/TestUnitTest++.cpp</code>. It covers most of UnitTest++'s features in an easy-to-grasp context, so start there if you want a quick overview of typical usage.</p>
+
+<h3>Getting started</h3>
+<p>Listed below is a minimal C++ program to run a failing test through UnitTest++.</p>
+
+<pre>
+  // test.cpp
+  #include &lt;UnitTest++.h&gt;
+
+  TEST(FailSpectacularly)
+  {
+    CHECK(false);
+  }
+
+  int main()
+  {
+    return UnitTest::RunAllTests();
+  }
+</pre>
+
+<p><code>UnitTest++.h</code> is a facade header for UnitTest++, so including that should get you all features of the library. All classes and free functions are placed in namespace <code>UnitTest</code>, so you need to either qualify their full names (as with <code>RunAllTests()</code> in the example) or add a <code>using namespace UnitTest;</code> statement in your .cpp files. Note that any mention of UnitTest++ functions and classes in this document assume that the <code>UnitTest</code> namespace has been opened.</p>
+
+<p>Compiling and linking this program with UnitTest++'s static library into an executable, and running it, will produce the following output (details may vary):</p>
+
+<pre>
+  .\test.cpp(5): error: Failure in FailSpectacularly: false
+  FAILED: 1 out of 1 tests failed (1 failures).
+  Test time: 0.00 seconds.
+</pre>
+
+<p>UnitTest++ attempts to report every failure in an IDE-friendly format, depending on platform (e.g. you can double-click it in Visual Studio's error list.) The exit code will be the number of failed tests, so that a failed test run always returns a non-zero exit code.</p>
+
+<h3>Test macros</h3>
+<p>To add a test, simply put the following code in a .cpp file of your choice:</p>
+
+<pre>
+  TEST(YourTestName)
+  {
+  }
+</pre>
+
+<p>The <code>TEST</code> macro contains enough machinery to turn this slightly odd-looking syntax into legal C++, and automatically register the test in a global list. This test list forms the basis of what is executed by <code>RunAllTests()</code>.</p>
+
+<p>If you want to re-use a set of test data for more than one test, or provide setup/teardown for tests, you can use the <code>TEST_FIXTURE</code> macro instead. The macro requires that you pass it a class name that it will instantiate, so any setup and teardown code should be in its constructor and destructor.</p>
+
+<pre>
+  struct SomeFixture
+  {
+    SomeFixture() { /* some setup */ }
+    ~SomeFixture() { /* some teardown */ }
+
+    int testData;
+  };
+  TEST_FIXTURE(SomeFixture, YourTestName)
+  {
+    int temp = testData;
+  }
+</pre>
+
+<p>Note how members of the fixture are used as if they are a part of the test, since the macro-generated test class derives from the provided fixture class.</p>
+
+<h3>Suite macros</h3>
+<p>Tests can be grouped into suites, using the <code>SUITE</code> macro. A suite serves as a namespace for test names, so that the same test name can be used in two difference contexts.</p>
+
+<pre>
+  SUITE(YourSuiteName)
+  {
+    TEST(YourTestName)
+    {
+    }
+
+    TEST(YourOtherTestName)
+    {
+    }
+  }
+</pre>
+
+<p>This will place the tests into a C++ namespace called <code>YourSuiteName</code>, and make the suite name available to UnitTest++. <code>RunAllTests()</code> can be called for a specific suite name, so you can use this to build named groups of tests to be run together.</p>
+
+<h3>Simple check macros</h3>
+<p>In test cases, we want to check the results of our system under test. UnitTest++ provides a number of check macros that handle comparison and proper failure reporting.</p>
+
+<p>The most basic variety is the boolean <code>CHECK</code> macro:</p>
+
+<pre>
+  CHECK(false); // fails
+</pre>
+
+<p>It will fail if the boolean expression evaluates to false.</p>
+
+<p>For equality checks, it's generally better to use <code>CHECK_EQUAL</code>:</p>
+
+<pre>
+  CHECK_EQUAL(10, 20); // fails
+  CHECK_EQUAL("foo", "bar"); // fails
+</pre>
+
+<p>Note how <code>CHECK_EQUAL</code> is overloaded for C strings, so you don't have to resort to <code>strcmp</code> or similar. There is no facility for case-insensitive comparison or string searches, so you may have to drop down to a plain boolean <code>CHECK</code> with help from the CRT:</p>
+
+<pre>
+  CHECK(std::strstr("zaza", "az") != 0); // succeeds
+</pre>
+
+<p>For floating-point comparison, equality <a href="http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm">isn't necessarily well-defined</a>, so you should prefer the <code>CHECK_CLOSE</code> macro:</p>
+
+<pre>
+  CHECK_CLOSE(3.14, 3.1415, 0.01); // succeeds
+</pre>
+
+<p>All of the macros are tailored to avoid unintended side-effects, for example:</p>
+
+<pre>
+  TEST(CheckMacrosHaveNoSideEffects)
+  {
+    int i = 4;
+    CHECK_EQUAL(5, ++i); // succeeds
+    CHECK_EQUAL(5, i); // succeeds
+  }
+</pre>
+
+<p>The check macros guarantee that the <code>++i</code> expression isn't repeated internally, as demonstrated above.</p>
+
+<h3>Array check macros</h3>
+<p>There is a set of check macros for array comparison as well:</p>
+
+<pre>
+  const float oned[2] = { 10, 20 };
+  CHECK_ARRAY_EQUAL(oned, oned, 2); // succeeds
+  CHECK_ARRAY_CLOSE(oned, oned, 2, 0.00); // succeeds
+
+  const float twod[2][3] = { {0, 1, 2}, {2, 3, 4} };
+  CHECK_ARRAY2D_CLOSE(twod, twod, 2, 3, 0.00); // succeeds
+</pre>
+
+<p>The array equal macro compares elements using <code>operator==</code>, so <code>CHECK_ARRAY_EQUAL</code> won't work for an array of C strings, for example.</p>
+
+<p>The array close macros are similar to the regular CHECK_CLOSE macro, and are really only useful for scalar types, that can be compared in terms of a difference between two array elements.</p>
+
+<p>Note that the one-dimensional array macros work for <code>std::vector</code> as well, as it can be indexed just as a C array.</p>
+
+<h3>Exception check macros</h3>
+<p>Finally, there's a <code>CHECK_THROW</code> macro, which asserts that its enclosed expression throws the specified type:</p>
+
+<pre>
+  struct TestException {};
+  CHECK_THROW(throw TestException(), TestException); // succeeds
+</pre>
+
+<p>UnitTest++ natively catches exceptions if your test code doesn't. So if your code under test throws any exception UnitTest++ will fail the test and report either using the <code>what()</code> method for <code>std::exception</code> derivatives or just a plain message for unknown exception types.</p>
+
+<p>Should your test or code raise an irrecoverable error (an Access Violation on Win32, for example, or a signal on Linux), UnitTest++ will attempt to map them to an exception and fail the test, just as for other unhandled exceptions.</p>
+
+<h3>Time constraints</h3>
+<p>UnitTest++ can fail a test if it takes too long to complete, using so-called time constraints.</p>
+
+<p>They come in two flavors; <em>local</em> and <em>global</em> time constraints.</p>
+
+<p>Local time constraints are limited to the current scope, like so:</p>
+
+<pre>
+  TEST(YourTimedTest)
+  {
+     // Lengthy setup...
+
+     {
+        UNITTEST_TIME_CONSTRAINT(50);
+
+        // Do time-critical stuff
+     }
+
+     // Lengthy teardown...
+  }
+</pre>
+
+<p>The test will fail if the "Do time-critical stuff" block takes longer than 50 ms to complete. The time-consuming setup and teardown are not measured, since the time constraint is scope-bound. It's perfectly valid to have multiple local time constraints in the same test, as long as there is only one per block.</p>
+
+<p>A global time constraint, on the other hand, requires that all of the tests in a test run are faster than a specified amount of time. This allows you, when you run a suite of tests, to ask UnitTest++ to fail it entirely if any test exceeds the global constraint. The max time is passed as a parameter to an overload of <code>RunAllTests()</code>.</p>
+
+<p>If you want to use a global time constraint, but have one test that is notoriously slow, you can exempt it from inspection by using the <code>UNITTEST_TIME_CONSTRAINT_EXEMPT</code> macro anywhere inside the test body.</p>
+
+<pre>
+  TEST(NotoriouslySlowTest)
+  {
+     UNITTEST_TIME_CONSTRAINT_EXEMPT();
+
+     // Oh boy, this is going to take a while
+     ...
+  }
+</pre>
+
+<h3>Test runners</h3>
+<p>The <code>RunAllTests()</code> function has an overload that lets you customize the behavior of the runner, such as global time constraints, custom reporters, which suite to run, etc.</p>
+
+<pre>
+  int RunAllTests(TestReporter& reporter, TestList const& list, char const* suiteName, int const maxTestTimeInMs);
+</pre>
+
+<p>If you attempt to pass custom parameters to <code>RunAllTests()</code>, note that the <code>list</code> parameter should have the value <code>Test::GetTestList()</code>.</p>
+
+<p>The parameterless <code>RunAllTests()</code> is a simple wrapper for this one, with sensible defaults.</p>
+
+<h3>Example setup</h3>
+<p>How to create a new test project varies depending on your environment, but here are some directions on common file structure and usage.</p>
+
+<p>The general idea is that you keep one <code>Main.cpp</code> file with the entry-point which calls <code>RunAllTests()</code>.</p>
+
+<p>Then you can simply compile and link new .cpp files at will, typically one per test suite.</p>
+
+<pre>
+   + ShaverTests/
+   |
+   +- Main.cpp
+   |
+   +- TestBrush.cpp   
+   +- TestEngine.cpp
+   +- TestRazor.cpp   
+</pre>
+
+<p>Each of the <code>Test*.cpp</code> files will contain one or more <code>TEST</code> macro incantations with the associated test code. There are no source-level dependencies between <code>Main.cpp</code> and <code>Test*.cpp</code>, as the <code>TEST</code> macro handles the registration and setup necessary for <code>RunAllTests()</code> to find all tests compiled into the same final executable.</p>
+
+<p>UnitTest++ does not require this structure, even if this is how the library itself does it. As long as your test project contains one or more <code>TESTs</code> and calls <code>RunAllTests()</code> at one point or another, it will be handled by UnitTest++.</p>
+
+<p>It's common to make the generated executable start as a post-build step, so that merely building your test project will run the tests as well. Since the exit code is the count of failures, a failed test will generally break the build, as most build engines will fail a build if any step returns a non-zero exit code.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/tools/UnitTest++/src/AssertException.cpp b/tools/UnitTest++/src/AssertException.cpp
new file mode 100644 (file)
index 0000000..63f556e
--- /dev/null
@@ -0,0 +1,34 @@
+#include "AssertException.h"
+#include <cstring>
+
+namespace UnitTest {
+
+AssertException::AssertException(char const* description, char const* filename, int lineNumber)
+    : m_lineNumber(lineNumber)
+{
+       using namespace std;
+
+    strcpy(m_description, description);
+    strcpy(m_filename, filename);
+}
+
+AssertException::~AssertException() throw()
+{
+}
+
+char const* AssertException::what() const throw()
+{
+    return m_description;
+}
+
+char const* AssertException::Filename() const
+{
+    return m_filename;
+}
+
+int AssertException::LineNumber() const
+{
+    return m_lineNumber;
+}
+
+}
diff --git a/tools/UnitTest++/src/AssertException.h b/tools/UnitTest++/src/AssertException.h
new file mode 100644 (file)
index 0000000..e04d450
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef UNITTEST_ASSERTEXCEPTION_H
+#define UNITTEST_ASSERTEXCEPTION_H
+
+#include <exception>
+
+
+namespace UnitTest {
+
+class AssertException : public std::exception
+{
+public:
+    AssertException(char const* description, char const* filename, int lineNumber);
+    virtual ~AssertException() throw();
+
+    virtual char const* what() const throw();
+
+    char const* Filename() const;
+    int LineNumber() const;
+
+private:
+    char m_description[512];
+    char m_filename[256];
+    int m_lineNumber;
+};
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/CheckMacros.h b/tools/UnitTest++/src/CheckMacros.h
new file mode 100644 (file)
index 0000000..8fbdae7
--- /dev/null
@@ -0,0 +1,122 @@
+#ifndef UNITTEST_CHECKMACROS_H 
+#define UNITTEST_CHECKMACROS_H
+
+#include "Checks.h"
+#include "AssertException.h"
+#include "MemoryOutStream.h"
+#include "TestDetails.h"
+#include "CurrentTest.h"
+
+#ifdef CHECK
+    #error UnitTest++ redefines CHECK
+#endif
+
+#ifdef CHECK_EQUAL
+       #error UnitTest++ redefines CHECK_EQUAL
+#endif
+
+#ifdef CHECK_CLOSE
+       #error UnitTest++ redefines CHECK_CLOSE
+#endif
+
+#ifdef CHECK_ARRAY_EQUAL
+       #error UnitTest++ redefines CHECK_ARRAY_EQUAL
+#endif
+
+#ifdef CHECK_ARRAY_CLOSE
+       #error UnitTest++ redefines CHECK_ARRAY_CLOSE
+#endif
+
+#ifdef CHECK_ARRAY2D_CLOSE
+       #error UnitTest++ redefines CHECK_ARRAY2D_CLOSE
+#endif
+
+#define CHECK(value) \
+    do \
+    { \
+        try { \
+            if (!UnitTest::Check(value)) \
+                UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK(" #value ")"); \
+        } \
+    } while (0)
+
+#define CHECK_EQUAL(expected, actual) \
+    do \
+    { \
+        try { \
+            UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \
+        } \
+    } while (0)
+
+#define CHECK_CLOSE(expected, actual, tolerance) \
+    do \
+    { \
+        try { \
+            UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \
+        } \
+    } while (0)
+
+#define CHECK_ARRAY_EQUAL(expected, actual, count) \
+    do \
+    { \
+        try { \
+            UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \
+        } \
+    } while (0)
+
+#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \
+    do \
+    { \
+        try { \
+            UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \
+        } \
+    } while (0)
+
+#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \
+    do \
+    { \
+        try { \
+            UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \
+        } \
+        catch (...) { \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \
+                    "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \
+        } \
+    } while (0)
+
+
+#define CHECK_THROW(expression, ExpectedExceptionType) \
+    do \
+    { \
+        bool caught_ = false; \
+        try { expression; } \
+        catch (ExpectedExceptionType const&) { caught_ = true; } \
+        catch (...) {} \
+        if (!caught_) \
+            UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), "Expected exception: \"" #ExpectedExceptionType "\" not thrown"); \
+    } while(0)
+
+#define CHECK_ASSERT(expression) \
+    CHECK_THROW(expression, UnitTest::AssertException);
+
+#endif
diff --git a/tools/UnitTest++/src/Checks.cpp b/tools/UnitTest++/src/Checks.cpp
new file mode 100644 (file)
index 0000000..2d09519
--- /dev/null
@@ -0,0 +1,50 @@
+#include "Checks.h"
+#include <cstring>
+
+namespace UnitTest {
+
+namespace {
+
+void CheckStringsEqual(TestResults& results, char const* expected, char const* actual, 
+                       TestDetails const& details)
+{
+       using namespace std;
+
+    if (strcmp(expected, actual))
+    {
+        UnitTest::MemoryOutStream stream;
+        stream << "Expected " << expected << " but was " << actual;
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+}
+
+
+void CheckEqual(TestResults& results, char const* expected, char const* actual,
+                TestDetails const& details)
+{
+    CheckStringsEqual(results, expected, actual, details);
+}
+
+void CheckEqual(TestResults& results, char* expected, char* actual,
+                TestDetails const& details)
+{
+    CheckStringsEqual(results, expected, actual, details);
+}
+
+void CheckEqual(TestResults& results, char* expected, char const* actual,
+                TestDetails const& details)
+{
+    CheckStringsEqual(results, expected, actual, details);
+}
+
+void CheckEqual(TestResults& results, char const* expected, char* actual,
+                TestDetails const& details)
+{
+    CheckStringsEqual(results, expected, actual, details);
+}
+
+
+}
diff --git a/tools/UnitTest++/src/Checks.h b/tools/UnitTest++/src/Checks.h
new file mode 100644 (file)
index 0000000..0090084
--- /dev/null
@@ -0,0 +1,158 @@
+#ifndef UNITTEST_CHECKS_H
+#define UNITTEST_CHECKS_H
+
+#include "Config.h"
+#include "TestResults.h"
+#include "MemoryOutStream.h"
+
+namespace UnitTest {
+
+
+template< typename Value >
+bool Check(Value const value)
+{
+    return !!value; // doing double negative to avoid silly VS warnings
+}
+
+
+template< typename Expected, typename Actual >
+void CheckEqual(TestResults& results, Expected const& expected, Actual const& actual, TestDetails const& details)
+{
+    if (!(expected == actual))
+    {
+        UnitTest::MemoryOutStream stream;
+        stream << "Expected " << expected << " but was " << actual;
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details);
+
+void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details);
+
+void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details);
+
+void CheckEqual(TestResults& results, char const* expected, char* actual, TestDetails const& details);
+
+template< typename Expected, typename Actual, typename Tolerance >
+bool AreClose(Expected const& expected, Actual const& actual, Tolerance const& tolerance)
+{
+    return (actual >= (expected - tolerance)) && (actual <= (expected + tolerance));
+}
+
+template< typename Expected, typename Actual, typename Tolerance >
+void CheckClose(TestResults& results, Expected const& expected, Actual const& actual, Tolerance const& tolerance,
+                TestDetails const& details)
+{
+    if (!AreClose(expected, actual, tolerance))
+    { 
+        UnitTest::MemoryOutStream stream;
+        stream << "Expected " << expected << " +/- " << tolerance << " but was " << actual;
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+
+template< typename Expected, typename Actual >
+void CheckArrayEqual(TestResults& results, Expected const& expected, Actual const& actual,
+                int const count, TestDetails const& details)
+{
+    bool equal = true;
+    for (int i = 0; i < count; ++i)
+        equal &= (expected[i] == actual[i]);
+
+    if (!equal)
+    {
+        UnitTest::MemoryOutStream stream;
+
+               stream << "Expected [ ";
+
+               for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex)
+            stream << expected[expectedIndex] << " ";
+
+               stream << "] but was [ ";
+
+               for (int actualIndex = 0; actualIndex < count; ++actualIndex)
+            stream << actual[actualIndex] << " ";
+
+               stream << "]";
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+template< typename Expected, typename Actual, typename Tolerance >
+bool ArrayAreClose(Expected const& expected, Actual const& actual, int const count, Tolerance const& tolerance)
+{
+    bool equal = true;
+    for (int i = 0; i < count; ++i)
+        equal &= AreClose(expected[i], actual[i], tolerance);
+    return equal;
+}
+
+template< typename Expected, typename Actual, typename Tolerance >
+void CheckArrayClose(TestResults& results, Expected const& expected, Actual const& actual,
+                   int const count, Tolerance const& tolerance, TestDetails const& details)
+{
+    bool equal = ArrayAreClose(expected, actual, count, tolerance);
+
+    if (!equal)
+    {
+        UnitTest::MemoryOutStream stream;
+
+        stream << "Expected [ ";
+        for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex)
+            stream << expected[expectedIndex] << " ";
+        stream << "] +/- " << tolerance << " but was [ ";
+
+               for (int actualIndex = 0; actualIndex < count; ++actualIndex)
+            stream << actual[actualIndex] << " ";
+        stream << "]";
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+template< typename Expected, typename Actual, typename Tolerance >
+void CheckArray2DClose(TestResults& results, Expected const& expected, Actual const& actual,
+                   int const rows, int const columns, Tolerance const& tolerance, TestDetails const& details)
+{
+    bool equal = true;
+    for (int i = 0; i < rows; ++i)
+        equal &= ArrayAreClose(expected[i], actual[i], columns, tolerance);
+
+    if (!equal)
+    {
+        UnitTest::MemoryOutStream stream;
+
+        stream << "Expected [ ";    
+
+               for (int expectedRow = 0; expectedRow < rows; ++expectedRow)
+        {
+            stream << "[ ";
+            for (int expectedColumn = 0; expectedColumn < columns; ++expectedColumn)
+                stream << expected[expectedRow][expectedColumn] << " ";
+            stream << "] ";
+        }
+
+               stream << "] +/- " << tolerance << " but was [ ";
+
+               for (int actualRow = 0; actualRow < rows; ++actualRow)
+        {
+            stream << "[ ";
+            for (int actualColumn = 0; actualColumn < columns; ++actualColumn)
+                stream << actual[actualRow][actualColumn] << " ";
+            stream << "] ";
+        }
+
+               stream << "]";
+
+        results.OnTestFailure(details, stream.GetText());
+    }
+}
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/Config.h b/tools/UnitTest++/src/Config.h
new file mode 100644 (file)
index 0000000..0ba21a0
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef UNITTEST_CONFIG_H
+#define UNITTEST_CONFIG_H
+
+// Standard defines documented here: http://predef.sourceforge.net
+
+#if defined(_MSC_VER)
+    #pragma warning(disable:4127) // conditional expression is constant
+       #pragma warning(disable:4702) // unreachable code
+       #pragma warning(disable:4722) // destructor never returns, potential memory leak
+
+       #if (_MSC_VER == 1200)  // VC6
+               #pragma warning(disable:4786)
+               #pragma warning(disable:4290)
+       #endif
+#endif
+
+#if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \
+    defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)        
+    #define UNITTEST_POSIX
+#endif
+
+#if defined(__MINGW32__)
+    #define UNITTEST_MINGW
+#endif
+
+// by default, MemoryOutStream is implemented in terms of std::ostringstream, which can be expensive.
+// uncomment this line to use the custom MemoryOutStream (no deps on std::ostringstream).
+
+//#define UNITTEST_USE_CUSTOM_STREAMS
+
+#endif
diff --git a/tools/UnitTest++/src/CurrentTest.cpp b/tools/UnitTest++/src/CurrentTest.cpp
new file mode 100644 (file)
index 0000000..ad8d9af
--- /dev/null
@@ -0,0 +1,18 @@
+#include "CurrentTest.h"
+#include <cstddef>
+
+namespace UnitTest {
+
+TestResults*& CurrentTest::Results()
+{
+       static TestResults* testResults = NULL;
+       return testResults;
+}
+
+const TestDetails*& CurrentTest::Details()
+{
+       static const TestDetails* testDetails = NULL;
+       return testDetails;
+}
+
+}
diff --git a/tools/UnitTest++/src/CurrentTest.h b/tools/UnitTest++/src/CurrentTest.h
new file mode 100644 (file)
index 0000000..9e9d07a
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef UNITTEST_CURRENTTESTRESULTS_H
+#define UNITTEST_CURRENTTESTRESULTS_H
+
+namespace UnitTest {
+
+class TestResults;
+class TestDetails;
+
+namespace CurrentTest
+{
+       TestResults*& Results();
+       const TestDetails*& Details();
+}
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/DeferredTestReporter.cpp b/tools/UnitTest++/src/DeferredTestReporter.cpp
new file mode 100644 (file)
index 0000000..f90826b
--- /dev/null
@@ -0,0 +1,29 @@
+#include "DeferredTestReporter.h"
+#include "TestDetails.h"
+#include "Config.h"
+
+using namespace UnitTest;
+
+void DeferredTestReporter::ReportTestStart(TestDetails const& details)
+{
+    m_results.push_back(DeferredTestResult(details.suiteName, details.testName));
+}
+
+void DeferredTestReporter::ReportFailure(TestDetails const& details, char const* failure)
+{
+    DeferredTestResult& r = m_results.back();
+    r.failed = true;
+    r.failures.push_back(DeferredTestResult::Failure(details.lineNumber, failure));
+    r.failureFile = details.filename;
+}
+
+void DeferredTestReporter::ReportTestFinish(TestDetails const&, float secondsElapsed)
+{
+    DeferredTestResult& r = m_results.back();
+    r.timeElapsed = secondsElapsed;
+}
+
+DeferredTestReporter::DeferredTestResultList& DeferredTestReporter::GetResults()
+{
+    return m_results;
+}
diff --git a/tools/UnitTest++/src/DeferredTestReporter.h b/tools/UnitTest++/src/DeferredTestReporter.h
new file mode 100644 (file)
index 0000000..026ed05
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef UNITTEST_DEFERREDTESTREPORTER_H
+#define UNITTEST_DEFERREDTESTREPORTER_H
+
+#include "TestReporter.h"
+#include "DeferredTestResult.h"
+
+#include <vector>
+
+namespace UnitTest
+{
+
+class DeferredTestReporter : public TestReporter
+{
+public:
+    virtual void ReportTestStart(TestDetails const& details);
+    virtual void ReportFailure(TestDetails const& details, char const* failure);
+    virtual void ReportTestFinish(TestDetails const& details, float secondsElapsed);
+
+    typedef std::vector< DeferredTestResult > DeferredTestResultList;
+    DeferredTestResultList& GetResults();
+
+private:
+    DeferredTestResultList m_results;
+};
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/DeferredTestResult.cpp b/tools/UnitTest++/src/DeferredTestResult.cpp
new file mode 100644 (file)
index 0000000..c2daa25
--- /dev/null
@@ -0,0 +1,25 @@
+#include "DeferredTestResult.h"
+#include "Config.h"
+
+namespace UnitTest
+{
+
+DeferredTestResult::DeferredTestResult()
+       : suiteName("")
+       , testName("")
+       , failureFile("")
+       , timeElapsed(0.0f)
+       , failed(false)
+{
+}
+
+DeferredTestResult::DeferredTestResult(char const* suite, char const* test)
+       : suiteName(suite)
+       , testName(test)
+       , failureFile("")
+       , timeElapsed(0.0f)
+       , failed(false)
+{
+}
+
+}
diff --git a/tools/UnitTest++/src/DeferredTestResult.h b/tools/UnitTest++/src/DeferredTestResult.h
new file mode 100644 (file)
index 0000000..6cca77c
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef UNITTEST_DEFERREDTESTRESULT_H
+#define UNITTEST_DEFERREDTESTRESULT_H
+
+#include <string>
+#include <vector>
+
+namespace UnitTest
+{
+
+struct DeferredTestResult
+{
+       DeferredTestResult();
+    DeferredTestResult(char const* suite, char const* test);
+
+    std::string suiteName;
+    std::string testName;
+    std::string failureFile;
+    
+    typedef std::pair< int, std::string > Failure;
+    typedef std::vector< Failure > FailureVec;
+    FailureVec failures;
+    
+    float timeElapsed;
+       bool failed;
+};
+
+}
+
+#endif //UNITTEST_DEFERREDTESTRESULT_H
diff --git a/tools/UnitTest++/src/ExecuteTest.h b/tools/UnitTest++/src/ExecuteTest.h
new file mode 100644 (file)
index 0000000..a00d4c5
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef UNITTEST_EXECUTE_TEST_H
+#define UNITTEST_EXECUTE_TEST_H
+
+#include "TestDetails.h"
+#include "MemoryOutStream.h"
+#include "AssertException.h"
+#include "CurrentTest.h"
+
+#ifdef UNITTEST_POSIX
+       #include "Posix/SignalTranslator.h"
+#endif
+
+namespace UnitTest {
+
+template< typename T >
+void ExecuteTest(T& testObject, TestDetails const& details)
+{
+       CurrentTest::Details() = &details;
+
+       try
+       {
+#ifdef UNITTEST_POSIX
+               UNITTEST_THROW_SIGNALS
+#endif
+               testObject.RunImpl();
+       }
+       catch (AssertException const& e)
+       {
+               CurrentTest::Results()->OnTestFailure(
+                       TestDetails(details.testName, details.suiteName, e.Filename(), e.LineNumber()), e.what());
+       }
+       catch (std::exception const& e)
+       {
+               MemoryOutStream stream;
+               stream << "Unhandled exception: " << e.what();
+               CurrentTest::Results()->OnTestFailure(details, stream.GetText());
+       }
+       catch (...)
+       {
+               CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: Crash!");
+       }
+}
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/MemoryOutStream.cpp b/tools/UnitTest++/src/MemoryOutStream.cpp
new file mode 100644 (file)
index 0000000..67a3e37
--- /dev/null
@@ -0,0 +1,149 @@
+#include "MemoryOutStream.h"
+
+#ifndef UNITTEST_USE_CUSTOM_STREAMS
+
+
+namespace UnitTest {
+
+char const* MemoryOutStream::GetText() const
+{
+    m_text = this->str();
+    return m_text.c_str();
+}
+
+
+}
+
+
+#else
+
+
+#include <cstring>
+#include <cstdio>
+
+namespace UnitTest {
+
+namespace {
+
+template<typename ValueType>
+void FormatToStream(MemoryOutStream& stream, char const* format, ValueType const& value)
+{
+       using namespace std;
+
+    char txt[32];
+    sprintf(txt, format, value);
+    stream << txt;
+}
+
+int RoundUpToMultipleOfPow2Number (int n, int pow2Number)
+{
+    return (n + (pow2Number - 1)) & ~(pow2Number - 1);
+}
+
+}
+
+
+MemoryOutStream::MemoryOutStream(int const size)
+    : m_capacity (0)
+    , m_buffer (0)
+
+{
+    GrowBuffer(size);
+}
+
+MemoryOutStream::~MemoryOutStream()
+{
+    delete [] m_buffer;
+}
+
+char const* MemoryOutStream::GetText() const
+{
+    return m_buffer;
+}
+
+MemoryOutStream& MemoryOutStream::operator << (char const* txt)
+{
+       using namespace std;
+
+    int const bytesLeft = m_capacity - (int)strlen(m_buffer);
+    int const bytesRequired = (int)strlen(txt) + 1;
+
+    if (bytesRequired > bytesLeft)
+    {
+        int const requiredCapacity = bytesRequired + m_capacity - bytesLeft;
+        GrowBuffer(requiredCapacity);
+    }
+
+    strcat(m_buffer, txt);
+    return *this;
+}
+
+MemoryOutStream& MemoryOutStream::operator << (int const n)
+{
+    FormatToStream(*this, "%i", n);
+    return *this;
+}
+
+MemoryOutStream& MemoryOutStream::operator << (long const n)
+{
+    FormatToStream(*this, "%li", n);
+    return *this;
+}
+
+MemoryOutStream& MemoryOutStream::operator << (unsigned long const n)
+{
+    FormatToStream(*this, "%lu", n);
+    return *this;
+}
+
+MemoryOutStream& MemoryOutStream::operator << (float const f)
+{
+    FormatToStream(*this, "%ff", f);
+    return *this;    
+}
+
+MemoryOutStream& MemoryOutStream::operator << (void const* p)
+{
+    FormatToStream(*this, "%p", p);
+    return *this;    
+}
+
+MemoryOutStream& MemoryOutStream::operator << (unsigned int const s)
+{
+    FormatToStream(*this, "%u", s);
+    return *this;    
+}
+
+MemoryOutStream& MemoryOutStream::operator <<(double const d)
+{
+       FormatToStream(*this, "%f", d);
+       return *this;
+}
+
+int MemoryOutStream::GetCapacity() const
+{
+    return m_capacity;
+}
+
+
+void MemoryOutStream::GrowBuffer(int const desiredCapacity)
+{
+    int const newCapacity = RoundUpToMultipleOfPow2Number(desiredCapacity, GROW_CHUNK_SIZE);
+
+       using namespace std;
+
+    char* buffer = new char[newCapacity];
+    if (m_buffer)
+        strcpy(buffer, m_buffer);
+    else
+        strcpy(buffer, "");
+
+    delete [] m_buffer;
+    m_buffer = buffer;
+    m_capacity = newCapacity;
+}
+
+}
+
+
+#endif
diff --git a/tools/UnitTest++/src/MemoryOutStream.h b/tools/UnitTest++/src/MemoryOutStream.h
new file mode 100644 (file)
index 0000000..e03227e
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef UNITTEST_MEMORYOUTSTREAM_H
+#define UNITTEST_MEMORYOUTSTREAM_H
+
+#include "Config.h"
+
+#ifndef UNITTEST_USE_CUSTOM_STREAMS
+
+#include <sstream>
+
+namespace UnitTest
+{
+
+class MemoryOutStream : public std::ostringstream
+{
+public:
+    MemoryOutStream() {}
+    char const* GetText() const;
+
+private:
+    MemoryOutStream(MemoryOutStream const&);
+    void operator =(MemoryOutStream const&);
+
+    mutable std::string m_text;
+};
+
+}
+
+#else
+
+#include <cstddef>
+
+namespace UnitTest
+{
+
+class MemoryOutStream
+{
+public:
+    explicit MemoryOutStream(int const size = 256);
+    ~MemoryOutStream();
+
+    char const* GetText() const;
+
+    MemoryOutStream& operator << (char const* txt);
+    MemoryOutStream& operator << (int n);
+    MemoryOutStream& operator << (long n);
+    MemoryOutStream& operator << (unsigned long n);
+    MemoryOutStream& operator << (float f);
+    MemoryOutStream& operator << (double d);
+    MemoryOutStream& operator << (void const* p);
+    MemoryOutStream& operator << (unsigned int s);
+
+    enum { GROW_CHUNK_SIZE = 32 };
+    int GetCapacity() const;
+
+private:
+    void operator= (MemoryOutStream const&);
+    void GrowBuffer(int capacity);
+
+    int m_capacity;
+    char* m_buffer;
+};
+
+}
+
+#endif
+
+#endif
diff --git a/tools/UnitTest++/src/Posix/SignalTranslator.cpp b/tools/UnitTest++/src/Posix/SignalTranslator.cpp
new file mode 100644 (file)
index 0000000..3689c8c
--- /dev/null
@@ -0,0 +1,46 @@
+#include "SignalTranslator.h"
+
+namespace UnitTest {
+
+sigjmp_buf* SignalTranslator::s_jumpTarget = 0;
+
+namespace {
+
+void SignalHandler(int sig)
+{
+    siglongjmp(*SignalTranslator::s_jumpTarget, sig );
+}
+
+}
+
+
+SignalTranslator::SignalTranslator()
+{
+    m_oldJumpTarget = s_jumpTarget;
+    s_jumpTarget = &m_currentJumpTarget;
+
+    struct sigaction action;
+    action.sa_flags = 0;
+    action.sa_handler = SignalHandler;
+    sigemptyset( &action.sa_mask );
+
+    sigaction( SIGSEGV, &action, &m_old_SIGSEGV_action );
+    sigaction( SIGFPE , &action, &m_old_SIGFPE_action  );
+    sigaction( SIGTRAP, &action, &m_old_SIGTRAP_action );
+    sigaction( SIGBUS , &action, &m_old_SIGBUS_action  );
+    sigaction( SIGILL , &action, &m_old_SIGBUS_action  );
+}
+
+SignalTranslator::~SignalTranslator()
+{
+    sigaction( SIGILL , &m_old_SIGBUS_action , 0 );
+    sigaction( SIGBUS , &m_old_SIGBUS_action , 0 );
+    sigaction( SIGTRAP, &m_old_SIGTRAP_action, 0 );
+    sigaction( SIGFPE , &m_old_SIGFPE_action , 0 );
+    sigaction( SIGSEGV, &m_old_SIGSEGV_action, 0 );
+
+    s_jumpTarget = m_oldJumpTarget;
+}
+
+
+}
diff --git a/tools/UnitTest++/src/Posix/SignalTranslator.h b/tools/UnitTest++/src/Posix/SignalTranslator.h
new file mode 100644 (file)
index 0000000..bf98ad3
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef UNITTEST_SIGNALTRANSLATOR_H
+#define UNITTEST_SIGNALTRANSLATOR_H
+
+#include <setjmp.h>
+#include <signal.h>
+
+namespace UnitTest {
+
+class SignalTranslator
+{
+public:
+    SignalTranslator();
+    ~SignalTranslator();
+
+    static sigjmp_buf* s_jumpTarget;
+
+private:
+    sigjmp_buf m_currentJumpTarget;
+    sigjmp_buf* m_oldJumpTarget;
+
+    struct sigaction m_old_SIGFPE_action;
+    struct sigaction m_old_SIGTRAP_action;
+    struct sigaction m_old_SIGSEGV_action;
+    struct sigaction m_old_SIGBUS_action;
+    struct sigaction m_old_SIGABRT_action;
+    struct sigaction m_old_SIGALRM_action;
+};
+
+#if !defined (__GNUC__)
+    #define UNITTEST_EXTENSION
+#else
+    #define UNITTEST_EXTENSION __extension__
+#endif
+
+#define UNITTEST_THROW_SIGNALS \
+       UnitTest::SignalTranslator sig; \
+       if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \
+        throw ("Unhandled system exception"); 
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/Posix/TimeHelpers.cpp b/tools/UnitTest++/src/Posix/TimeHelpers.cpp
new file mode 100644 (file)
index 0000000..bfd23c0
--- /dev/null
@@ -0,0 +1,33 @@
+#include "TimeHelpers.h"
+#include <unistd.h>
+
+namespace UnitTest {
+
+Timer::Timer()
+{
+    m_startTime.tv_sec = 0;
+    m_startTime.tv_usec = 0;
+}
+
+void Timer::Start()
+{
+    gettimeofday(&m_startTime, 0);
+}
+
+
+int Timer::GetTimeInMs() const
+{
+    struct timeval currentTime;
+    gettimeofday(&currentTime, 0);
+    int const dsecs = currentTime.tv_sec - m_startTime.tv_sec;
+    int const dus = currentTime.tv_usec - m_startTime.tv_usec;
+    return dsecs*1000 + dus/1000;
+}
+
+
+void TimeHelpers::SleepMs (int ms)
+{
+    usleep(ms * 1000);
+}
+
+}
diff --git a/tools/UnitTest++/src/Posix/TimeHelpers.h b/tools/UnitTest++/src/Posix/TimeHelpers.h
new file mode 100644 (file)
index 0000000..fdc8428
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef UNITTEST_TIMEHELPERS_H
+#define UNITTEST_TIMEHELPERS_H
+
+#include <sys/time.h>
+
+namespace UnitTest {
+
+class Timer
+{
+public:
+    Timer();
+    void Start();
+    int GetTimeInMs() const;    
+
+private:
+    struct timeval m_startTime;    
+};
+
+
+namespace TimeHelpers
+{
+void SleepMs (int ms);
+}
+
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/ReportAssert.cpp b/tools/UnitTest++/src/ReportAssert.cpp
new file mode 100644 (file)
index 0000000..a1810d9
--- /dev/null
@@ -0,0 +1,10 @@
+#include "AssertException.h"
+
+namespace UnitTest {
+
+void ReportAssert(char const* description, char const* filename, int lineNumber)
+{
+    throw AssertException(description, filename, lineNumber);
+}
+
+}
diff --git a/tools/UnitTest++/src/ReportAssert.h b/tools/UnitTest++/src/ReportAssert.h
new file mode 100644 (file)
index 0000000..d4dd864
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef UNITTEST_ASSERT_H
+#define UNITTEST_ASSERT_H
+
+namespace UnitTest {
+
+void ReportAssert(char const* description, char const* filename, int lineNumber);
+    
+}
+
+#endif
diff --git a/tools/UnitTest++/src/Test.cpp b/tools/UnitTest++/src/Test.cpp
new file mode 100644 (file)
index 0000000..bc9cb3d
--- /dev/null
@@ -0,0 +1,41 @@
+#include "Config.h"
+#include "Test.h"
+#include "TestList.h"
+#include "TestResults.h"
+#include "AssertException.h"
+#include "MemoryOutStream.h"
+#include "ExecuteTest.h"
+
+#ifdef UNITTEST_POSIX
+    #include "Posix/SignalTranslator.h"
+#endif
+
+namespace UnitTest {
+
+TestList& Test::GetTestList()
+{
+    static TestList s_list;
+    return s_list;
+}
+
+Test::Test(char const* testName, char const* suiteName, char const* filename, int lineNumber)
+    : m_details(testName, suiteName, filename, lineNumber)
+    , next(0)
+    , m_timeConstraintExempt(false)
+{
+}
+
+Test::~Test()
+{
+}
+
+void Test::Run()
+{
+       ExecuteTest(*this, m_details);
+}
+
+void Test::RunImpl() const
+{
+}
+
+}
diff --git a/tools/UnitTest++/src/Test.h b/tools/UnitTest++/src/Test.h
new file mode 100644 (file)
index 0000000..91026b6
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef UNITTEST_TEST_H
+#define UNITTEST_TEST_H
+
+#include "TestDetails.h"
+
+namespace UnitTest {
+
+class TestResults;
+class TestList;
+
+class Test
+{
+public:
+    explicit Test(char const* testName, char const* suiteName = "DefaultSuite", char const* filename = "", int lineNumber = 0);
+    virtual ~Test();
+    void Run();
+
+    TestDetails const m_details;
+    Test* next;
+    mutable bool m_timeConstraintExempt;
+
+    static TestList& GetTestList();
+
+    virtual void RunImpl() const;
+
+private:
+       Test(Test const&);
+    Test& operator =(Test const&);
+};
+
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/TestDetails.cpp b/tools/UnitTest++/src/TestDetails.cpp
new file mode 100644 (file)
index 0000000..a13a168
--- /dev/null
@@ -0,0 +1,22 @@
+#include "TestDetails.h"
+
+namespace UnitTest {
+
+TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_)
+    : suiteName(suiteName_)
+    , testName(testName_)
+    , filename(filename_)
+    , lineNumber(lineNumber_)
+{
+}
+
+TestDetails::TestDetails(const TestDetails& details, int lineNumber_)
+    : suiteName(details.suiteName)
+    , testName(details.testName)
+    , filename(details.filename)
+    , lineNumber(lineNumber_)
+{
+}
+
+
+}
diff --git a/tools/UnitTest++/src/TestDetails.h b/tools/UnitTest++/src/TestDetails.h
new file mode 100644 (file)
index 0000000..eae0e71
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef UNITTEST_TESTDETAILS_H
+#define UNITTEST_TESTDETAILS_H
+
+namespace UnitTest {
+
+class TestDetails
+{
+public:
+    TestDetails(char const* testName, char const* suiteName, char const* filename, int lineNumber);
+    TestDetails(const TestDetails& details, int lineNumber);
+
+    char const* const suiteName;
+    char const* const testName;
+    char const* const filename;
+    int const lineNumber;
+
+    TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind
+private:
+    TestDetails& operator=(TestDetails const&);
+};
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/TestList.cpp b/tools/UnitTest++/src/TestList.cpp
new file mode 100644 (file)
index 0000000..e31e613
--- /dev/null
@@ -0,0 +1,39 @@
+#include "TestList.h"
+#include "Test.h"
+
+#include <cassert>
+
+namespace UnitTest {
+
+TestList::TestList() 
+    : m_head(0)
+    , m_tail(0)
+{
+}
+
+void TestList::Add(Test* test)
+{
+    if (m_tail == 0)
+    {
+        assert(m_head == 0);
+        m_head = test;
+        m_tail = test;
+    }
+    else
+    {
+        m_tail->next = test;
+        m_tail = test;
+    }
+}
+
+Test* TestList::GetHead() const
+{
+    return m_head;
+}
+
+ListAdder::ListAdder(TestList& list, Test* test)
+{
+    list.Add(test);
+}
+
+}
diff --git a/tools/UnitTest++/src/TestList.h b/tools/UnitTest++/src/TestList.h
new file mode 100644 (file)
index 0000000..b17424b
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef UNITTEST_TESTLIST_H
+#define UNITTEST_TESTLIST_H
+
+
+namespace UnitTest {
+
+class Test;
+
+class TestList
+{
+public:
+    TestList();
+    void Add (Test* test);
+
+    Test* GetHead() const;
+
+private:
+    Test* m_head;
+    Test* m_tail;
+};
+
+
+class ListAdder
+{
+public:
+    ListAdder(TestList& list, Test* test);
+};
+
+}
+
+
+#endif
diff --git a/tools/UnitTest++/src/TestMacros.h b/tools/UnitTest++/src/TestMacros.h
new file mode 100644 (file)
index 0000000..a297f15
--- /dev/null
@@ -0,0 +1,113 @@
+#ifndef UNITTEST_TESTMACROS_H
+#define UNITTEST_TESTMACROS_H
+
+#include "Config.h"
+#include "ExecuteTest.h"
+#include "AssertException.h"
+#include "TestDetails.h"
+#include "MemoryOutStream.h"
+
+#ifndef UNITTEST_POSIX
+       #define UNITTEST_THROW_SIGNALS
+#else
+       #include "Posix/SignalTranslator.h"
+#endif
+
+#ifdef TEST
+    #error UnitTest++ redefines TEST
+#endif
+
+#ifdef TEST_EX
+       #error UnitTest++ redefines TEST_EX
+#endif
+
+#ifdef TEST_FIXTURE_EX
+       #error UnitTest++ redefines TEST_FIXTURE_EX
+#endif
+
+#define SUITE(Name)                                                         \
+       namespace Suite##Name {                                                        \
+        namespace UnitTestSuite {                                           \
+            inline char const* GetSuiteName () {                            \
+                return #Name ;                                              \
+            }                                                               \
+        }                                                                   \
+    }                                                                       \
+       namespace Suite##Name
+
+#define TEST_EX(Name, List)                                                \
+    class Test##Name : public UnitTest::Test                               \
+    {                                                                      \
+    public:                                                                \
+               Test##Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {}  \
+    private:                                                               \
+        virtual void RunImpl() const;   \
+    } test##Name##Instance;                                                \
+                                                                                                                                                  \
+    UnitTest::ListAdder adder##Name (List, &test##Name##Instance);         \
+                                                                                                                                                  \
+    void Test##Name::RunImpl() const
+
+
+#define TEST(Name) TEST_EX(Name, UnitTest::Test::GetTestList())
+
+
+#define TEST_FIXTURE_EX(Fixture, Name, List)                                         \
+    class Fixture##Name##Helper : public Fixture                                                                        \
+       {                                                                                                                                                                \
+       public:                                                                                                                                                  \
+        explicit Fixture##Name##Helper(UnitTest::TestDetails const& details) : m_details(details) {} \
+        void RunImpl();                           \
+        UnitTest::TestDetails const& m_details;                                      \
+    private:                                                                         \
+        Fixture##Name##Helper(Fixture##Name##Helper const&);                         \
+        Fixture##Name##Helper& operator =(Fixture##Name##Helper const&);             \
+    };                                                                               \
+                                                                                                                                                                        \
+    class Test##Fixture##Name : public UnitTest::Test                                \
+    {                                                                                \
+    public:                                                                          \
+           Test##Fixture##Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \
+    private:                                                                         \
+        virtual void RunImpl() const;             \
+    } test##Fixture##Name##Instance;                                                 \
+                                                                                                                                                                        \
+    UnitTest::ListAdder adder##Fixture##Name (List, &test##Fixture##Name##Instance); \
+                                                                                                                                                                        \
+    void Test##Fixture##Name::RunImpl() const   \
+       {                                                                                                                                                                \
+               bool ctorOk = false;                                                                                                             \
+               try {                                                                                                                                            \
+                       Fixture##Name##Helper fixtureHelper(m_details);                                                  \
+                       ctorOk = true;                                                                                                                   \
+                       UnitTest::ExecuteTest(fixtureHelper, m_details);                                         \
+               }                                                                                                                                                        \
+               catch (UnitTest::AssertException const& e)                                                                                       \
+               {                                                                                                                                                        \
+                       UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(m_details.testName, m_details.suiteName, e.Filename(), e.LineNumber()), e.what()); \
+               }                                                                                                                                                        \
+               catch (std::exception const& e)                                                                                          \
+               {                                                                                                                                                        \
+                       UnitTest::MemoryOutStream stream;                                                                                                        \
+                       stream << "Unhandled exception: " << e.what();                                                   \
+                       UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText());                            \
+               }                                                                                                                                                        \
+               catch (...) {                                                                                                                            \
+                       if (ctorOk)                                                                                                                              \
+                       {                                                                                                                                                \
+                   UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(m_details, __LINE__),  \
+                                       "Unhandled exception while destroying fixture " #Fixture);               \
+                       }                                                                                                                                                \
+                       else                                                                                                                                     \
+                       {                                                                                                                                                \
+                               UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(m_details, __LINE__),   \
+                                       "Unhandled exception while constructing fixture " #Fixture);         \
+                       }                                                                                                                                                \
+               }                                                                                                                                                        \
+    }                                                                                \
+    void Fixture##Name##Helper::RunImpl()
+
+#define TEST_FIXTURE(Fixture,Name) TEST_FIXTURE_EX(Fixture, Name, UnitTest::Test::GetTestList())
+
+
+#endif
diff --git a/tools/UnitTest++/src/TestReporter.cpp b/tools/UnitTest++/src/TestReporter.cpp
new file mode 100644 (file)
index 0000000..608d3c6
--- /dev/null
@@ -0,0 +1,10 @@
+#include "TestReporter.h"
+
+namespace UnitTest {
+
+
+TestReporter::~TestReporter()
+{
+}
+
+}
diff --git a/tools/UnitTest++/src/TestReporter.h b/tools/UnitTest++/src/TestReporter.h
new file mode 100644 (file)
index 0000000..5a2f404
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef UNITTEST_TESTREPORTER_H
+#define UNITTEST_TESTREPORTER_H
+
+namespace UnitTest {
+
+class TestDetails;
+
+class TestReporter
+{
+public:
+    virtual ~TestReporter();
+
+    virtual void ReportTestStart(TestDetails const& test) = 0;
+    virtual void ReportFailure(TestDetails const& test, char const* failure) = 0;
+    virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed) = 0;
+    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) = 0;
+};
+
+}
+#endif
diff --git a/tools/UnitTest++/src/TestReporterStdout.cpp b/tools/UnitTest++/src/TestReporterStdout.cpp
new file mode 100644 (file)
index 0000000..f495c0f
--- /dev/null
@@ -0,0 +1,41 @@
+#include "TestReporterStdout.h"
+#include <cstdio>
+
+#include "TestDetails.h"
+
+namespace UnitTest {
+
+void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure)
+{
+#if defined(__APPLE__) || defined(__GNUG__)
+    char const* const errorFormat = "%s:%d: error: Failure in %s: %s\n";
+#else
+    char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n";
+#endif
+
+       using namespace std;
+    printf(errorFormat, details.filename, details.lineNumber, details.testName, failure);
+}
+
+void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/)
+{
+}
+
+void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float)
+{
+}
+
+void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount,
+                                       int const failureCount, float secondsElapsed)
+{
+       using namespace std;
+
+    if (failureCount > 0)
+        printf("FAILURE: %d out of %d tests failed (%d failures).\n", failedTestCount, totalTestCount, failureCount);
+    else
+        printf("Success: %d tests passed.\n", totalTestCount);
+
+    printf("Test time: %.2f seconds.\n", secondsElapsed);
+}
+
+}
diff --git a/tools/UnitTest++/src/TestReporterStdout.h b/tools/UnitTest++/src/TestReporterStdout.h
new file mode 100644 (file)
index 0000000..eacbba3
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef UNITTEST_TESTREPORTERSTDOUT_H
+#define UNITTEST_TESTREPORTERSTDOUT_H
+
+#include "TestReporter.h"
+
+namespace UnitTest {
+
+class TestReporterStdout : public TestReporter
+{
+private:
+    virtual void ReportTestStart(TestDetails const& test);
+    virtual void ReportFailure(TestDetails const& test, char const* failure);
+    virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed);
+    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
+};
+
+}
+
+#endif 
diff --git a/tools/UnitTest++/src/TestResults.cpp b/tools/UnitTest++/src/TestResults.cpp
new file mode 100644 (file)
index 0000000..b3b67c0
--- /dev/null
@@ -0,0 +1,60 @@
+#include "TestResults.h"
+#include "TestReporter.h"
+
+#include "TestDetails.h"
+
+namespace UnitTest {
+
+TestResults::TestResults(TestReporter* testReporter)
+    : m_testReporter(testReporter)
+    , m_totalTestCount(0)
+    , m_failedTestCount(0)
+    , m_failureCount(0)
+    , m_currentTestFailed(false)
+{
+}
+
+void TestResults::OnTestStart(TestDetails const& test)
+{
+    ++m_totalTestCount;
+    m_currentTestFailed = false;
+    if (m_testReporter)
+        m_testReporter->ReportTestStart(test);
+}
+
+void TestResults::OnTestFailure(TestDetails const& test, char const* failure)
+{
+    ++m_failureCount;
+    if (!m_currentTestFailed)
+    {
+        ++m_failedTestCount;
+        m_currentTestFailed = true;
+    }
+
+    if (m_testReporter)
+        m_testReporter->ReportFailure(test, failure);
+}
+
+void TestResults::OnTestFinish(TestDetails const& test, float secondsElapsed)
+{
+    if (m_testReporter)
+        m_testReporter->ReportTestFinish(test, secondsElapsed);
+}
+
+int TestResults::GetTotalTestCount() const
+{
+    return m_totalTestCount;
+}
+
+int TestResults::GetFailedTestCount() const
+{
+    return m_failedTestCount;
+}
+
+int TestResults::GetFailureCount() const
+{
+    return m_failureCount;
+}
+
+
+}
diff --git a/tools/UnitTest++/src/TestResults.h b/tools/UnitTest++/src/TestResults.h
new file mode 100644 (file)
index 0000000..8ef7fda
--- /dev/null
@@ -0,0 +1,36 @@
+#ifndef UNITTEST_TESTRESULTS_H
+#define UNITTEST_TESTRESULTS_H
+
+namespace UnitTest {
+
+class TestReporter;
+class TestDetails;
+
+class TestResults
+{
+public:
+    explicit TestResults(TestReporter* reporter = 0);
+
+    void OnTestStart(TestDetails const& test);
+    void OnTestFailure(TestDetails const& test, char const* failure);
+    void OnTestFinish(TestDetails const& test, float secondsElapsed);
+
+    int GetTotalTestCount() const;
+    int GetFailedTestCount() const;
+    int GetFailureCount() const;
+
+private:
+    TestReporter* m_testReporter;
+    int m_totalTestCount;
+    int m_failedTestCount;
+    int m_failureCount;
+
+    bool m_currentTestFailed;
+
+    TestResults(TestResults const&);
+    TestResults& operator =(TestResults const&);
+};
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/TestRunner.cpp b/tools/UnitTest++/src/TestRunner.cpp
new file mode 100644 (file)
index 0000000..466265d
--- /dev/null
@@ -0,0 +1,76 @@
+#include "TestRunner.h"
+#include "TestResults.h"
+#include "TestReporter.h"
+#include "TestReporterStdout.h"
+#include "TimeHelpers.h"
+#include "MemoryOutStream.h"
+
+#include <cstring>
+
+
+namespace UnitTest {
+
+int RunAllTests()
+{
+       TestReporterStdout reporter;
+       TestRunner runner(reporter);
+       return runner.RunTestsIf(Test::GetTestList(), NULL, True(), 0);
+}
+
+
+TestRunner::TestRunner(TestReporter& reporter)
+       : m_reporter(&reporter)
+       , m_result(new TestResults(&reporter))
+       , m_timer(new Timer)
+{
+       m_timer->Start();
+}
+
+TestRunner::~TestRunner()
+{
+       delete m_result;
+       delete m_timer;
+}
+
+int TestRunner::Finish() const
+{
+    float const secondsElapsed = m_timer->GetTimeInMs() / 1000.0f;
+    m_reporter->ReportSummary(m_result->GetTotalTestCount(), 
+                                                         m_result->GetFailedTestCount(), 
+                                                         m_result->GetFailureCount(), 
+                                                         secondsElapsed);
+    
+       return m_result->GetFailureCount();
+}
+
+bool TestRunner::IsTestInSuite(const Test* const curTest, char const* suiteName) const
+{
+       using namespace std;
+       return (suiteName == NULL) || !strcmp(curTest->m_details.suiteName, suiteName);
+}
+
+void TestRunner::RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const
+{
+       CurrentTest::Results() = result;
+
+       Timer testTimer;
+       testTimer.Start();
+
+       result->OnTestStart(curTest->m_details);
+
+       curTest->Run();
+
+       int const testTimeInMs = testTimer.GetTimeInMs();
+       if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_timeConstraintExempt)
+       {
+           MemoryOutStream stream;
+           stream << "Global time constraint failed. Expected under " << maxTestTimeInMs <<
+                   "ms but took " << testTimeInMs << "ms.";
+
+           result->OnTestFailure(curTest->m_details, stream.GetText());
+       }
+
+       result->OnTestFinish(curTest->m_details, testTimeInMs/1000.0f);
+}
+
+}
diff --git a/tools/UnitTest++/src/TestRunner.h b/tools/UnitTest++/src/TestRunner.h
new file mode 100644 (file)
index 0000000..0798af9
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef UNITTEST_TESTRUNNER_H
+#define UNITTEST_TESTRUNNER_H
+
+#include "Test.h"
+#include "TestList.h"
+#include "CurrentTest.h"
+
+namespace UnitTest {
+
+class TestReporter;
+class TestResults;
+class Timer;
+
+int RunAllTests();
+
+struct True
+{
+       bool operator()(const Test* const) const
+       {
+               return true;    
+       }
+};
+
+class TestRunner
+{
+public:
+       explicit TestRunner(TestReporter& reporter);
+       ~TestRunner();
+
+       template <class Predicate>
+       int RunTestsIf(TestList const& list, char const* suiteName, 
+                                  const Predicate& predicate, int maxTestTimeInMs) const
+       {
+           Test* curTest = list.GetHead();
+
+           while (curTest != 0)
+           {
+                   if (IsTestInSuite(curTest,suiteName) && predicate(curTest))
+                       {
+                               RunTest(m_result, curTest, maxTestTimeInMs);
+                       }
+
+                       curTest = curTest->next;
+           }
+
+           return Finish();
+       }       
+
+private:
+       TestReporter* m_reporter;
+       TestResults* m_result;
+       Timer* m_timer;
+
+       int Finish() const;
+       bool IsTestInSuite(const Test* const curTest, char const* suiteName) const;
+       void RunTest(TestResults* const result, Test* const curTest, int const maxTestTimeInMs) const;
+};
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/TestSuite.h b/tools/UnitTest++/src/TestSuite.h
new file mode 100644 (file)
index 0000000..dd3717e
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef UNITTEST_TESTSUITE_H
+#define UNITTEST_TESTSUITE_H
+
+namespace UnitTestSuite {
+
+    inline char const* GetSuiteName ()
+    {
+        return "DefaultSuite";
+    }
+
+}
+
+#endif
+
diff --git a/tools/UnitTest++/src/TimeConstraint.cpp b/tools/UnitTest++/src/TimeConstraint.cpp
new file mode 100644 (file)
index 0000000..b313be7
--- /dev/null
@@ -0,0 +1,29 @@
+#include "TimeConstraint.h"
+#include "TestResults.h"
+#include "MemoryOutStream.h"
+#include "CurrentTest.h"
+
+namespace UnitTest {
+
+
+TimeConstraint::TimeConstraint(int ms, TestDetails const& details)
+       : m_details(details)
+    , m_maxMs(ms)
+{
+    m_timer.Start();
+}
+
+TimeConstraint::~TimeConstraint()
+{
+    int const totalTimeInMs = m_timer.GetTimeInMs();
+    if (totalTimeInMs > m_maxMs)
+    {
+        MemoryOutStream stream;
+        stream << "Time constraint failed. Expected to run test under " << m_maxMs <<
+                  "ms but took " << totalTimeInMs << "ms.";
+
+               UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText());
+    }
+}
+
+}
diff --git a/tools/UnitTest++/src/TimeConstraint.h b/tools/UnitTest++/src/TimeConstraint.h
new file mode 100644 (file)
index 0000000..ac32914
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef UNITTEST_TIMECONSTRAINT_H
+#define UNITTEST_TIMECONSTRAINT_H
+
+#include "TimeHelpers.h"
+
+namespace UnitTest {
+
+class TestResults;
+class TestDetails;
+
+class TimeConstraint
+{
+public:
+    TimeConstraint(int ms, TestDetails const& details);
+    ~TimeConstraint();
+
+private:
+    void operator=(TimeConstraint const&); 
+       TimeConstraint(TimeConstraint const&);
+
+       Timer m_timer;
+    TestDetails const& m_details;
+       int const m_maxMs;
+};
+
+#define UNITTEST_TIME_CONSTRAINT(ms) \
+       UnitTest::TimeConstraint unitTest__timeConstraint__(ms, UnitTest::TestDetails(m_details, __LINE__))
+
+#define UNITTEST_TIME_CONSTRAINT_EXEMPT() do { m_timeConstraintExempt = true; } while (0)
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/TimeHelpers.h b/tools/UnitTest++/src/TimeHelpers.h
new file mode 100644 (file)
index 0000000..f34ed00
--- /dev/null
@@ -0,0 +1,7 @@
+#include "Config.h"
+
+#if defined UNITTEST_POSIX
+    #include "Posix/TimeHelpers.h"
+#else
+    #include "Win32/TimeHelpers.h"
+#endif
diff --git a/tools/UnitTest++/src/UnitTest++.h b/tools/UnitTest++/src/UnitTest++.h
new file mode 100644 (file)
index 0000000..3318735
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef UNITTESTCPP_H
+#define UNITTESTCPP_H
+
+//lint -esym(1509,*Fixture)
+
+#include "Config.h"
+#include "Test.h"
+#include "TestList.h"
+#include "TestSuite.h"
+#include "TestResults.h"
+
+#include "TestMacros.h"
+
+#include "CheckMacros.h"
+#include "TestRunner.h"
+#include "TimeConstraint.h"
+
+#endif
diff --git a/tools/UnitTest++/src/Win32/TimeHelpers.cpp b/tools/UnitTest++/src/Win32/TimeHelpers.cpp
new file mode 100644 (file)
index 0000000..a1f9fdd
--- /dev/null
@@ -0,0 +1,50 @@
+#include "TimeHelpers.h"
+#include <windows.h>
+
+namespace UnitTest {
+
+Timer::Timer()
+    : m_startTime(0)
+       , m_threadHandle(::GetCurrentThread())
+{
+#if defined(_MSC_VER) && (_MSC_VER == 1200) // VC6 doesn't have DWORD_PTR?
+       typedef unsigned long DWORD_PTR;
+#endif
+
+    DWORD_PTR systemMask;
+    ::GetProcessAffinityMask(GetCurrentProcess(), &m_processAffinityMask, &systemMask);
+    
+    ::SetThreadAffinityMask(m_threadHandle, 1);
+       ::QueryPerformanceFrequency(reinterpret_cast< LARGE_INTEGER* >(&m_frequency));
+    ::SetThreadAffinityMask(m_threadHandle, m_processAffinityMask);
+}
+
+void Timer::Start()
+{
+    m_startTime = GetTime();
+}
+
+int Timer::GetTimeInMs() const
+{
+    __int64 const elapsedTime = GetTime() - m_startTime;
+       double const seconds = double(elapsedTime) / double(m_frequency);
+       return int(seconds * 1000.0f);
+}
+
+__int64 Timer::GetTime() const
+{
+    LARGE_INTEGER curTime;
+    ::SetThreadAffinityMask(m_threadHandle, 1);
+       ::QueryPerformanceCounter(&curTime);
+    ::SetThreadAffinityMask(m_threadHandle, m_processAffinityMask);
+    return curTime.QuadPart;
+}
+
+
+
+void TimeHelpers::SleepMs(int const ms)
+{
+       ::Sleep(ms);
+}
+
+}
diff --git a/tools/UnitTest++/src/Win32/TimeHelpers.h b/tools/UnitTest++/src/Win32/TimeHelpers.h
new file mode 100644 (file)
index 0000000..883d419
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef UNITTEST_TIMEHELPERS_H
+#define UNITTEST_TIMEHELPERS_H
+
+#include "../Config.h"
+
+
+#ifdef UNITTEST_MINGW
+    #ifndef __int64
+        #define __int64 long long
+    #endif
+#endif
+
+namespace UnitTest {
+
+class Timer
+{
+public:
+    Timer();
+       void Start();
+       int GetTimeInMs() const;    
+
+private:
+    __int64 GetTime() const;
+
+    void* m_threadHandle;
+
+#if defined(_WIN64)
+    unsigned __int64 m_processAffinityMask;
+#else
+    unsigned long m_processAffinityMask;
+#endif
+
+       __int64 m_startTime;
+       __int64 m_frequency;
+};
+
+
+namespace TimeHelpers
+{
+void SleepMs (int ms);
+}
+
+
+}
+
+
+
+#endif
diff --git a/tools/UnitTest++/src/XmlTestReporter.cpp b/tools/UnitTest++/src/XmlTestReporter.cpp
new file mode 100644 (file)
index 0000000..fe8966f
--- /dev/null
@@ -0,0 +1,127 @@
+#include "XmlTestReporter.h"
+#include "Config.h"
+
+#include <iostream>
+#include <sstream>
+#include <string>
+
+using std::string;
+using std::ostringstream;
+using std::ostream;
+
+namespace {
+
+void ReplaceChar(string& str, char c, string const& replacement)
+{
+    for (size_t pos = str.find(c); pos != string::npos; pos = str.find(c, pos + 1))
+        str.replace(pos, 1, replacement);
+}
+
+string XmlEscape(string const& value)
+{
+    string escaped = value;
+
+    ReplaceChar(escaped, '&', "&amp;");
+    ReplaceChar(escaped, '<', "&lt;");
+    ReplaceChar(escaped, '>', "&gt;");
+    ReplaceChar(escaped, '\'', "&apos;");
+    ReplaceChar(escaped, '\"', "&quot;");
+    return escaped;
+}
+
+string BuildFailureMessage(string const& file, int line, string const& message)
+{
+    ostringstream failureMessage;
+    failureMessage << file << "(" << line << ") : " << message;
+    return failureMessage.str();
+}
+
+}
+
+namespace UnitTest {
+
+XmlTestReporter::XmlTestReporter(ostream& ostream)
+    : m_ostream(ostream)
+{
+}
+
+void XmlTestReporter::ReportSummary(int totalTestCount, int failedTestCount,
+                                    int failureCount, float secondsElapsed)
+{
+    AddXmlElement(m_ostream, NULL);
+
+    BeginResults(m_ostream, totalTestCount, failedTestCount, failureCount, secondsElapsed);
+
+    DeferredTestResultList const& results = GetResults();
+    for (DeferredTestResultList::const_iterator i = results.begin(); i != results.end(); ++i)
+    {
+        BeginTest(m_ostream, *i);
+
+        if (i->failed)
+            AddFailure(m_ostream, *i);
+
+        EndTest(m_ostream, *i);
+    }
+
+    EndResults(m_ostream);
+}
+
+void XmlTestReporter::AddXmlElement(ostream& os, char const* encoding)
+{
+    os << "<?xml version=\"1.0\"";
+
+    if (encoding != NULL)
+        os << " encoding=\"" << encoding << "\"";
+
+    os << "?>";
+}
+
+void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, 
+                                   int failureCount, float secondsElapsed)
+{
+   os << "<unittest-results"
+       << " tests=\"" << totalTestCount << "\"" 
+       << " failedtests=\"" << failedTestCount << "\"" 
+       << " failures=\"" << failureCount << "\"" 
+       << " time=\"" << secondsElapsed << "\""
+       << ">";
+}
+
+void XmlTestReporter::EndResults(std::ostream& os)
+{
+    os << "</unittest-results>";
+}
+
+void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result)
+{
+    os << "<test"
+        << " suite=\"" << result.suiteName << "\"" 
+        << " name=\"" << result.testName << "\""
+        << " time=\"" << result.timeElapsed << "\"";
+}
+
+void XmlTestReporter::EndTest(std::ostream& os, DeferredTestResult const& result)
+{
+    if (result.failed)
+        os << "</test>";
+    else
+        os << "/>";
+}
+
+void XmlTestReporter::AddFailure(std::ostream& os, DeferredTestResult const& result)
+{
+    os << ">"; // close <test> element
+
+    for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); 
+         it != result.failures.end(); 
+         ++it)
+    {
+        string const escapedMessage = XmlEscape(it->second);
+        string const message = BuildFailureMessage(result.failureFile, it->first, escapedMessage);
+
+        os << "<failure" << " message=\"" << message << "\"" << "/>";
+    }
+}
+
+}
diff --git a/tools/UnitTest++/src/XmlTestReporter.h b/tools/UnitTest++/src/XmlTestReporter.h
new file mode 100644 (file)
index 0000000..884123b
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef UNITTEST_XMLTESTREPORTER_H
+#define UNITTEST_XMLTESTREPORTER_H
+
+#include "DeferredTestReporter.h"
+
+#include <iosfwd>
+
+namespace UnitTest
+{
+
+class XmlTestReporter : public DeferredTestReporter
+{
+public:
+    explicit XmlTestReporter(std::ostream& ostream);
+
+    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
+
+private:
+    XmlTestReporter(XmlTestReporter const&);
+    XmlTestReporter& operator=(XmlTestReporter const&);
+
+    void AddXmlElement(std::ostream& os, char const* encoding);
+    void BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed);
+    void EndResults(std::ostream& os);
+    void BeginTest(std::ostream& os, DeferredTestResult const& result);
+    void AddFailure(std::ostream& os, DeferredTestResult const& result);
+    void EndTest(std::ostream& os, DeferredTestResult const& result);
+
+    std::ostream& m_ostream;
+};
+
+}
+
+#endif
diff --git a/tools/UnitTest++/src/tests/Main.cpp b/tools/UnitTest++/src/tests/Main.cpp
new file mode 100644 (file)
index 0000000..b2d9615
--- /dev/null
@@ -0,0 +1,8 @@
+#include "../UnitTest++.h"
+#include "../TestReporterStdout.h"
+
+
+int main(int, char const *[])
+{
+    return UnitTest::RunAllTests();
+}
diff --git a/tools/UnitTest++/src/tests/RecordingReporter.h b/tools/UnitTest++/src/tests/RecordingReporter.h
new file mode 100644 (file)
index 0000000..982c294
--- /dev/null
@@ -0,0 +1,98 @@
+#ifndef UNITTEST_RECORDINGREPORTER_H
+#define UNITTEST_RECORDINGREPORTER_H
+
+#include "../TestReporter.h"
+#include <cstring>
+
+#include "../TestDetails.h"
+
+struct RecordingReporter : public UnitTest::TestReporter
+{
+private:
+    enum { kMaxStringLength = 256 };
+
+public:
+    RecordingReporter()
+        : testRunCount(0)
+        , testFailedCount(0)
+        , lastFailedLine(0)
+        , testFinishedCount(0)
+        , lastFinishedTestTime(0)
+        , summaryTotalTestCount(0)
+        , summaryFailedTestCount(0)
+        , summaryFailureCount(0)
+        , summarySecondsElapsed(0)
+    {
+        lastStartedSuite[0] = '\0';
+        lastStartedTest[0] = '\0';
+        lastFailedFile[0] = '\0';
+        lastFailedSuite[0] = '\0';
+        lastFailedTest[0] = '\0';
+        lastFailedMessage[0] = '\0';
+        lastFinishedSuite[0] = '\0';
+        lastFinishedTest[0] = '\0';
+    }
+
+    virtual void ReportTestStart(UnitTest::TestDetails const& test)
+    {
+               using namespace std;
+
+        ++testRunCount;
+        strcpy(lastStartedSuite, test.suiteName);
+        strcpy(lastStartedTest, test.testName);
+    }
+
+    virtual void ReportFailure(UnitTest::TestDetails const& test, char const* failure)
+    {
+               using namespace std;
+
+               ++testFailedCount;
+        strcpy(lastFailedFile, test.filename);
+        lastFailedLine = test.lineNumber;
+        strcpy(lastFailedSuite, test.suiteName);
+        strcpy(lastFailedTest, test.testName);
+        strcpy(lastFailedMessage, failure);
+    }
+
+    virtual void ReportTestFinish(UnitTest::TestDetails const& test, float testDuration)
+    {
+               using namespace std;
+
+               ++testFinishedCount;
+        strcpy(lastFinishedSuite, test.suiteName);
+        strcpy(lastFinishedTest, test.testName);
+        lastFinishedTestTime = testDuration;
+    }
+
+    virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) 
+    {
+        summaryTotalTestCount = totalTestCount;
+        summaryFailedTestCount = failedTestCount;
+        summaryFailureCount = failureCount;
+        summarySecondsElapsed = secondsElapsed;
+    }
+
+    int testRunCount;
+    char lastStartedSuite[kMaxStringLength];
+    char lastStartedTest[kMaxStringLength];
+
+    int testFailedCount;
+    char lastFailedFile[kMaxStringLength];
+    int lastFailedLine;
+    char lastFailedSuite[kMaxStringLength];
+    char lastFailedTest[kMaxStringLength];
+    char lastFailedMessage[kMaxStringLength];
+
+    int testFinishedCount;
+    char lastFinishedSuite[kMaxStringLength];
+    char lastFinishedTest[kMaxStringLength];
+    float lastFinishedTestTime;
+
+    int summaryTotalTestCount;
+    int summaryFailedTestCount;
+    int summaryFailureCount;
+    float summarySecondsElapsed;
+};
+
+
+#endif
diff --git a/tools/UnitTest++/src/tests/ScopedCurrentTest.h b/tools/UnitTest++/src/tests/ScopedCurrentTest.h
new file mode 100644 (file)
index 0000000..e03ae0a
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef UNITTEST_SCOPEDCURRENTTEST_H
+#define UNITTEST_SCOPEDCURRENTTEST_H
+
+#include "../CurrentTest.h"
+#include <cstddef>
+
+class ScopedCurrentTest
+{
+public:
+       ScopedCurrentTest()
+               : m_oldTestResults(UnitTest::CurrentTest::Results())
+               , m_oldTestDetails(UnitTest::CurrentTest::Details())
+       {
+       }
+
+       explicit ScopedCurrentTest(UnitTest::TestResults& newResults, const UnitTest::TestDetails* newDetails = NULL)
+               : m_oldTestResults(UnitTest::CurrentTest::Results())
+               , m_oldTestDetails(UnitTest::CurrentTest::Details())
+       {
+               UnitTest::CurrentTest::Results() = &newResults;
+
+               if (newDetails != NULL)
+                       UnitTest::CurrentTest::Details() = newDetails;
+       }
+
+       ~ScopedCurrentTest()
+       {
+               UnitTest::CurrentTest::Results() = m_oldTestResults;
+               UnitTest::CurrentTest::Details() = m_oldTestDetails;
+       }
+
+private:
+       UnitTest::TestResults* m_oldTestResults;
+       const UnitTest::TestDetails* m_oldTestDetails;
+};
+
+#endif
diff --git a/tools/UnitTest++/src/tests/TestAssertHandler.cpp b/tools/UnitTest++/src/tests/TestAssertHandler.cpp
new file mode 100644 (file)
index 0000000..a5fd07c
--- /dev/null
@@ -0,0 +1,44 @@
+#include "../UnitTest++.h"
+#include "../AssertException.h"
+#include "../ReportAssert.h"
+
+using namespace UnitTest;
+
+namespace {
+
+TEST(ReportAssertThrowsAssertException)
+{
+    bool caught = false;
+
+    try
+    {
+        ReportAssert("", "", 0);
+    }
+    catch(AssertException const&)
+    {
+        caught = true;
+    }
+
+    CHECK (true == caught);
+}
+
+TEST(ReportAssertSetsCorrectInfoInException)
+{
+    const int lineNumber = 12345;
+    const char* description = "description";
+    const char* filename = "filename";
+
+    try
+    {
+        ReportAssert(description, filename, lineNumber);
+    }
+    catch(AssertException const& e)
+    {
+        CHECK_EQUAL(description, e.what());
+        CHECK_EQUAL(filename, e.Filename());
+        CHECK_EQUAL(lineNumber, e.LineNumber());
+    }
+}
+
+
+}
diff --git a/tools/UnitTest++/src/tests/TestCheckMacros.cpp b/tools/UnitTest++/src/tests/TestCheckMacros.cpp
new file mode 100644 (file)
index 0000000..37d184b
--- /dev/null
@@ -0,0 +1,801 @@
+#include "../UnitTest++.h"
+#include "../CurrentTest.h"
+#include "RecordingReporter.h"
+#include "ScopedCurrentTest.h"
+
+using namespace std;
+
+namespace {
+
+TEST(CheckSucceedsOnTrue)
+{
+    bool failure = true;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+
+               ScopedCurrentTest scopedResults(testResults);
+               CHECK(true);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(!failure);
+}
+
+TEST(CheckFailsOnFalse)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK(false);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(FailureReportsCorrectTestName)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK(false);
+    }
+
+    CHECK_EQUAL(m_details.testName, reporter.lastFailedTest);
+}
+
+TEST(CheckFailureIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        const bool yaddayadda = false;
+        CHECK(yaddayadda);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "yaddayadda"));
+}
+
+int ThrowingFunction()
+{
+    throw "Doh";
+}
+
+TEST(CheckFailsOnException)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK(ThrowingFunction() == 1);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckFailureBecauseOfExceptionIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK(ThrowingFunction() == 1);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1"));
+}
+
+TEST(CheckEqualSucceedsOnEqual)
+{
+    bool failure = true;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_EQUAL(1, 1);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(!failure);
+}
+
+TEST(CheckEqualFailsOnNotEqual)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_EQUAL(1, 2);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckEqualFailsOnException)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_EQUAL(ThrowingFunction(), 1);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckEqualFailureContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               CHECK_EQUAL(1, 123);    line = __LINE__;
+    }
+
+    CHECK_EQUAL("testName", reporter.lastFailedTest);
+    CHECK_EQUAL("suiteName", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckEqualFailureBecauseOfExceptionContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               CHECK_EQUAL(ThrowingFunction(), 123);    line = __LINE__;
+    }
+
+    CHECK_EQUAL("testName", reporter.lastFailedTest);
+    CHECK_EQUAL("suiteName", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckEqualFailureBecauseOfExceptionIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_EQUAL(ThrowingFunction(), 123);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()"));
+    CHECK(strstr(reporter.lastFailedMessage, "123"));
+}
+
+int g_sideEffect = 0;
+int FunctionWithSideEffects()
+{
+    ++g_sideEffect;
+    return 1;
+}
+
+TEST(CheckEqualDoesNotHaveSideEffectsWhenPassing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_EQUAL(1, FunctionWithSideEffects());
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+TEST(CheckEqualDoesNotHaveSideEffectsWhenFailing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_EQUAL(2, FunctionWithSideEffects());
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+
+TEST(CheckCloseSucceedsOnEqual)
+{
+    bool failure = true;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_CLOSE (1.0f, 1.001f, 0.01f);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(!failure);
+}
+
+TEST(CheckCloseFailsOnNotEqual)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_CLOSE (1.0f, 1.1f, 0.01f);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckCloseFailsOnException)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_CLOSE ((float)ThrowingFunction(), 1.0001f, 0.1f);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckCloseFailureContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails testDetails("test", "suite", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               CHECK_CLOSE (1.0f, 1.1f, 0.01f);    line = __LINE__;
+    }
+
+    CHECK_EQUAL("test", reporter.lastFailedTest);
+    CHECK_EQUAL("suite", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckCloseFailureBecauseOfExceptionContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails testDetails("closeTest", "closeSuite", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+        CHECK_CLOSE ((float)ThrowingFunction(), 1.0001f, 0.1f);    line = __LINE__;
+    }
+
+    CHECK_EQUAL("closeTest", reporter.lastFailedTest);
+    CHECK_EQUAL("closeSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckCloseFailureBecauseOfExceptionIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_CLOSE ((float)ThrowingFunction(), 1.0001f, 0.1f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "(float)ThrowingFunction()"));
+    CHECK(strstr(reporter.lastFailedMessage, "1.0001f"));
+}
+
+TEST(CheckCloseDoesNotHaveSideEffectsWhenPassing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f);
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+TEST(CheckCloseDoesNotHaveSideEffectsWhenFailing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+        CHECK_CLOSE (2, FunctionWithSideEffects(), 0.1f);
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+
+class ThrowingObject
+{
+public:
+    float operator[](int) const
+    {
+        throw "Test throw";
+    }
+};
+
+
+TEST(CheckArrayCloseSucceedsOnEqual)
+{
+    bool failure = true;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+        const float data[4] = { 0, 1, 2, 3 };
+        CHECK_ARRAY_CLOSE (data, data, 4, 0.01f);
+        failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(!failure);
+}
+
+TEST(CheckArrayCloseFailsOnNotEqual)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[4] = { 0, 1, 2, 3 };
+        int const data2[4] = { 0, 1, 3, 3 };
+               CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckArrayCloseFailureIncludesCheckExpectedAndActual)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[4] = { 0, 1, 2, 3 };
+        int const data2[4] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]"));
+    CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]"));
+}
+
+TEST(CheckArrayCloseFailureContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               int const data1[4] = { 0, 1, 2, 3 };
+        int const data2[4] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);     line = __LINE__;
+    }
+
+    CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
+    CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckArrayCloseFailureBecauseOfExceptionContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               int const data[4] = { 0, 1, 2, 3 };
+        CHECK_ARRAY_CLOSE (data, ThrowingObject(), 4, 0.01f);     line = __LINE__;
+    }
+
+    CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
+    CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckArrayCloseFailureIncludesTolerance)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               float const data1[4] = { 0, 1, 2, 3 };
+        float const data2[4] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "0.01"));
+}
+
+
+TEST(CheckArrayCloseFailsOnException)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[4] = { 0, 1, 2, 3 };
+        ThrowingObject obj;
+        CHECK_ARRAY_CLOSE (data, obj, 3, 0.01f);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckArrayCloseFailureOnExceptionIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[4] = { 0, 1, 2, 3 };
+        ThrowingObject obj;
+        CHECK_ARRAY_CLOSE (data, obj, 3, 0.01f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "data"));
+    CHECK(strstr(reporter.lastFailedMessage, "obj"));
+}
+
+
+TEST(CheckArrayEqualSuceedsOnEqual)
+{
+    bool failure = true;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[4] = { 0, 1, 2, 3 };
+        CHECK_ARRAY_EQUAL (data, data, 4);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(!failure);
+}
+
+TEST(CheckArrayEqualFailsOnNotEqual)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[4] = { 0, 1, 2, 3 };
+        int const data2[4] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_EQUAL (data1, data2, 4);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckArrayEqualFailureIncludesCheckExpectedAndActual)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[4] = { 0, 1, 2, 3 };
+        int const data2[4] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_EQUAL (data1, data2, 4);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]"));
+    CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]"));
+}
+
+TEST(CheckArrayEqualFailureContainsCorrectInfo)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[4] = { 0, 1, 2, 3 };
+        int const data2[4] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_EQUAL (data1, data2, 4);     line = __LINE__;
+    }
+
+    CHECK_EQUAL("CheckArrayEqualFailureContainsCorrectInfo", reporter.lastFailedTest);
+    CHECK_EQUAL(__FILE__, reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckArrayEqualFailsOnException)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[4] = { 0, 1, 2, 3 };
+        ThrowingObject obj;
+        CHECK_ARRAY_EQUAL (data, obj, 3);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckArrayEqualFailureOnExceptionIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[4] = { 0, 1, 2, 3 };
+        ThrowingObject obj;
+        CHECK_ARRAY_EQUAL (data, obj, 3);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "data"));
+    CHECK(strstr(reporter.lastFailedMessage, "obj"));
+}
+
+float const* FunctionWithSideEffects2()
+{
+    ++g_sideEffect;
+    static float const data[] = {1,2,3,4};
+    return data;
+}
+
+TEST(CheckArrayCloseDoesNotHaveSideEffectsWhenPassing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[] = { 0, 1, 2, 3 };
+        CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f);
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+TEST(CheckArrayCloseDoesNotHaveSideEffectsWhenFailing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[] = { 0, 1, 3, 3 };
+        CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f);
+    }
+
+       CHECK_EQUAL(1, g_sideEffect);
+}
+
+class ThrowingObject2D
+{
+public:
+    float* operator[](int) const
+    {
+        throw "Test throw";
+    }
+};
+
+
+TEST(CheckArray2DCloseSucceedsOnEqual)
+{
+    bool failure = true;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[2][2] = { {0, 1}, {2, 3} };
+        CHECK_ARRAY2D_CLOSE (data, data, 2, 2, 0.01f);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(!failure);
+}
+
+TEST(CheckArray2DCloseFailsOnNotEqual)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[2][2] = { {0, 1}, {2, 3} };
+        int const data2[2][2] = { {0, 1}, {3, 3} };
+        CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckArray2DCloseFailureIncludesCheckExpectedAndActual)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               int const data1[2][2] = { {0, 1}, {2, 3} };
+        int const data2[2][2] = { {0, 1}, {3, 3} };
+
+               CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "xpected [ [ 0 1 ] [ 2 3 ] ]"));
+    CHECK(strstr(reporter.lastFailedMessage, "was [ [ 0 1 ] [ 3 3 ] ]"));
+}
+
+TEST(CheckArray2DCloseFailureContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               int const data1[2][2] = { {0, 1}, {2, 3} };
+        int const data2[2][2] = { {0, 1}, {3, 3} };
+               CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);     line = __LINE__;
+    }
+
+    CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
+    CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckArray2DCloseFailureBecauseOfExceptionContainsCorrectDetails)
+{
+    int line = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               UnitTest::TestDetails testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1);
+               ScopedCurrentTest scopedResults(testResults, &testDetails);
+
+               const float data[2][2] = { {0, 1}, {2, 3} };
+        CHECK_ARRAY2D_CLOSE (data, ThrowingObject2D(), 2, 2, 0.01f);   line = __LINE__;
+    }
+
+    CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
+    CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("filename", reporter.lastFailedFile);
+    CHECK_EQUAL(line, reporter.lastFailedLine);
+}
+
+TEST(CheckArray2DCloseFailureIncludesTolerance)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               float const data1[2][2] = { {0, 1}, {2, 3} };
+        float const data2[2][2] = { {0, 1}, {3, 3} };
+        CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "0.01"));
+}
+
+TEST(CheckArray2DCloseFailsOnException)
+{
+    bool failure = false;
+    {
+        RecordingReporter reporter;
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[2][2] = { {0, 1}, {2, 3} };
+        ThrowingObject2D obj;
+        CHECK_ARRAY2D_CLOSE (data, obj, 2, 2, 0.01f);
+
+               failure = (testResults.GetFailureCount() > 0);
+    }
+
+    CHECK(failure);
+}
+
+TEST(CheckArray2DCloseFailureOnExceptionIncludesCheckContents)
+{
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[2][2] = { {0, 1}, {2, 3} };
+        ThrowingObject2D obj;
+        CHECK_ARRAY2D_CLOSE (data, obj, 2, 2, 0.01f);
+    }
+
+    CHECK(strstr(reporter.lastFailedMessage, "data"));
+    CHECK(strstr(reporter.lastFailedMessage, "obj"));
+}
+
+float const* const* FunctionWithSideEffects3()
+{
+    ++g_sideEffect;
+    static float const data1[] = {0,1};
+    static float const data2[] = {2,3};
+    static const float* const data[] = {data1, data2};
+    return data;
+}
+
+TEST(CheckArray2DCloseDoesNotHaveSideEffectsWhenPassing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[2][2] = { {0, 1}, {2, 3} };
+        CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f);
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+TEST(CheckArray2DCloseDoesNotHaveSideEffectsWhenFailing)
+{
+    g_sideEffect = 0;
+    {
+        UnitTest::TestResults testResults;
+               ScopedCurrentTest scopedResults(testResults);
+
+               const float data[2][2] = { {0, 1}, {3, 3} };
+        CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f);
+    }
+    CHECK_EQUAL(1, g_sideEffect);
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestChecks.cpp b/tools/UnitTest++/src/tests/TestChecks.cpp
new file mode 100644 (file)
index 0000000..642f52b
--- /dev/null
@@ -0,0 +1,293 @@
+#include "../UnitTest++.h"
+#include "RecordingReporter.h"
+
+using namespace UnitTest;
+
+
+namespace {
+
+
+TEST(CheckEqualWithUnsignedLong)
+{
+    TestResults results;
+    unsigned long something = 2;
+    CHECK_EQUAL(something, something);
+}
+
+TEST(CheckEqualsWithStringsFailsOnDifferentStrings)
+{
+    char txt1[] = "Hello";
+    char txt2[] = "Hallo";
+    TestResults results;
+    CheckEqual(results, txt1, txt2, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+char txt1[] = "Hello"; // non-const on purpose so no folding of duplicate data
+char txt2[] = "Hello";
+
+TEST(CheckEqualsWithStringsWorksOnContentsNonConstNonConst)
+{
+    char const* const p1 = txt1;
+    char const* const p2 = txt2;
+    TestResults results;
+    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckEqualsWithStringsWorksOnContentsConstConst)
+{
+    char* const p1 = txt1;
+    char* const p2 = txt2;
+    TestResults results;
+    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckEqualsWithStringsWorksOnContentsNonConstConst)
+{
+    char* const p1 = txt1;
+    char const* const p2 = txt2;
+    TestResults results;
+    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckEqualsWithStringsWorksOnContentsConstNonConst)
+{
+    char const* const p1 = txt1;
+    char* const p2 = txt2;
+    TestResults results;
+    CheckEqual(results, p1, p2, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckEqualsWithStringsWorksOnContentsWithALiteral)
+{
+    char const* const p1 = txt1;
+    TestResults results;
+    CheckEqual(results, "Hello", p1, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckEqualFailureIncludesCheckExpectedAndActual)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    const int something = 2;
+    CheckEqual(results, 1, something, TestDetails("", "", "", 0));
+
+       using namespace std;
+    CHECK(strstr(reporter.lastFailedMessage, "xpected 1"));
+    CHECK(strstr(reporter.lastFailedMessage, "was 2"));
+}
+
+TEST(CheckEqualFailureIncludesDetails)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    TestDetails const details("mytest", "mysuite", "file.h", 101);
+
+    CheckEqual(results, 1, 2, details);
+
+    CHECK_EQUAL("mytest", reporter.lastFailedTest);
+    CHECK_EQUAL("mysuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("file.h", reporter.lastFailedFile);
+    CHECK_EQUAL(101, reporter.lastFailedLine);
+}
+
+TEST(CheckCloseTrue)
+{
+    TestResults results;
+    CheckClose(results, 3.001f, 3.0f, 0.1f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckCloseFalse)
+{
+    TestResults results;
+    CheckClose(results, 3.12f, 3.0f, 0.1f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckCloseWithZeroEpsilonWorksForSameNumber)
+{
+    TestResults results;
+    CheckClose(results, 0.1f, 0.1f, 0, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckCloseWithNaNFails)
+{
+    union
+    {
+        unsigned int bitpattern;
+        float nan;
+    };
+    bitpattern = 0xFFFFFFFF;
+    TestResults results;
+    CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckCloseWithNaNAgainstItselfFails)
+{
+    union
+    {
+        unsigned int bitpattern;
+        float nan;
+    };
+    bitpattern = 0xFFFFFFFF;
+    TestResults results;
+    CheckClose(results, nan, nan, 0.1f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckCloseFailureIncludesCheckExpectedAndActual)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    const float expected = 0.9f;
+    const float actual = 1.1f;
+    CheckClose(results, expected, actual, 0.01f, TestDetails("", "", "", 0));
+
+       using namespace std;
+    CHECK(strstr(reporter.lastFailedMessage, "xpected 0.9"));
+    CHECK(strstr(reporter.lastFailedMessage, "was 1.1"));
+}
+
+TEST(CheckCloseFailureIncludesTolerance)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    CheckClose(results, 2, 3, 0.01f, TestDetails("", "", "", 0));
+
+       using namespace std;
+    CHECK(strstr(reporter.lastFailedMessage, "0.01"));
+}
+
+TEST(CheckCloseFailureIncludesDetails)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    TestDetails const details("mytest", "mysuite", "header.h", 10);
+
+    CheckClose(results, 2, 3, 0.01f, details);
+
+    CHECK_EQUAL("mytest", reporter.lastFailedTest);
+    CHECK_EQUAL("mysuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("header.h", reporter.lastFailedFile);
+    CHECK_EQUAL(10, reporter.lastFailedLine);
+}
+
+
+TEST(CheckArrayEqualTrue)
+{
+    TestResults results;
+
+    int const array[3] = { 1, 2, 3 };
+    CheckArrayEqual(results, array, array, 3, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckArrayEqualFalse)
+{
+    TestResults results;
+
+    int const array1[3] = { 1, 2, 3 };
+    int const array2[3] = { 1, 2, 2 };
+    CheckArrayEqual(results, array1, array2, 3, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckArrayCloseTrue)
+{
+    TestResults results;
+
+    float const array1[3] = { 1.0f, 1.5f, 2.0f };
+    float const array2[3] = { 1.01f, 1.51f, 2.01f };
+    CheckArrayClose(results, array1, array2, 3, 0.02f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckArrayCloseFalse)
+{
+    TestResults results;
+
+    float const array1[3] = { 1.0f, 1.5f, 2.0f };
+    float const array2[3] = { 1.01f, 1.51f, 2.01f };
+    CheckArrayClose(results, array1, array2, 3, 0.001f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckArrayCloseFailureIncludesDetails)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    TestDetails const details("arrayCloseTest", "arrayCloseSuite", "file", 1337);
+
+    float const array1[3] = { 1.0f, 1.5f, 2.0f };
+    float const array2[3] = { 1.01f, 1.51f, 2.01f };
+    CheckArrayClose(results, array1, array2, 3, 0.001f, details);
+
+    CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest);
+    CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("file", reporter.lastFailedFile);
+    CHECK_EQUAL(1337, reporter.lastFailedLine);
+}
+
+
+TEST(CheckArray2DCloseTrue)
+{
+    TestResults results;
+
+    float const array1[3][3] = { { 1.0f, 1.5f, 2.0f },
+                                 { 2.0f, 2.5f, 3.0f },
+                                 { 3.0f, 3.5f, 4.0f } };
+    float const array2[3][3] = { { 1.01f, 1.51f, 2.01f },
+                                 { 2.01f, 2.51f, 3.01f },
+                                 { 3.01f, 3.51f, 4.01f } };
+    CheckArray2DClose(results, array1, array2, 3, 3, 0.02f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+TEST(CheckArray2DCloseFalse)
+{
+    TestResults results;
+
+    float const array1[3][3] = { { 1.0f, 1.5f, 2.0f },
+                                 { 2.0f, 2.5f, 3.0f },
+                                 { 3.0f, 3.5f, 4.0f } };
+    float const array2[3][3] = { { 1.01f, 1.51f, 2.01f },
+                                 { 2.01f, 2.51f, 3.01f },
+                                 { 3.01f, 3.51f, 4.01f } };
+    CheckArray2DClose(results, array1, array2, 3, 3, 0.001f, TestDetails("", "", "", 0));
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckCloseWithDoublesSucceeds)
+{
+    CHECK_CLOSE(0.5, 0.5, 0.0001);
+}
+
+TEST(CheckArray2DCloseFailureIncludesDetails)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    TestDetails const details("array2DCloseTest", "array2DCloseSuite", "file", 1234);
+
+    float const array1[3][3] = { { 1.0f, 1.5f, 2.0f },
+                                 { 2.0f, 2.5f, 3.0f },
+                                 { 3.0f, 3.5f, 4.0f } };
+    float const array2[3][3] = { { 1.01f, 1.51f, 2.01f },
+                                 { 2.01f, 2.51f, 3.01f },
+                                 { 3.01f, 3.51f, 4.01f } };
+    CheckArray2DClose(results, array1, array2, 3, 3, 0.001f, details);
+
+    CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest);
+    CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite);
+    CHECK_EQUAL("file", reporter.lastFailedFile);
+    CHECK_EQUAL(1234, reporter.lastFailedLine);
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestCurrentTest.cpp b/tools/UnitTest++/src/tests/TestCurrentTest.cpp
new file mode 100644 (file)
index 0000000..a248b31
--- /dev/null
@@ -0,0 +1,38 @@
+#include "../UnitTest++.h"
+#include "../CurrentTest.h"
+#include "ScopedCurrentTest.h"
+
+namespace 
+{
+
+TEST(CanSetandGetDetails)
+{
+       bool ok = false;
+       {
+               ScopedCurrentTest scopedTest;
+
+               const UnitTest::TestDetails* details = reinterpret_cast< const UnitTest::TestDetails* >(12345);
+               UnitTest::CurrentTest::Details() = details;
+
+               ok = (UnitTest::CurrentTest::Details() == details);
+       }
+
+       CHECK(ok);
+}
+
+TEST(CanSetAndGetResults)
+{
+       bool ok = false;
+       {
+               ScopedCurrentTest scopedTest;
+
+               UnitTest::TestResults results;
+               UnitTest::CurrentTest::Results() = &results;
+
+               ok = (UnitTest::CurrentTest::Results() == &results);
+       }
+
+       CHECK(ok);
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestDeferredTestReporter.cpp b/tools/UnitTest++/src/tests/TestDeferredTestReporter.cpp
new file mode 100644 (file)
index 0000000..2b2b955
--- /dev/null
@@ -0,0 +1,117 @@
+#include "../UnitTest++.h"
+#include "../DeferredTestReporter.h"
+#include "../Config.h"
+#include <cstring>
+
+namespace UnitTest
+{
+
+namespace 
+{
+
+#ifdef UNITTEST_USE_CUSTOM_STREAMS
+       MemoryOutStream& operator <<(MemoryOutStream& lhs, const std::string& rhs)
+       {
+               lhs << rhs.c_str();
+               return lhs;
+       }
+#endif
+
+struct MockDeferredTestReporter : public DeferredTestReporter
+{
+    virtual void ReportSummary(int, int, int, float) 
+    {
+    }
+};
+
+struct DeferredTestReporterFixture
+{
+    DeferredTestReporterFixture()
+        : testName("UniqueTestName")
+        , testSuite("UniqueTestSuite")
+        , fileName("filename.h")
+        , lineNumber(12)
+        , details(testName.c_str(), testSuite.c_str(), fileName.c_str(), lineNumber)
+    {
+    }
+
+    MockDeferredTestReporter reporter;
+    std::string const testName;
+    std::string const testSuite;
+    std::string const fileName;
+    int const lineNumber;
+    TestDetails const details;
+};
+
+TEST_FIXTURE(DeferredTestReporterFixture, ReportTestStartCreatesANewDeferredTest)
+{
+    reporter.ReportTestStart(details);
+    CHECK_EQUAL(1, (int)reporter.GetResults().size());
+}
+
+TEST_FIXTURE(DeferredTestReporterFixture, ReportTestStartCapturesTestNameAndSuite)
+{
+    reporter.ReportTestStart(details);
+
+    DeferredTestResult const& result = reporter.GetResults().at(0);
+    CHECK_EQUAL(testName.c_str(), result.testName);
+    CHECK_EQUAL(testSuite.c_str(), result.suiteName);
+}
+
+TEST_FIXTURE(DeferredTestReporterFixture, ReportTestEndCapturesTestTime)
+{
+    float const elapsed = 123.45f;
+    reporter.ReportTestStart(details);
+    reporter.ReportTestFinish(details, elapsed);
+
+    DeferredTestResult const& result = reporter.GetResults().at(0);
+    CHECK_CLOSE(elapsed, result.timeElapsed, 0.0001f);
+}
+
+TEST_FIXTURE(DeferredTestReporterFixture, ReportFailureSavesFailureDetails)
+{
+    char const* failure = "failure";
+
+    reporter.ReportTestStart(details);
+    reporter.ReportFailure(details, failure);
+
+    DeferredTestResult const& result = reporter.GetResults().at(0);
+    CHECK(result.failed == true);
+    CHECK_EQUAL(fileName.c_str(), result.failureFile);
+}
+
+TEST_FIXTURE(DeferredTestReporterFixture, ReportFailureSavesFailureDetailsForMultipleFailures)
+{
+    char const* failure1 = "failure 1";
+    char const* failure2 = "failure 2";
+
+    reporter.ReportTestStart(details);
+    reporter.ReportFailure(details, failure1);
+    reporter.ReportFailure(details, failure2);
+
+    DeferredTestResult const& result = reporter.GetResults().at(0);
+    CHECK_EQUAL(2, (int)result.failures.size());
+    CHECK_EQUAL(failure1, result.failures[0].second);
+    CHECK_EQUAL(failure2, result.failures[1].second);
+}
+
+TEST_FIXTURE(DeferredTestReporterFixture, DeferredTestReporterTakesCopyOfFailureMessage)
+{
+    reporter.ReportTestStart(details);
+
+    char failureMessage[128];
+    char const* goodStr = "Real failure message";
+    char const* badStr = "Bogus failure message";
+    
+       using namespace std;
+
+    strcpy(failureMessage, goodStr);
+    reporter.ReportFailure(details, failureMessage);
+    strcpy(failureMessage, badStr);
+
+    DeferredTestResult const& result = reporter.GetResults().at(0);
+    DeferredTestResult::Failure const& failure = result.failures.at(0);
+    CHECK_EQUAL(goodStr, failure.second);
+}
+
+}}
diff --git a/tools/UnitTest++/src/tests/TestMemoryOutStream.cpp b/tools/UnitTest++/src/tests/TestMemoryOutStream.cpp
new file mode 100644 (file)
index 0000000..4b7b40e
--- /dev/null
@@ -0,0 +1,151 @@
+#include "../UnitTest++.h"
+
+#include "../MemoryOutStream.h"
+#include <cstring>
+
+using namespace UnitTest;
+using namespace std;
+
+namespace {
+
+TEST(DefaultIsEmptyString)
+{
+    MemoryOutStream const stream;
+    CHECK(stream.GetText() != 0);
+    CHECK_EQUAL("", stream.GetText());
+}
+
+TEST(StreamingTextCopiesCharacters)
+{
+    MemoryOutStream stream;
+    stream << "Lalala";
+    CHECK_EQUAL("Lalala", stream.GetText());
+}
+
+TEST(StreamingMultipleTimesConcatenatesResult)
+{
+    MemoryOutStream stream;
+    stream << "Bork" << "Foo" << "Bar";
+    CHECK_EQUAL("BorkFooBar", stream.GetText());
+}
+
+TEST(StreamingIntWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    stream << (int)123;
+    CHECK_EQUAL("123", stream.GetText());
+}
+
+TEST(StreamingUnsignedIntWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    stream << (unsigned int)123;
+    CHECK_EQUAL("123", stream.GetText());
+}
+
+TEST(StreamingLongWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    stream << (long)(-123);
+    CHECK_EQUAL("-123", stream.GetText());
+}
+
+TEST(StreamingUnsignedLongWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    stream << (unsigned long)123;
+    CHECK_EQUAL("123", stream.GetText());
+}
+
+TEST(StreamingFloatWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    stream << 3.1415f;
+       CHECK(strstr(stream.GetText(), "3.1415"));
+}
+
+TEST(StreamingDoubleWritesCorrectCharacters)
+{
+       MemoryOutStream stream;
+       stream << 3.1415;
+       CHECK(strstr(stream.GetText(), "3.1415"));
+}
+
+TEST(StreamingPointerWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    int* p = (int*)0x1234;
+    stream << p;
+    CHECK(strstr(stream.GetText(), "1234"));
+}
+
+TEST(StreamingSizeTWritesCorrectCharacters)
+{
+    MemoryOutStream stream;
+    size_t const s = 53124;
+    stream << s;
+    CHECK_EQUAL("53124", stream.GetText());
+}
+
+#ifdef UNITTEST_USE_CUSTOM_STREAMS
+
+TEST(StreamInitialCapacityIsCorrect)
+{
+    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE);
+    CHECK_EQUAL((int)MemoryOutStream::GROW_CHUNK_SIZE, stream.GetCapacity());
+}
+
+TEST(StreamInitialCapacityIsMultipleOfGrowChunkSize)
+{
+    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE + 1);
+    CHECK_EQUAL((int)MemoryOutStream::GROW_CHUNK_SIZE * 2, stream.GetCapacity());
+}
+
+
+TEST(ExceedingCapacityGrowsBuffer)
+{
+    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE);
+    stream << "012345678901234567890123456789";
+    char const* const oldBuffer = stream.GetText();
+    stream << "0123456789";
+    CHECK(oldBuffer != stream.GetText());
+}
+
+TEST(ExceedingCapacityGrowsBufferByGrowChunk)
+{
+    MemoryOutStream stream(MemoryOutStream::GROW_CHUNK_SIZE);
+    stream << "0123456789012345678901234567890123456789";
+    CHECK_EQUAL(MemoryOutStream::GROW_CHUNK_SIZE * 2, stream.GetCapacity());
+}
+
+TEST(WritingStringLongerThanCapacityFitsInNewBuffer)
+{
+    MemoryOutStream stream(8);
+    stream << "0123456789ABCDEF";
+    CHECK_EQUAL("0123456789ABCDEF", stream.GetText());
+}
+
+TEST(WritingIntLongerThanCapacityFitsInNewBuffer)
+{
+    MemoryOutStream stream(8);
+    stream << "aaaa" << 123456;;
+    CHECK_EQUAL("aaaa123456", stream.GetText());
+}
+
+TEST(WritingFloatLongerThanCapacityFitsInNewBuffer)
+{
+    MemoryOutStream stream(8);
+    stream << "aaaa" << 123456.0f;;
+    CHECK_EQUAL("aaaa123456.000000f", stream.GetText());
+}
+
+TEST(WritingSizeTLongerThanCapacityFitsInNewBuffer)
+{
+    MemoryOutStream stream(8);
+    stream << "aaaa" << size_t(32145);
+    CHECK_EQUAL("aaaa32145", stream.GetText());
+}
+
+#endif
+
+}
diff --git a/tools/UnitTest++/src/tests/TestTest.cpp b/tools/UnitTest++/src/tests/TestTest.cpp
new file mode 100644 (file)
index 0000000..fb1f39e
--- /dev/null
@@ -0,0 +1,129 @@
+#include "../UnitTest++.h"
+#include "../TestReporter.h"
+#include "../TimeHelpers.h"
+#include "ScopedCurrentTest.h"
+
+using namespace UnitTest;
+
+namespace {
+
+TEST(PassingTestHasNoFailures)
+{
+    class PassingTest : public Test
+    {
+    public:
+        PassingTest() : Test("passing") {}
+        virtual void RunImpl() const
+        {
+            CHECK(true);
+        }
+    };
+
+    TestResults results;
+       {
+               ScopedCurrentTest scopedResults(results);
+               PassingTest().Run();
+       }
+
+    CHECK_EQUAL(0, results.GetFailureCount());
+}
+
+
+TEST(FailingTestHasFailures)
+{
+    class FailingTest : public Test
+    {
+    public:
+        FailingTest() : Test("failing") {}
+        virtual void RunImpl() const
+        {
+            CHECK(false);
+        }
+    };
+
+    TestResults results;
+       {
+               ScopedCurrentTest scopedResults(results);
+               FailingTest().Run();
+       }
+
+    CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+
+TEST(ThrowingTestsAreReportedAsFailures)
+{
+    class CrashingTest : public Test
+    {
+    public:
+        CrashingTest() : Test("throwing") {}
+        virtual void RunImpl() const
+        {
+            throw "Blah";
+        }
+    };
+    TestResults results;
+       {
+               ScopedCurrentTest scopedResult(results);
+               CrashingTest().Run();
+       }
+
+       CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+
+#ifndef UNITTEST_MINGW
+TEST(CrashingTestsAreReportedAsFailures)
+{
+    class CrashingTest : public Test
+    {
+    public:
+        CrashingTest() : Test("crashing") {}
+        virtual void RunImpl() const
+        {
+            reinterpret_cast< void (*)() >(0)();
+        }
+    };
+
+    TestResults results;
+       {
+               ScopedCurrentTest scopedResult(results);
+               CrashingTest().Run();
+       }
+
+       CHECK_EQUAL(1, results.GetFailureCount());
+}
+#endif
+
+TEST(TestWithUnspecifiedSuiteGetsDefaultSuite)
+{
+    Test test("test");
+    CHECK(test.m_details.suiteName != NULL);
+    CHECK_EQUAL("DefaultSuite", test.m_details.suiteName);
+}
+
+TEST(TestReflectsSpecifiedSuiteName)
+{
+    Test test("test", "testSuite");
+    CHECK(test.m_details.suiteName != NULL);
+    CHECK_EQUAL("testSuite", test.m_details.suiteName);
+}
+
+void Fail()
+{
+       CHECK(false);
+}
+
+TEST(OutOfCoreCHECKMacrosCanFailTests)
+{
+       TestResults results;
+       {
+               ScopedCurrentTest scopedResult(results);
+               Fail();
+       }
+
+       CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestTestList.cpp b/tools/UnitTest++/src/tests/TestTestList.cpp
new file mode 100644 (file)
index 0000000..1498ad7
--- /dev/null
@@ -0,0 +1,50 @@
+#include "../UnitTest++.h"
+#include "../TestList.h"
+
+using namespace UnitTest;
+
+namespace {
+
+
+TEST (TestListIsEmptyByDefault)
+{
+    TestList list;
+    CHECK (list.GetHead() == 0);
+}
+
+TEST (AddingTestSetsHeadToTest)
+{
+    Test test("test");
+    TestList list;
+    list.Add(&test);
+
+    CHECK (list.GetHead() == &test);
+    CHECK (test.next == 0);
+}
+
+TEST (AddingSecondTestAddsItToEndOfList)
+{
+    Test test1("test1");
+    Test test2("test2");
+
+    TestList list;
+    list.Add(&test1);
+    list.Add(&test2);
+
+    CHECK (list.GetHead() == &test1);
+    CHECK (test1.next == &test2);
+    CHECK (test2.next == 0);
+}
+
+TEST (ListAdderAddsTestToList)
+{
+    TestList list;
+
+    Test test("");    
+    ListAdder adder(list, &test);
+
+    CHECK (list.GetHead() == &test);
+    CHECK (test.next == 0);
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestTestMacros.cpp b/tools/UnitTest++/src/tests/TestTestMacros.cpp
new file mode 100644 (file)
index 0000000..8fd7778
--- /dev/null
@@ -0,0 +1,212 @@
+#include "../UnitTest++.h"
+#include "../TestMacros.h"
+#include "../TestList.h"
+#include "../TestResults.h"
+#include "../TestReporter.h"
+#include "../ReportAssert.h"
+#include "RecordingReporter.h"
+#include "ScopedCurrentTest.h"
+
+using namespace UnitTest;
+
+namespace {
+
+TestList list1;
+TEST_EX(DummyTest, list1)
+{
+}
+
+TEST (TestsAreAddedToTheListThroughMacro)
+{
+    CHECK(list1.GetHead() != 0);
+    CHECK(list1.GetHead()->next == 0);
+}
+
+struct ThrowingThingie
+{
+    ThrowingThingie() : dummy(false)
+    {
+        if (!dummy)
+            throw "Oops";
+    }
+
+    bool dummy;
+};
+
+TestList list2;
+TEST_FIXTURE_EX(ThrowingThingie, DummyTestName, list2)
+{
+}
+
+TEST (ExceptionsInFixtureAreReportedAsHappeningInTheFixture)
+{
+    RecordingReporter reporter;
+    TestResults result(&reporter);
+       {
+               ScopedCurrentTest scopedResults(result);
+               list2.GetHead()->Run();
+       }
+
+    CHECK(strstr(reporter.lastFailedMessage, "xception"));
+    CHECK(strstr(reporter.lastFailedMessage, "fixture"));
+    CHECK(strstr(reporter.lastFailedMessage, "ThrowingThingie"));
+}
+
+struct DummyFixture
+{
+    int x;
+};
+
+// We're really testing the macros so we just want them to compile and link
+SUITE(TestSuite1)
+{
+       TEST(SimilarlyNamedTestsInDifferentSuitesWork)
+       {
+       }
+
+       TEST_FIXTURE(DummyFixture, SimilarlyNamedFixtureTestsInDifferentSuitesWork)
+       {
+       }
+}
+
+SUITE(TestSuite2)
+{
+       TEST(SimilarlyNamedTestsInDifferentSuitesWork)
+       {
+       }
+
+       TEST_FIXTURE(DummyFixture,SimilarlyNamedFixtureTestsInDifferentSuitesWork)
+       {
+       }
+}
+
+TestList macroTestList1;
+TEST_EX(MacroTestHelper1, macroTestList1)
+{
+}
+
+TEST(TestAddedWithTEST_EXMacroGetsDefaultSuite)
+{
+    CHECK(macroTestList1.GetHead() != NULL);
+    CHECK_EQUAL ("MacroTestHelper1", macroTestList1.GetHead()->m_details.testName);
+    CHECK_EQUAL ("DefaultSuite", macroTestList1.GetHead()->m_details.suiteName);
+}
+
+TestList macroTestList2;
+TEST_FIXTURE_EX(DummyFixture, MacroTestHelper2, macroTestList2)
+{
+}
+
+TEST(TestAddedWithTEST_FIXTURE_EXMacroGetsDefaultSuite)
+{
+    CHECK(macroTestList2.GetHead() != NULL);
+    CHECK_EQUAL ("MacroTestHelper2", macroTestList2.GetHead()->m_details.testName);
+    CHECK_EQUAL ("DefaultSuite", macroTestList2.GetHead()->m_details.suiteName);
+}
+
+struct FixtureCtorThrows
+{
+       FixtureCtorThrows()     { throw "exception"; }
+};
+
+TestList throwingFixtureTestList1;
+TEST_FIXTURE_EX(FixtureCtorThrows, FixtureCtorThrowsTestName, throwingFixtureTestList1)
+{
+}
+
+TEST(FixturesWithThrowingCtorsAreFailures)
+{
+       CHECK(throwingFixtureTestList1.GetHead() != NULL);
+       RecordingReporter reporter;
+       TestResults result(&reporter);
+       {
+               ScopedCurrentTest scopedResult(result);
+               throwingFixtureTestList1.GetHead()->Run();
+       }
+
+       int const failureCount = result.GetFailedTestCount();
+       CHECK_EQUAL(1, failureCount);
+       CHECK(strstr(reporter.lastFailedMessage, "while constructing fixture"));
+}
+
+struct FixtureDtorThrows
+{
+       ~FixtureDtorThrows() { throw "exception"; }
+};
+
+TestList throwingFixtureTestList2;
+TEST_FIXTURE_EX(FixtureDtorThrows, FixtureDtorThrowsTestName, throwingFixtureTestList2)
+{
+}
+
+TEST(FixturesWithThrowingDtorsAreFailures)
+{
+       CHECK(throwingFixtureTestList2.GetHead() != NULL);
+
+       RecordingReporter reporter;
+       TestResults result(&reporter);
+       {
+               ScopedCurrentTest scopedResult(result);
+               throwingFixtureTestList2.GetHead()->Run();
+       }
+
+       int const failureCount = result.GetFailedTestCount();
+       CHECK_EQUAL(1, failureCount);
+       CHECK(strstr(reporter.lastFailedMessage, "while destroying fixture"));
+}
+
+const int FailingLine = 123;
+
+struct FixtureCtorAsserts
+{
+       FixtureCtorAsserts()
+       {
+               UnitTest::ReportAssert("assert failure", "file", FailingLine);
+       }
+};
+
+TestList ctorAssertFixtureTestList;
+TEST_FIXTURE_EX(FixtureCtorAsserts, CorrectlyReportsAssertFailureInCtor, ctorAssertFixtureTestList)
+{
+}
+
+TEST(CorrectlyReportsFixturesWithCtorsThatAssert)
+{
+       RecordingReporter reporter;
+       TestResults result(&reporter);
+       {
+               ScopedCurrentTest scopedResults(result);
+               ctorAssertFixtureTestList.GetHead()->Run();
+       }
+
+       const int failureCount = result.GetFailedTestCount();
+       CHECK_EQUAL(1, failureCount);
+       CHECK_EQUAL(FailingLine, reporter.lastFailedLine);
+       CHECK(strstr(reporter.lastFailedMessage, "assert failure"));
+}
+
+}
+
+// We're really testing if it's possible to use the same suite in two files
+// to compile and link successfuly (TestTestSuite.cpp has suite with the same name)
+// Note: we are outside of the anonymous namespace
+SUITE(SameTestSuite)
+{
+       TEST(DummyTest1)
+       {
+       }
+}
+
+#define CUR_TEST_NAME CurrentTestDetailsContainCurrentTestInfo
+#define INNER_STRINGIFY(X) #X
+#define STRINGIFY(X) INNER_STRINGIFY(X)
+
+TEST(CUR_TEST_NAME)
+{
+       const UnitTest::TestDetails* details = CurrentTest::Details();
+       CHECK_EQUAL(STRINGIFY(CUR_TEST_NAME), details->testName);
+}
+
+#undef CUR_TEST_NAME
+#undef INNER_STRINGIFY
+#undef STRINGIFY
diff --git a/tools/UnitTest++/src/tests/TestTestResults.cpp b/tools/UnitTest++/src/tests/TestTestResults.cpp
new file mode 100644 (file)
index 0000000..65efbff
--- /dev/null
@@ -0,0 +1,111 @@
+#include "../UnitTest++.h"
+#include "../TestResults.h"
+#include "RecordingReporter.h"
+
+using namespace UnitTest;
+
+namespace {
+
+TestDetails const details("testname", "suitename", "filename", 123);
+
+
+TEST(StartsWithNoTestsRun)
+{
+    TestResults results;
+    CHECK_EQUAL (0, results.GetTotalTestCount());
+}
+
+TEST(RecordsNumbersOfTests)
+{
+    TestResults results;
+    results.OnTestStart(details);
+    results.OnTestStart(details);
+    results.OnTestStart(details);
+    CHECK_EQUAL(3, results.GetTotalTestCount());
+}
+
+TEST(StartsWithNoTestsFailing)
+{
+    TestResults results;
+    CHECK_EQUAL (0, results.GetFailureCount());
+}
+
+TEST(RecordsNumberOfFailures)
+{
+    TestResults results;
+    results.OnTestFailure(details, "");
+    results.OnTestFailure(details, "");
+    CHECK_EQUAL(2, results.GetFailureCount());
+}
+
+TEST(RecordsNumberOfFailedTests)
+{
+    TestResults results;
+
+    results.OnTestStart(details);
+    results.OnTestFailure(details, "");
+    results.OnTestFinish(details, 0);
+
+    results.OnTestStart(details);
+    results.OnTestFailure(details, "");
+    results.OnTestFailure(details, "");
+    results.OnTestFailure(details, "");
+    results.OnTestFinish(details, 0);
+
+    CHECK_EQUAL (2, results.GetFailedTestCount());
+}
+
+TEST(NotifiesReporterOfTestStartWithCorrectInfo)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+    results.OnTestStart(details);
+
+    CHECK_EQUAL (1, reporter.testRunCount);
+    CHECK_EQUAL ("suitename", reporter.lastStartedSuite);
+    CHECK_EQUAL ("testname", reporter.lastStartedTest);
+}
+
+TEST(NotifiesReporterOfTestFailureWithCorrectInfo)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+
+    results.OnTestFailure(details, "failurestring");
+    CHECK_EQUAL (1, reporter.testFailedCount);
+    CHECK_EQUAL ("filename", reporter.lastFailedFile);
+    CHECK_EQUAL (123, reporter.lastFailedLine);
+    CHECK_EQUAL ("suitename", reporter.lastFailedSuite);
+    CHECK_EQUAL ("testname", reporter.lastFailedTest);
+    CHECK_EQUAL ("failurestring", reporter.lastFailedMessage);
+}
+
+TEST(NotifiesReporterOfCheckFailureWithCorrectInfo)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+
+    results.OnTestFailure(details, "failurestring");
+    CHECK_EQUAL (1, reporter.testFailedCount);
+
+    CHECK_EQUAL ("filename", reporter.lastFailedFile);
+    CHECK_EQUAL (123, reporter.lastFailedLine);
+    CHECK_EQUAL ("testname", reporter.lastFailedTest);
+    CHECK_EQUAL ("suitename", reporter.lastFailedSuite);
+    CHECK_EQUAL ("failurestring", reporter.lastFailedMessage);
+}
+
+TEST(NotifiesReporterOfTestEnd)
+{
+    RecordingReporter reporter;
+    TestResults results(&reporter);
+
+    results.OnTestFinish(details, 0.1234f);
+    CHECK_EQUAL (1, reporter.testFinishedCount);
+    CHECK_EQUAL ("testname", reporter.lastFinishedTest);
+    CHECK_EQUAL ("suitename", reporter.lastFinishedSuite);
+    CHECK_CLOSE (0.1234f, reporter.lastFinishedTestTime, 0.0001f);
+}
+
+
+}
diff --git a/tools/UnitTest++/src/tests/TestTestRunner.cpp b/tools/UnitTest++/src/tests/TestTestRunner.cpp
new file mode 100644 (file)
index 0000000..ad35d2c
--- /dev/null
@@ -0,0 +1,307 @@
+#include "../UnitTest++.h"
+#include "RecordingReporter.h"
+#include "../ReportAssert.h"
+#include "../TestList.h"
+#include "../TimeHelpers.h"
+#include "../TimeConstraint.h"
+
+using namespace UnitTest;
+
+namespace
+{
+
+struct MockTest : public Test
+{
+    MockTest(char const* testName, bool const success_, bool const assert_, int const count_ = 1)
+        : Test(testName)
+        , success(success_)
+        , asserted(assert_)
+        , count(count_)
+    {
+    }
+
+    virtual void RunImpl(TestResults& testResults_) const
+    {
+        for (int i=0; i < count; ++i)
+        {
+            if (asserted)
+                ReportAssert("desc", "file", 0);
+            else if (!success)
+                testResults_.OnTestFailure(m_details, "message");
+        }
+    }
+
+    bool const success;
+    bool const asserted;
+    int const count;
+};
+
+
+struct TestRunnerFixture
+{
+       TestRunnerFixture()
+               : runner(reporter)
+       {
+       }
+
+    RecordingReporter reporter;
+    TestList list;
+       TestRunner runner;
+};
+
+TEST_FIXTURE(TestRunnerFixture, TestStartIsReportedCorrectly)
+{
+    MockTest test("goodtest", true, false);
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(1, reporter.testRunCount);
+    CHECK_EQUAL("goodtest", reporter.lastStartedTest);
+}
+
+TEST_FIXTURE(TestRunnerFixture, TestFinishIsReportedCorrectly)
+{
+    MockTest test("goodtest", true, false);
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(1, reporter.testFinishedCount);
+    CHECK_EQUAL("goodtest", reporter.lastFinishedTest);
+}
+
+class SlowTest : public Test
+{
+public:
+    SlowTest() : Test("slow", "somesuite", "filename", 123) {}
+    virtual void RunImpl(TestResults&) const
+    {
+        TimeHelpers::SleepMs(20);
+    }
+};
+
+TEST_FIXTURE(TestRunnerFixture, TestFinishIsCalledWithCorrectTime)
+{
+    SlowTest test;
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= 0.050f);
+}
+
+TEST_FIXTURE(TestRunnerFixture, FailureCountIsZeroWhenNoTestsAreRun)
+{
+       CHECK_EQUAL(0, runner.RunTestsIf(list, NULL, True(), 0));
+    CHECK_EQUAL(0, reporter.testRunCount);
+    CHECK_EQUAL(0, reporter.testFailedCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, CallsReportFailureOncePerFailingTest)
+{
+    MockTest test1("test", false, false);
+    list.Add(&test1);
+    MockTest test2("test", true, false);
+    list.Add(&test2);
+    MockTest test3("test", false, false);
+    list.Add(&test3);
+
+       CHECK_EQUAL(2,  runner.RunTestsIf(list, NULL, True(), 0));
+    CHECK_EQUAL(2, reporter.testFailedCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, TestsThatAssertAreReportedAsFailing)
+{
+    MockTest test("test", true, true);
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(1, reporter.testFailedCount);
+}
+
+
+TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfTestCount)
+{
+    MockTest test1("test", true, false);
+    MockTest test2("test", true, false);
+    MockTest test3("test", true, false);
+    list.Add(&test1);
+    list.Add(&test2);
+    list.Add(&test3);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(3, reporter.summaryTotalTestCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfFailedTests)
+{
+    MockTest test1("test", false, false, 2);
+    MockTest test2("test", true, false);
+    MockTest test3("test", false, false, 3);
+    list.Add(&test1);
+    list.Add(&test2);
+    list.Add(&test3);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(2, reporter.summaryFailedTestCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfFailures)
+{
+    MockTest test1("test", false, false, 2);
+    MockTest test2("test", true, false);
+    MockTest test3("test", false, false, 3);
+    list.Add(&test1);
+    list.Add(&test2);
+    list.Add(&test3);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+       CHECK_EQUAL(5, reporter.summaryFailureCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, SlowTestPassesForHighTimeThreshold)
+{
+    SlowTest test;
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(0, reporter.testFailedCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, SlowTestFailsForLowTimeThreshold)
+{
+    SlowTest test;
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 3);
+    CHECK_EQUAL(1, reporter.testFailedCount);
+}
+
+TEST_FIXTURE(TestRunnerFixture, SlowTestHasCorrectFailureInformation)
+{
+    SlowTest test;
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 3);
+
+       using namespace std;
+
+    CHECK_EQUAL(test.m_details.testName, reporter.lastFailedTest);
+    CHECK(strstr(test.m_details.filename, reporter.lastFailedFile));
+    CHECK_EQUAL(test.m_details.lineNumber, reporter.lastFailedLine);
+
+       CHECK(strstr(reporter.lastFailedMessage, "Global time constraint failed"));
+    CHECK(strstr(reporter.lastFailedMessage, "3ms"));
+}
+
+TEST_FIXTURE(TestRunnerFixture, SlowTestWithTimeExemptionPasses)
+{
+    class SlowExemptedTest : public Test
+    {
+    public:
+        SlowExemptedTest() : Test("slowexempted", "", 0) {}
+        virtual void RunImpl(TestResults&) const
+        {
+            UNITTEST_TIME_CONSTRAINT_EXEMPT();
+            TimeHelpers::SleepMs(20);
+        }
+    };
+
+    SlowExemptedTest test;
+    list.Add(&test);
+
+       runner.RunTestsIf(list, NULL, True(), 3);
+    CHECK_EQUAL(0, reporter.testFailedCount);
+}
+
+struct TestSuiteFixture
+{
+    TestSuiteFixture()
+        : test1("TestInDefaultSuite")
+        , test2("TestInOtherSuite", "OtherSuite")
+        , test3("SecondTestInDefaultSuite")
+               , runner(reporter)
+    {
+        list.Add(&test1);
+        list.Add(&test2);
+    }
+
+    Test test1;
+    Test test2;
+    Test test3;
+    RecordingReporter reporter;
+    TestList list;
+       TestRunner runner;
+};
+
+TEST_FIXTURE(TestSuiteFixture, TestRunnerRunsAllSuitesIfNullSuiteIsPassed)
+{
+       runner.RunTestsIf(list, NULL, True(), 0);
+    CHECK_EQUAL(2, reporter.summaryTotalTestCount);
+}
+
+TEST_FIXTURE(TestSuiteFixture,TestRunnerRunsOnlySpecifiedSuite)
+{
+       runner.RunTestsIf(list, "OtherSuite", True(), 0);
+    CHECK_EQUAL(1, reporter.summaryTotalTestCount);
+    CHECK_EQUAL("TestInOtherSuite", reporter.lastFinishedTest);
+}
+
+struct RunTestIfNameIs
+{
+       RunTestIfNameIs(char const* name_)
+       : name(name_)
+       {               
+       }
+       
+       bool operator()(const Test* const test) const
+       {
+               using namespace std;
+               return (0 == strcmp(test->m_details.testName, name));
+       }
+       
+       char const* name;
+};
+
+TEST(TestMockPredicateBehavesCorrectly)
+{
+       RunTestIfNameIs predicate("pass");
+       
+       Test pass("pass");
+       Test fail("fail");
+       
+       CHECK(predicate(&pass));
+       CHECK(!predicate(&fail));       
+}
+
+TEST_FIXTURE(TestRunnerFixture, TestRunnerRunsTestsThatPassPredicate)
+{
+    Test should_run("goodtest");
+    list.Add(&should_run);
+
+    Test should_not_run("badtest");
+       list.Add(&should_not_run);
+       runner.RunTestsIf(list, NULL, RunTestIfNameIs("goodtest"), 0);
+       CHECK_EQUAL(1, reporter.testRunCount);
+    CHECK_EQUAL("goodtest", reporter.lastStartedTest);
+}
+
+TEST_FIXTURE(TestRunnerFixture, TestRunnerOnlyRunsTestsInSpecifiedSuiteAndThatPassPredicate)
+{
+    Test runningTest1("goodtest", "suite");
+    Test skippedTest2("goodtest");
+    Test skippedTest3("badtest", "suite");
+    Test skippedTest4("badtest");
+    
+    list.Add(&runningTest1);
+    list.Add(&skippedTest2);
+    list.Add(&skippedTest3);
+    list.Add(&skippedTest4);   
+
+       runner.RunTestsIf(list, "suite", RunTestIfNameIs("goodtest"), 0);
+
+       CHECK_EQUAL(1, reporter.testRunCount);
+    CHECK_EQUAL("goodtest", reporter.lastStartedTest); 
+    CHECK_EQUAL("suite", reporter.lastStartedSuite);    
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestTestSuite.cpp b/tools/UnitTest++/src/tests/TestTestSuite.cpp
new file mode 100644 (file)
index 0000000..9b29e43
--- /dev/null
@@ -0,0 +1,12 @@
+#include "../UnitTest++.h"
+
+// We're really testing if it's possible to use the same suite in two files
+// to compile and link successfuly (TestTestSuite.cpp has suite with the same name)
+// Note: we are outside of the anonymous namespace
+SUITE(SameTestSuite)
+{
+    TEST(DummyTest2)
+    {
+    }
+}
+
diff --git a/tools/UnitTest++/src/tests/TestTimeConstraint.cpp b/tools/UnitTest++/src/tests/TestTimeConstraint.cpp
new file mode 100644 (file)
index 0000000..c424160
--- /dev/null
@@ -0,0 +1,69 @@
+#include "../UnitTest++.h"
+#include "../TestResults.h"
+#include "../TimeHelpers.h"
+#include "RecordingReporter.h"
+#include "ScopedCurrentTest.h"
+
+using namespace UnitTest;
+
+namespace
+{
+
+TEST(TimeConstraintSucceedsWithFastTest)
+{
+    TestResults result;
+    {
+               ScopedCurrentTest scopedResult(result);
+        TimeConstraint t(200, TestDetails("", "", "", 0));
+        TimeHelpers::SleepMs(5);
+    }
+    CHECK_EQUAL(0, result.GetFailureCount());
+}
+
+TEST(TimeConstraintFailsWithSlowTest)
+{
+    TestResults result;
+    {
+               ScopedCurrentTest scopedResult(result);
+        TimeConstraint t(10, TestDetails("", "", "", 0));
+        TimeHelpers::SleepMs(20);
+    }
+    CHECK_EQUAL(1, result.GetFailureCount());
+}
+
+TEST(TimeConstraintFailureIncludesCorrectData)
+{
+    RecordingReporter reporter;
+    TestResults result(&reporter);
+    {
+               ScopedCurrentTest scopedResult(result);
+
+               TestDetails const details("testname", "suitename", "filename", 10);
+        TimeConstraint t(10, details);
+        TimeHelpers::SleepMs(20);
+    }
+
+       using namespace std;
+
+       CHECK(strstr(reporter.lastFailedFile, "filename"));
+    CHECK_EQUAL(10, reporter.lastFailedLine);
+    CHECK(strstr(reporter.lastFailedTest, "testname"));
+}
+
+TEST(TimeConstraintFailureIncludesTimeoutInformation)
+{
+    RecordingReporter reporter;
+    TestResults result(&reporter);
+    {
+               ScopedCurrentTest scopedResult(result);
+        TimeConstraint t(10, TestDetails("", "", "", 0));
+        TimeHelpers::SleepMs(20);
+    }
+
+       using namespace std;
+
+       CHECK(strstr(reporter.lastFailedMessage, "ime constraint"));
+    CHECK(strstr(reporter.lastFailedMessage, "under 10ms"));
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestTimeConstraintMacro.cpp b/tools/UnitTest++/src/tests/TestTimeConstraintMacro.cpp
new file mode 100644 (file)
index 0000000..a39b0cd
--- /dev/null
@@ -0,0 +1,35 @@
+#include "../UnitTest++.h"
+#include "../TimeHelpers.h"
+
+#include "RecordingReporter.h"
+#include "ScopedCurrentTest.h"
+
+namespace {
+
+TEST (TimeConstraintMacroQualifiesNamespace)
+{
+    // If this compiles without a "using namespace UnitTest;", all is well.
+    UNITTEST_TIME_CONSTRAINT(1);
+}
+
+TEST (TimeConstraintMacroUsesCorrectInfo)
+{
+    int testLine = 0;
+    RecordingReporter reporter;
+    {
+        UnitTest::TestResults testResults(&reporter);
+               ScopedCurrentTest scopedResults(testResults);
+
+        UNITTEST_TIME_CONSTRAINT(10); testLine = __LINE__;
+        UnitTest::TimeHelpers::SleepMs(20);
+    }
+
+       using namespace std;
+
+    CHECK_EQUAL(1, reporter.testFailedCount);
+    CHECK(strstr(reporter.lastFailedFile, __FILE__));
+    CHECK_EQUAL(testLine, reporter.lastFailedLine);
+    CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroUsesCorrectInfo"));
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestUnitTest++.cpp b/tools/UnitTest++/src/tests/TestUnitTest++.cpp
new file mode 100644 (file)
index 0000000..4755e5e
--- /dev/null
@@ -0,0 +1,156 @@
+#include "../UnitTest++.h"
+#include "../ReportAssert.h"
+#include "ScopedCurrentTest.h"
+
+#include <vector>
+
+// These are sample tests that show the different features of the framework
+
+namespace {
+
+TEST(ValidCheckSucceeds)
+{
+    bool const b = true;
+    CHECK(b);
+}
+
+TEST(CheckWorksWithPointers)
+{
+    void* p = (void *)0x100;
+    CHECK(p);
+    CHECK(p != 0);
+}
+
+TEST(ValidCheckEqualSucceeds)
+{
+    int const x = 3;
+    int const y = 3;
+    CHECK_EQUAL(x, y);
+}
+
+TEST(CheckEqualWorksWithPointers)
+{
+    void* p = (void *)0;
+    CHECK_EQUAL((void*)0, p);
+}
+
+TEST(ValidCheckCloseSucceeds)
+{
+    CHECK_CLOSE(2.0f, 2.001f, 0.01f);
+    CHECK_CLOSE(2.001f, 2.0f, 0.01f);
+}
+
+TEST(ArrayCloseSucceeds)
+{
+    float const a1[] = {1, 2, 3};
+    float const a2[] = {1, 2.01f, 3};
+    CHECK_ARRAY_CLOSE(a1, a2, 3, 0.1f);
+}
+
+TEST (CheckArrayCloseWorksWithVectors)
+{
+    std::vector< float > a(4);
+    for (int i = 0; i < 4; ++i)
+        a[i] = (float)i;
+
+    CHECK_ARRAY_CLOSE(a, a, (int)a.size(), 0.0001f);
+}
+
+TEST(CheckThrowMacroSucceedsOnCorrectException)
+{
+    struct TestException {};
+    CHECK_THROW(throw TestException(), TestException);
+}
+
+TEST(CheckAssertSucceeds)
+{
+    CHECK_ASSERT(UnitTest::ReportAssert("desc", "file", 0));
+}
+
+TEST(CheckThrowMacroFailsOnMissingException)
+{
+    class NoThrowTest : public UnitTest::Test
+    {
+    public:
+        NoThrowTest() : Test("nothrow") {}
+        void DontThrow() const
+        {
+        }
+
+        virtual void RunImpl() const
+        {
+            CHECK_THROW(DontThrow(), int);
+        }
+    };
+
+    UnitTest::TestResults results;
+       {
+               ScopedCurrentTest scopedResults(results);
+
+               NoThrowTest test;
+               test.Run();
+       }
+
+       CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+TEST(CheckThrowMacroFailsOnWrongException)
+{
+    class WrongThrowTest : public UnitTest::Test
+    {
+    public:
+        WrongThrowTest() : Test("wrongthrow") {}
+        virtual void RunImpl() const
+        {
+            CHECK_THROW(throw "oops", int);
+        }
+    };
+
+    UnitTest::TestResults results;
+       {
+               ScopedCurrentTest scopedResults(results);
+
+               WrongThrowTest test;
+               test.Run();
+       }
+
+       CHECK_EQUAL(1, results.GetFailureCount());
+}
+
+struct SimpleFixture
+{
+    SimpleFixture()
+    {
+        ++instanceCount;
+    }
+    ~SimpleFixture()
+    {
+        --instanceCount;
+    }
+
+    static int instanceCount;
+};
+
+int SimpleFixture::instanceCount = 0;
+
+TEST_FIXTURE(SimpleFixture, DefaultFixtureCtorIsCalled)
+{
+    CHECK(SimpleFixture::instanceCount > 0);
+}
+
+TEST_FIXTURE(SimpleFixture, OnlyOneFixtureAliveAtATime)
+{
+    CHECK_EQUAL(1, SimpleFixture::instanceCount);
+}
+
+void CheckBool(const bool b)
+{
+       CHECK(b);
+}
+
+TEST(CanCallCHECKOutsideOfTestFunction)
+{
+       CheckBool(true);
+}
+
+}
diff --git a/tools/UnitTest++/src/tests/TestXmlTestReporter.cpp b/tools/UnitTest++/src/tests/TestXmlTestReporter.cpp
new file mode 100644 (file)
index 0000000..a63abb8
--- /dev/null
@@ -0,0 +1,183 @@
+#include "../UnitTest++.h"
+#include "../XmlTestReporter.h"
+
+#include <sstream>
+
+using namespace UnitTest;
+using std::ostringstream;
+
+namespace
+{
+
+#ifdef UNITTEST_USE_CUSTOM_STREAMS
+
+// Overload to let MemoryOutStream accept std::string
+MemoryOutStream& operator<<(MemoryOutStream& s, const std::string& value)
+{
+    s << value.c_str();
+    return s;
+}
+
+#endif
+
+struct XmlTestReporterFixture
+{
+    XmlTestReporterFixture()
+        : reporter(output)
+    {
+    }
+
+    ostringstream output;
+    XmlTestReporter reporter;
+};
+
+TEST_FIXTURE(XmlTestReporterFixture, MultipleCharactersAreEscaped)
+{
+    TestDetails const details("TestName", "suite", "filename.h", 4321);
+
+    reporter.ReportTestStart(details);
+    reporter.ReportFailure(details, "\"\"\'\'&&<<>>");
+    reporter.ReportTestFinish(details, 0.1f);
+    reporter.ReportSummary(1, 2, 3, 0.1f);
+
+    char const* expected =
+        "<?xml version=\"1.0\"?>"
+        "<unittest-results tests=\"1\" failedtests=\"2\" failures=\"3\" time=\"0.1\">"
+        "<test suite=\"suite\" name=\"TestName\" time=\"0.1\">"
+        "<failure message=\"filename.h(4321) : "
+        "&quot;&quot;&apos;&apos;&amp;&amp;&lt;&lt;&gt;&gt;\"/>"
+        "</test>"
+        "</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, OutputIsCachedUntilReportSummaryIsCalled)
+{
+    TestDetails const details("", "", "", 0);
+
+    reporter.ReportTestStart(details);
+    reporter.ReportFailure(details, "message");
+    reporter.ReportTestFinish(details, 1.0F);
+    CHECK(output.str().empty());
+
+    reporter.ReportSummary(1, 1, 1, 1.0f);
+    CHECK(!output.str().empty());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, EmptyReportSummaryFormat)
+{
+    reporter.ReportSummary(0, 0, 0, 0.1f);
+
+    const char *expected =
+"<?xml version=\"1.0\"?>"
+"<unittest-results tests=\"0\" failedtests=\"0\" failures=\"0\" time=\"0.1\">"
+"</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, SingleSuccessfulTestReportSummaryFormat)
+{
+    TestDetails const details("TestName", "DefaultSuite", "", 0);
+
+    reporter.ReportTestStart(details);
+    reporter.ReportSummary(1, 0, 0, 0.1f);
+
+    const char *expected =
+"<?xml version=\"1.0\"?>"
+"<unittest-results tests=\"1\" failedtests=\"0\" failures=\"0\" time=\"0.1\">"
+"<test suite=\"DefaultSuite\" name=\"TestName\" time=\"0\"/>"
+"</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, SingleFailedTestReportSummaryFormat)
+{
+    TestDetails const details("A Test", "suite", "A File", 4321);
+
+    reporter.ReportTestStart(details);
+    reporter.ReportFailure(details, "A Failure");
+    reporter.ReportSummary(1, 1, 1, 0.1f);
+
+    const char *expected =
+        "<?xml version=\"1.0\"?>"
+        "<unittest-results tests=\"1\" failedtests=\"1\" failures=\"1\" time=\"0.1\">"
+        "<test suite=\"suite\" name=\"A Test\" time=\"0\">"
+        "<failure message=\"A File(4321) : A Failure\"/>"
+        "</test>"
+        "</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, FailureMessageIsXMLEscaped)
+{
+    TestDetails const details("TestName", "suite", "filename.h", 4321);
+
+    reporter.ReportTestStart(details);
+    reporter.ReportFailure(details, "\"\'&<>");
+    reporter.ReportTestFinish(details, 0.1f);
+    reporter.ReportSummary(1, 1, 1, 0.1f);
+
+    char const* expected =
+        "<?xml version=\"1.0\"?>"
+        "<unittest-results tests=\"1\" failedtests=\"1\" failures=\"1\" time=\"0.1\">"
+        "<test suite=\"suite\" name=\"TestName\" time=\"0.1\">"
+        "<failure message=\"filename.h(4321) : &quot;&apos;&amp;&lt;&gt;\"/>"
+        "</test>"
+        "</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, OneFailureAndOneSuccess)
+{
+    TestDetails const failedDetails("FailedTest", "suite", "fail.h", 1);
+    reporter.ReportTestStart(failedDetails);
+    reporter.ReportFailure(failedDetails, "expected 1 but was 2");
+    reporter.ReportTestFinish(failedDetails, 0.1f);
+
+    TestDetails const succeededDetails("SucceededTest", "suite", "", 0);
+    reporter.ReportTestStart(succeededDetails);
+    reporter.ReportTestFinish(succeededDetails, 1.0f);
+    reporter.ReportSummary(2, 1, 1, 1.1f);
+
+    char const* expected =
+        "<?xml version=\"1.0\"?>"
+        "<unittest-results tests=\"2\" failedtests=\"1\" failures=\"1\" time=\"1.1\">"
+        "<test suite=\"suite\" name=\"FailedTest\" time=\"0.1\">"
+        "<failure message=\"fail.h(1) : expected 1 but was 2\"/>"
+        "</test>"
+        "<test suite=\"suite\" name=\"SucceededTest\" time=\"1\"/>"
+        "</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+TEST_FIXTURE(XmlTestReporterFixture, MultipleFailures)
+{
+    TestDetails const failedDetails1("FailedTest", "suite", "fail.h", 1);
+    TestDetails const failedDetails2("FailedTest", "suite", "fail.h", 31);
+
+    reporter.ReportTestStart(failedDetails1);
+    reporter.ReportFailure(failedDetails1, "expected 1 but was 2");
+    reporter.ReportFailure(failedDetails2, "expected one but was two");
+    reporter.ReportTestFinish(failedDetails1, 0.1f);
+
+    reporter.ReportSummary(1, 1, 2, 1.1f);
+
+    char const* expected =
+        "<?xml version=\"1.0\"?>"
+        "<unittest-results tests=\"1\" failedtests=\"1\" failures=\"2\" time=\"1.1\">"
+        "<test suite=\"suite\" name=\"FailedTest\" time=\"0.1\">"
+        "<failure message=\"fail.h(1) : expected 1 but was 2\"/>"
+        "<failure message=\"fail.h(31) : expected one but was two\"/>"
+        "</test>"
+        "</unittest-results>";
+
+    CHECK_EQUAL(expected, output.str());
+}
+
+}