From 259cf50b213933262b621c6d62a01a15238d4934 Mon Sep 17 00:00:00 2001 From: qdii Date: Wed, 14 Nov 2012 16:30:25 -0500 Subject: [PATCH 001/184] Added autobuild system --- AUTHORS | 5 + ChangeLog | 0 INSTALL | 370 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 96 ------------- Makefile.am | 2 + NEWS | 0 configure.ac | 33 +++++ src/Makefile.am | 9 ++ 8 files changed, 419 insertions(+), 96 deletions(-) create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 INSTALL delete mode 100644 Makefile create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 configure.ac create mode 100644 src/Makefile.am diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..1bebc1c --- /dev/null +++ b/AUTHORS @@ -0,0 +1,5 @@ + Noel Llopis (llopis@convexhull.com) + Charles Nicholson (charles.nicholson@gmail.com) + +But they have been unactive for years. +The maintainer of this fork is Victor Lavaud (victor.lavaud@gmail.com) diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..6e90e07 --- /dev/null +++ b/INSTALL @@ -0,0 +1,370 @@ +Installation Instructions +************************* + +Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation, +Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell commands `./configure; make; make install' should +configure, build, and install this package. The following +more-detailed instructions are generic; see the `README' file for +instructions specific to this package. Some packages provide this +`INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. Caching is +disabled by default to prevent problems with accidental use of stale +cache files. + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You need `configure.ac' if +you want to change it or regenerate `configure' using a newer version +of `autoconf'. + + The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. + + Running `configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type `make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the `make install' phase executed with root + privileges. + + 5. Optionally, type `make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior `make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type `make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide `make + distcheck', which can by used by developers to test that all other + targets like `make install' and `make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. This +is known as a "VPATH" build. + + With a non-GNU `make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use `make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple `-arch' options to the +compiler but only a single `-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the `lipo' tool if you have problems. + +Installation Names +================== + + By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the +default for these options is expressed in terms of `${prefix}', so that +specifying just `--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to `configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +`make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, `make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +`${prefix}'. Any directories that were specified during `configure', +but not in terms of `${prefix}', must each be overridden at install +time for the entire installation to be relocated. The approach of +makefile variable overrides for each directory variable is required by +the GNU Coding Standards, and ideally causes no recompilation. +However, some platforms have known limitations with the semantics of +shared libraries that end up requiring recompilation when using this +method, particularly noticeable in packages that use GNU Libtool. + + The second method involves providing the `DESTDIR' variable. For +example, `make install DESTDIR=/alternate/directory' will prepend +`/alternate/directory' before all installation names. The approach of +`DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of `${prefix}' +at `configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of `make' will be. For these packages, running `./configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with `make V=1'; while running `./configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with `make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU +CC is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX `make' updates targets which have the same time stamps as +their prerequisites, which makes it generally unusable when shipped +generated files such as `configure' are involved. Use GNU `make' +instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its `' header file. The option `-nodtk' can be used as +a workaround. If GNU CC is not installed, it is therefore recommended +to try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put `/usr/ucb' early in your `PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in `/usr/bin'. So, if you need `/usr/ucb' +in your `PATH', put it _after_ `/usr/bin'. + + On Haiku, software installed for all users goes in `/boot/common', +not `/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for `CONFIG_SHELL' due to +an Autoconf limitation. Until the limitation is lifted, you can use +this workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of all of the options to `configure', and exit. + +`--help=short' +`--help=recursive' + Print a summary of the options unique to this package's + `configure', and exit. The `short' variant lists options used + only in the top level, while the `recursive' variant lists options + also present in any nested packages. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: + for more details, including other options available for fine-tuning + the installation locations. + +`--no-create' +`-n' + Run the configure checks, but stop before creating any output + files. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. diff --git a/Makefile b/Makefile deleted file mode 100644 index 4f2ea9d..0000000 --- a/Makefile +++ /dev/null @@ -1,96 +0,0 @@ -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) $(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/Makefile.am b/Makefile.am new file mode 100644 index 0000000..1563f21 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,2 @@ +EXTRA_DIST = docs +SUBDIRS = src diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..88ab84c --- /dev/null +++ b/configure.ac @@ -0,0 +1,33 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([UnitTest++], [1.4], [victor.lavaud@gmail.com]) +AC_CONFIG_SRCDIR([src/TestDetails.cpp]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE() +LT_INIT() + +AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:0]) + +# Checks for programs. +AC_PROG_CXX +AC_PROG_CC + +# Checks for libraries. + +# Checks for header files. +AC_CHECK_HEADERS([sys/time.h unistd.h setjmp.h signal.h cassert cstddef cstdio cstring exception iosfwd iostream sstream string vector]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_C_INLINE +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_CHECK_FUNCS([gettimeofday strstr]) + +AC_CONFIG_FILES([Makefile + src/Makefile]) +AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..c38712e --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,9 @@ +lib_LTLIBRARIES = libUnitTest++.la +pkgincludedir = $(includedir)/UnitTest++ +nobase_pkginclude_HEADERS = UnitTest++.h Config.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h +libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp +libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ +check_PROGRAMS = TestUnitTest++ +TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestChecks.cpp tests/TestUnitTest++.cpp tests/TestTest.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestCheckMacros.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestMemoryOutStream.cpp tests/TestDeferredTestReporter.cpp tests/TestXmlTestReporter.cpp tests/TestCurrentTest.cpp +TestUnitTest___LDADD = libUnitTest++.la +TESTS = TestUnitTest++ From 062241c85d063ea1eaa84fa2f17b0cb9a4bdff71 Mon Sep 17 00:00:00 2001 From: Aaron Simmons Date: Thu, 15 Nov 2012 10:07:33 -0700 Subject: [PATCH 002/184] adding CMakeLists.txt --- CMakeLists.txt | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9210fe6 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 2.8.1) +project(UnitTest++) + +# get the main sources +file(GLOB SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp src/*.h) +source_group("" FILES ${SRCS}) + +# get platform specific sources +if (WIN32) + set(PLAT_DIR Win32) +else() + set(PLAT_DIR Posix) +endif(WIN32) +file(GLOB PLAT_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${PLAT_DIR}/*.cpp src/${PLAT_DIR}/*.h) +source_group(${PLAT_DIR} FILES ${PLAT_SRCS}) + +# create the lib +add_library(UnitTestPP STATIC ${SRCS} ${PLAT_SRCS}) +set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) +include_directories(src) + +# build the test runner +file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/tests/*.cpp src/tests/*.h) +source_group( "" FILES ${TEST_SRCS}) +add_executable(TestUnitTestPP ${TEST_SRCS}) +set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) +target_link_libraries(TestUnitTestPP UnitTestPP) + +# turn on testing +enable_testing() +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V) + +# add the test runner as a test +add_test(NAME TestUnitTestPP COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) +add_dependencies(check TestUnitTestPP) From cbbcffa26bf54f3edef0ad632b2ea7b81664f777 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 26 Jan 2013 01:27:06 -0600 Subject: [PATCH 003/184] Setting up an initial .gitattributes to start dealing with line endings --- .gitattributes | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bcf1e7a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,13 @@ +* text=auto + +*.h text +*.cpp text + +# VS 20xx files +*.sln text eol=crlf +*.vcproj text eol=crlf +*.vcxproj text eol=crlt + +# VC6 files +*.dsw text eol=crlf +*.dsp text eol=crlf From 8379eb566168a11031b4744b2b240fe20d1db3ee Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 26 Jan 2013 09:04:33 -0600 Subject: [PATCH 004/184] Fix inadvertent 'crlt' for .vcxproj --- .gitattributes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index bcf1e7a..615713b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,7 +6,7 @@ # VS 20xx files *.sln text eol=crlf *.vcproj text eol=crlf -*.vcxproj text eol=crlt +*.vcxproj text eol=crlf # VC6 files *.dsw text eol=crlf From 7e99532785c7d363591b6edaaf5ed514028ee1fe Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 31 Jan 2013 20:49:13 -0600 Subject: [PATCH 005/184] Normalized line endings --- COPYING | 40 +- README | 136 +-- TestUnitTest++.vsnet2003.vcproj | 348 +++---- TestUnitTest++.vsnet2005.vcproj | 512 +++++----- TestUnitTestPP_vs6.dsp | 338 +++---- UnitTest++.vsnet2003.sln | 60 +- UnitTest++.vsnet2003.vcproj | 452 ++++----- UnitTest++.vsnet2005.sln | 58 +- UnitTest++.vsnet2005.vcproj | 636 ++++++------ UnitTestPP_vs6.dsp | 520 +++++----- UnitTestPP_vs6.dsw | 88 +- config.h | 108 +- src/AssertException.cpp | 34 +- src/AssertException.h | 46 +- src/CheckMacros.h | 274 ++--- src/Checks.cpp | 100 +- src/Checks.h | 316 +++--- src/CompositeTestReporter.cpp | 134 +-- src/CompositeTestReporter.h | 68 +- src/CurrentTest.cpp | 36 +- src/CurrentTest.h | 38 +- src/DeferredTestReporter.cpp | 66 +- src/DeferredTestReporter.h | 70 +- src/DeferredTestResult.cpp | 92 +- src/DeferredTestResult.h | 104 +- src/ExceptionMacros.h | 36 +- src/ExecuteTest.h | 118 +-- src/HelperMacros.h | 104 +- src/MemoryOutStream.cpp | 356 +++---- src/MemoryOutStream.h | 146 +-- src/Posix/SignalTranslator.cpp | 92 +- src/Posix/SignalTranslator.h | 84 +- src/Posix/TimeHelpers.cpp | 66 +- src/Posix/TimeHelpers.h | 56 +- src/ReportAssert.cpp | 140 +-- src/ReportAssert.h | 24 +- src/ReportAssertImpl.h | 92 +- src/Test.cpp | 84 +- src/Test.h | 70 +- src/TestDetails.cpp | 44 +- src/TestDetails.h | 52 +- src/TestList.cpp | 78 +- src/TestList.h | 66 +- src/TestMacros.h | 234 ++--- src/TestReporter.cpp | 18 +- src/TestReporter.h | 44 +- src/TestReporterStdout.cpp | 92 +- src/TestReporterStdout.h | 38 +- src/TestResults.cpp | 120 +-- src/TestResults.h | 76 +- src/TestRunner.cpp | 164 +-- src/TestRunner.h | 122 +-- src/TestSuite.h | 24 +- src/TimeConstraint.cpp | 58 +- src/TimeConstraint.h | 74 +- src/TimeHelpers.h | 14 +- src/Win32/TimeHelpers.cpp | 98 +- src/Win32/TimeHelpers.h | 90 +- src/XmlTestReporter.cpp | 262 ++--- src/XmlTestReporter.h | 76 +- src/tests/Main.cpp | 12 +- src/tests/RecordingReporter.h | 196 ++-- src/tests/ScopedCurrentTest.h | 74 +- src/tests/TestAssertHandler.cpp | 272 ++--- src/tests/TestCheckMacros.cpp | 1036 +++++++++---------- src/tests/TestChecks.cpp | 582 +++++------ src/tests/TestCompositeTestReporter.cpp | 352 +++---- src/tests/TestCurrentTest.cpp | 76 +- src/tests/TestDeferredTestReporter.cpp | 244 ++--- src/tests/TestExceptions.cpp | 586 +++++------ src/tests/TestMemoryOutStream.cpp | 350 +++---- src/tests/TestTest.cpp | 258 ++--- src/tests/TestTestList.cpp | 100 +- src/tests/TestTestMacros.cpp | 442 ++++---- src/tests/TestTestResults.cpp | 222 ++-- src/tests/TestTestRunner.cpp | 644 ++++++------ src/tests/TestTestSuite.cpp | 24 +- src/tests/TestTimeConstraint.cpp | 138 +-- src/tests/TestTimeConstraintMacro.cpp | 130 +-- src/tests/TestUnitTestPP.cpp | 296 +++--- src/tests/TestXmlTestReporter.cpp | 376 +++---- src/tests/test-unittestpp_vs2005.vcproj | 1160 ++++++++++----------- src/tests/test-unittestpp_vs2008.vcproj | 1138 ++++++++++----------- src/unittestpp_vs2005.vcproj | 1228 +++++++++++------------ src/unittestpp_vs2008.vcproj | 1214 +++++++++++----------- unittestpp.h | 22 +- unittestpp_vs2005.sln | 98 +- unittestpp_vs2008.sln | 98 +- 88 files changed, 9677 insertions(+), 9677 deletions(-) diff --git a/COPYING b/COPYING index dc16f73..9f96308 100644 --- a/COPYING +++ b/COPYING @@ -1,20 +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. +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/README b/README index 1389cc6..63c9351 100644 --- a/README +++ b/README @@ -1,68 +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 - +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/TestUnitTest++.vsnet2003.vcproj b/TestUnitTest++.vsnet2003.vcproj index fbc4154..e596d80 100644 --- a/TestUnitTest++.vsnet2003.vcproj +++ b/TestUnitTest++.vsnet2003.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestUnitTest++.vsnet2005.vcproj b/TestUnitTest++.vsnet2005.vcproj index aa8f95b..79b7874 100644 --- a/TestUnitTest++.vsnet2005.vcproj +++ b/TestUnitTest++.vsnet2005.vcproj @@ -1,256 +1,256 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TestUnitTestPP_vs6.dsp b/TestUnitTestPP_vs6.dsp index bdfb234..6e0f85f 100644 --- a/TestUnitTestPP_vs6.dsp +++ b/TestUnitTestPP_vs6.dsp @@ -1,169 +1,169 @@ -# Microsoft Developer Studio Project File - Name="TestUnitTestPP_vs6" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** 編集しないでください ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=TestUnitTestPP_vs6 - Win32 Debug -!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 -!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください -!MESSAGE -!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak". -!MESSAGE -!MESSAGE NMAKE の実行時に構成を指定できます -!MESSAGE コマンド ライン上でマクロの設定を定義します。例: -!MESSAGE -!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak" CFG="TestUnitTestPP_vs6 - Win32 Debug" -!MESSAGE -!MESSAGE 選択可能なビルド モード: -!MESSAGE -!MESSAGE "TestUnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Console Application" 用) -!MESSAGE "TestUnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Console Application" 用) -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "TestUnitTestPP_vs6 - Win32 Release" -# Name "TestUnitTestPP_vs6 - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\tests\Main.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestAssertHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestCheckMacros.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestChecks.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestCurrentTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestDeferredTestReporter.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestMemoryOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestList.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestMacros.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestResults.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestRunner.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestSuite.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTimeConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTimeConstraintMacro.cpp -# End Source File -# Begin Source File - -SOURCE=".\src\tests\TestUnitTestPP.cpp" -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestXmlTestReporter.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\src\tests\RecordingReporter.h -# End Source File -# Begin Source File - -SOURCE=.\src\tests\ScopedCurrentTest.h -# End Source File -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="TestUnitTestPP_vs6" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** 編集しないでください ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=TestUnitTestPP_vs6 - Win32 Debug +!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 +!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください +!MESSAGE +!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak". +!MESSAGE +!MESSAGE NMAKE の実行時に構成を指定できます +!MESSAGE コマンド ライン上でマクロの設定を定義します。例: +!MESSAGE +!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak" CFG="TestUnitTestPP_vs6 - Win32 Debug" +!MESSAGE +!MESSAGE 選択可能なビルド モード: +!MESSAGE +!MESSAGE "TestUnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Console Application" 用) +!MESSAGE "TestUnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Console Application" 用) +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x411 /d "NDEBUG" +# ADD RSC /l 0x411 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x411 /d "_DEBUG" +# ADD RSC /l 0x411 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "TestUnitTestPP_vs6 - Win32 Release" +# Name "TestUnitTestPP_vs6 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\src\tests\Main.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestAssertHandler.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestCheckMacros.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestChecks.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestCurrentTest.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestDeferredTestReporter.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestMemoryOutStream.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTest.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTestList.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTestMacros.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTestResults.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTestRunner.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTestSuite.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTimeConstraint.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestTimeConstraintMacro.cpp +# End Source File +# Begin Source File + +SOURCE=".\src\tests\TestUnitTestPP.cpp" +# End Source File +# Begin Source File + +SOURCE=.\src\tests\TestXmlTestReporter.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\src\tests\RecordingReporter.h +# End Source File +# Begin Source File + +SOURCE=.\src\tests\ScopedCurrentTest.h +# End Source File +# End Group +# End Target +# End Project diff --git a/UnitTest++.vsnet2003.sln b/UnitTest++.vsnet2003.sln index 748dedb..265d7ba 100644 --- a/UnitTest++.vsnet2003.sln +++ b/UnitTest++.vsnet2003.sln @@ -1,30 +1,30 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2003", "UnitTest++.vsnet2003.vcproj", "{7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2003", "TestUnitTest++.vsnet2003.vcproj", "{ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}" - ProjectSection(ProjectDependencies) = postProject - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5} = {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Debug.ActiveCfg = Debug|Win32 - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Debug.Build.0 = Debug|Win32 - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Release.ActiveCfg = Release|Win32 - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Release.Build.0 = Release|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Debug.ActiveCfg = Debug|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Debug.Build.0 = Debug|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Release.ActiveCfg = Release|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2003", "UnitTest++.vsnet2003.vcproj", "{7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2003", "TestUnitTest++.vsnet2003.vcproj", "{ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}" + ProjectSection(ProjectDependencies) = postProject + {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5} = {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Debug.ActiveCfg = Debug|Win32 + {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Debug.Build.0 = Debug|Win32 + {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Release.ActiveCfg = Release|Win32 + {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Release.Build.0 = Release|Win32 + {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Debug.ActiveCfg = Debug|Win32 + {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Debug.Build.0 = Debug|Win32 + {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Release.ActiveCfg = Release|Win32 + {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/UnitTest++.vsnet2003.vcproj b/UnitTest++.vsnet2003.vcproj index 7fc9721..75c8f2e 100644 --- a/UnitTest++.vsnet2003.vcproj +++ b/UnitTest++.vsnet2003.vcproj @@ -1,226 +1,226 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UnitTest++.vsnet2005.sln b/UnitTest++.vsnet2005.sln index f27ed4a..382f334 100644 --- a/UnitTest++.vsnet2005.sln +++ b/UnitTest++.vsnet2005.sln @@ -1,29 +1,29 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2005", "UnitTest++.vsnet2005.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2005", "TestUnitTest++.vsnet2005.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" - ProjectSection(ProjectDependencies) = postProject - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.ActiveCfg = Debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.Build.0 = Debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.ActiveCfg = Release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.Build.0 = Release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.ActiveCfg = Debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.Build.0 = Debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.ActiveCfg = Release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +サソ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2005", "UnitTest++.vsnet2005.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2005", "TestUnitTest++.vsnet2005.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" + ProjectSection(ProjectDependencies) = postProject + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.ActiveCfg = Debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.Build.0 = Debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.ActiveCfg = Release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.Build.0 = Release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.ActiveCfg = Debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.Build.0 = Debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.ActiveCfg = Release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/UnitTest++.vsnet2005.vcproj b/UnitTest++.vsnet2005.vcproj index 9c56365..7e45646 100644 --- a/UnitTest++.vsnet2005.vcproj +++ b/UnitTest++.vsnet2005.vcproj @@ -1,318 +1,318 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UnitTestPP_vs6.dsp b/UnitTestPP_vs6.dsp index 564471b..b9014cd 100644 --- a/UnitTestPP_vs6.dsp +++ b/UnitTestPP_vs6.dsp @@ -1,260 +1,260 @@ -# Microsoft Developer Studio Project File - Name="UnitTestPP_vs6" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** 編集しないでください ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=UnitTestPP_vs6 - Win32 Debug -!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 -!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください -!MESSAGE -!MESSAGE NMAKE /f "UnitTestPP_vs6.mak". -!MESSAGE -!MESSAGE NMAKE の実行時に構成を指定できます -!MESSAGE コマンド ライン上でマクロの設定を定義します。例: -!MESSAGE -!MESSAGE NMAKE /f "UnitTestPP_vs6.mak" CFG="UnitTestPP_vs6 - Win32 Debug" -!MESSAGE -!MESSAGE 選択可能なビルド モード: -!MESSAGE -!MESSAGE "UnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Static Library" 用) -!MESSAGE "UnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Static Library" 用) -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "UnitTestPP_vs6 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "UnitTestPP_vs6 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "UnitTestPP_vs6 - Win32 Release" -# Name "UnitTestPP_vs6 - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\AssertException.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\Checks.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\CurrentTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestReporter.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestResult.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\MemoryOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\ReportAssert.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\Test.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestDetails.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestList.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporter.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporterStdout.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestResults.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestRunner.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TimeConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\XmlTestReporter.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\src\AssertException.h -# End Source File -# Begin Source File - -SOURCE=.\src\CheckMacros.h -# End Source File -# Begin Source File - -SOURCE=.\src\Checks.h -# End Source File -# Begin Source File - -SOURCE=.\src\Config.h -# End Source File -# Begin Source File - -SOURCE=.\src\CurrentTest.h -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestReporter.h -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestResult.h -# End Source File -# Begin Source File - -SOURCE=.\src\ExecuteTest.h -# End Source File -# Begin Source File - -SOURCE=.\src\MemoryOutStream.h -# End Source File -# Begin Source File - -SOURCE=.\src\ReportAssert.h -# End Source File -# Begin Source File - -SOURCE=.\src\Test.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestDetails.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestList.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestMacros.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporter.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporterStdout.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestResults.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestRunner.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestSuite.h -# End Source File -# Begin Source File - -SOURCE=.\src\TimeConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\src\TimeHelpers.h -# End Source File -# Begin Source File - -SOURCE=".\src\unittestpp.h" -# End Source File -# Begin Source File - -SOURCE=.\src\XmlTestReporter.h -# End Source File -# End Group -# Begin Group "Win32" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\Win32\TimeHelpers.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\Win32\TimeHelpers.h -# End Source File -# End Group -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="UnitTestPP_vs6" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** 編集しないでください ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=UnitTestPP_vs6 - Win32 Debug +!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 +!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください +!MESSAGE +!MESSAGE NMAKE /f "UnitTestPP_vs6.mak". +!MESSAGE +!MESSAGE NMAKE の実行時に構成を指定できます +!MESSAGE コマンド ライン上でマクロの設定を定義します。例: +!MESSAGE +!MESSAGE NMAKE /f "UnitTestPP_vs6.mak" CFG="UnitTestPP_vs6 - Win32 Debug" +!MESSAGE +!MESSAGE 選択可能なビルド モード: +!MESSAGE +!MESSAGE "UnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Static Library" 用) +!MESSAGE "UnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Static Library" 用) +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "UnitTestPP_vs6 - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE RSC /l 0x411 /d "NDEBUG" +# ADD RSC /l 0x411 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ELSEIF "$(CFG)" == "UnitTestPP_vs6 - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD BASE RSC /l 0x411 /d "_DEBUG" +# ADD RSC /l 0x411 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=link.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo + +!ENDIF + +# Begin Target + +# Name "UnitTestPP_vs6 - Win32 Release" +# Name "UnitTestPP_vs6 - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\src\AssertException.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\Checks.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\CurrentTest.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\DeferredTestReporter.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\DeferredTestResult.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\MemoryOutStream.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\ReportAssert.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\Test.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TestDetails.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TestList.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TestReporter.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TestReporterStdout.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TestResults.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TestRunner.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\TimeConstraint.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\XmlTestReporter.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\src\AssertException.h +# End Source File +# Begin Source File + +SOURCE=.\src\CheckMacros.h +# End Source File +# Begin Source File + +SOURCE=.\src\Checks.h +# End Source File +# Begin Source File + +SOURCE=.\src\Config.h +# End Source File +# Begin Source File + +SOURCE=.\src\CurrentTest.h +# End Source File +# Begin Source File + +SOURCE=.\src\DeferredTestReporter.h +# End Source File +# Begin Source File + +SOURCE=.\src\DeferredTestResult.h +# End Source File +# Begin Source File + +SOURCE=.\src\ExecuteTest.h +# End Source File +# Begin Source File + +SOURCE=.\src\MemoryOutStream.h +# End Source File +# Begin Source File + +SOURCE=.\src\ReportAssert.h +# End Source File +# Begin Source File + +SOURCE=.\src\Test.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestDetails.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestList.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestMacros.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestReporter.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestReporterStdout.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestResults.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestRunner.h +# End Source File +# Begin Source File + +SOURCE=.\src\TestSuite.h +# End Source File +# Begin Source File + +SOURCE=.\src\TimeConstraint.h +# End Source File +# Begin Source File + +SOURCE=.\src\TimeHelpers.h +# End Source File +# Begin Source File + +SOURCE=".\src\unittestpp.h" +# End Source File +# Begin Source File + +SOURCE=.\src\XmlTestReporter.h +# End Source File +# End Group +# Begin Group "Win32" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\src\Win32\TimeHelpers.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\Win32\TimeHelpers.h +# End Source File +# End Group +# End Target +# End Project diff --git a/UnitTestPP_vs6.dsw b/UnitTestPP_vs6.dsw index 58e105a..7afab45 100644 --- a/UnitTestPP_vs6.dsw +++ b/UnitTestPP_vs6.dsw @@ -1,44 +1,44 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# 警告: このワークスペース ファイル を編集または削除しないでください! - -############################################################################### - -Project: "TestUnitTestPP_vs6"=".\TestUnitTestPP_vs6.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name UnitTestPP_vs6 - End Project Dependency -}}} - -############################################################################### - -Project: "UnitTestPP_vs6"=".\UnitTestPP_vs6.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - +Microsoft Developer Studio Workspace File, Format Version 6.00 +# 警告: このワークスペース ファイル を編集または削除しないでください! + +############################################################################### + +Project: "TestUnitTestPP_vs6"=".\TestUnitTestPP_vs6.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name UnitTestPP_vs6 + End Project Dependency +}}} + +############################################################################### + +Project: "UnitTestPP_vs6"=".\UnitTestPP_vs6.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/config.h b/config.h index bb95a45..92706c7 100644 --- a/config.h +++ b/config.h @@ -1,54 +1,54 @@ -#ifndef UNITTEST_CONFIG_H -#define UNITTEST_CONFIG_H - -// Standard defines documented here: http://predef.sourceforge.net - -#if defined(_MSC_VER) - #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 - - #ifdef _USRDLL - #define UNITTEST_WIN32_DLL - #endif - #define UNITTEST_WIN32 -#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 - - -// MemoryOutStream is a custom reimplementation of parts of std::ostringstream. -// Uncomment this line to have MemoryOutStream implemented in terms of std::ostringstream. -// This is useful if you are using the CHECK macros on objects that have something like this defined: -// std::ostringstream& operator<<(std::ostringstream& s, const YourObject& value) - -//#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - - -// DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like -// XmlTestReporter. If you don't want to use this functionality, uncomment this line and no STL -// headers or code will be compiled into UnitTest++ - -//#define UNITTEST_NO_DEFERRED_REPORTER - - -// By default, asserts that you report via UnitTest::ReportAssert() abort the current test and -// continue to the next one by throwing an exception, which unwinds the stack naturally, destroying -// all auto variables on its way back down. If you don't want to (or can't) use exceptions for your -// platform/compiler, uncomment this line. All exception code will be removed from UnitTest++, -// assert recovery will be done via setjmp/longjmp, and NO correct stack unwinding will happen! - -//#define UNITTEST_NO_EXCEPTIONS - -#endif +#ifndef UNITTEST_CONFIG_H +#define UNITTEST_CONFIG_H + +// Standard defines documented here: http://predef.sourceforge.net + +#if defined(_MSC_VER) + #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 + + #ifdef _USRDLL + #define UNITTEST_WIN32_DLL + #endif + #define UNITTEST_WIN32 +#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 + + +// MemoryOutStream is a custom reimplementation of parts of std::ostringstream. +// Uncomment this line to have MemoryOutStream implemented in terms of std::ostringstream. +// This is useful if you are using the CHECK macros on objects that have something like this defined: +// std::ostringstream& operator<<(std::ostringstream& s, const YourObject& value) + +//#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + + +// DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like +// XmlTestReporter. If you don't want to use this functionality, uncomment this line and no STL +// headers or code will be compiled into UnitTest++ + +//#define UNITTEST_NO_DEFERRED_REPORTER + + +// By default, asserts that you report via UnitTest::ReportAssert() abort the current test and +// continue to the next one by throwing an exception, which unwinds the stack naturally, destroying +// all auto variables on its way back down. If you don't want to (or can't) use exceptions for your +// platform/compiler, uncomment this line. All exception code will be removed from UnitTest++, +// assert recovery will be done via setjmp/longjmp, and NO correct stack unwinding will happen! + +//#define UNITTEST_NO_EXCEPTIONS + +#endif diff --git a/src/AssertException.cpp b/src/AssertException.cpp index 634eb07..9a7d78f 100644 --- a/src/AssertException.cpp +++ b/src/AssertException.cpp @@ -1,17 +1,17 @@ -#include "AssertException.h" - -#ifndef UNITTEST_NO_EXCEPTIONS - -namespace UnitTest { - -AssertException::AssertException() -{ -} - -AssertException::~AssertException() throw() -{ -} - -} - -#endif +#include "AssertException.h" + +#ifndef UNITTEST_NO_EXCEPTIONS + +namespace UnitTest { + +AssertException::AssertException() +{ +} + +AssertException::~AssertException() throw() +{ +} + +} + +#endif diff --git a/src/AssertException.h b/src/AssertException.h index 74291db..620e397 100644 --- a/src/AssertException.h +++ b/src/AssertException.h @@ -1,23 +1,23 @@ -#ifndef UNITTEST_ASSERTEXCEPTION_H -#define UNITTEST_ASSERTEXCEPTION_H - -#include "../config.h" -#ifndef UNITTEST_NO_EXCEPTIONS - -#include "HelperMacros.h" -#include - -namespace UnitTest { - -class UNITTEST_LINKAGE AssertException : public std::exception -{ -public: - AssertException(); - virtual ~AssertException() throw(); -}; - -} - -#endif - -#endif +#ifndef UNITTEST_ASSERTEXCEPTION_H +#define UNITTEST_ASSERTEXCEPTION_H + +#include "../config.h" +#ifndef UNITTEST_NO_EXCEPTIONS + +#include "HelperMacros.h" +#include + +namespace UnitTest { + +class UNITTEST_LINKAGE AssertException : public std::exception +{ +public: + AssertException(); + virtual ~AssertException() throw(); +}; + +} + +#endif + +#endif diff --git a/src/CheckMacros.h b/src/CheckMacros.h index 1e73699..db93aab 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -1,137 +1,137 @@ -#ifndef UNITTEST_CHECKMACROS_H -#define UNITTEST_CHECKMACROS_H - -#include "HelperMacros.h" -#include "ExceptionMacros.h" -#include "Checks.h" -#include "AssertException.h" -#include "MemoryOutStream.h" -#include "TestDetails.h" -#include "CurrentTest.h" -#include "ReportAssertImpl.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) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - if (!UnitTest::Check(value)) \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK(" #value ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_EQUAL(expected, actual) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_CLOSE(expected, actual, tolerance) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_ARRAY_EQUAL(expected, actual, count) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - - -// CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h) -#ifndef UNITTEST_NO_EXCEPTIONS -#define CHECK_THROW(expression, ExpectedExceptionType) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - 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"); \ - UNITTEST_MULTILINE_MACRO_END - - -#define CHECK_ASSERT(expression) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UnitTest::Detail::ExpectAssert(true); \ - CHECK_THROW(expression, UnitTest::AssertException); \ - UnitTest::Detail::ExpectAssert(false); \ - UNITTEST_MULTILINE_MACRO_END -#endif -#endif +#ifndef UNITTEST_CHECKMACROS_H +#define UNITTEST_CHECKMACROS_H + +#include "HelperMacros.h" +#include "ExceptionMacros.h" +#include "Checks.h" +#include "AssertException.h" +#include "MemoryOutStream.h" +#include "TestDetails.h" +#include "CurrentTest.h" +#include "ReportAssertImpl.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) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + if (!UnitTest::Check(value)) \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK(" #value ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_EQUAL(expected, actual) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_CLOSE(expected, actual, tolerance) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_ARRAY_EQUAL(expected, actual, count) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + + +// CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h) +#ifndef UNITTEST_NO_EXCEPTIONS +#define CHECK_THROW(expression, ExpectedExceptionType) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + 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"); \ + UNITTEST_MULTILINE_MACRO_END + + +#define CHECK_ASSERT(expression) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UnitTest::Detail::ExpectAssert(true); \ + CHECK_THROW(expression, UnitTest::AssertException); \ + UnitTest::Detail::ExpectAssert(false); \ + UNITTEST_MULTILINE_MACRO_END +#endif +#endif diff --git a/src/Checks.cpp b/src/Checks.cpp index 0ccd698..2d09519 100644 --- a/src/Checks.cpp +++ b/src/Checks.cpp @@ -1,50 +1,50 @@ -#include "Checks.h" -#include - -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); -} - - -} +#include "Checks.h" +#include + +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/src/Checks.h b/src/Checks.h index c323244..4eb1842 100644 --- a/src/Checks.h +++ b/src/Checks.h @@ -1,158 +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()); - } -} - -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details); - -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details); - -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details); - -UNITTEST_LINKAGE 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 +#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()); + } +} + +UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details); + +UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details); + +UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details); + +UNITTEST_LINKAGE 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/src/CompositeTestReporter.cpp b/src/CompositeTestReporter.cpp index 2a3d22e..2dd2ffc 100644 --- a/src/CompositeTestReporter.cpp +++ b/src/CompositeTestReporter.cpp @@ -1,67 +1,67 @@ -#include "CompositeTestReporter.h" -#include - -namespace UnitTest { - -CompositeTestReporter::CompositeTestReporter() - : m_reporterCount(0) -{ -} - -int CompositeTestReporter::GetReporterCount() const -{ - return m_reporterCount; -} - -bool CompositeTestReporter::AddReporter(TestReporter* reporter) -{ - if (m_reporterCount == kMaxReporters) - return false; - - m_reporters[m_reporterCount++] = reporter; - return true; -} - -bool CompositeTestReporter::RemoveReporter(TestReporter* reporter) -{ - for (int index = 0; index < m_reporterCount; ++index) - { - if (m_reporters[index] == reporter) - { - m_reporters[index] = m_reporters[m_reporterCount - 1]; - --m_reporterCount; - return true; - } - } - - return false; -} - -void CompositeTestReporter::ReportFailure(TestDetails const& details, char const* failure) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportFailure(details, failure); -} - -void CompositeTestReporter::ReportTestStart(TestDetails const& test) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportTestStart(test); -} - -void CompositeTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportTestFinish(test, secondsElapsed); -} - -void CompositeTestReporter::ReportSummary(int totalTestCount, - int failedTestCount, - int failureCount, - float secondsElapsed) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); -} - -} +#include "CompositeTestReporter.h" +#include + +namespace UnitTest { + +CompositeTestReporter::CompositeTestReporter() + : m_reporterCount(0) +{ +} + +int CompositeTestReporter::GetReporterCount() const +{ + return m_reporterCount; +} + +bool CompositeTestReporter::AddReporter(TestReporter* reporter) +{ + if (m_reporterCount == kMaxReporters) + return false; + + m_reporters[m_reporterCount++] = reporter; + return true; +} + +bool CompositeTestReporter::RemoveReporter(TestReporter* reporter) +{ + for (int index = 0; index < m_reporterCount; ++index) + { + if (m_reporters[index] == reporter) + { + m_reporters[index] = m_reporters[m_reporterCount - 1]; + --m_reporterCount; + return true; + } + } + + return false; +} + +void CompositeTestReporter::ReportFailure(TestDetails const& details, char const* failure) +{ + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportFailure(details, failure); +} + +void CompositeTestReporter::ReportTestStart(TestDetails const& test) +{ + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportTestStart(test); +} + +void CompositeTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) +{ + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportTestFinish(test, secondsElapsed); +} + +void CompositeTestReporter::ReportSummary(int totalTestCount, + int failedTestCount, + int failureCount, + float secondsElapsed) +{ + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); +} + +} diff --git a/src/CompositeTestReporter.h b/src/CompositeTestReporter.h index a4806f4..a9a0d29 100644 --- a/src/CompositeTestReporter.h +++ b/src/CompositeTestReporter.h @@ -1,34 +1,34 @@ -#ifndef UNITTEST_COMPOSITETESTREPORTER_H -#define UNITTEST_COMPOSITETESTREPORTER_H - -#include "TestReporter.h" - -namespace UnitTest { - -class UNITTEST_LINKAGE CompositeTestReporter : public TestReporter -{ -public: - CompositeTestReporter(); - - int GetReporterCount() const; - bool AddReporter(TestReporter* reporter); - bool RemoveReporter(TestReporter* reporter); - - 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); - -private: - enum { kMaxReporters = 16 }; - TestReporter* m_reporters[kMaxReporters]; - int m_reporterCount; - - // revoked - CompositeTestReporter(const CompositeTestReporter&); - CompositeTestReporter& operator =(const CompositeTestReporter&); -}; - -} - -#endif +#ifndef UNITTEST_COMPOSITETESTREPORTER_H +#define UNITTEST_COMPOSITETESTREPORTER_H + +#include "TestReporter.h" + +namespace UnitTest { + +class UNITTEST_LINKAGE CompositeTestReporter : public TestReporter +{ +public: + CompositeTestReporter(); + + int GetReporterCount() const; + bool AddReporter(TestReporter* reporter); + bool RemoveReporter(TestReporter* reporter); + + 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); + +private: + enum { kMaxReporters = 16 }; + TestReporter* m_reporters[kMaxReporters]; + int m_reporterCount; + + // revoked + CompositeTestReporter(const CompositeTestReporter&); + CompositeTestReporter& operator =(const CompositeTestReporter&); +}; + +} + +#endif diff --git a/src/CurrentTest.cpp b/src/CurrentTest.cpp index 19eb9bf..dd9d245 100644 --- a/src/CurrentTest.cpp +++ b/src/CurrentTest.cpp @@ -1,18 +1,18 @@ -#include "CurrentTest.h" -#include - -namespace UnitTest { - -UNITTEST_LINKAGE TestResults*& CurrentTest::Results() -{ - static TestResults* testResults = NULL; - return testResults; -} - -UNITTEST_LINKAGE const TestDetails*& CurrentTest::Details() -{ - static const TestDetails* testDetails = NULL; - return testDetails; -} - -} +#include "CurrentTest.h" +#include + +namespace UnitTest { + +UNITTEST_LINKAGE TestResults*& CurrentTest::Results() +{ + static TestResults* testResults = NULL; + return testResults; +} + +UNITTEST_LINKAGE const TestDetails*& CurrentTest::Details() +{ + static const TestDetails* testDetails = NULL; + return testDetails; +} + +} diff --git a/src/CurrentTest.h b/src/CurrentTest.h index 0d62fdc..642b9dc 100644 --- a/src/CurrentTest.h +++ b/src/CurrentTest.h @@ -1,19 +1,19 @@ -#ifndef UNITTEST_CURRENTTESTRESULTS_H -#define UNITTEST_CURRENTTESTRESULTS_H - -#include "HelperMacros.h" - -namespace UnitTest { - -class TestResults; -class TestDetails; - -namespace CurrentTest -{ - UNITTEST_LINKAGE TestResults*& Results(); - UNITTEST_LINKAGE const TestDetails*& Details(); -} - -} - -#endif +#ifndef UNITTEST_CURRENTTESTRESULTS_H +#define UNITTEST_CURRENTTESTRESULTS_H + +#include "HelperMacros.h" + +namespace UnitTest { + +class TestResults; +class TestDetails; + +namespace CurrentTest +{ + UNITTEST_LINKAGE TestResults*& Results(); + UNITTEST_LINKAGE const TestDetails*& Details(); +} + +} + +#endif diff --git a/src/DeferredTestReporter.cpp b/src/DeferredTestReporter.cpp index 83dee1a..4b731f4 100644 --- a/src/DeferredTestReporter.cpp +++ b/src/DeferredTestReporter.cpp @@ -1,33 +1,33 @@ -#include "../config.h" -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "DeferredTestReporter.h" -#include "TestDetails.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(DeferredTestFailure(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; -} - -#endif +#include "../config.h" +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "DeferredTestReporter.h" +#include "TestDetails.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(DeferredTestFailure(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; +} + +#endif diff --git a/src/DeferredTestReporter.h b/src/DeferredTestReporter.h index d4947f4..ad69b26 100644 --- a/src/DeferredTestReporter.h +++ b/src/DeferredTestReporter.h @@ -1,35 +1,35 @@ -#ifndef UNITTEST_DEFERREDTESTREPORTER_H -#define UNITTEST_DEFERREDTESTREPORTER_H - -#include "../config.h" - -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "TestReporter.h" -#include "DeferredTestResult.h" - -#include - -UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestResult); - -namespace UnitTest -{ - -class UNITTEST_LINKAGE 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 -#endif +#ifndef UNITTEST_DEFERREDTESTREPORTER_H +#define UNITTEST_DEFERREDTESTREPORTER_H + +#include "../config.h" + +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "TestReporter.h" +#include "DeferredTestResult.h" + +#include + +UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestResult); + +namespace UnitTest +{ + +class UNITTEST_LINKAGE 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 +#endif diff --git a/src/DeferredTestResult.cpp b/src/DeferredTestResult.cpp index cbf0a8a..ae54d38 100644 --- a/src/DeferredTestResult.cpp +++ b/src/DeferredTestResult.cpp @@ -1,46 +1,46 @@ -#include "../config.h" -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "DeferredTestResult.h" -#include - -namespace UnitTest -{ - -DeferredTestFailure::DeferredTestFailure() - : lineNumber(-1) -{ - failureStr[0] = '\0'; -} - -DeferredTestFailure::DeferredTestFailure(int lineNumber_, const char* failureStr_) - : lineNumber(lineNumber_) -{ - std::strcpy(failureStr, failureStr_); -} - -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) -{ -} - -DeferredTestResult::~DeferredTestResult() -{ -} - -} - -#endif +#include "../config.h" +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "DeferredTestResult.h" +#include + +namespace UnitTest +{ + +DeferredTestFailure::DeferredTestFailure() + : lineNumber(-1) +{ + failureStr[0] = '\0'; +} + +DeferredTestFailure::DeferredTestFailure(int lineNumber_, const char* failureStr_) + : lineNumber(lineNumber_) +{ + std::strcpy(failureStr, failureStr_); +} + +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) +{ +} + +DeferredTestResult::~DeferredTestResult() +{ +} + +} + +#endif diff --git a/src/DeferredTestResult.h b/src/DeferredTestResult.h index e580d0c..6f56621 100644 --- a/src/DeferredTestResult.h +++ b/src/DeferredTestResult.h @@ -1,52 +1,52 @@ -#ifndef UNITTEST_DEFERREDTESTRESULT_H -#define UNITTEST_DEFERREDTESTRESULT_H - -#include "../config.h" -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "HelperMacros.h" -#include -#include - -namespace UnitTest -{ - -class UNITTEST_LINKAGE DeferredTestFailure -{ -public: - DeferredTestFailure(); - DeferredTestFailure(int lineNumber_, const char* failureStr_); - - int lineNumber; - char failureStr[1024]; -}; - -} - -UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestFailure); - -namespace UnitTest -{ - -class UNITTEST_LINKAGE DeferredTestResult -{ -public: - DeferredTestResult(); - DeferredTestResult(char const* suite, char const* test); - ~DeferredTestResult(); - - std::string suiteName; - std::string testName; - std::string failureFile; - - typedef std::vector< DeferredTestFailure > FailureVec; - FailureVec failures; - - float timeElapsed; - bool failed; -}; - -} - -#endif -#endif +#ifndef UNITTEST_DEFERREDTESTRESULT_H +#define UNITTEST_DEFERREDTESTRESULT_H + +#include "../config.h" +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "HelperMacros.h" +#include +#include + +namespace UnitTest +{ + +class UNITTEST_LINKAGE DeferredTestFailure +{ +public: + DeferredTestFailure(); + DeferredTestFailure(int lineNumber_, const char* failureStr_); + + int lineNumber; + char failureStr[1024]; +}; + +} + +UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestFailure); + +namespace UnitTest +{ + +class UNITTEST_LINKAGE DeferredTestResult +{ +public: + DeferredTestResult(); + DeferredTestResult(char const* suite, char const* test); + ~DeferredTestResult(); + + std::string suiteName; + std::string testName; + std::string failureFile; + + typedef std::vector< DeferredTestFailure > FailureVec; + FailureVec failures; + + float timeElapsed; + bool failed; +}; + +} + +#endif +#endif diff --git a/src/ExceptionMacros.h b/src/ExceptionMacros.h index 4ddf5ec..508150f 100644 --- a/src/ExceptionMacros.h +++ b/src/ExceptionMacros.h @@ -1,18 +1,18 @@ -#ifndef UNITTEST_EXCEPTIONMACROS_H -#define UNITTEST_EXCEPTIONMACROS_H - -#include "../config.h" - -#ifndef UNITTEST_NO_EXCEPTIONS - #define UT_TRY(x) try x - #define UT_THROW(x) throw x - #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody - #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody -#else - #define UT_TRY(x) x - #define UT_THROW(x) - #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) - #define UT_CATCH_ALL(CatchBody) -#endif - -#endif +#ifndef UNITTEST_EXCEPTIONMACROS_H +#define UNITTEST_EXCEPTIONMACROS_H + +#include "../config.h" + +#ifndef UNITTEST_NO_EXCEPTIONS + #define UT_TRY(x) try x + #define UT_THROW(x) throw x + #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody + #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody +#else + #define UT_TRY(x) x + #define UT_THROW(x) + #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) + #define UT_CATCH_ALL(CatchBody) +#endif + +#endif diff --git a/src/ExecuteTest.h b/src/ExecuteTest.h index 2f47013..d7abc90 100644 --- a/src/ExecuteTest.h +++ b/src/ExecuteTest.h @@ -1,59 +1,59 @@ -#ifndef UNITTEST_EXECUTE_TEST_H -#define UNITTEST_EXECUTE_TEST_H - -#include "../config.h" -#include "ExceptionMacros.h" -#include "TestDetails.h" -#include "TestResults.h" -#include "MemoryOutStream.h" -#include "AssertException.h" -#include "CurrentTest.h" - -#ifdef UNITTEST_NO_EXCEPTIONS - #include "ReportAssertImpl.h" -#endif - -#ifdef UNITTEST_POSIX - #include "Posix/SignalTranslator.h" -#endif - -namespace UnitTest { - -template< typename T > -void ExecuteTest(T& testObject, TestDetails const& details, bool isMockTest) -{ - if (isMockTest == false) - CurrentTest::Details() = &details; - -#ifdef UNITTEST_NO_EXCEPTIONS - if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0) - { -#endif -#ifndef UNITTEST_POSIX - UT_TRY({ testObject.RunImpl(); }) -#else - UT_TRY - ({ - UNITTEST_THROW_SIGNALS_POSIX_ONLY - testObject.RunImpl(); - }) -#endif - UT_CATCH(AssertException, e, { (void)e; }) - UT_CATCH(std::exception, e, - { - MemoryOutStream stream; - stream << "Unhandled exception: " << e.what(); - CurrentTest::Results()->OnTestFailure(details, stream.GetText()); - }) - UT_CATCH_ALL - ({ - CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed"); - }) -#ifdef UNITTEST_NO_EXCEPTIONS - } -#endif -} - -} - -#endif +#ifndef UNITTEST_EXECUTE_TEST_H +#define UNITTEST_EXECUTE_TEST_H + +#include "../config.h" +#include "ExceptionMacros.h" +#include "TestDetails.h" +#include "TestResults.h" +#include "MemoryOutStream.h" +#include "AssertException.h" +#include "CurrentTest.h" + +#ifdef UNITTEST_NO_EXCEPTIONS + #include "ReportAssertImpl.h" +#endif + +#ifdef UNITTEST_POSIX + #include "Posix/SignalTranslator.h" +#endif + +namespace UnitTest { + +template< typename T > +void ExecuteTest(T& testObject, TestDetails const& details, bool isMockTest) +{ + if (isMockTest == false) + CurrentTest::Details() = &details; + +#ifdef UNITTEST_NO_EXCEPTIONS + if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0) + { +#endif +#ifndef UNITTEST_POSIX + UT_TRY({ testObject.RunImpl(); }) +#else + UT_TRY + ({ + UNITTEST_THROW_SIGNALS_POSIX_ONLY + testObject.RunImpl(); + }) +#endif + UT_CATCH(AssertException, e, { (void)e; }) + UT_CATCH(std::exception, e, + { + MemoryOutStream stream; + stream << "Unhandled exception: " << e.what(); + CurrentTest::Results()->OnTestFailure(details, stream.GetText()); + }) + UT_CATCH_ALL + ({ + CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed"); + }) +#ifdef UNITTEST_NO_EXCEPTIONS + } +#endif +} + +} + +#endif diff --git a/src/HelperMacros.h b/src/HelperMacros.h index 68792da..67e57ed 100644 --- a/src/HelperMacros.h +++ b/src/HelperMacros.h @@ -1,52 +1,52 @@ -#ifndef UNITTEST_HELPERMACROS_H -#define UNITTEST_HELPERMACROS_H - -#include "../config.h" - -#define UNITTEST_MULTILINE_MACRO_BEGIN do { - -#ifdef UNITTEST_WIN32 - #define UNITTEST_MULTILINE_MACRO_END \ - } __pragma(warning(push)) __pragma(warning(disable:4127)) while (0) __pragma(warning(pop)) -#else - #define UNITTEST_MULTILINE_MACRO_END } while(0) -#endif - - -#ifdef UNITTEST_WIN32_DLL - #define UNITTEST_IMPORT __declspec(dllimport) - #define UNITTEST_EXPORT __declspec(dllexport) - - #ifdef UNITTEST_DLL_EXPORT - #define UNITTEST_LINKAGE UNITTEST_EXPORT - #define UNITTEST_IMPEXP_TEMPLATE - #else - #define UNITTEST_LINKAGE UNITTEST_IMPORT - #define UNITTEST_IMPEXP_TEMPLATE extern - #endif - - #define UNITTEST_STDVECTOR_LINKAGE(T) \ - __pragma(warning(push)) \ - __pragma(warning(disable:4231)) \ - UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ - UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ - __pragma(warning(pop)) -#else - #define UNITTEST_IMPORT - #define UNITTEST_EXPORT - #define UNITTEST_LINKAGE - #define UNITTEST_IMPEXP_TEMPLATE - #define UNITTEST_STDVECTOR_LINKAGE(T) -#endif - -#ifdef UNITTEST_WIN32 - #define UNITTEST_JMPBUF jmp_buf - #define UNITTEST_SETJMP setjmp - #define UNITTEST_LONGJMP longjmp -#elif defined UNITTEST_POSIX - #define UNITTEST_JMPBUF std::jmp_buf - #define UNITTEST_SETJMP setjmp - #define UNITTEST_LONGJMP std::longjmp -#endif - -#endif +#ifndef UNITTEST_HELPERMACROS_H +#define UNITTEST_HELPERMACROS_H + +#include "../config.h" + +#define UNITTEST_MULTILINE_MACRO_BEGIN do { + +#ifdef UNITTEST_WIN32 + #define UNITTEST_MULTILINE_MACRO_END \ + } __pragma(warning(push)) __pragma(warning(disable:4127)) while (0) __pragma(warning(pop)) +#else + #define UNITTEST_MULTILINE_MACRO_END } while(0) +#endif + + +#ifdef UNITTEST_WIN32_DLL + #define UNITTEST_IMPORT __declspec(dllimport) + #define UNITTEST_EXPORT __declspec(dllexport) + + #ifdef UNITTEST_DLL_EXPORT + #define UNITTEST_LINKAGE UNITTEST_EXPORT + #define UNITTEST_IMPEXP_TEMPLATE + #else + #define UNITTEST_LINKAGE UNITTEST_IMPORT + #define UNITTEST_IMPEXP_TEMPLATE extern + #endif + + #define UNITTEST_STDVECTOR_LINKAGE(T) \ + __pragma(warning(push)) \ + __pragma(warning(disable:4231)) \ + UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ + UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ + __pragma(warning(pop)) +#else + #define UNITTEST_IMPORT + #define UNITTEST_EXPORT + #define UNITTEST_LINKAGE + #define UNITTEST_IMPEXP_TEMPLATE + #define UNITTEST_STDVECTOR_LINKAGE(T) +#endif + +#ifdef UNITTEST_WIN32 + #define UNITTEST_JMPBUF jmp_buf + #define UNITTEST_SETJMP setjmp + #define UNITTEST_LONGJMP longjmp +#elif defined UNITTEST_POSIX + #define UNITTEST_JMPBUF std::jmp_buf + #define UNITTEST_SETJMP setjmp + #define UNITTEST_LONGJMP std::longjmp +#endif + +#endif diff --git a/src/MemoryOutStream.cpp b/src/MemoryOutStream.cpp index 1e1e97d..3bacb45 100644 --- a/src/MemoryOutStream.cpp +++ b/src/MemoryOutStream.cpp @@ -1,178 +1,178 @@ -#include "MemoryOutStream.h" - -#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - -namespace UnitTest { - -char const* MemoryOutStream::GetText() const -{ - m_text = this->str(); - return m_text.c_str(); -} - -void MemoryOutStream::Clear() -{ - this->str(std::string()); - m_text = this->str(); -} - -} - -#else - -#include -#include - -namespace UnitTest { - -namespace { - -template -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; -} - -void MemoryOutStream::Clear() -{ - m_buffer[0] = '\0'; -} - -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 <<(long long const n) -{ -#ifdef UNITTEST_WIN32 - FormatToStream(*this, "%I64d", n); -#else - FormatToStream(*this, "%lld", n); -#endif - - return *this; -} - -MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) -{ -#ifdef UNITTEST_WIN32 - FormatToStream(*this, "%I64u", n); -#else - FormatToStream(*this, "%llu", n); -#endif - - 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 +#include "MemoryOutStream.h" + +#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + +namespace UnitTest { + +char const* MemoryOutStream::GetText() const +{ + m_text = this->str(); + return m_text.c_str(); +} + +void MemoryOutStream::Clear() +{ + this->str(std::string()); + m_text = this->str(); +} + +} + +#else + +#include +#include + +namespace UnitTest { + +namespace { + +template +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; +} + +void MemoryOutStream::Clear() +{ + m_buffer[0] = '\0'; +} + +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 <<(long long const n) +{ +#ifdef UNITTEST_WIN32 + FormatToStream(*this, "%I64d", n); +#else + FormatToStream(*this, "%lld", n); +#endif + + return *this; +} + +MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) +{ +#ifdef UNITTEST_WIN32 + FormatToStream(*this, "%I64u", n); +#else + FormatToStream(*this, "%llu", n); +#endif + + 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/src/MemoryOutStream.h b/src/MemoryOutStream.h index 380826a..ef2c86f 100644 --- a/src/MemoryOutStream.h +++ b/src/MemoryOutStream.h @@ -1,73 +1,73 @@ -#ifndef UNITTEST_MEMORYOUTSTREAM_H -#define UNITTEST_MEMORYOUTSTREAM_H - -#include "../config.h" -#include "HelperMacros.h" - -#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - -#include - -namespace UnitTest -{ - -class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream -{ -public: - MemoryOutStream() {} - ~MemoryOutStream() {} - void Clear(); - char const* GetText() const; - -private: - MemoryOutStream(MemoryOutStream const&); - void operator =(MemoryOutStream const&); - - mutable std::string m_text; -}; - -} - -#else - -#include - -namespace UnitTest -{ - -class UNITTEST_LINKAGE MemoryOutStream -{ -public: - explicit MemoryOutStream(int const size = 256); - ~MemoryOutStream(); - - void Clear(); - char const* GetText() const; - - MemoryOutStream& operator <<(char const* txt); - MemoryOutStream& operator <<(int n); - MemoryOutStream& operator <<(long n); - MemoryOutStream& operator <<(long long n); - MemoryOutStream& operator <<(unsigned long n); - MemoryOutStream& operator <<(unsigned long 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 +#ifndef UNITTEST_MEMORYOUTSTREAM_H +#define UNITTEST_MEMORYOUTSTREAM_H + +#include "../config.h" +#include "HelperMacros.h" + +#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + +#include + +namespace UnitTest +{ + +class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream +{ +public: + MemoryOutStream() {} + ~MemoryOutStream() {} + void Clear(); + char const* GetText() const; + +private: + MemoryOutStream(MemoryOutStream const&); + void operator =(MemoryOutStream const&); + + mutable std::string m_text; +}; + +} + +#else + +#include + +namespace UnitTest +{ + +class UNITTEST_LINKAGE MemoryOutStream +{ +public: + explicit MemoryOutStream(int const size = 256); + ~MemoryOutStream(); + + void Clear(); + char const* GetText() const; + + MemoryOutStream& operator <<(char const* txt); + MemoryOutStream& operator <<(int n); + MemoryOutStream& operator <<(long n); + MemoryOutStream& operator <<(long long n); + MemoryOutStream& operator <<(unsigned long n); + MemoryOutStream& operator <<(unsigned long 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/src/Posix/SignalTranslator.cpp b/src/Posix/SignalTranslator.cpp index 014a771..3689c8c 100644 --- a/src/Posix/SignalTranslator.cpp +++ b/src/Posix/SignalTranslator.cpp @@ -1,46 +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; -} - - -} +#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/src/Posix/SignalTranslator.h b/src/Posix/SignalTranslator.h index 2152b9c..50da5f9 100644 --- a/src/Posix/SignalTranslator.h +++ b/src/Posix/SignalTranslator.h @@ -1,42 +1,42 @@ -#ifndef UNITTEST_SIGNALTRANSLATOR_H -#define UNITTEST_SIGNALTRANSLATOR_H - -#include -#include - -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_POSIX_ONLY \ - UnitTest::SignalTranslator sig; \ - if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ - throw ("Unhandled system exception"); - -} - -#endif +#ifndef UNITTEST_SIGNALTRANSLATOR_H +#define UNITTEST_SIGNALTRANSLATOR_H + +#include +#include + +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_POSIX_ONLY \ + UnitTest::SignalTranslator sig; \ + if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ + throw ("Unhandled system exception"); + +} + +#endif diff --git a/src/Posix/TimeHelpers.cpp b/src/Posix/TimeHelpers.cpp index 35e8136..65c6393 100644 --- a/src/Posix/TimeHelpers.cpp +++ b/src/Posix/TimeHelpers.cpp @@ -1,33 +1,33 @@ -#include "TimeHelpers.h" -#include - -namespace UnitTest { - -Timer::Timer() -{ - m_startTime.tv_sec = 0; - m_startTime.tv_usec = 0; -} - -void Timer::Start() -{ - gettimeofday(&m_startTime, 0); -} - -double Timer::GetTimeInMs() const -{ - struct timeval currentTime; - gettimeofday(¤tTime, 0); - - double const dsecs = currentTime.tv_sec - m_startTime.tv_sec; - double const dus = currentTime.tv_usec - m_startTime.tv_usec; - - return (dsecs * 1000.0) + (dus / 1000.0); -} - -void TimeHelpers::SleepMs(int ms) -{ - usleep(ms * 1000); -} - -} +#include "TimeHelpers.h" +#include + +namespace UnitTest { + +Timer::Timer() +{ + m_startTime.tv_sec = 0; + m_startTime.tv_usec = 0; +} + +void Timer::Start() +{ + gettimeofday(&m_startTime, 0); +} + +double Timer::GetTimeInMs() const +{ + struct timeval currentTime; + gettimeofday(¤tTime, 0); + + double const dsecs = currentTime.tv_sec - m_startTime.tv_sec; + double const dus = currentTime.tv_usec - m_startTime.tv_usec; + + return (dsecs * 1000.0) + (dus / 1000.0); +} + +void TimeHelpers::SleepMs(int ms) +{ + usleep(ms * 1000); +} + +} diff --git a/src/Posix/TimeHelpers.h b/src/Posix/TimeHelpers.h index 5a5bd79..0de4b1a 100644 --- a/src/Posix/TimeHelpers.h +++ b/src/Posix/TimeHelpers.h @@ -1,28 +1,28 @@ -#ifndef UNITTEST_TIMEHELPERS_H -#define UNITTEST_TIMEHELPERS_H - -#include - -namespace UnitTest { - -class Timer -{ -public: - Timer(); - void Start(); - double GetTimeInMs() const; - -private: - struct timeval m_startTime; -}; - - -namespace TimeHelpers -{ - void SleepMs(int ms); -} - - -} - -#endif +#ifndef UNITTEST_TIMEHELPERS_H +#define UNITTEST_TIMEHELPERS_H + +#include + +namespace UnitTest { + +class Timer +{ +public: + Timer(); + void Start(); + double GetTimeInMs() const; + +private: + struct timeval m_startTime; +}; + + +namespace TimeHelpers +{ + void SleepMs(int ms); +} + + +} + +#endif diff --git a/src/ReportAssert.cpp b/src/ReportAssert.cpp index c38a518..7a9a63a 100644 --- a/src/ReportAssert.cpp +++ b/src/ReportAssert.cpp @@ -1,70 +1,70 @@ -#include "ReportAssert.h" -#include "ReportAssertImpl.h" -#include "AssertException.h" -#include "CurrentTest.h" -#include "TestResults.h" -#include "TestDetails.h" - -#ifdef UNITTEST_NO_EXCEPTIONS - #include "ReportAssertImpl.h" -#endif - -namespace UnitTest { - -namespace -{ - bool& AssertExpectedFlag() - { - static bool s_assertExpected = false; - return s_assertExpected; - } -} - -UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber) -{ - Detail::ReportAssertEx(CurrentTest::Results(), CurrentTest::Details(), - description, filename, lineNumber); -} - -namespace Detail { - -#ifdef UNITTEST_NO_EXCEPTIONS -UNITTEST_JMPBUF* GetAssertJmpBuf() -{ - static UNITTEST_JMPBUF s_jmpBuf; - return &s_jmpBuf; -} -#endif - -UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, - const TestDetails* testDetails, - char const* description, - char const* filename, - int lineNumber) -{ - if (AssertExpectedFlag() == false) - { - TestDetails assertDetails(testDetails->testName, testDetails->suiteName, filename, lineNumber); - testResults->OnTestFailure(assertDetails, description); - } - - ExpectAssert(false); - -#ifndef UNITTEST_NO_EXCEPTIONS - throw AssertException(); -#else - UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); -#endif -} - -UNITTEST_LINKAGE void ExpectAssert(bool expected) -{ - AssertExpectedFlag() = expected; -} - -UNITTEST_LINKAGE bool AssertExpected() -{ - return AssertExpectedFlag(); -} - -}} +#include "ReportAssert.h" +#include "ReportAssertImpl.h" +#include "AssertException.h" +#include "CurrentTest.h" +#include "TestResults.h" +#include "TestDetails.h" + +#ifdef UNITTEST_NO_EXCEPTIONS + #include "ReportAssertImpl.h" +#endif + +namespace UnitTest { + +namespace +{ + bool& AssertExpectedFlag() + { + static bool s_assertExpected = false; + return s_assertExpected; + } +} + +UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber) +{ + Detail::ReportAssertEx(CurrentTest::Results(), CurrentTest::Details(), + description, filename, lineNumber); +} + +namespace Detail { + +#ifdef UNITTEST_NO_EXCEPTIONS +UNITTEST_JMPBUF* GetAssertJmpBuf() +{ + static UNITTEST_JMPBUF s_jmpBuf; + return &s_jmpBuf; +} +#endif + +UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, + const TestDetails* testDetails, + char const* description, + char const* filename, + int lineNumber) +{ + if (AssertExpectedFlag() == false) + { + TestDetails assertDetails(testDetails->testName, testDetails->suiteName, filename, lineNumber); + testResults->OnTestFailure(assertDetails, description); + } + + ExpectAssert(false); + +#ifndef UNITTEST_NO_EXCEPTIONS + throw AssertException(); +#else + UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); +#endif +} + +UNITTEST_LINKAGE void ExpectAssert(bool expected) +{ + AssertExpectedFlag() = expected; +} + +UNITTEST_LINKAGE bool AssertExpected() +{ + return AssertExpectedFlag(); +} + +}} diff --git a/src/ReportAssert.h b/src/ReportAssert.h index 7bdf7bb..0b5d6dd 100644 --- a/src/ReportAssert.h +++ b/src/ReportAssert.h @@ -1,12 +1,12 @@ -#ifndef UNITTEST_ASSERT_H -#define UNITTEST_ASSERT_H - -#include "HelperMacros.h" - -namespace UnitTest { - -UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber); - -} - -#endif +#ifndef UNITTEST_ASSERT_H +#define UNITTEST_ASSERT_H + +#include "HelperMacros.h" + +namespace UnitTest { + +UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber); + +} + +#endif diff --git a/src/ReportAssertImpl.h b/src/ReportAssertImpl.h index aefc78d..2f158c5 100644 --- a/src/ReportAssertImpl.h +++ b/src/ReportAssertImpl.h @@ -1,46 +1,46 @@ -#ifndef UNITTEST_REPORTASSERTIMPL_H -#define UNITTEST_REPORTASSERTIMPL_H - -#include "../config.h" -#include "HelperMacros.h" - -#ifdef UNITTEST_NO_EXCEPTIONS - #include -#endif - -namespace UnitTest { - -class TestResults; -class TestDetails; - -namespace Detail { - -UNITTEST_LINKAGE void ExpectAssert(bool expected); - -UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, - const TestDetails* testDetails, - char const* description, - char const* filename, - int lineNumber); - -UNITTEST_LINKAGE bool AssertExpected(); - -#ifdef UNITTEST_NO_EXCEPTIONS - UNITTEST_LINKAGE UNITTEST_JMPBUF* GetAssertJmpBuf(); - - #ifdef UNITTEST_WIN32 - #define UNITTEST_SET_ASSERT_JUMP_TARGET() \ - __pragma(warning(push)) __pragma(warning(disable:4611)) \ - UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) \ - __pragma(warning(pop)) - #else - #define UNITTEST_SET_ASSERT_JUMP_TARGET() UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) - #endif - - #define UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET() UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), 1) -#endif - -} -} - -#endif +#ifndef UNITTEST_REPORTASSERTIMPL_H +#define UNITTEST_REPORTASSERTIMPL_H + +#include "../config.h" +#include "HelperMacros.h" + +#ifdef UNITTEST_NO_EXCEPTIONS + #include +#endif + +namespace UnitTest { + +class TestResults; +class TestDetails; + +namespace Detail { + +UNITTEST_LINKAGE void ExpectAssert(bool expected); + +UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, + const TestDetails* testDetails, + char const* description, + char const* filename, + int lineNumber); + +UNITTEST_LINKAGE bool AssertExpected(); + +#ifdef UNITTEST_NO_EXCEPTIONS + UNITTEST_LINKAGE UNITTEST_JMPBUF* GetAssertJmpBuf(); + + #ifdef UNITTEST_WIN32 + #define UNITTEST_SET_ASSERT_JUMP_TARGET() \ + __pragma(warning(push)) __pragma(warning(disable:4611)) \ + UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) \ + __pragma(warning(pop)) + #else + #define UNITTEST_SET_ASSERT_JUMP_TARGET() UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) + #endif + + #define UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET() UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), 1) +#endif + +} +} + +#endif diff --git a/src/Test.cpp b/src/Test.cpp index eaab9aa..352ba7e 100644 --- a/src/Test.cpp +++ b/src/Test.cpp @@ -1,42 +1,42 @@ -#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) - , m_nextTest(0) - , m_timeConstraintExempt(false) - , m_isMockTest(false) -{ -} - -Test::~Test() -{ -} - -void Test::Run() -{ - ExecuteTest(*this, m_details, m_isMockTest); -} - -void Test::RunImpl() const -{ -} - -} +#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) + , m_nextTest(0) + , m_timeConstraintExempt(false) + , m_isMockTest(false) +{ +} + +Test::~Test() +{ +} + +void Test::Run() +{ + ExecuteTest(*this, m_details, m_isMockTest); +} + +void Test::RunImpl() const +{ +} + +} diff --git a/src/Test.h b/src/Test.h index 1e1dbb2..f51d8e8 100644 --- a/src/Test.h +++ b/src/Test.h @@ -1,35 +1,35 @@ -#ifndef UNITTEST_TEST_H -#define UNITTEST_TEST_H - -#include "TestDetails.h" - -namespace UnitTest { - -class TestResults; -class TestList; - -class UNITTEST_LINKAGE 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* m_nextTest; - mutable bool m_timeConstraintExempt; - mutable bool m_isMockTest; - - static TestList& GetTestList(); - - virtual void RunImpl() const; - -private: - Test(Test const&); - Test& operator =(Test const&); -}; - - -} - -#endif +#ifndef UNITTEST_TEST_H +#define UNITTEST_TEST_H + +#include "TestDetails.h" + +namespace UnitTest { + +class TestResults; +class TestList; + +class UNITTEST_LINKAGE 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* m_nextTest; + mutable bool m_timeConstraintExempt; + mutable bool m_isMockTest; + + static TestList& GetTestList(); + + virtual void RunImpl() const; + +private: + Test(Test const&); + Test& operator =(Test const&); +}; + + +} + +#endif diff --git a/src/TestDetails.cpp b/src/TestDetails.cpp index fdd7d1d..a13a168 100644 --- a/src/TestDetails.cpp +++ b/src/TestDetails.cpp @@ -1,22 +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_) -{ -} - - -} +#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/src/TestDetails.h b/src/TestDetails.h index 898f7f3..50b630c 100644 --- a/src/TestDetails.h +++ b/src/TestDetails.h @@ -1,26 +1,26 @@ -#ifndef UNITTEST_TESTDETAILS_H -#define UNITTEST_TESTDETAILS_H - -#include "HelperMacros.h" - -namespace UnitTest { - -class UNITTEST_LINKAGE 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 +#ifndef UNITTEST_TESTDETAILS_H +#define UNITTEST_TESTDETAILS_H + +#include "HelperMacros.h" + +namespace UnitTest { + +class UNITTEST_LINKAGE 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/src/TestList.cpp b/src/TestList.cpp index 38fbfec..4583cbb 100644 --- a/src/TestList.cpp +++ b/src/TestList.cpp @@ -1,39 +1,39 @@ -#include "TestList.h" -#include "Test.h" - -#include - -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->m_nextTest = test; - m_tail = test; - } -} - -Test* TestList::GetHead() const -{ - return m_head; -} - -ListAdder::ListAdder(TestList& list, Test* test) -{ - list.Add(test); -} - -} +#include "TestList.h" +#include "Test.h" + +#include + +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->m_nextTest = test; + m_tail = test; + } +} + +Test* TestList::GetHead() const +{ + return m_head; +} + +ListAdder::ListAdder(TestList& list, Test* test) +{ + list.Add(test); +} + +} diff --git a/src/TestList.h b/src/TestList.h index ed190c2..a001d3f 100644 --- a/src/TestList.h +++ b/src/TestList.h @@ -1,33 +1,33 @@ -#ifndef UNITTEST_TESTLIST_H -#define UNITTEST_TESTLIST_H - -#include "HelperMacros.h" - -namespace UnitTest { - -class Test; - -class UNITTEST_LINKAGE TestList -{ -public: - TestList(); - void Add (Test* test); - - Test* GetHead() const; - -private: - Test* m_head; - Test* m_tail; -}; - - -class UNITTEST_LINKAGE ListAdder -{ -public: - ListAdder(TestList& list, Test* test); -}; - -} - - -#endif +#ifndef UNITTEST_TESTLIST_H +#define UNITTEST_TESTLIST_H + +#include "HelperMacros.h" + +namespace UnitTest { + +class Test; + +class UNITTEST_LINKAGE TestList +{ +public: + TestList(); + void Add (Test* test); + + Test* GetHead() const; + +private: + Test* m_head; + Test* m_tail; +}; + + +class UNITTEST_LINKAGE ListAdder +{ +public: + ListAdder(TestList& list, Test* test); +}; + +} + + +#endif diff --git a/src/TestMacros.h b/src/TestMacros.h index 931d8e7..92b11a4 100644 --- a/src/TestMacros.h +++ b/src/TestMacros.h @@ -1,117 +1,117 @@ -#ifndef UNITTEST_TESTMACROS_H -#define UNITTEST_TESTMACROS_H - -#include "../config.h" -#include "TestSuite.h" -#include "ExceptionMacros.h" -#include "ExecuteTest.h" -#include "AssertException.h" -#include "TestDetails.h" -#include "MemoryOutStream.h" - -#ifndef UNITTEST_POSIX - #define UNITTEST_THROW_SIGNALS_POSIX_ONLY -#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 \ - { \ - volatile bool ctorOk = false; \ - UT_TRY \ - ({ \ - Fixture##Name##Helper fixtureHelper(m_details); \ - ctorOk = true; \ - UnitTest::ExecuteTest(fixtureHelper, m_details, false); \ - }) \ - UT_CATCH (UnitTest::AssertException, e, \ - { \ - (void)e; \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream stream; \ - stream << "Unhandled exception: " << e.what(); \ - UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - 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 +#ifndef UNITTEST_TESTMACROS_H +#define UNITTEST_TESTMACROS_H + +#include "../config.h" +#include "TestSuite.h" +#include "ExceptionMacros.h" +#include "ExecuteTest.h" +#include "AssertException.h" +#include "TestDetails.h" +#include "MemoryOutStream.h" + +#ifndef UNITTEST_POSIX + #define UNITTEST_THROW_SIGNALS_POSIX_ONLY +#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 \ + { \ + volatile bool ctorOk = false; \ + UT_TRY \ + ({ \ + Fixture##Name##Helper fixtureHelper(m_details); \ + ctorOk = true; \ + UnitTest::ExecuteTest(fixtureHelper, m_details, false); \ + }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + (void)e; \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream stream; \ + stream << "Unhandled exception: " << e.what(); \ + UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + 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/src/TestReporter.cpp b/src/TestReporter.cpp index 78c765f..acfca3e 100644 --- a/src/TestReporter.cpp +++ b/src/TestReporter.cpp @@ -1,9 +1,9 @@ -#include "TestReporter.h" - -namespace UnitTest { - -TestReporter::~TestReporter() -{ -} - -} +#include "TestReporter.h" + +namespace UnitTest { + +TestReporter::~TestReporter() +{ +} + +} diff --git a/src/TestReporter.h b/src/TestReporter.h index 99bfaa6..2100524 100644 --- a/src/TestReporter.h +++ b/src/TestReporter.h @@ -1,22 +1,22 @@ -#ifndef UNITTEST_TESTREPORTER_H -#define UNITTEST_TESTREPORTER_H - -#include "HelperMacros.h" - -namespace UnitTest { - -class TestDetails; - -class UNITTEST_LINKAGE 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 +#ifndef UNITTEST_TESTREPORTER_H +#define UNITTEST_TESTREPORTER_H + +#include "HelperMacros.h" + +namespace UnitTest { + +class TestDetails; + +class UNITTEST_LINKAGE 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/src/TestReporterStdout.cpp b/src/TestReporterStdout.cpp index cd2c131..1538570 100644 --- a/src/TestReporterStdout.cpp +++ b/src/TestReporterStdout.cpp @@ -1,46 +1,46 @@ -#include "TestReporterStdout.h" -#include - -#include "TestDetails.h" - -// cstdio doesn't pull in namespace std on VC6, so we do it here. -#if defined(UNITTEST_WIN32) && (_MSC_VER == 1200) - namespace std {} -#endif - -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); -} - -} +#include "TestReporterStdout.h" +#include + +#include "TestDetails.h" + +// cstdio doesn't pull in namespace std on VC6, so we do it here. +#if defined(UNITTEST_WIN32) && (_MSC_VER == 1200) + namespace std {} +#endif + +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/src/TestReporterStdout.h b/src/TestReporterStdout.h index 4f52f8a..e8d7bbf 100644 --- a/src/TestReporterStdout.h +++ b/src/TestReporterStdout.h @@ -1,19 +1,19 @@ -#ifndef UNITTEST_TESTREPORTERSTDOUT_H -#define UNITTEST_TESTREPORTERSTDOUT_H - -#include "TestReporter.h" - -namespace UnitTest { - -class UNITTEST_LINKAGE 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 +#ifndef UNITTEST_TESTREPORTERSTDOUT_H +#define UNITTEST_TESTREPORTERSTDOUT_H + +#include "TestReporter.h" + +namespace UnitTest { + +class UNITTEST_LINKAGE 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/src/TestResults.cpp b/src/TestResults.cpp index 2368e20..b3b67c0 100644 --- a/src/TestResults.cpp +++ b/src/TestResults.cpp @@ -1,60 +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; -} - - -} +#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/src/TestResults.h b/src/TestResults.h index d4006a0..a24aaf5 100644 --- a/src/TestResults.h +++ b/src/TestResults.h @@ -1,38 +1,38 @@ -#ifndef UNITTEST_TESTRESULTS_H -#define UNITTEST_TESTRESULTS_H - -#include "HelperMacros.h" - -namespace UnitTest { - -class TestReporter; -class TestDetails; - -class UNITTEST_LINKAGE 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 +#ifndef UNITTEST_TESTRESULTS_H +#define UNITTEST_TESTRESULTS_H + +#include "HelperMacros.h" + +namespace UnitTest { + +class TestReporter; +class TestDetails; + +class UNITTEST_LINKAGE 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/src/TestRunner.cpp b/src/TestRunner.cpp index 108348e..10f47e4 100644 --- a/src/TestRunner.cpp +++ b/src/TestRunner.cpp @@ -1,82 +1,82 @@ -#include "TestRunner.h" -#include "TestResults.h" -#include "TestReporter.h" -#include "TestReporterStdout.h" -#include "TimeHelpers.h" -#include "MemoryOutStream.h" - -#include - - -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; -} - -TestResults* TestRunner::GetTestResults() -{ - return m_result; -} - -int TestRunner::Finish() const -{ - float const secondsElapsed = static_cast(m_timer->GetTimeInMs() / 1000.0); - 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 -{ - if (curTest->m_isMockTest == false) - CurrentTest::Results() = result; - - Timer testTimer; - testTimer.Start(); - - result->OnTestStart(curTest->m_details); - - curTest->Run(); - - double 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, static_cast< float >(testTimeInMs / 1000.0)); -} - -} +#include "TestRunner.h" +#include "TestResults.h" +#include "TestReporter.h" +#include "TestReporterStdout.h" +#include "TimeHelpers.h" +#include "MemoryOutStream.h" + +#include + + +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; +} + +TestResults* TestRunner::GetTestResults() +{ + return m_result; +} + +int TestRunner::Finish() const +{ + float const secondsElapsed = static_cast(m_timer->GetTimeInMs() / 1000.0); + 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 +{ + if (curTest->m_isMockTest == false) + CurrentTest::Results() = result; + + Timer testTimer; + testTimer.Start(); + + result->OnTestStart(curTest->m_details); + + curTest->Run(); + + double 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, static_cast< float >(testTimeInMs / 1000.0)); +} + +} diff --git a/src/TestRunner.h b/src/TestRunner.h index 0253ae2..f88b9cc 100644 --- a/src/TestRunner.h +++ b/src/TestRunner.h @@ -1,61 +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; - -UNITTEST_LINKAGE int RunAllTests(); - -struct True -{ - bool operator()(const Test* const) const - { - return true; - } -}; - -class UNITTEST_LINKAGE 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->m_nextTest; - } - - return Finish(); - } - - TestResults* GetTestResults(); - -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 +#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; + +UNITTEST_LINKAGE int RunAllTests(); + +struct True +{ + bool operator()(const Test* const) const + { + return true; + } +}; + +class UNITTEST_LINKAGE 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->m_nextTest; + } + + return Finish(); + } + + TestResults* GetTestResults(); + +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/src/TestSuite.h b/src/TestSuite.h index 02067fd..2812d8c 100644 --- a/src/TestSuite.h +++ b/src/TestSuite.h @@ -1,12 +1,12 @@ -#ifndef UNITTEST_TESTSUITE_H -#define UNITTEST_TESTSUITE_H - -namespace UnitTestSuite -{ - inline char const* GetSuiteName () - { - return "DefaultSuite"; - } -} - -#endif +#ifndef UNITTEST_TESTSUITE_H +#define UNITTEST_TESTSUITE_H + +namespace UnitTestSuite +{ + inline char const* GetSuiteName () + { + return "DefaultSuite"; + } +} + +#endif diff --git a/src/TimeConstraint.cpp b/src/TimeConstraint.cpp index 89f1b87..1c12d83 100644 --- a/src/TimeConstraint.cpp +++ b/src/TimeConstraint.cpp @@ -1,29 +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() -{ - double 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."; - - CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); - } -} - -} +#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() +{ + double 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."; + + CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); + } +} + +} diff --git a/src/TimeConstraint.h b/src/TimeConstraint.h index fe14461..a73057c 100644 --- a/src/TimeConstraint.h +++ b/src/TimeConstraint.h @@ -1,37 +1,37 @@ -#ifndef UNITTEST_TIMECONSTRAINT_H -#define UNITTEST_TIMECONSTRAINT_H - -#include "TimeHelpers.h" -#include "HelperMacros.h" - -namespace UnitTest { - -class TestResults; -class TestDetails; - -class UNITTEST_LINKAGE 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() \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - m_timeConstraintExempt = true; \ - UNITTEST_MULTILINE_MACRO_END - -} - -#endif +#ifndef UNITTEST_TIMECONSTRAINT_H +#define UNITTEST_TIMECONSTRAINT_H + +#include "TimeHelpers.h" +#include "HelperMacros.h" + +namespace UnitTest { + +class TestResults; +class TestDetails; + +class UNITTEST_LINKAGE 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() \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + m_timeConstraintExempt = true; \ + UNITTEST_MULTILINE_MACRO_END + +} + +#endif diff --git a/src/TimeHelpers.h b/src/TimeHelpers.h index 24f0efd..bb5a31a 100644 --- a/src/TimeHelpers.h +++ b/src/TimeHelpers.h @@ -1,7 +1,7 @@ -#include "../config.h" - -#if defined UNITTEST_POSIX - #include "Posix/TimeHelpers.h" -#else - #include "Win32/TimeHelpers.h" -#endif +#include "../config.h" + +#if defined UNITTEST_POSIX + #include "Posix/TimeHelpers.h" +#else + #include "Win32/TimeHelpers.h" +#endif diff --git a/src/Win32/TimeHelpers.cpp b/src/Win32/TimeHelpers.cpp index 1b39cab..aa97b89 100644 --- a/src/Win32/TimeHelpers.cpp +++ b/src/Win32/TimeHelpers.cpp @@ -1,49 +1,49 @@ -#include "TimeHelpers.h" - -#define WIN32_LEAN_AND_MEAN -#include - -namespace UnitTest { - -Timer::Timer() - : m_threadHandle(::GetCurrentThread()) - , m_startTime(0) -{ -#if defined(UNITTEST_WIN32) && (_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(); -} - -double Timer::GetTimeInMs() const -{ - __int64 const elapsedTime = GetTime() - m_startTime; - double const seconds = double(elapsedTime) / double(m_frequency); - return seconds * 1000.0; -} - -__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 ms) -{ - ::Sleep(ms); -} - -} +#include "TimeHelpers.h" + +#define WIN32_LEAN_AND_MEAN +#include + +namespace UnitTest { + +Timer::Timer() + : m_threadHandle(::GetCurrentThread()) + , m_startTime(0) +{ +#if defined(UNITTEST_WIN32) && (_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(); +} + +double Timer::GetTimeInMs() const +{ + __int64 const elapsedTime = GetTime() - m_startTime; + double const seconds = double(elapsedTime) / double(m_frequency); + return seconds * 1000.0; +} + +__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 ms) +{ + ::Sleep(ms); +} + +} diff --git a/src/Win32/TimeHelpers.h b/src/Win32/TimeHelpers.h index 80c9118..4fb1b43 100644 --- a/src/Win32/TimeHelpers.h +++ b/src/Win32/TimeHelpers.h @@ -1,45 +1,45 @@ -#ifndef UNITTEST_TIMEHELPERS_H -#define UNITTEST_TIMEHELPERS_H - -#include "../../config.h" -#include "../HelperMacros.h" - -#ifdef UNITTEST_MINGW - #ifndef __int64 - #define __int64 long long - #endif -#endif - -namespace UnitTest { - -class UNITTEST_LINKAGE Timer -{ -public: - Timer(); - void Start(); - double 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 -{ - UNITTEST_LINKAGE void SleepMs(int ms); -} - -} - -#endif +#ifndef UNITTEST_TIMEHELPERS_H +#define UNITTEST_TIMEHELPERS_H + +#include "../../config.h" +#include "../HelperMacros.h" + +#ifdef UNITTEST_MINGW + #ifndef __int64 + #define __int64 long long + #endif +#endif + +namespace UnitTest { + +class UNITTEST_LINKAGE Timer +{ +public: + Timer(); + void Start(); + double 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 +{ + UNITTEST_LINKAGE void SleepMs(int ms); +} + +} + +#endif diff --git a/src/XmlTestReporter.cpp b/src/XmlTestReporter.cpp index 09f0f24..c5e858b 100644 --- a/src/XmlTestReporter.cpp +++ b/src/XmlTestReporter.cpp @@ -1,131 +1,131 @@ -#include "../config.h" -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "XmlTestReporter.h" - -#include -#include -#include - -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, '&', "&"); - ReplaceChar(escaped, '<', "<"); - ReplaceChar(escaped, '>', ">"); - ReplaceChar(escaped, '\'', "'"); - ReplaceChar(escaped, '\"', """); - - 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 << ""; -} - -void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, - int failureCount, float secondsElapsed) -{ - os << ""; -} - -void XmlTestReporter::EndResults(std::ostream& os) -{ - os << ""; -} - -void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result) -{ - os << ""; - else - os << "/>"; -} - -void XmlTestReporter::AddFailure(std::ostream& os, DeferredTestResult const& result) -{ - os << ">"; // close element - - for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); - it != result.failures.end(); - ++it) - { - string const escapedMessage = XmlEscape(std::string(it->failureStr)); - string const message = BuildFailureMessage(result.failureFile, it->lineNumber, escapedMessage); - - os << ""; - } -} - -} - -#endif +#include "../config.h" +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "XmlTestReporter.h" + +#include +#include +#include + +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, '&', "&"); + ReplaceChar(escaped, '<', "<"); + ReplaceChar(escaped, '>', ">"); + ReplaceChar(escaped, '\'', "'"); + ReplaceChar(escaped, '\"', """); + + 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 << ""; +} + +void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, + int failureCount, float secondsElapsed) +{ + os << ""; +} + +void XmlTestReporter::EndResults(std::ostream& os) +{ + os << ""; +} + +void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result) +{ + os << ""; + else + os << "/>"; +} + +void XmlTestReporter::AddFailure(std::ostream& os, DeferredTestResult const& result) +{ + os << ">"; // close element + + for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); + it != result.failures.end(); + ++it) + { + string const escapedMessage = XmlEscape(std::string(it->failureStr)); + string const message = BuildFailureMessage(result.failureFile, it->lineNumber, escapedMessage); + + os << ""; + } +} + +} + +#endif diff --git a/src/XmlTestReporter.h b/src/XmlTestReporter.h index 2adf298..0c3441c 100644 --- a/src/XmlTestReporter.h +++ b/src/XmlTestReporter.h @@ -1,38 +1,38 @@ -#ifndef UNITTEST_XMLTESTREPORTER_H -#define UNITTEST_XMLTESTREPORTER_H - -#include "../config.h" -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "DeferredTestReporter.h" - -#include - -namespace UnitTest -{ - -class UNITTEST_LINKAGE 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 -#endif +#ifndef UNITTEST_XMLTESTREPORTER_H +#define UNITTEST_XMLTESTREPORTER_H + +#include "../config.h" +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "DeferredTestReporter.h" + +#include + +namespace UnitTest +{ + +class UNITTEST_LINKAGE 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 +#endif diff --git a/src/tests/Main.cpp b/src/tests/Main.cpp index 963ad7b..47de7db 100644 --- a/src/tests/Main.cpp +++ b/src/tests/Main.cpp @@ -1,6 +1,6 @@ -#include "../../unittestpp.h" - -int main(int, char const *[]) -{ - return UnitTest::RunAllTests(); -} +#include "../../unittestpp.h" + +int main(int, char const *[]) +{ + return UnitTest::RunAllTests(); +} diff --git a/src/tests/RecordingReporter.h b/src/tests/RecordingReporter.h index df46fdf..982c294 100644 --- a/src/tests/RecordingReporter.h +++ b/src/tests/RecordingReporter.h @@ -1,98 +1,98 @@ -#ifndef UNITTEST_RECORDINGREPORTER_H -#define UNITTEST_RECORDINGREPORTER_H - -#include "../TestReporter.h" -#include - -#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 +#ifndef UNITTEST_RECORDINGREPORTER_H +#define UNITTEST_RECORDINGREPORTER_H + +#include "../TestReporter.h" +#include + +#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/src/tests/ScopedCurrentTest.h b/src/tests/ScopedCurrentTest.h index 68ae7f5..e03ae0a 100644 --- a/src/tests/ScopedCurrentTest.h +++ b/src/tests/ScopedCurrentTest.h @@ -1,37 +1,37 @@ -#ifndef UNITTEST_SCOPEDCURRENTTEST_H -#define UNITTEST_SCOPEDCURRENTTEST_H - -#include "../CurrentTest.h" -#include - -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 +#ifndef UNITTEST_SCOPEDCURRENTTEST_H +#define UNITTEST_SCOPEDCURRENTTEST_H + +#include "../CurrentTest.h" +#include + +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/src/tests/TestAssertHandler.cpp b/src/tests/TestAssertHandler.cpp index 3b28c5f..6caba43 100644 --- a/src/tests/TestAssertHandler.cpp +++ b/src/tests/TestAssertHandler.cpp @@ -1,136 +1,136 @@ -#include "../../config.h" -#include "../../unittestpp.h" - -#include "../ReportAssert.h" -#include "../ReportAssertImpl.h" -#include "../AssertException.h" - -#include "RecordingReporter.h" -#include - -using namespace UnitTest; - -namespace { - -TEST(CanSetAssertExpected) -{ - Detail::ExpectAssert(true); - CHECK(Detail::AssertExpected()); - - Detail::ExpectAssert(false); - CHECK(!Detail::AssertExpected()); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -TEST(ReportAssertThrowsAssertException) -{ - bool caught = false; - - try - { - TestResults testResults; - TestDetails testDetails("", "", "", 0); - Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); - } - catch(AssertException const&) - { - caught = true; - } - - CHECK(true == caught); -} - -TEST(ReportAssertClearsExpectAssertFlag) -{ - RecordingReporter reporter; - TestResults testResults(&reporter); - TestDetails testDetails("", "", "", 0); - - try - { - Detail::ExpectAssert(true); - Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); - } - catch(AssertException const&) - { - } - - CHECK(Detail::AssertExpected() == false); - CHECK_EQUAL(0, reporter.testFailedCount); -} - -TEST(ReportAssertWritesFailureToResultsAndDetailsWhenAssertIsNotExpected) -{ - const int lineNumber = 12345; - const char* description = "description"; - const char* filename = "filename"; - - RecordingReporter reporter; - TestResults testResults(&reporter); - TestDetails testDetails("", "", "", 0); - - try - { - Detail::ReportAssertEx(&testResults, &testDetails, description, filename, lineNumber); - } - catch(AssertException const&) - { - } - - CHECK_EQUAL(description, reporter.lastFailedMessage); - CHECK_EQUAL(filename, reporter.lastFailedFile); - CHECK_EQUAL(lineNumber, reporter.lastFailedLine); -} - -TEST(ReportAssertReportsNoErrorsWhenAssertIsExpected) -{ - Detail::ExpectAssert(true); - - RecordingReporter reporter; - TestResults testResults(&reporter); - TestDetails testDetails("", "", "", 0); - - try - { - Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); - } - catch(AssertException const&) - { - } - - CHECK_EQUAL(0, reporter.testFailedCount); -} - -TEST(CheckAssertMacroSetsAssertExpectationToFalseAfterRunning) -{ - Detail::ExpectAssert(true); - CHECK_ASSERT(ReportAssert("", "", 0)); - CHECK(!Detail::AssertExpected()); - Detail::ExpectAssert(false); -} - -#else - -TEST(SetAssertJumpTargetReturnsFalseWhenSettingJumpTarget) -{ - CHECK(UNITTEST_SET_ASSERT_JUMP_TARGET() == false); -} - -TEST(JumpToAssertJumpTarget_JumpsToSetPoint_ReturnsTrue) -{ - const volatile bool taken = !!UNITTEST_SET_ASSERT_JUMP_TARGET(); - - volatile bool set = false; - if (taken == false) - { - UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); - set = true; - } - - CHECK(set == false); -} - -#endif - -} +#include "../../config.h" +#include "../../unittestpp.h" + +#include "../ReportAssert.h" +#include "../ReportAssertImpl.h" +#include "../AssertException.h" + +#include "RecordingReporter.h" +#include + +using namespace UnitTest; + +namespace { + +TEST(CanSetAssertExpected) +{ + Detail::ExpectAssert(true); + CHECK(Detail::AssertExpected()); + + Detail::ExpectAssert(false); + CHECK(!Detail::AssertExpected()); +} + +#ifndef UNITTEST_NO_EXCEPTIONS + +TEST(ReportAssertThrowsAssertException) +{ + bool caught = false; + + try + { + TestResults testResults; + TestDetails testDetails("", "", "", 0); + Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); + } + catch(AssertException const&) + { + caught = true; + } + + CHECK(true == caught); +} + +TEST(ReportAssertClearsExpectAssertFlag) +{ + RecordingReporter reporter; + TestResults testResults(&reporter); + TestDetails testDetails("", "", "", 0); + + try + { + Detail::ExpectAssert(true); + Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); + } + catch(AssertException const&) + { + } + + CHECK(Detail::AssertExpected() == false); + CHECK_EQUAL(0, reporter.testFailedCount); +} + +TEST(ReportAssertWritesFailureToResultsAndDetailsWhenAssertIsNotExpected) +{ + const int lineNumber = 12345; + const char* description = "description"; + const char* filename = "filename"; + + RecordingReporter reporter; + TestResults testResults(&reporter); + TestDetails testDetails("", "", "", 0); + + try + { + Detail::ReportAssertEx(&testResults, &testDetails, description, filename, lineNumber); + } + catch(AssertException const&) + { + } + + CHECK_EQUAL(description, reporter.lastFailedMessage); + CHECK_EQUAL(filename, reporter.lastFailedFile); + CHECK_EQUAL(lineNumber, reporter.lastFailedLine); +} + +TEST(ReportAssertReportsNoErrorsWhenAssertIsExpected) +{ + Detail::ExpectAssert(true); + + RecordingReporter reporter; + TestResults testResults(&reporter); + TestDetails testDetails("", "", "", 0); + + try + { + Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); + } + catch(AssertException const&) + { + } + + CHECK_EQUAL(0, reporter.testFailedCount); +} + +TEST(CheckAssertMacroSetsAssertExpectationToFalseAfterRunning) +{ + Detail::ExpectAssert(true); + CHECK_ASSERT(ReportAssert("", "", 0)); + CHECK(!Detail::AssertExpected()); + Detail::ExpectAssert(false); +} + +#else + +TEST(SetAssertJumpTargetReturnsFalseWhenSettingJumpTarget) +{ + CHECK(UNITTEST_SET_ASSERT_JUMP_TARGET() == false); +} + +TEST(JumpToAssertJumpTarget_JumpsToSetPoint_ReturnsTrue) +{ + const volatile bool taken = !!UNITTEST_SET_ASSERT_JUMP_TARGET(); + + volatile bool set = false; + if (taken == false) + { + UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); + set = true; + } + + CHECK(set == false); +} + +#endif + +} diff --git a/src/tests/TestCheckMacros.cpp b/src/tests/TestCheckMacros.cpp index 6b9fb66..c6c727b 100644 --- a/src/tests/TestCheckMacros.cpp +++ b/src/tests/TestCheckMacros.cpp @@ -1,518 +1,518 @@ -#include "../../unittestpp.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")); -} - -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(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); -} - -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(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(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); -} - -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(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(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); -} - -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); -} - -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(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")); -} - -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); -} - -} +#include "../../unittestpp.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")); +} + +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(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); +} + +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(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(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); +} + +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(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(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); +} + +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); +} + +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(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")); +} + +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/src/tests/TestChecks.cpp b/src/tests/TestChecks.cpp index 10b3071..110102a 100644 --- a/src/tests/TestChecks.cpp +++ b/src/tests/TestChecks.cpp @@ -1,291 +1,291 @@ -#include "../../unittestpp.h" -#include "RecordingReporter.h" - -#include - -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) -{ - const unsigned int bitpattern = 0xFFFFFFFF; - float nan; - std::memcpy(&nan, &bitpattern, sizeof(bitpattern)); - - TestResults results; - CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0)); - CHECK_EQUAL(1, results.GetFailureCount()); -} - -TEST(CheckCloseWithNaNAgainstItselfFails) -{ - const unsigned int bitpattern = 0xFFFFFFFF; - float nan; - std::memcpy(&nan, &bitpattern, sizeof(bitpattern)); - - 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); -} - -} +#include "../../unittestpp.h" +#include "RecordingReporter.h" + +#include + +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) +{ + const unsigned int bitpattern = 0xFFFFFFFF; + float nan; + std::memcpy(&nan, &bitpattern, sizeof(bitpattern)); + + TestResults results; + CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0)); + CHECK_EQUAL(1, results.GetFailureCount()); +} + +TEST(CheckCloseWithNaNAgainstItselfFails) +{ + const unsigned int bitpattern = 0xFFFFFFFF; + float nan; + std::memcpy(&nan, &bitpattern, sizeof(bitpattern)); + + 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/src/tests/TestCompositeTestReporter.cpp b/src/tests/TestCompositeTestReporter.cpp index d302577..c3d6a24 100644 --- a/src/tests/TestCompositeTestReporter.cpp +++ b/src/tests/TestCompositeTestReporter.cpp @@ -1,176 +1,176 @@ -#include "../../unittestpp.h" -#include "../CompositeTestReporter.h" - -using namespace UnitTest; - -namespace { - -TEST(ZeroReportersByDefault) -{ - CHECK_EQUAL(0, CompositeTestReporter().GetReporterCount()); -} - -struct MockReporter : TestReporter -{ - MockReporter() - : testStartCalled(false) - , testStartDetails(NULL) - , failureCalled(false) - , failureDetails(NULL) - , failureStr(NULL) - , testFinishCalled(false) - , testFinishDetails(NULL) - , testFinishSecondsElapsed(-1.0f) - , summaryCalled(false) - , summaryTotalTestCount(-1) - , summaryFailureCount(-1) - , summarySecondsElapsed(-1.0f) - { - } - - virtual void ReportTestStart(TestDetails const& test) - { - testStartCalled = true; - testStartDetails = &test; - } - - virtual void ReportFailure(TestDetails const& test, char const* failure) - { - failureCalled = true; - failureDetails = &test; - failureStr = failure; - } - - virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed) - { - testFinishCalled = true; - testFinishDetails = &test; - testFinishSecondsElapsed = secondsElapsed; - } - - virtual void ReportSummary(int totalTestCount, - int failedTestCount, - int failureCount, - float secondsElapsed) - { - summaryCalled = true; - summaryTotalTestCount = totalTestCount; - summaryFailedTestCount = failedTestCount; - summaryFailureCount = failureCount; - summarySecondsElapsed = secondsElapsed; - } - - bool testStartCalled; - TestDetails const* testStartDetails; - - bool failureCalled; - TestDetails const* failureDetails; - const char* failureStr; - - bool testFinishCalled; - TestDetails const* testFinishDetails; - float testFinishSecondsElapsed; - - bool summaryCalled; - int summaryTotalTestCount; - int summaryFailedTestCount; - int summaryFailureCount; - float summarySecondsElapsed; -}; - -TEST(AddReporter) -{ - MockReporter r; - CompositeTestReporter c; - - CHECK(c.AddReporter(&r)); - CHECK_EQUAL(1, c.GetReporterCount()); -} - -TEST(RemoveReporter) -{ - MockReporter r; - CompositeTestReporter c; - - c.AddReporter(&r); - CHECK(c.RemoveReporter(&r)); - CHECK_EQUAL(0, c.GetReporterCount()); -} - -struct Fixture -{ - Fixture() - { - c.AddReporter(&r0); - c.AddReporter(&r1); - } - - MockReporter r0, r1; - CompositeTestReporter c; -}; - -TEST_FIXTURE(Fixture, ReportTestStartCallsReportTestStartOnAllAggregates) -{ - TestDetails t("", "", "", 0); - c.ReportTestStart(t); - - CHECK(r0.testStartCalled); - CHECK_EQUAL(&t, r0.testStartDetails); - CHECK(r1.testStartCalled); - CHECK_EQUAL(&t, r1.testStartDetails); -} - -TEST_FIXTURE(Fixture, ReportFailureCallsReportFailureOnAllAggregates) -{ - TestDetails t("", "", "", 0); - const char* failStr = "fail"; - c.ReportFailure(t, failStr); - - CHECK(r0.failureCalled); - CHECK_EQUAL(&t, r0.failureDetails); - CHECK_EQUAL(failStr, r0.failureStr); - - CHECK(r1.failureCalled); - CHECK_EQUAL(&t, r1.failureDetails); - CHECK_EQUAL(failStr, r1.failureStr); -} - -TEST_FIXTURE(Fixture, ReportTestFinishCallsReportTestFinishOnAllAggregates) -{ - TestDetails t("", "", "", 0); - const float s = 1.2345f; - c.ReportTestFinish(t, s); - - CHECK(r0.testFinishCalled); - CHECK_EQUAL(&t, r0.testFinishDetails); - CHECK_CLOSE(s, r0.testFinishSecondsElapsed, 0.00001f); - - CHECK(r1.testFinishCalled); - CHECK_EQUAL(&t, r1.testFinishDetails); - CHECK_CLOSE(s, r1.testFinishSecondsElapsed, 0.00001f); -} - -TEST_FIXTURE(Fixture, ReportSummaryCallsReportSummaryOnAllAggregates) -{ - TestDetails t("", "", "", 0); - const int testCount = 3; - const int failedTestCount = 4; - const int failureCount = 5; - const float secondsElapsed = 3.14159f; - - c.ReportSummary(testCount, failedTestCount, failureCount, secondsElapsed); - - CHECK(r0.summaryCalled); - CHECK_EQUAL(testCount, r0.summaryTotalTestCount); - CHECK_EQUAL(failedTestCount, r0.summaryFailedTestCount); - CHECK_EQUAL(failureCount, r0.summaryFailureCount); - CHECK_CLOSE(secondsElapsed, r0.summarySecondsElapsed, 0.00001f); - - CHECK(r1.summaryCalled); - CHECK_EQUAL(testCount, r1.summaryTotalTestCount); - CHECK_EQUAL(failedTestCount, r1.summaryFailedTestCount); - CHECK_EQUAL(failureCount, r1.summaryFailureCount); - CHECK_CLOSE(secondsElapsed, r1.summarySecondsElapsed, 0.00001f); -} - -} +#include "../../unittestpp.h" +#include "../CompositeTestReporter.h" + +using namespace UnitTest; + +namespace { + +TEST(ZeroReportersByDefault) +{ + CHECK_EQUAL(0, CompositeTestReporter().GetReporterCount()); +} + +struct MockReporter : TestReporter +{ + MockReporter() + : testStartCalled(false) + , testStartDetails(NULL) + , failureCalled(false) + , failureDetails(NULL) + , failureStr(NULL) + , testFinishCalled(false) + , testFinishDetails(NULL) + , testFinishSecondsElapsed(-1.0f) + , summaryCalled(false) + , summaryTotalTestCount(-1) + , summaryFailureCount(-1) + , summarySecondsElapsed(-1.0f) + { + } + + virtual void ReportTestStart(TestDetails const& test) + { + testStartCalled = true; + testStartDetails = &test; + } + + virtual void ReportFailure(TestDetails const& test, char const* failure) + { + failureCalled = true; + failureDetails = &test; + failureStr = failure; + } + + virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed) + { + testFinishCalled = true; + testFinishDetails = &test; + testFinishSecondsElapsed = secondsElapsed; + } + + virtual void ReportSummary(int totalTestCount, + int failedTestCount, + int failureCount, + float secondsElapsed) + { + summaryCalled = true; + summaryTotalTestCount = totalTestCount; + summaryFailedTestCount = failedTestCount; + summaryFailureCount = failureCount; + summarySecondsElapsed = secondsElapsed; + } + + bool testStartCalled; + TestDetails const* testStartDetails; + + bool failureCalled; + TestDetails const* failureDetails; + const char* failureStr; + + bool testFinishCalled; + TestDetails const* testFinishDetails; + float testFinishSecondsElapsed; + + bool summaryCalled; + int summaryTotalTestCount; + int summaryFailedTestCount; + int summaryFailureCount; + float summarySecondsElapsed; +}; + +TEST(AddReporter) +{ + MockReporter r; + CompositeTestReporter c; + + CHECK(c.AddReporter(&r)); + CHECK_EQUAL(1, c.GetReporterCount()); +} + +TEST(RemoveReporter) +{ + MockReporter r; + CompositeTestReporter c; + + c.AddReporter(&r); + CHECK(c.RemoveReporter(&r)); + CHECK_EQUAL(0, c.GetReporterCount()); +} + +struct Fixture +{ + Fixture() + { + c.AddReporter(&r0); + c.AddReporter(&r1); + } + + MockReporter r0, r1; + CompositeTestReporter c; +}; + +TEST_FIXTURE(Fixture, ReportTestStartCallsReportTestStartOnAllAggregates) +{ + TestDetails t("", "", "", 0); + c.ReportTestStart(t); + + CHECK(r0.testStartCalled); + CHECK_EQUAL(&t, r0.testStartDetails); + CHECK(r1.testStartCalled); + CHECK_EQUAL(&t, r1.testStartDetails); +} + +TEST_FIXTURE(Fixture, ReportFailureCallsReportFailureOnAllAggregates) +{ + TestDetails t("", "", "", 0); + const char* failStr = "fail"; + c.ReportFailure(t, failStr); + + CHECK(r0.failureCalled); + CHECK_EQUAL(&t, r0.failureDetails); + CHECK_EQUAL(failStr, r0.failureStr); + + CHECK(r1.failureCalled); + CHECK_EQUAL(&t, r1.failureDetails); + CHECK_EQUAL(failStr, r1.failureStr); +} + +TEST_FIXTURE(Fixture, ReportTestFinishCallsReportTestFinishOnAllAggregates) +{ + TestDetails t("", "", "", 0); + const float s = 1.2345f; + c.ReportTestFinish(t, s); + + CHECK(r0.testFinishCalled); + CHECK_EQUAL(&t, r0.testFinishDetails); + CHECK_CLOSE(s, r0.testFinishSecondsElapsed, 0.00001f); + + CHECK(r1.testFinishCalled); + CHECK_EQUAL(&t, r1.testFinishDetails); + CHECK_CLOSE(s, r1.testFinishSecondsElapsed, 0.00001f); +} + +TEST_FIXTURE(Fixture, ReportSummaryCallsReportSummaryOnAllAggregates) +{ + TestDetails t("", "", "", 0); + const int testCount = 3; + const int failedTestCount = 4; + const int failureCount = 5; + const float secondsElapsed = 3.14159f; + + c.ReportSummary(testCount, failedTestCount, failureCount, secondsElapsed); + + CHECK(r0.summaryCalled); + CHECK_EQUAL(testCount, r0.summaryTotalTestCount); + CHECK_EQUAL(failedTestCount, r0.summaryFailedTestCount); + CHECK_EQUAL(failureCount, r0.summaryFailureCount); + CHECK_CLOSE(secondsElapsed, r0.summarySecondsElapsed, 0.00001f); + + CHECK(r1.summaryCalled); + CHECK_EQUAL(testCount, r1.summaryTotalTestCount); + CHECK_EQUAL(failedTestCount, r1.summaryFailedTestCount); + CHECK_EQUAL(failureCount, r1.summaryFailureCount); + CHECK_CLOSE(secondsElapsed, r1.summarySecondsElapsed, 0.00001f); +} + +} diff --git a/src/tests/TestCurrentTest.cpp b/src/tests/TestCurrentTest.cpp index 766539f..35f9c5a 100644 --- a/src/tests/TestCurrentTest.cpp +++ b/src/tests/TestCurrentTest.cpp @@ -1,38 +1,38 @@ -#include "../../unittestpp.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); -} - -} +#include "../../unittestpp.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/src/tests/TestDeferredTestReporter.cpp b/src/tests/TestDeferredTestReporter.cpp index 7550ab4..16ff4af 100644 --- a/src/tests/TestDeferredTestReporter.cpp +++ b/src/tests/TestDeferredTestReporter.cpp @@ -1,122 +1,122 @@ -#include "../../config.h" - -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "../../unittestpp.h" -#include "../DeferredTestReporter.h" -#include - -namespace UnitTest -{ - -namespace -{ - -#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - 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].failureStr); - CHECK_EQUAL(failure2, result.failures[1].failureStr); -} - -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); - DeferredTestFailure const& failure = result.failures.at(0); - CHECK_EQUAL(goodStr, failure.failureStr); -} - -}} - -#endif +#include "../../config.h" + +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "../../unittestpp.h" +#include "../DeferredTestReporter.h" +#include + +namespace UnitTest +{ + +namespace +{ + +#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + 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].failureStr); + CHECK_EQUAL(failure2, result.failures[1].failureStr); +} + +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); + DeferredTestFailure const& failure = result.failures.at(0); + CHECK_EQUAL(goodStr, failure.failureStr); +} + +}} + +#endif diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index 6f55c9a..ecb3dc7 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -1,293 +1,293 @@ -#include "../../config.h" -#ifndef UNITTEST_NO_EXCEPTIONS - -#include "../../unittestpp.h" -#include "../CurrentTest.h" -#include "RecordingReporter.h" -#include "ScopedCurrentTest.h" - -using namespace std; - -namespace { - -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(CheckEqualFailsOnException) -{ - bool failure = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_EQUAL(ThrowingFunction(), 1); - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(failure); -} - -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")); -} - -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(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")); -} - -class ThrowingObject -{ -public: - float operator[](int) const - { - throw "Test throw"; - } -}; - -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(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(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")); -} - -class ThrowingObject2D -{ -public: - float* operator[](int) const - { - throw "Test throw"; - } -}; - -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(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")); -} - -} - -#endif +#include "../../config.h" +#ifndef UNITTEST_NO_EXCEPTIONS + +#include "../../unittestpp.h" +#include "../CurrentTest.h" +#include "RecordingReporter.h" +#include "ScopedCurrentTest.h" + +using namespace std; + +namespace { + +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(CheckEqualFailsOnException) +{ + bool failure = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + CHECK_EQUAL(ThrowingFunction(), 1); + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); +} + +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")); +} + +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(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")); +} + +class ThrowingObject +{ +public: + float operator[](int) const + { + throw "Test throw"; + } +}; + +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(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(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")); +} + +class ThrowingObject2D +{ +public: + float* operator[](int) const + { + throw "Test throw"; + } +}; + +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(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")); +} + +} + +#endif diff --git a/src/tests/TestMemoryOutStream.cpp b/src/tests/TestMemoryOutStream.cpp index f83b10c..87d19c5 100644 --- a/src/tests/TestMemoryOutStream.cpp +++ b/src/tests/TestMemoryOutStream.cpp @@ -1,175 +1,175 @@ -#include "../../unittestpp.h" - -#include "../MemoryOutStream.h" -#include -#include -#include - -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(StreamingLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (long long)8589934590ll; - CHECK_EQUAL("8589934590", stream.GetText()); -} - -TEST(StreamingUnsignedLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned long long)8589934590ull; - CHECK_EQUAL("8589934590", 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()); -} - -TEST(ClearEmptiesMemoryOutStreamContents) -{ - MemoryOutStream stream; - stream << "Hello world"; - stream.Clear(); - CHECK_EQUAL("", stream.GetText()); -} - -#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - -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 - -} +#include "../../unittestpp.h" + +#include "../MemoryOutStream.h" +#include +#include +#include + +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(StreamingLongLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (long long)8589934590ll; + CHECK_EQUAL("8589934590", stream.GetText()); +} + +TEST(StreamingUnsignedLongLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned long long)8589934590ull; + CHECK_EQUAL("8589934590", 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()); +} + +TEST(ClearEmptiesMemoryOutStreamContents) +{ + MemoryOutStream stream; + stream << "Hello world"; + stream.Clear(); + CHECK_EQUAL("", stream.GetText()); +} + +#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + +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/src/tests/TestTest.cpp b/src/tests/TestTest.cpp index 2ae2192..efa31b8 100644 --- a/src/tests/TestTest.cpp +++ b/src/tests/TestTest.cpp @@ -1,129 +1,129 @@ -#include "../../unittestpp.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()); -} - -#ifndef UNITTEST_NO_EXCEPTIONS -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 -#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()); -} - -} +#include "../../unittestpp.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()); +} + +#ifndef UNITTEST_NO_EXCEPTIONS +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 +#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/src/tests/TestTestList.cpp b/src/tests/TestTestList.cpp index fdeba34..59517e7 100644 --- a/src/tests/TestTestList.cpp +++ b/src/tests/TestTestList.cpp @@ -1,50 +1,50 @@ -#include "../../unittestpp.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.m_nextTest == 0); -} - -TEST(AddingSecondTestAddsItToEndOfList) -{ - Test test1("test1"); - Test test2("test2"); - - TestList list; - list.Add(&test1); - list.Add(&test2); - - CHECK(list.GetHead() == &test1); - CHECK(test1.m_nextTest == &test2); - CHECK(test2.m_nextTest == 0); -} - -TEST(ListAdderAddsTestToList) -{ - TestList list; - - Test test(""); - ListAdder adder(list, &test); - - CHECK(list.GetHead() == &test); - CHECK(test.m_nextTest == 0); -} - -} +#include "../../unittestpp.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.m_nextTest == 0); +} + +TEST(AddingSecondTestAddsItToEndOfList) +{ + Test test1("test1"); + Test test2("test2"); + + TestList list; + list.Add(&test1); + list.Add(&test2); + + CHECK(list.GetHead() == &test1); + CHECK(test1.m_nextTest == &test2); + CHECK(test2.m_nextTest == 0); +} + +TEST(ListAdderAddsTestToList) +{ + TestList list; + + Test test(""); + ListAdder adder(list, &test); + + CHECK(list.GetHead() == &test); + CHECK(test.m_nextTest == 0); +} + +} diff --git a/src/tests/TestTestMacros.cpp b/src/tests/TestTestMacros.cpp index b057e4f..8ab11d6 100644 --- a/src/tests/TestTestMacros.cpp +++ b/src/tests/TestTestMacros.cpp @@ -1,221 +1,221 @@ -#include "../../unittestpp.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; -using namespace std; - -namespace { - -TestList list1; -TEST_EX(DummyTest, list1) -{ -} - -TEST (TestsAreAddedToTheListThroughMacro) -{ - CHECK(list1.GetHead() != 0); - CHECK(list1.GetHead()->m_nextTest == 0); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -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")); -} - -#endif - -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); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -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")); -} - -#endif - -} - -// 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 +#include "../../unittestpp.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; +using namespace std; + +namespace { + +TestList list1; +TEST_EX(DummyTest, list1) +{ +} + +TEST (TestsAreAddedToTheListThroughMacro) +{ + CHECK(list1.GetHead() != 0); + CHECK(list1.GetHead()->m_nextTest == 0); +} + +#ifndef UNITTEST_NO_EXCEPTIONS + +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")); +} + +#endif + +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); +} + +#ifndef UNITTEST_NO_EXCEPTIONS + +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")); +} + +#endif + +} + +// 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/src/tests/TestTestResults.cpp b/src/tests/TestTestResults.cpp index 15fff1e..38414e5 100644 --- a/src/tests/TestTestResults.cpp +++ b/src/tests/TestTestResults.cpp @@ -1,111 +1,111 @@ -#include "../../unittestpp.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); -} - - -} +#include "../../unittestpp.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/src/tests/TestTestRunner.cpp b/src/tests/TestTestRunner.cpp index 0aeec11..b607ec6 100644 --- a/src/tests/TestTestRunner.cpp +++ b/src/tests/TestTestRunner.cpp @@ -1,322 +1,322 @@ -#include "../../unittestpp.h" -#include "RecordingReporter.h" -#include "../ReportAssert.h" -#include "../TestList.h" -#include "../TimeHelpers.h" -#include "../TimeConstraint.h" -#include "../ReportAssertImpl.h" - -using namespace UnitTest; - -namespace -{ - -struct TestRunnerFixture -{ - TestRunnerFixture() - : runner(reporter) - { - s_testRunnerFixtureTestResults = runner.GetTestResults(); - } - - static TestResults* s_testRunnerFixtureTestResults; - - RecordingReporter reporter; - TestList list; - TestRunner runner; -}; - -TestResults* TestRunnerFixture::s_testRunnerFixtureTestResults = NULL; - -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_) - { - m_isMockTest = true; - } - - virtual void RunImpl() const - { - TestResults* testResults = TestRunnerFixture::s_testRunnerFixtureTestResults; - - for (int i=0; i < count; ++i) - { - if (asserted) - Detail::ReportAssertEx(testResults, &m_details, "desc", "file", 0); - else if (!success) - testResults->OnTestFailure(m_details, "message"); - } - } - - bool const success; - bool const asserted; - int const count; -}; - -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() 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, AssertingTestAbortsAsSoonAsAssertIsHit) -{ - MockTest test("test", false, true, 3); - list.Add(&test); - runner.RunTestsIf(list, NULL, True(), 0); - CHECK_EQUAL(1, reporter.summaryFailureCount); -} - -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() 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); -} - -} +#include "../../unittestpp.h" +#include "RecordingReporter.h" +#include "../ReportAssert.h" +#include "../TestList.h" +#include "../TimeHelpers.h" +#include "../TimeConstraint.h" +#include "../ReportAssertImpl.h" + +using namespace UnitTest; + +namespace +{ + +struct TestRunnerFixture +{ + TestRunnerFixture() + : runner(reporter) + { + s_testRunnerFixtureTestResults = runner.GetTestResults(); + } + + static TestResults* s_testRunnerFixtureTestResults; + + RecordingReporter reporter; + TestList list; + TestRunner runner; +}; + +TestResults* TestRunnerFixture::s_testRunnerFixtureTestResults = NULL; + +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_) + { + m_isMockTest = true; + } + + virtual void RunImpl() const + { + TestResults* testResults = TestRunnerFixture::s_testRunnerFixtureTestResults; + + for (int i=0; i < count; ++i) + { + if (asserted) + Detail::ReportAssertEx(testResults, &m_details, "desc", "file", 0); + else if (!success) + testResults->OnTestFailure(m_details, "message"); + } + } + + bool const success; + bool const asserted; + int const count; +}; + +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() 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, AssertingTestAbortsAsSoonAsAssertIsHit) +{ + MockTest test("test", false, true, 3); + list.Add(&test); + runner.RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(1, reporter.summaryFailureCount); +} + +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() 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/src/tests/TestTestSuite.cpp b/src/tests/TestTestSuite.cpp index 07e51cd..ad7725f 100644 --- a/src/tests/TestTestSuite.cpp +++ b/src/tests/TestTestSuite.cpp @@ -1,12 +1,12 @@ -#include "../../unittestpp.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) - { - } -} - +#include "../../unittestpp.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/src/tests/TestTimeConstraint.cpp b/src/tests/TestTimeConstraint.cpp index 96f880c..eec7e43 100644 --- a/src/tests/TestTimeConstraint.cpp +++ b/src/tests/TestTimeConstraint.cpp @@ -1,69 +1,69 @@ -#include "../../unittestpp.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")); -} - -} +#include "../../unittestpp.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/src/tests/TestTimeConstraintMacro.cpp b/src/tests/TestTimeConstraintMacro.cpp index 76f15c3..bee7dcf 100644 --- a/src/tests/TestTimeConstraintMacro.cpp +++ b/src/tests/TestTimeConstraintMacro.cpp @@ -1,65 +1,65 @@ -#include "../../unittestpp.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")); -} - -TEST(TimeConstraintMacroComparesAgainstPreciseActual) -{ - int testLine = 0; - RecordingReporter reporter; - - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - UNITTEST_TIME_CONSTRAINT(1); testLine = __LINE__; - - // start a new timer and run until we're as little over the 1 msec - // threshold as we can achieve; this should guarantee that the "test" - // runs in some very small amount of time > 1 msec - UnitTest::Timer myTimer; - myTimer.Start(); - - while (myTimer.GetTimeInMs() < 1.001) - UnitTest::TimeHelpers::SleepMs(0); - } - - using namespace std; - - CHECK_EQUAL(1, reporter.testFailedCount); - CHECK(strstr(reporter.lastFailedFile, __FILE__)); - CHECK_EQUAL(testLine, reporter.lastFailedLine); - CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroComparesAgainstPreciseActual")); -} - -} +#include "../../unittestpp.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")); +} + +TEST(TimeConstraintMacroComparesAgainstPreciseActual) +{ + int testLine = 0; + RecordingReporter reporter; + + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + UNITTEST_TIME_CONSTRAINT(1); testLine = __LINE__; + + // start a new timer and run until we're as little over the 1 msec + // threshold as we can achieve; this should guarantee that the "test" + // runs in some very small amount of time > 1 msec + UnitTest::Timer myTimer; + myTimer.Start(); + + while (myTimer.GetTimeInMs() < 1.001) + UnitTest::TimeHelpers::SleepMs(0); + } + + using namespace std; + + CHECK_EQUAL(1, reporter.testFailedCount); + CHECK(strstr(reporter.lastFailedFile, __FILE__)); + CHECK_EQUAL(testLine, reporter.lastFailedLine); + CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroComparesAgainstPreciseActual")); +} + +} diff --git a/src/tests/TestUnitTestPP.cpp b/src/tests/TestUnitTestPP.cpp index e6a00bf..f38ca93 100644 --- a/src/tests/TestUnitTestPP.cpp +++ b/src/tests/TestUnitTestPP.cpp @@ -1,148 +1,148 @@ -#include "../../unittestpp.h" -#include "ScopedCurrentTest.h" - -// 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); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -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()); -} - -#endif - -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); -} - -} +#include "../../unittestpp.h" +#include "ScopedCurrentTest.h" + +// 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); +} + +#ifndef UNITTEST_NO_EXCEPTIONS + +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()); +} + +#endif + +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/src/tests/TestXmlTestReporter.cpp b/src/tests/TestXmlTestReporter.cpp index dde5759..cbf93a9 100644 --- a/src/tests/TestXmlTestReporter.cpp +++ b/src/tests/TestXmlTestReporter.cpp @@ -1,188 +1,188 @@ -#include "../../config.h" -#ifndef UNITTEST_NO_DEFERRED_REPORTER - -#include "../../unittestpp.h" -#include "../XmlTestReporter.h" - -#include - -using namespace UnitTest; -using std::ostringstream; - -namespace -{ - -#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - -// 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 = - "" - "" - "" - "" - "" - ""; - - 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 = - "" - "" - ""; - - 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 = - "" - "" - "" - ""; - - 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 = - "" - "" - "" - "" - "" - ""; - - 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 = - "" - "" - "" - "" - "" - ""; - - 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 = - "" - "" - "" - "" - "" - "" - ""; - - 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 = - "" - "" - "" - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str()); -} - -} - -#endif +#include "../../config.h" +#ifndef UNITTEST_NO_DEFERRED_REPORTER + +#include "../../unittestpp.h" +#include "../XmlTestReporter.h" + +#include + +using namespace UnitTest; +using std::ostringstream; + +namespace +{ + +#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + +// 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 = + "" + "" + "" + "" + "" + ""; + + 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 = + "" + "" + ""; + + 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 = + "" + "" + "" + ""; + + 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 = + "" + "" + "" + "" + "" + ""; + + 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 = + "" + "" + "" + "" + "" + ""; + + 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 = + "" + "" + "" + "" + "" + "" + ""; + + 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 = + "" + "" + "" + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str()); +} + +} + +#endif diff --git a/src/tests/test-unittestpp_vs2005.vcproj b/src/tests/test-unittestpp_vs2005.vcproj index 50d9fa3..fd855f2 100644 --- a/src/tests/test-unittestpp_vs2005.vcproj +++ b/src/tests/test-unittestpp_vs2005.vcproj @@ -1,580 +1,580 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/test-unittestpp_vs2008.vcproj b/src/tests/test-unittestpp_vs2008.vcproj index e6cfbee..93fc202 100644 --- a/src/tests/test-unittestpp_vs2008.vcproj +++ b/src/tests/test-unittestpp_vs2008.vcproj @@ -1,569 +1,569 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unittestpp_vs2005.vcproj b/src/unittestpp_vs2005.vcproj index b69882c..0c1f6ae 100644 --- a/src/unittestpp_vs2005.vcproj +++ b/src/unittestpp_vs2005.vcproj @@ -1,614 +1,614 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/unittestpp_vs2008.vcproj b/src/unittestpp_vs2008.vcproj index b695cab..68a2ea3 100644 --- a/src/unittestpp_vs2008.vcproj +++ b/src/unittestpp_vs2008.vcproj @@ -1,607 +1,607 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/unittestpp.h b/unittestpp.h index b66b2c4..dd3a5de 100644 --- a/unittestpp.h +++ b/unittestpp.h @@ -1,11 +1,11 @@ -#ifndef UNITTESTPP_H -#define UNITTESTPP_H - -#include "config.h" -#include "src/TestMacros.h" -#include "src/CheckMacros.h" -#include "src/TestRunner.h" -#include "src/TimeConstraint.h" -#include "src/ReportAssert.h" - -#endif +#ifndef UNITTESTPP_H +#define UNITTESTPP_H + +#include "config.h" +#include "src/TestMacros.h" +#include "src/CheckMacros.h" +#include "src/TestRunner.h" +#include "src/TimeConstraint.h" +#include "src/ReportAssert.h" + +#endif diff --git a/unittestpp_vs2005.sln b/unittestpp_vs2005.sln index 3bb7617..85c6b09 100644 --- a/unittestpp_vs2005.sln +++ b/unittestpp_vs2005.sln @@ -1,49 +1,49 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittestpp_vs2005", "src\unittestpp_vs2005.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-unittestpp_vs2005", "src\tests\test-unittestpp_vs2005.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" - ProjectSection(ProjectDependencies) = postProject - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - win32_dll_vc80_debug|Win32 = win32_dll_vc80_debug|Win32 - win32_dll_vc80_release|Win32 = win32_dll_vc80_release|Win32 - win32_static_vc80_md_debug|Win32 = win32_static_vc80_md_debug|Win32 - win32_static_vc80_md_release|Win32 = win32_static_vc80_md_release|Win32 - win32_static_vc80_mt_debug|Win32 = win32_static_vc80_mt_debug|Win32 - win32_static_vc80_mt_release|Win32 = win32_static_vc80_mt_release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_debug|Win32.ActiveCfg = win32_dll_vc80_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_debug|Win32.Build.0 = win32_dll_vc80_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_release|Win32.ActiveCfg = win32_dll_vc80_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_release|Win32.Build.0 = win32_dll_vc80_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_debug|Win32.ActiveCfg = win32_static_vc80_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_debug|Win32.Build.0 = win32_static_vc80_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_release|Win32.ActiveCfg = win32_static_vc80_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_release|Win32.Build.0 = win32_static_vc80_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_debug|Win32.ActiveCfg = win32_static_vc80_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_debug|Win32.Build.0 = win32_static_vc80_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_release|Win32.ActiveCfg = win32_static_vc80_mt_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_release|Win32.Build.0 = win32_static_vc80_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_debug|Win32.ActiveCfg = win32_dll_vc80_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_debug|Win32.Build.0 = win32_dll_vc80_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_release|Win32.ActiveCfg = win32_dll_vc80_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_release|Win32.Build.0 = win32_dll_vc80_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_debug|Win32.ActiveCfg = win32_static_vc80_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_debug|Win32.Build.0 = win32_static_vc80_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_release|Win32.ActiveCfg = win32_static_vc80_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_release|Win32.Build.0 = win32_static_vc80_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_debug|Win32.ActiveCfg = win32_static_vc80_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_debug|Win32.Build.0 = win32_static_vc80_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_release|Win32.ActiveCfg = win32_static_vc80_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_release|Win32.Build.0 = win32_static_vc80_mt_release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +サソ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittestpp_vs2005", "src\unittestpp_vs2005.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-unittestpp_vs2005", "src\tests\test-unittestpp_vs2005.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" + ProjectSection(ProjectDependencies) = postProject + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + win32_dll_vc80_debug|Win32 = win32_dll_vc80_debug|Win32 + win32_dll_vc80_release|Win32 = win32_dll_vc80_release|Win32 + win32_static_vc80_md_debug|Win32 = win32_static_vc80_md_debug|Win32 + win32_static_vc80_md_release|Win32 = win32_static_vc80_md_release|Win32 + win32_static_vc80_mt_debug|Win32 = win32_static_vc80_mt_debug|Win32 + win32_static_vc80_mt_release|Win32 = win32_static_vc80_mt_release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_debug|Win32.ActiveCfg = win32_dll_vc80_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_debug|Win32.Build.0 = win32_dll_vc80_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_release|Win32.ActiveCfg = win32_dll_vc80_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_release|Win32.Build.0 = win32_dll_vc80_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_debug|Win32.ActiveCfg = win32_static_vc80_md_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_debug|Win32.Build.0 = win32_static_vc80_md_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_release|Win32.ActiveCfg = win32_static_vc80_md_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_release|Win32.Build.0 = win32_static_vc80_md_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_debug|Win32.ActiveCfg = win32_static_vc80_mt_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_debug|Win32.Build.0 = win32_static_vc80_mt_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_release|Win32.ActiveCfg = win32_static_vc80_mt_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_release|Win32.Build.0 = win32_static_vc80_mt_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_debug|Win32.ActiveCfg = win32_dll_vc80_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_debug|Win32.Build.0 = win32_dll_vc80_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_release|Win32.ActiveCfg = win32_dll_vc80_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_release|Win32.Build.0 = win32_dll_vc80_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_debug|Win32.ActiveCfg = win32_static_vc80_md_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_debug|Win32.Build.0 = win32_static_vc80_md_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_release|Win32.ActiveCfg = win32_static_vc80_md_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_release|Win32.Build.0 = win32_static_vc80_md_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_debug|Win32.ActiveCfg = win32_static_vc80_mt_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_debug|Win32.Build.0 = win32_static_vc80_mt_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_release|Win32.ActiveCfg = win32_static_vc80_mt_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_release|Win32.Build.0 = win32_static_vc80_mt_release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/unittestpp_vs2008.sln b/unittestpp_vs2008.sln index f7004a4..fe863c2 100644 --- a/unittestpp_vs2008.sln +++ b/unittestpp_vs2008.sln @@ -1,49 +1,49 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittestpp_vs2008", "src\unittestpp_vs2008.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-unittestpp_vs2008", "src\tests\test-unittestpp_vs2008.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" - ProjectSection(ProjectDependencies) = postProject - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - win32_dll_vc90_debug|Win32 = win32_dll_vc90_debug|Win32 - win32_dll_vc90_release|Win32 = win32_dll_vc90_release|Win32 - win32_static_vc90_md_debug|Win32 = win32_static_vc90_md_debug|Win32 - win32_static_vc90_md_release|Win32 = win32_static_vc90_md_release|Win32 - win32_static_vc90_mt_debug|Win32 = win32_static_vc90_mt_debug|Win32 - win32_static_vc90_mt_release|Win32 = win32_static_vc90_mt_release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_debug|Win32.ActiveCfg = win32_dll_vc90_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_debug|Win32.Build.0 = win32_dll_vc90_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_release|Win32.ActiveCfg = win32_dll_vc90_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_release|Win32.Build.0 = win32_dll_vc90_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_debug|Win32.ActiveCfg = win32_static_vc90_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_debug|Win32.Build.0 = win32_static_vc90_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_release|Win32.ActiveCfg = win32_static_vc90_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_release|Win32.Build.0 = win32_static_vc90_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_debug|Win32.ActiveCfg = win32_static_vc90_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_debug|Win32.Build.0 = win32_static_vc90_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_release|Win32.ActiveCfg = win32_static_vc90_mt_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_release|Win32.Build.0 = win32_static_vc90_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_debug|Win32.ActiveCfg = win32_dll_vc90_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_debug|Win32.Build.0 = win32_dll_vc90_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_release|Win32.ActiveCfg = win32_dll_vc90_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_release|Win32.Build.0 = win32_dll_vc90_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_debug|Win32.ActiveCfg = win32_static_vc90_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_debug|Win32.Build.0 = win32_static_vc90_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_release|Win32.ActiveCfg = win32_static_vc90_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_release|Win32.Build.0 = win32_static_vc90_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_debug|Win32.ActiveCfg = win32_static_vc90_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_debug|Win32.Build.0 = win32_static_vc90_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_release|Win32.ActiveCfg = win32_static_vc90_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_release|Win32.Build.0 = win32_static_vc90_mt_release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +サソ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittestpp_vs2008", "src\unittestpp_vs2008.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-unittestpp_vs2008", "src\tests\test-unittestpp_vs2008.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" + ProjectSection(ProjectDependencies) = postProject + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + win32_dll_vc90_debug|Win32 = win32_dll_vc90_debug|Win32 + win32_dll_vc90_release|Win32 = win32_dll_vc90_release|Win32 + win32_static_vc90_md_debug|Win32 = win32_static_vc90_md_debug|Win32 + win32_static_vc90_md_release|Win32 = win32_static_vc90_md_release|Win32 + win32_static_vc90_mt_debug|Win32 = win32_static_vc90_mt_debug|Win32 + win32_static_vc90_mt_release|Win32 = win32_static_vc90_mt_release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_debug|Win32.ActiveCfg = win32_dll_vc90_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_debug|Win32.Build.0 = win32_dll_vc90_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_release|Win32.ActiveCfg = win32_dll_vc90_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_release|Win32.Build.0 = win32_dll_vc90_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_debug|Win32.ActiveCfg = win32_static_vc90_md_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_debug|Win32.Build.0 = win32_static_vc90_md_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_release|Win32.ActiveCfg = win32_static_vc90_md_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_release|Win32.Build.0 = win32_static_vc90_md_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_debug|Win32.ActiveCfg = win32_static_vc90_mt_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_debug|Win32.Build.0 = win32_static_vc90_mt_debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_release|Win32.ActiveCfg = win32_static_vc90_mt_release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_release|Win32.Build.0 = win32_static_vc90_mt_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_debug|Win32.ActiveCfg = win32_dll_vc90_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_debug|Win32.Build.0 = win32_dll_vc90_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_release|Win32.ActiveCfg = win32_dll_vc90_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_release|Win32.Build.0 = win32_dll_vc90_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_debug|Win32.ActiveCfg = win32_static_vc90_md_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_debug|Win32.Build.0 = win32_static_vc90_md_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_release|Win32.ActiveCfg = win32_static_vc90_md_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_release|Win32.Build.0 = win32_static_vc90_md_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_debug|Win32.ActiveCfg = win32_static_vc90_mt_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_debug|Win32.Build.0 = win32_static_vc90_mt_debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_release|Win32.ActiveCfg = win32_static_vc90_mt_release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_release|Win32.Build.0 = win32_static_vc90_mt_release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal From aeaae3e6e6ac7eaf0471dd5de8952fcc1f8354dd Mon Sep 17 00:00:00 2001 From: Pete Johns Date: Mon, 28 Jan 2013 21:13:15 +1100 Subject: [PATCH 006/184] Compare char* with char* to fix OS X build with clang. --- src/tests/TestDeferredTestReporter.cpp | 6 +++--- src/tests/TestXmlTestReporter.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tests/TestDeferredTestReporter.cpp b/src/tests/TestDeferredTestReporter.cpp index 16ff4af..a45eb05 100644 --- a/src/tests/TestDeferredTestReporter.cpp +++ b/src/tests/TestDeferredTestReporter.cpp @@ -57,8 +57,8 @@ TEST_FIXTURE(DeferredTestReporterFixture, ReportTestStartCapturesTestNameAndSuit reporter.ReportTestStart(details); DeferredTestResult const& result = reporter.GetResults().at(0); - CHECK_EQUAL(testName.c_str(), result.testName); - CHECK_EQUAL(testSuite.c_str(), result.suiteName); + CHECK_EQUAL(testName.c_str(), result.testName.c_str()); + CHECK_EQUAL(testSuite.c_str(), result.suiteName.c_str()); } TEST_FIXTURE(DeferredTestReporterFixture, ReportTestEndCapturesTestTime) @@ -80,7 +80,7 @@ TEST_FIXTURE(DeferredTestReporterFixture, ReportFailureSavesFailureDetails) DeferredTestResult const& result = reporter.GetResults().at(0); CHECK(result.failed == true); - CHECK_EQUAL(fileName.c_str(), result.failureFile); + CHECK_EQUAL(fileName.c_str(), result.failureFile.c_str()); } TEST_FIXTURE(DeferredTestReporterFixture, ReportFailureSavesFailureDetailsForMultipleFailures) diff --git a/src/tests/TestXmlTestReporter.cpp b/src/tests/TestXmlTestReporter.cpp index cbf93a9..ec9cb7a 100644 --- a/src/tests/TestXmlTestReporter.cpp +++ b/src/tests/TestXmlTestReporter.cpp @@ -52,7 +52,7 @@ TEST_FIXTURE(XmlTestReporterFixture, MultipleCharactersAreEscaped) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } TEST_FIXTURE(XmlTestReporterFixture, OutputIsCachedUntilReportSummaryIsCalled) @@ -77,7 +77,7 @@ TEST_FIXTURE(XmlTestReporterFixture, EmptyReportSummaryFormat) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } TEST_FIXTURE(XmlTestReporterFixture, SingleSuccessfulTestReportSummaryFormat) @@ -93,7 +93,7 @@ TEST_FIXTURE(XmlTestReporterFixture, SingleSuccessfulTestReportSummaryFormat) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } TEST_FIXTURE(XmlTestReporterFixture, SingleFailedTestReportSummaryFormat) @@ -112,7 +112,7 @@ TEST_FIXTURE(XmlTestReporterFixture, SingleFailedTestReportSummaryFormat) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } TEST_FIXTURE(XmlTestReporterFixture, FailureMessageIsXMLEscaped) @@ -132,7 +132,7 @@ TEST_FIXTURE(XmlTestReporterFixture, FailureMessageIsXMLEscaped) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } TEST_FIXTURE(XmlTestReporterFixture, OneFailureAndOneSuccess) @@ -156,7 +156,7 @@ TEST_FIXTURE(XmlTestReporterFixture, OneFailureAndOneSuccess) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } TEST_FIXTURE(XmlTestReporterFixture, MultipleFailures) @@ -180,7 +180,7 @@ TEST_FIXTURE(XmlTestReporterFixture, MultipleFailures) "" ""; - CHECK_EQUAL(expected, output.str()); + CHECK_EQUAL(expected, output.str().c_str()); } } From 69acc43ef408e296a56d2a97770a92d356dda75b Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 3 Feb 2013 00:47:52 -0600 Subject: [PATCH 007/184] CHECK_EQUAL no longer crashes if string pointers are NULL. --- src/Checks.cpp | 4 ++-- src/tests/TestChecks.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Checks.cpp b/src/Checks.cpp index 2d09519..3e09231 100644 --- a/src/Checks.cpp +++ b/src/Checks.cpp @@ -10,10 +10,10 @@ void CheckStringsEqual(TestResults& results, char const* expected, char const* a { using namespace std; - if (strcmp(expected, actual)) + if ((expected && actual) ? strcmp(expected, actual) : (expected || actual)) { UnitTest::MemoryOutStream stream; - stream << "Expected " << expected << " but was " << actual; + stream << "Expected " << (expected ? expected : "") << " but was " << (actual ? actual : ""); results.OnTestFailure(details, stream.GetText()); } diff --git a/src/tests/TestChecks.cpp b/src/tests/TestChecks.cpp index 110102a..3d73b99 100644 --- a/src/tests/TestChecks.cpp +++ b/src/tests/TestChecks.cpp @@ -72,6 +72,33 @@ TEST(CheckEqualsWithStringsWorksOnContentsWithALiteral) CHECK_EQUAL(0, results.GetFailureCount()); } +TEST(CheckEqualsWithStringsWorksOnNullExpected) +{ + char const* const expected = "hi"; + char const* const actual = NULL; + TestResults results; + CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); + CHECK_EQUAL (1, results.GetFailureCount()); +} + +TEST(CheckEqualsWithStringsWorksOnNullActual) +{ + char const* const expected = NULL; + char const* const actual = "hi"; + TestResults results; + CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); + CHECK_EQUAL (1, results.GetFailureCount()); +} + +TEST(CheckEqualsWithStringsWorksOnNullExpectedAndActual) +{ + char const* const expected = NULL; + char const* const actual = NULL; + TestResults results; + CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); + CHECK_EQUAL (0, results.GetFailureCount()); +} + TEST(CheckEqualFailureIncludesCheckExpectedAndActual) { RecordingReporter reporter; From 904f733b158499a82a3747e1370997132d706540 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 3 Feb 2013 01:14:24 -0600 Subject: [PATCH 008/184] Added test verifying that UNITTEST_TIME_CONSTRAINT works in TEST_FIXTURE tests. --- src/tests/TestTimeConstraintMacro.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/TestTimeConstraintMacro.cpp b/src/tests/TestTimeConstraintMacro.cpp index bee7dcf..ebb5388 100644 --- a/src/tests/TestTimeConstraintMacro.cpp +++ b/src/tests/TestTimeConstraintMacro.cpp @@ -62,4 +62,27 @@ TEST(TimeConstraintMacroComparesAgainstPreciseActual) CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroComparesAgainstPreciseActual")); } +struct EmptyFixture {}; + +TEST_FIXTURE(EmptyFixture, TimeConstraintMacroWorksInFixtures) +{ + 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, "TimeConstraintMacroWorksInFixtures")); +} + } From 4dced283c84fdd0727759a0cded823c52b2018ea Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 3 Feb 2013 01:38:16 -0600 Subject: [PATCH 009/184] Refactored SlowTestWithTimeExemptionPass into two tests, defined in the SlowTestHelper namespace. These tests are actually run by new test SlowTestsWithTimeExemptionsPass. --- src/Test.cpp | 1 - src/Test.h | 2 +- src/TestDetails.cpp | 2 ++ src/TestDetails.h | 1 + src/TestRunner.cpp | 2 +- src/TimeConstraint.h | 2 +- src/tests/TestTestRunner.cpp | 36 +++++++++++++++++++++--------------- 7 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/Test.cpp b/src/Test.cpp index 352ba7e..6a270db 100644 --- a/src/Test.cpp +++ b/src/Test.cpp @@ -21,7 +21,6 @@ TestList& Test::GetTestList() Test::Test(char const* testName, char const* suiteName, char const* filename, int lineNumber) : m_details(testName, suiteName, filename, lineNumber) , m_nextTest(0) - , m_timeConstraintExempt(false) , m_isMockTest(false) { } diff --git a/src/Test.h b/src/Test.h index f51d8e8..bf7c4a3 100644 --- a/src/Test.h +++ b/src/Test.h @@ -17,7 +17,7 @@ class UNITTEST_LINKAGE Test TestDetails const m_details; Test* m_nextTest; - mutable bool m_timeConstraintExempt; + mutable bool m_isMockTest; static TestList& GetTestList(); diff --git a/src/TestDetails.cpp b/src/TestDetails.cpp index a13a168..3af0446 100644 --- a/src/TestDetails.cpp +++ b/src/TestDetails.cpp @@ -7,6 +7,7 @@ TestDetails::TestDetails(char const* testName_, char const* suiteName_, char con , testName(testName_) , filename(filename_) , lineNumber(lineNumber_) + , timeConstraintExempt(false) { } @@ -15,6 +16,7 @@ TestDetails::TestDetails(const TestDetails& details, int lineNumber_) , testName(details.testName) , filename(details.filename) , lineNumber(lineNumber_) + , timeConstraintExempt(details.timeConstraintExempt) { } diff --git a/src/TestDetails.h b/src/TestDetails.h index 50b630c..eb7d596 100644 --- a/src/TestDetails.h +++ b/src/TestDetails.h @@ -15,6 +15,7 @@ class UNITTEST_LINKAGE TestDetails char const* const testName; char const* const filename; int const lineNumber; + mutable bool timeConstraintExempt; TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind private: diff --git a/src/TestRunner.cpp b/src/TestRunner.cpp index 10f47e4..a8151e6 100644 --- a/src/TestRunner.cpp +++ b/src/TestRunner.cpp @@ -67,7 +67,7 @@ void TestRunner::RunTest(TestResults* const result, Test* const curTest, int con curTest->Run(); double const testTimeInMs = testTimer.GetTimeInMs(); - if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_timeConstraintExempt) + if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_details.timeConstraintExempt) { MemoryOutStream stream; stream << "Global time constraint failed. Expected under " << maxTestTimeInMs << diff --git a/src/TimeConstraint.h b/src/TimeConstraint.h index a73057c..8c06913 100644 --- a/src/TimeConstraint.h +++ b/src/TimeConstraint.h @@ -29,7 +29,7 @@ class UNITTEST_LINKAGE TimeConstraint #define UNITTEST_TIME_CONSTRAINT_EXEMPT() \ UNITTEST_MULTILINE_MACRO_BEGIN \ - m_timeConstraintExempt = true; \ + m_details.timeConstraintExempt = true; \ UNITTEST_MULTILINE_MACRO_END } diff --git a/src/tests/TestTestRunner.cpp b/src/tests/TestTestRunner.cpp index b607ec6..5b2d65a 100644 --- a/src/tests/TestTestRunner.cpp +++ b/src/tests/TestTestRunner.cpp @@ -207,24 +207,30 @@ TEST_FIXTURE(TestRunnerFixture, SlowTestHasCorrectFailureInformation) CHECK(strstr(reporter.lastFailedMessage, "3ms")); } -TEST_FIXTURE(TestRunnerFixture, SlowTestWithTimeExemptionPasses) + +namespace SlowTestHelper { - class SlowExemptedTest : public Test - { - public: - SlowExemptedTest() : Test("slowexempted", "", 0) {} - virtual void RunImpl() const - { - UNITTEST_TIME_CONSTRAINT_EXEMPT(); - TimeHelpers::SleepMs(20); - } - }; + TestRunnerFixture testRunnerFixture; - SlowExemptedTest test; - list.Add(&test); + TEST_EX(SlowExemptedTest, testRunnerFixture.list) + { + UNITTEST_TIME_CONSTRAINT_EXEMPT(); + TimeHelpers::SleepMs(20); + } + + class Fixture {}; + + TEST_FIXTURE_EX(Fixture, SlowExemptedTest, testRunnerFixture.list) + { + UNITTEST_TIME_CONSTRAINT_EXEMPT(); + TimeHelpers::SleepMs(20); + } +} - runner.RunTestsIf(list, NULL, True(), 3); - CHECK_EQUAL(0, reporter.testFailedCount); +TEST(SlowTestsWithTimeExemptionPass) +{ + SlowTestHelper::testRunnerFixture.runner.RunTestsIf(SlowTestHelper::testRunnerFixture.list, NULL, True(), 3); + CHECK_EQUAL(0, SlowTestHelper::testRunnerFixture.reporter.testFailedCount); } struct TestSuiteFixture From 107378a39710230fbc3110a38dfd5acd302e76a1 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 5 Feb 2013 23:22:32 -0600 Subject: [PATCH 010/184] Changed all parameters to TestReporterStdout::ReportSummary to be const. This best preserved the intent of the original definition while supporting a non-conformant compiler that could not handle the mismatch. --- src/TestReporterStdout.cpp | 2 +- src/TestReporterStdout.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TestReporterStdout.cpp b/src/TestReporterStdout.cpp index 1538570..c519e76 100644 --- a/src/TestReporterStdout.cpp +++ b/src/TestReporterStdout.cpp @@ -31,7 +31,7 @@ void TestReporterStdout::ReportTestFinish(TestDetails const& /*test*/, float) } void TestReporterStdout::ReportSummary(int const totalTestCount, int const failedTestCount, - int const failureCount, float secondsElapsed) + int const failureCount, float const secondsElapsed) { using namespace std; diff --git a/src/TestReporterStdout.h b/src/TestReporterStdout.h index e8d7bbf..457c0b6 100644 --- a/src/TestReporterStdout.h +++ b/src/TestReporterStdout.h @@ -11,7 +11,7 @@ class UNITTEST_LINKAGE TestReporterStdout : public TestReporter 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); + virtual void ReportSummary(int const totalTestCount, int const failedTestCount, int const failureCount, float const secondsElapsed); }; } From 000349718d3a77b95f54df6ac4e17fb698ab6eb4 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 6 Feb 2013 00:13:45 -0600 Subject: [PATCH 011/184] Changed sprintf to snprintf in MemoryOutStream::FormatToStream. Removed trailing 'f' from floats and formatted all floats and doubles to '%0.6f'. --- src/MemoryOutStream.cpp | 9 +++++---- src/tests/TestMemoryOutStream.cpp | 14 +++++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/MemoryOutStream.cpp b/src/MemoryOutStream.cpp index 3bacb45..8b97132 100644 --- a/src/MemoryOutStream.cpp +++ b/src/MemoryOutStream.cpp @@ -32,8 +32,9 @@ void FormatToStream(MemoryOutStream& stream, char const* format, ValueType const { using namespace std; - char txt[32]; - sprintf(txt, format, value); + const size_t BUFFER_SIZE=32; + char txt[BUFFER_SIZE]; + snprintf(txt, BUFFER_SIZE, format, value); stream << txt; } @@ -127,7 +128,7 @@ MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) MemoryOutStream& MemoryOutStream::operator <<(float const f) { - FormatToStream(*this, "%ff", f); + FormatToStream(*this, "%0.6f", f); return *this; } @@ -145,7 +146,7 @@ MemoryOutStream& MemoryOutStream::operator <<(unsigned int const s) MemoryOutStream& MemoryOutStream::operator <<(double const d) { - FormatToStream(*this, "%f", d); + FormatToStream(*this, "%0.6f", d); return *this; } diff --git a/src/tests/TestMemoryOutStream.cpp b/src/tests/TestMemoryOutStream.cpp index 87d19c5..964f149 100644 --- a/src/tests/TestMemoryOutStream.cpp +++ b/src/tests/TestMemoryOutStream.cpp @@ -4,6 +4,7 @@ #include #include #include +#include using namespace UnitTest; using namespace std; @@ -152,15 +153,15 @@ TEST(WritingStringLongerThanCapacityFitsInNewBuffer) TEST(WritingIntLongerThanCapacityFitsInNewBuffer) { MemoryOutStream stream(8); - stream << "aaaa" << 123456;; + stream << "aaaa" << 123456; CHECK_EQUAL("aaaa123456", stream.GetText()); } TEST(WritingFloatLongerThanCapacityFitsInNewBuffer) { MemoryOutStream stream(8); - stream << "aaaa" << 123456.0f;; - CHECK_EQUAL("aaaa123456.000000f", stream.GetText()); + stream << "aaaa" << 123456.0f; + CHECK_EQUAL("aaaa123456.000000", stream.GetText()); } TEST(WritingSizeTLongerThanCapacityFitsInNewBuffer) @@ -170,6 +171,13 @@ TEST(WritingSizeTLongerThanCapacityFitsInNewBuffer) CHECK_EQUAL("aaaa32145", stream.GetText()); } +TEST(VerifyLargeDoubleCanBeStreamedWithoutCrashing) +{ + MemoryOutStream stream(8); + stream << DBL_MAX; + CHECK(true); +} + #endif } From 4706ca942f53da90cc09117d7fe0f7da5efa5ffe Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 8 Feb 2013 23:33:47 -0600 Subject: [PATCH 012/184] Converted integral stream testing to min/max/mid style. Added hard-coded strings for each sizeof() the common integral sizes to eliminate dependency on platform-specific sizes. --- src/tests/TestMemoryOutStream.cpp | 151 +++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 5 deletions(-) diff --git a/src/tests/TestMemoryOutStream.cpp b/src/tests/TestMemoryOutStream.cpp index 964f149..8ab0d03 100644 --- a/src/tests/TestMemoryOutStream.cpp +++ b/src/tests/TestMemoryOutStream.cpp @@ -2,8 +2,8 @@ #include "../MemoryOutStream.h" #include -#include #include +#include #include using namespace UnitTest; @@ -11,6 +11,57 @@ using namespace std; namespace { +const char* const maxSignedIntegralStr(size_t nBytes) +{ + switch(nBytes) + { + case 8: + return "9223372036854775807"; + case 4: + return "2147483647"; + case 2: + return "32767"; + case 1: + return "127"; + default: + return "Unsupported signed integral size"; + } +} + +const char* const minSignedIntegralStr(size_t nBytes) +{ + switch(nBytes) + { + case 8: + return "-9223372036854775808"; + case 4: + return "-2147483648"; + case 2: + return "-32768"; + case 1: + return "-128"; + default: + return "Unsupported signed integral size"; + } +} + +const char* const maxUnsignedIntegralStr(size_t nBytes) +{ + switch(nBytes) + { + case 8: + return "18446744073709551615"; + case 4: + return "4294967295"; + case 2: + return "65535"; + case 1: + return "255"; + default: + return "Unsupported signed integral size"; + } +} + TEST(DefaultIsEmptyString) { MemoryOutStream const stream; @@ -39,6 +90,20 @@ TEST(StreamingIntWritesCorrectCharacters) CHECK_EQUAL("123", stream.GetText()); } +TEST(StreaminMaxIntWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << INT_MAX; + CHECK_EQUAL(maxSignedIntegralStr(sizeof(int)), stream.GetText()); +} + +TEST(StreamingMinIntWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << INT_MIN; + CHECK_EQUAL(minSignedIntegralStr(sizeof(int)), stream.GetText()); +} + TEST(StreamingUnsignedIntWritesCorrectCharacters) { MemoryOutStream stream; @@ -46,6 +111,20 @@ TEST(StreamingUnsignedIntWritesCorrectCharacters) CHECK_EQUAL("123", stream.GetText()); } +TEST(StreamingMaxUnsignedIntWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned int)UINT_MAX; + CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned int)), stream.GetText()); +} + +TEST(StreamingMinUnsignedIntWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned int)0; + CHECK_EQUAL("0", stream.GetText()); +} + TEST(StreamingLongWritesCorrectCharacters) { MemoryOutStream stream; @@ -53,6 +132,20 @@ TEST(StreamingLongWritesCorrectCharacters) CHECK_EQUAL("-123", stream.GetText()); } +TEST(StreamingMaxLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (long)(LONG_MAX); + CHECK_EQUAL(maxSignedIntegralStr(sizeof(long)), stream.GetText()); +} + +TEST(StreamingMinLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (long)(LONG_MIN); + CHECK_EQUAL(minSignedIntegralStr(sizeof(long)), stream.GetText()); +} + TEST(StreamingUnsignedLongWritesCorrectCharacters) { MemoryOutStream stream; @@ -60,18 +153,66 @@ TEST(StreamingUnsignedLongWritesCorrectCharacters) CHECK_EQUAL("123", stream.GetText()); } +TEST(StreamingMaxUnsignedLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned long)ULONG_MAX; + CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long)), stream.GetText()); +} + +TEST(StreamingMinUnsignedLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned long)0ul; + CHECK_EQUAL("0", stream.GetText()); +} + TEST(StreamingLongLongWritesCorrectCharacters) { MemoryOutStream stream; - stream << (long long)8589934590ll; - CHECK_EQUAL("8589934590", stream.GetText()); + stream << (long long)-12345ll; + CHECK_EQUAL("-12345", stream.GetText()); } +#ifdef LLONG_MAX +TEST(StreamingMaxLongLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (long long)LLONG_MAX; + CHECK_EQUAL(maxSignedIntegralStr(sizeof(long long)), stream.GetText()); +} +#endif + +#ifdef LLONG_MIN +TEST(StreamingMinLongLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (long long)LLONG_MIN; + CHECK_EQUAL(minSignedIntegralStr(sizeof(long long)), stream.GetText()); +} +#endif + TEST(StreamingUnsignedLongLongWritesCorrectCharacters) { MemoryOutStream stream; - stream << (unsigned long long)8589934590ull; - CHECK_EQUAL("8589934590", stream.GetText()); + stream << (unsigned long long)85899ull; + CHECK_EQUAL("85899", stream.GetText()); +} + +#ifdef ULLONG_MAX +TEST(StreamingMaxUnsignedLongLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned long long)ULLONG_MAX; + CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long long)), stream.GetText()); +} +#endif + +TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) +{ + MemoryOutStream stream; + stream << (unsigned long long)0ull; + CHECK_EQUAL("0", stream.GetText()); } TEST(StreamingFloatWritesCorrectCharacters) From cd36781bed3237d34a71d42359abeed4b41bf13c Mon Sep 17 00:00:00 2001 From: Sean Farrell Date: Fri, 15 Feb 2013 13:34:25 +0100 Subject: [PATCH 013/184] Fixes compile error with MSC. Unfortunately MSC does not support C99 where snprintf was added to the standard. As a workaround alias _snprint to snprintf. --- src/MemoryOutStream.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MemoryOutStream.cpp b/src/MemoryOutStream.cpp index 8b97132..3c112b6 100644 --- a/src/MemoryOutStream.cpp +++ b/src/MemoryOutStream.cpp @@ -23,6 +23,10 @@ void MemoryOutStream::Clear() #include #include +#if _MSC_VER +#define snprintf _snprintf +#endif + namespace UnitTest { namespace { From 14ec171068181c97c27908159867920df7de7d22 Mon Sep 17 00:00:00 2001 From: Sean Farrell Date: Fri, 15 Feb 2013 13:34:58 +0100 Subject: [PATCH 014/184] Adds Visual Studio 2010 project files. --- TestUnitTest++.vsnet2010.vcxproj | 123 +++++++++++++++++++++++ TestUnitTest++.vsnet2010.vcxproj.filters | 26 +++++ UnitTest++.vsnet2010.sln | 26 +++++ UnitTest++.vsnet2010.vcxproj | 118 ++++++++++++++++++++++ UnitTest++.vsnet2010.vcxproj.filters | 55 ++++++++++ 5 files changed, 348 insertions(+) create mode 100644 TestUnitTest++.vsnet2010.vcxproj create mode 100644 TestUnitTest++.vsnet2010.vcxproj.filters create mode 100644 UnitTest++.vsnet2010.sln create mode 100644 UnitTest++.vsnet2010.vcxproj create mode 100644 UnitTest++.vsnet2010.vcxproj.filters diff --git a/TestUnitTest++.vsnet2010.vcxproj b/TestUnitTest++.vsnet2010.vcxproj new file mode 100644 index 0000000..0bc8ac1 --- /dev/null +++ b/TestUnitTest++.vsnet2010.vcxproj @@ -0,0 +1,123 @@ +サソ + + + + Debug + Win32 + + + Release + Win32 + + + + {9CCC3439-309E-4E85-B3B8-CE704D385D48} + TestUnitTestvsnet2005 + Win32Proj + TestUnitTest++.vsnet2010 + + + + Application + Unicode + false + + + Application + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + obj\$(ProjectName)\$(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + obj\$(ProjectName)\$(Configuration)\ + false + + + + Disabled + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + Async + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + + + true + Console + MachineX86 + + + "$(TargetPath)" + + + + + MaxSpeed + WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + Async + MultiThreadedDLL + + + Level4 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + "$(TargetPath)" + + + + + + + + + + + + + + + + + + + + + + + + + + + + {64a4fefe-0461-4e95-8cc1-91ef5f57dbc6} + + + + + + \ No newline at end of file diff --git a/TestUnitTest++.vsnet2010.vcxproj.filters b/TestUnitTest++.vsnet2010.vcxproj.filters new file mode 100644 index 0000000..450d1fb --- /dev/null +++ b/TestUnitTest++.vsnet2010.vcxproj.filters @@ -0,0 +1,26 @@ +サソ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UnitTest++.vsnet2010.sln b/UnitTest++.vsnet2010.sln new file mode 100644 index 0000000..47268f1 --- /dev/null +++ b/UnitTest++.vsnet2010.sln @@ -0,0 +1,26 @@ +サソ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2010", "UnitTest++.vsnet2010.vcxproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2010", "TestUnitTest++.vsnet2010.vcxproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.ActiveCfg = Debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.Build.0 = Debug|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.ActiveCfg = Release|Win32 + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.Build.0 = Release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.ActiveCfg = Debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.Build.0 = Debug|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.ActiveCfg = Release|Win32 + {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/UnitTest++.vsnet2010.vcxproj b/UnitTest++.vsnet2010.vcxproj new file mode 100644 index 0000000..9e0816b --- /dev/null +++ b/UnitTest++.vsnet2010.vcxproj @@ -0,0 +1,118 @@ +サソ + + + + Debug + Win32 + + + Release + Win32 + + + + {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} + UnitTestvsnet2005 + Win32Proj + UnitTest++.vsnet2010 + + + + StaticLibrary + Unicode + false + + + StaticLibrary + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + obj\$(ProjectName)\$(Configuration)\ + $(SolutionDir)$(Configuration)\ + obj\$(ProjectName)\$(Configuration)\ + + + + Disabled + WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + Async + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + + + + + MinSpace + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + Async + MultiThreadedDLL + + + Level4 + ProgramDatabase + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/UnitTest++.vsnet2010.vcxproj.filters b/UnitTest++.vsnet2010.vcxproj.filters new file mode 100644 index 0000000..eea216f --- /dev/null +++ b/UnitTest++.vsnet2010.vcxproj.filters @@ -0,0 +1,55 @@ +サソ + + + + {574dd04f-2b0e-463b-adf4-d019dba5403f} + + + + + Win32 + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d62159e6ab823112589025a10583e0a83ae12a92 Mon Sep 17 00:00:00 2001 From: Sean Farrell Date: Fri, 15 Feb 2013 13:35:23 +0100 Subject: [PATCH 015/184] Adds .gitignore. --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23d7021 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.o +*.a +*.user +*.suo +*.sdf +*.opensdf +Release +Debug +ipch \ No newline at end of file From fbf390cd8d0e55009fb94a4a45e617bcdd3eed19 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 16 Feb 2013 23:53:30 -0600 Subject: [PATCH 016/184] Add .what() to error message when standard exception is raised in CHECK. --- src/CheckMacros.h | 7 +++++++ src/tests/TestExceptions.cpp | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/CheckMacros.h b/src/CheckMacros.h index db93aab..a8c125c 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -41,6 +41,13 @@ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ UT_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index ecb3dc7..b5b7339 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -6,13 +6,15 @@ #include "RecordingReporter.h" #include "ScopedCurrentTest.h" +#include + using namespace std; namespace { int ThrowingFunction() { - throw "Doh"; + throw std::logic_error("Doh"); } TEST(CheckFailsOnException) @@ -41,6 +43,18 @@ TEST(CheckFailureBecauseOfExceptionIncludesCheckContents) CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); } +TEST(CheckFailureBecauseOfStandardExceptionIncludesWhat) +{ + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + CHECK(ThrowingFunction() == 1); + } + + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); +} + TEST(CheckEqualFailsOnException) { bool failure = false; From 5ddcdd9682490d1033cf2ef212b18aa837fc099a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 16 Feb 2013 23:56:20 -0600 Subject: [PATCH 017/184] Add .what() to error message when standard exception is raised in CHECK_EQUAL. --- src/CheckMacros.h | 7 +++++++ src/tests/TestExceptions.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/CheckMacros.h b/src/CheckMacros.h index a8c125c..c8e6e34 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -61,6 +61,13 @@ ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ UT_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index b5b7339..d8e1c6f 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -100,6 +100,18 @@ TEST(CheckEqualFailureBecauseOfExceptionIncludesCheckContents) CHECK(strstr(reporter.lastFailedMessage, "123")); } +TEST(CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) +{ + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + CHECK_EQUAL(ThrowingFunction(), 123); + } + + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); +} + TEST(CheckCloseFailsOnException) { bool failure = false; From 0950a96eee8ca6b33ea9c8bfe29f5ebd94456c8a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 16 Feb 2013 23:59:18 -0600 Subject: [PATCH 018/184] Add .what() to error message when standard exception is raised in CHECK_CLOSE. --- src/CheckMacros.h | 7 +++++++ src/tests/TestExceptions.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/CheckMacros.h b/src/CheckMacros.h index c8e6e34..65be97a 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -81,6 +81,13 @@ ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ UT_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index d8e1c6f..ff3b597 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -156,6 +156,18 @@ TEST(CheckCloseFailureBecauseOfExceptionIncludesCheckContents) CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); } +TEST(CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) +{ + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + CHECK_CLOSE((float)ThrowingFunction(), 1.0001f, 0.1f); + } + + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); +} + class ThrowingObject { public: From 6266300f01a3bd244330869b479107dda0f087b7 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 17 Feb 2013 00:31:05 -0600 Subject: [PATCH 019/184] Refactor common logic for CHECK tests into a fixture and add separate tests for std::exception and non. --- src/tests/TestExceptions.cpp | 67 +++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index ff3b597..88ee41b 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -13,45 +13,66 @@ using namespace std; namespace { int ThrowingFunction() +{ + throw "Doh"; +} + +int ThrowingStdExceptionFunction() { throw std::logic_error("Doh"); } -TEST(CheckFailsOnException) +struct CheckFixture { - bool failure = false; + CheckFixture() + : reporter() + , testResults(&reporter) { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + } + + void Throw() + { + ScopedCurrentTest scopedResults(testResults); CHECK(ThrowingFunction() == 1); - failure = (testResults.GetFailureCount() > 0); } - CHECK(failure); + void StdThrow() + { + ScopedCurrentTest scopedResults(testResults); + CHECK(ThrowingStdExceptionFunction() == 1); + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; +}; + +TEST_FIXTURE(CheckFixture, CheckFailsOnException) +{ + Throw(); + CHECK(testResults.GetFailureCount() > 0); } -TEST(CheckFailureBecauseOfExceptionIncludesCheckContents) +TEST_FIXTURE(CheckFixture, CheckFailsOnStdException) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK(ThrowingFunction() == 1); - } + StdThrow(); + CHECK(testResults.GetFailureCount() > 0); +} +TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents) +{ + Throw(); CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); } -TEST(CheckFailureBecauseOfStandardExceptionIncludesWhat) +TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK(ThrowingFunction() == 1); - } + StdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1")); +} +TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) +{ + StdThrow(); CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); } @@ -106,7 +127,7 @@ TEST(CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) { UnitTest::TestResults testResults(&reporter); ScopedCurrentTest scopedResults(testResults); - CHECK_EQUAL(ThrowingFunction(), 123); + CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); } CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); @@ -162,7 +183,7 @@ TEST(CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) { UnitTest::TestResults testResults(&reporter); ScopedCurrentTest scopedResults(testResults); - CHECK_CLOSE((float)ThrowingFunction(), 1.0001f, 0.1f); + CHECK_CLOSE((float)ThrowingStdExceptionFunction(), 1.0001f, 0.1f); } CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); From 7e97b46aa422c8d7ebbc8b86d1fa51c31a8e8af6 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 17 Feb 2013 22:03:36 -0600 Subject: [PATCH 020/184] Improve CheckFixture method names. Rename `CheckFixture::Throw` to `CheckFixture::PerformCheckWithNonStdThrow`. Rename `CheckFixture::StdThrow` to CheckFixture::PerformCheckWithStdThrow`. --- src/tests/TestExceptions.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index 88ee41b..bf43152 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -30,13 +30,13 @@ struct CheckFixture { } - void Throw() + void PerformCheckWithNonStdThrow() { ScopedCurrentTest scopedResults(testResults); CHECK(ThrowingFunction() == 1); } - void StdThrow() + void PerformCheckWithStdThrow() { ScopedCurrentTest scopedResults(testResults); CHECK(ThrowingStdExceptionFunction() == 1); @@ -48,31 +48,31 @@ struct CheckFixture TEST_FIXTURE(CheckFixture, CheckFailsOnException) { - Throw(); + PerformCheckWithNonStdThrow(); CHECK(testResults.GetFailureCount() > 0); } TEST_FIXTURE(CheckFixture, CheckFailsOnStdException) { - StdThrow(); + PerformCheckWithStdThrow(); CHECK(testResults.GetFailureCount() > 0); } TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents) { - Throw(); + PerformCheckWithNonStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); } TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents) { - StdThrow(); + PerformCheckWithStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1")); } TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) { - StdThrow(); + PerformCheckWithStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); } From 3d1e3324d2ae82dccdead10b0f702ecb3941b998 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 17 Feb 2013 22:17:35 -0600 Subject: [PATCH 021/184] Refactor TestExceptions CheckEqual tests to use a fixture and add additional tests for std:: exceptions. --- src/tests/TestExceptions.cpp | 88 +++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 31 deletions(-) diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index bf43152..753df10 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -76,31 +76,49 @@ TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); } -TEST(CheckEqualFailsOnException) +struct CheckEqualFixture { - bool failure = false; + CheckEqualFixture() + : reporter() + , testResults(&reporter) + , line(-1) { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_EQUAL(ThrowingFunction(), 1); - failure = (testResults.GetFailureCount() > 0); } - CHECK(failure); + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_EQUAL(ThrowingFunction(), 123); line = __LINE__; + } + + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); line = __LINE__; + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; +}; + +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnException) +{ + PerformCheckWithNonStdThrow(); + CHECK(testResults.GetFailureCount() > 0); } -TEST(CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnStdException) { - int line = 0; - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); + PerformCheckWithStdThrow(); + CHECK(testResults.GetFailureCount() > 0); +} - CHECK_EQUAL(ThrowingFunction(), 123); line = __LINE__; - } +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) +{ + PerformCheckWithNonStdThrow(); CHECK_EQUAL("testName", reporter.lastFailedTest); CHECK_EQUAL("suiteName", reporter.lastFailedSuite); @@ -108,27 +126,35 @@ TEST(CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST(CheckEqualFailureBecauseOfExceptionIncludesCheckContents) +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionContainsCorrectDetails) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_EQUAL(ThrowingFunction(), 123); - } + PerformCheckWithStdThrow(); + + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionIncludesCheckContents) +{ + PerformCheckWithNonStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()")); CHECK(strstr(reporter.lastFailedMessage, "123")); } -TEST(CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionIncludesCheckContents) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); - } + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction()")); + CHECK(strstr(reporter.lastFailedMessage, "123")); +} + +TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) +{ + PerformCheckWithStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); } From 858fa04977b3b23ea2aabc0e1119b6572eb57a20 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 17 Feb 2013 22:23:59 -0600 Subject: [PATCH 022/184] Refactor TestExceptions CheckClose tests to use a fixture and add additional tests for std:: exceptions. --- src/tests/TestExceptions.cpp | 93 +++++++++++++++++++++++------------- 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index 753df10..c225035 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -159,58 +159,87 @@ TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionInclu CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); } -TEST(CheckCloseFailsOnException) +struct CheckCloseFixture { - bool failure = false; + CheckCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_CLOSE((float)ThrowingFunction(), 1.0001f, 0.1f); - failure = (testResults.GetFailureCount() > 0); } - CHECK(failure); -} + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_CLOSE(static_cast(ThrowingFunction()), 1.0001f, 0.1f); line = __LINE__; + } -TEST(CheckCloseFailureBecauseOfExceptionContainsCorrectDetails) -{ - int line = 0; - RecordingReporter reporter; + void PerformCheckWithStdThrow() { - 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__; + UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_CLOSE(static_cast(ThrowingStdExceptionFunction()), 1.0001f, 0.1f); line = __LINE__; } + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; +}; + +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnException) +{ + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnStdException) +{ + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionContainsCorrectDetails) +{ + PerformCheckWithNonStdThrow(); + CHECK_EQUAL("closeTest", reporter.lastFailedTest); CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); CHECK_EQUAL("filename", reporter.lastFailedFile); CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST(CheckCloseFailureBecauseOfExceptionIncludesCheckContents) +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionContainsCorrectDetails) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_CLOSE((float)ThrowingFunction(), 1.0001f, 0.1f); - } + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "(float)ThrowingFunction()")); + CHECK_EQUAL("closeTest", reporter.lastFailedTest); + CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionIncludesCheckContents) +{ + PerformCheckWithNonStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingFunction())")); CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); } -TEST(CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionIncludesCheckContents) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - CHECK_CLOSE((float)ThrowingStdExceptionFunction(), 1.0001f, 0.1f); - } + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingStdExceptionFunction())")); + CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); +} + +TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) +{ + PerformCheckWithStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); } From 17293bf412367566ff735981d53999aeab6ddf6e Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 17 Feb 2013 22:46:04 -0600 Subject: [PATCH 023/184] Add .what() to error reporting for std::exceptions in CHECK_ARRAY_CLOSE. --- src/CheckMacros.h | 7 ++ src/tests/TestExceptions.cpp | 123 +++++++++++++++++++++++------------ 2 files changed, 88 insertions(+), 42 deletions(-) diff --git a/src/CheckMacros.h b/src/CheckMacros.h index 65be97a..6560af9 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -114,6 +114,13 @@ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ UT_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index c225035..e3333de 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -253,75 +253,114 @@ class ThrowingObject } }; -TEST(CheckArrayCloseFailureBecauseOfExceptionContainsCorrectDetails) +class StdThrowingObject { - int line = 0; - RecordingReporter reporter; +public: + float operator[](int) const { - UnitTest::TestResults testResults(&reporter); - UnitTest::TestDetails testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); + throw std::runtime_error("Test throw"); + } +}; - int const data[4] = { 0, 1, 2, 3 }; - CHECK_ARRAY_CLOSE(data, ThrowingObject(), 4, 0.01f); line = __LINE__; +struct CheckArrayCloseFixture +{ + CheckArrayCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } + + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const 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__; + } + + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + int const data[4] = { 0, 1, 2, 3 }; + CHECK_ARRAY_CLOSE(data, StdThrowingObject(), 4, 0.01f); line = __LINE__; } + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; +}; + +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureBecauseOfExceptionContainsCorrectDetails) +{ + PerformCheckWithNonStdThrow(); + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); CHECK_EQUAL("filename", reporter.lastFailedFile); CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST(CheckArrayCloseFailsOnException) +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureBecauseOfStdExceptionContainsCorrectDetails) { - bool failure = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + PerformCheckWithStdThrow(); - const float data[4] = { 0, 1, 2, 3 }; - ThrowingObject obj; - CHECK_ARRAY_CLOSE(data, obj, 3, 0.01f); + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} - failure = (testResults.GetFailureCount() > 0); - } +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailsOnException) +{ + PerformCheckWithNonStdThrow(); - CHECK(failure); + CHECK(testResults.GetFailureCount() > 0); } -TEST(CheckArrayCloseFailureOnExceptionIncludesCheckContents) +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailsOnStdException) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + PerformCheckWithStdThrow(); - const float data[4] = { 0, 1, 2, 3 }; - ThrowingObject obj; - CHECK_ARRAY_CLOSE(data, obj, 3, 0.01f); - } + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureOnExceptionIncludesCheckContents) +{ + PerformCheckWithNonStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "obj")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); } -TEST(CheckArrayEqualFailsOnException) +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureOnStdExceptionIncludesCheckContents) { - bool failure = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + PerformCheckWithStdThrow(); - 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, "StdThrowingObject()")); +} - failure = (testResults.GetFailureCount() > 0); - } +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailsOnException) +{ + PerformCheckWithNonStdThrow(); - CHECK(failure); + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailsOnStdException) +{ + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailureOnStdExceptionIncludesWhat) +{ + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); } TEST(CheckArrayEqualFailureOnExceptionIncludesCheckContents) From af9d91d16bd8e7cf9da33af889cbbd3201910768 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 21:20:34 -0600 Subject: [PATCH 024/184] Add .what() to error reporting for std::exceptions in CHECK_ARRAY_EQUAL. --- src/CheckMacros.h | 7 +++ src/tests/TestExceptions.cpp | 82 ++++++++++++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 8 deletions(-) diff --git a/src/CheckMacros.h b/src/CheckMacros.h index 6560af9..9833222 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -101,6 +101,13 @@ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ UT_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index e3333de..647517d 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -363,22 +363,88 @@ TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailureOnStdExceptionInclude CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); } -TEST(CheckArrayEqualFailureOnExceptionIncludesCheckContents) +struct CheckArrayEqualFixture { - RecordingReporter reporter; + CheckArrayEqualFixture() + : reporter() + , testResults(&reporter) + , line(-1) { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + } - const float data[4] = { 0, 1, 2, 3 }; - ThrowingObject obj; - CHECK_ARRAY_EQUAL (data, obj, 3); + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + int const data[4] = { 0, 1, 2, 3 }; + CHECK_ARRAY_EQUAL(data, ThrowingObject(), 4); line = __LINE__; + } + + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + int const data[4] = { 0, 1, 2, 3 }; + CHECK_ARRAY_EQUAL(data, StdThrowingObject(), 4); line = __LINE__; } + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; +}; + +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailsOnException) +{ + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailsOnStdException) +{ + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailureOnExceptionIncludesCheckContents) +{ + PerformCheckWithNonStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "obj")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); } +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailureOnStdExceptionIncludesCheckContents) +{ + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); +} + +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayEqualFailsOnException) +{ + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayEqualFailsOnStdException) +{ + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayEqualFailureOnStdExceptionIncludesWhat) +{ + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); +} + + class ThrowingObject2D { public: From 4a95a3473ab28f4b520dd00504c783d51148108e Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 21:40:38 -0600 Subject: [PATCH 025/184] Add .what() to error reporting for std::exceptions in CHECK_ARRAY2D_CLOSE. --- src/CheckMacros.h | 9 +- src/tests/TestExceptions.cpp | 228 +++++++++++++++++++++-------------- 2 files changed, 143 insertions(+), 94 deletions(-) diff --git a/src/CheckMacros.h b/src/CheckMacros.h index 9833222..9d6a759 100644 --- a/src/CheckMacros.h +++ b/src/CheckMacros.h @@ -141,10 +141,17 @@ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ UT_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ + "Unhandled exception in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"); \ }) \ UNITTEST_MULTILINE_MACRO_END diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index 647517d..0965467 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -262,6 +262,8 @@ class StdThrowingObject } }; +SUITE(ArrayClose) +{ struct CheckArrayCloseFixture { CheckArrayCloseFixture() @@ -292,7 +294,7 @@ struct CheckArrayCloseFixture int line; }; -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureBecauseOfExceptionContainsCorrectDetails) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) { PerformCheckWithNonStdThrow(); @@ -302,7 +304,7 @@ TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureBecauseOfExceptionCon CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureBecauseOfStdExceptionContainsCorrectDetails) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) { PerformCheckWithStdThrow(); @@ -312,21 +314,21 @@ TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureBecauseOfStdException CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailsOnException) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnException) { PerformCheckWithNonStdThrow(); CHECK(testResults.GetFailureCount() > 0); } -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailsOnStdException) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnStdException) { PerformCheckWithStdThrow(); CHECK(testResults.GetFailureCount() > 0); } -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureOnExceptionIncludesCheckContents) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnExceptionIncludesCheckContents) { PerformCheckWithNonStdThrow(); @@ -334,7 +336,7 @@ TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureOnExceptionIncludesCh CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); } -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureOnStdExceptionIncludesCheckContents) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) { PerformCheckWithStdThrow(); @@ -342,109 +344,106 @@ TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayCloseFailureOnStdExceptionInclude CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); } -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailsOnException) -{ - PerformCheckWithNonStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); -} - -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailsOnStdException) -{ - PerformCheckWithStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); -} - -TEST_FIXTURE(CheckArrayCloseFixture, CheckArrayEqualFailureOnStdExceptionIncludesWhat) +TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesWhat) { PerformCheckWithStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); } +} -struct CheckArrayEqualFixture +SUITE(ArrayEqual) { - CheckArrayEqualFixture() - : reporter() - , testResults(&reporter) - , line(-1) - { - } - - void PerformCheckWithNonStdThrow() + struct CheckArrayEqualFixture { - UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - int const data[4] = { 0, 1, 2, 3 }; - CHECK_ARRAY_EQUAL(data, ThrowingObject(), 4); line = __LINE__; - } - - void PerformCheckWithStdThrow() - { - UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - int const data[4] = { 0, 1, 2, 3 }; - CHECK_ARRAY_EQUAL(data, StdThrowingObject(), 4); line = __LINE__; - } + CheckArrayEqualFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } + + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const testDetails("arrayEqualTest", "arrayEqualSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + int const data[4] = { 0, 1, 2, 3 }; + CHECK_ARRAY_EQUAL(data, ThrowingObject(), 4); line = __LINE__; + } + + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("arrayEqualTest", "arrayEqualSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + int const data[4] = { 0, 1, 2, 3 }; + CHECK_ARRAY_EQUAL(data, StdThrowingObject(), 4); line = __LINE__; + } - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; -}; + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailsOnException) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) { PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); + CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailsOnStdException) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) { PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); + CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailureOnExceptionIncludesCheckContents) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnException) { PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); + CHECK(testResults.GetFailureCount() > 0); } -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayCloseFailureOnStdExceptionIncludesCheckContents) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnStdException) { PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); + CHECK(testResults.GetFailureCount() > 0); } -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayEqualFailsOnException) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnExceptionIncludesCheckContents) { PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); } -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayEqualFailsOnStdException) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesCheckContents) { PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); } -TEST_FIXTURE(CheckArrayEqualFixture, CheckArrayEqualFailureOnStdExceptionIncludesWhat) +TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesWhat) { PerformCheckWithStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); } +} - +SUITE(Check2D) +{ class ThrowingObject2D { public: @@ -454,59 +453,102 @@ class ThrowingObject2D } }; -TEST(CheckArray2DCloseFailureBecauseOfExceptionContainsCorrectDetails) +class StdThrowingObject2D { - int line = 0; - RecordingReporter reporter; +public: + float* operator[](int) const { - UnitTest::TestResults testResults(&reporter); - UnitTest::TestDetails testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); + throw std::runtime_error("Test throw"); + } +}; + +struct CheckArray2DCloseFixture +{ + CheckArray2DCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } + + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const 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__; + } - const float data[2][2] = { {0, 1}, {2, 3} }; - CHECK_ARRAY2D_CLOSE(data, ThrowingObject2D(), 2, 2, 0.01f); line = __LINE__; + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + const float data[2][2] = { {0, 1}, {2, 3} }; + CHECK_ARRAY2D_CLOSE(data, StdThrowingObject2D(), 2, 2, 0.01f); line = __LINE__; } + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; +}; + +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) +{ + PerformCheckWithNonStdThrow(); + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); CHECK_EQUAL("filename", reporter.lastFailedFile); CHECK_EQUAL(line, reporter.lastFailedLine); } -TEST(CheckArray2DCloseFailsOnException) +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) { - bool failure = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + PerformCheckWithStdThrow(); - const float data[2][2] = { {0, 1}, {2, 3} }; - ThrowingObject2D obj; - CHECK_ARRAY2D_CLOSE(data, obj, 2, 2, 0.01f); + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} - failure = (testResults.GetFailureCount() > 0); - } +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnException) +{ + PerformCheckWithNonStdThrow(); - CHECK(failure); + CHECK(testResults.GetFailureCount() > 0); } -TEST(CheckArray2DCloseFailureOnExceptionIncludesCheckContents) +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnStdException) { - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + PerformCheckWithStdThrow(); - const float data[2][2] = { {0, 1}, {2, 3} }; - ThrowingObject2D obj; - CHECK_ARRAY2D_CLOSE(data, obj, 2, 2, 0.01f); - } + CHECK(testResults.GetFailureCount() > 0); +} + +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnExceptionIncludesCheckContents) +{ + PerformCheckWithNonStdThrow(); CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "obj")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject2D()")); } +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) +{ + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject2D()")); +} + +TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesWhat) +{ + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); +} +} } #endif From 299df3efe54d147194156575392e8b8b5af287e8 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 21:46:40 -0600 Subject: [PATCH 026/184] Group all exception tests into suites and normalize indentation. --- src/tests/TestExceptions.cpp | 727 ++++++++++++++++++----------------- 1 file changed, 368 insertions(+), 359 deletions(-) diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index 0965467..fa8b917 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -22,226 +22,235 @@ int ThrowingStdExceptionFunction() throw std::logic_error("Doh"); } -struct CheckFixture +SUITE(CheckExceptionTests) { - CheckFixture() - : reporter() - , testResults(&reporter) + struct CheckFixture { + CheckFixture() + : reporter() + , testResults(&reporter) + { + } + + void PerformCheckWithNonStdThrow() + { + ScopedCurrentTest scopedResults(testResults); + CHECK(ThrowingFunction() == 1); + } + + void PerformCheckWithStdThrow() + { + ScopedCurrentTest scopedResults(testResults); + CHECK(ThrowingStdExceptionFunction() == 1); + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + }; + + TEST_FIXTURE(CheckFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); + CHECK(testResults.GetFailureCount() > 0); } - void PerformCheckWithNonStdThrow() + TEST_FIXTURE(CheckFixture, CheckFailsOnStdException) { - ScopedCurrentTest scopedResults(testResults); - CHECK(ThrowingFunction() == 1); + PerformCheckWithStdThrow(); + CHECK(testResults.GetFailureCount() > 0); } - void PerformCheckWithStdThrow() + TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents) { - ScopedCurrentTest scopedResults(testResults); - CHECK(ThrowingStdExceptionFunction() == 1); + PerformCheckWithNonStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); } - RecordingReporter reporter; - UnitTest::TestResults testResults; -}; + TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1")); + } -TEST_FIXTURE(CheckFixture, CheckFailsOnException) -{ - PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); + TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + } } -TEST_FIXTURE(CheckFixture, CheckFailsOnStdException) +SUITE(CheckEqualExceptionTests) { - PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + struct CheckEqualFixture + { + CheckEqualFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } -TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents) -{ - PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); -} + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_EQUAL(ThrowingFunction(), 123); line = __LINE__; + } -TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents) -{ - PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1")); -} + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); line = __LINE__; + } -TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) -{ - PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); -} + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; -struct CheckEqualFixture -{ - CheckEqualFixture() - : reporter() - , testResults(&reporter) - , line(-1) + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnException) { + PerformCheckWithNonStdThrow(); + CHECK(testResults.GetFailureCount() > 0); } - void PerformCheckWithNonStdThrow() + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnStdException) { - UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - CHECK_EQUAL(ThrowingFunction(), 123); line = __LINE__; + PerformCheckWithStdThrow(); + CHECK(testResults.GetFailureCount() > 0); } - void PerformCheckWithStdThrow() + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) { - UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); line = __LINE__; - } + PerformCheckWithNonStdThrow(); - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; -}; + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnException) -{ - PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnStdException) -{ - PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); - CHECK_EQUAL("testName", reporter.lastFailedTest); - CHECK_EQUAL("suiteName", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()")); + CHECK(strstr(reporter.lastFailedMessage, "123")); + } -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionContainsCorrectDetails) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); - CHECK_EQUAL("testName", reporter.lastFailedTest); - CHECK_EQUAL("suiteName", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction()")); + CHECK(strstr(reporter.lastFailedMessage, "123")); + } -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionIncludesCheckContents) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()")); - CHECK(strstr(reporter.lastFailedMessage, "123")); + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + } } -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionIncludesCheckContents) +SUITE(CheckCloseExceptionTests) { - PerformCheckWithStdThrow(); + struct CheckCloseFixture + { + CheckCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } - CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction()")); - CHECK(strstr(reporter.lastFailedMessage, "123")); -} + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_CLOSE(static_cast(ThrowingFunction()), 1.0001f, 0.1f); line = __LINE__; + } -TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) -{ - PerformCheckWithStdThrow(); + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + CHECK_CLOSE(static_cast(ThrowingStdExceptionFunction()), 1.0001f, 0.1f); line = __LINE__; + } - CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); -} + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; -struct CheckCloseFixture -{ - CheckCloseFixture() - : reporter() - , testResults(&reporter) - , line(-1) + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnException) { - } + PerformCheckWithNonStdThrow(); - void PerformCheckWithNonStdThrow() - { - UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - CHECK_CLOSE(static_cast(ThrowingFunction()), 1.0001f, 0.1f); line = __LINE__; + CHECK(testResults.GetFailureCount() > 0); } - void PerformCheckWithStdThrow() + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnStdException) { - UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - CHECK_CLOSE(static_cast(ThrowingStdExceptionFunction()), 1.0001f, 0.1f); line = __LINE__; - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; -}; - -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnException) -{ - PerformCheckWithNonStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); -} - -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnStdException) -{ - PerformCheckWithStdThrow(); + PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionContainsCorrectDetails) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); - CHECK_EQUAL("closeTest", reporter.lastFailedTest); - CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("closeTest", reporter.lastFailedTest); + CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionContainsCorrectDetails) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); - CHECK_EQUAL("closeTest", reporter.lastFailedTest); - CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("closeTest", reporter.lastFailedTest); + CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionIncludesCheckContents) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingFunction())")); - CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); -} + CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingFunction())")); + CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); + } -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionIncludesCheckContents) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingStdExceptionFunction())")); - CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); -} + CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingStdExceptionFunction())")); + CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); + } -TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + } } class ThrowingObject @@ -262,97 +271,97 @@ class StdThrowingObject } }; -SUITE(ArrayClose) +SUITE(CheckArrayCloseExceptionTests) { -struct CheckArrayCloseFixture -{ - CheckArrayCloseFixture() - : reporter() - , testResults(&reporter) - , line(-1) + struct CheckArrayCloseFixture { - } + CheckArrayCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } - void PerformCheckWithNonStdThrow() - { - UnitTest::TestDetails const 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__; - } + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const 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__; + } - void PerformCheckWithStdThrow() - { - UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - int const data[4] = { 0, 1, 2, 3 }; - CHECK_ARRAY_CLOSE(data, StdThrowingObject(), 4, 0.01f); line = __LINE__; - } + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + int const data[4] = { 0, 1, 2, 3 }; + CHECK_ARRAY_CLOSE(data, StdThrowingObject(), 4, 0.01f); line = __LINE__; + } - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; -}; + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); - CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); - CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnException) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnStdException) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnExceptionIncludesCheckContents) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); -} + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); + } -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); -} + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); + } -TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesWhat) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); -} + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); + } } -SUITE(ArrayEqual) +SUITE(CheckArrayEqualExceptionTests) { struct CheckArrayEqualFixture { @@ -384,170 +393,170 @@ SUITE(ArrayEqual) int line; }; -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); - CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); - CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnException) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnStdException) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnExceptionIncludesCheckContents) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); -} + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); + } -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesCheckContents) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); -} + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); + } -TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesWhat) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); -} + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); + } } -SUITE(Check2D) +SUITE(CheckArray2DExceptionTests) { -class ThrowingObject2D -{ -public: - float* operator[](int) const + class ThrowingObject2D { - throw "Test throw"; - } -}; + public: + float* operator[](int) const + { + throw "Test throw"; + } + }; -class StdThrowingObject2D -{ -public: - float* operator[](int) const + class StdThrowingObject2D { - throw std::runtime_error("Test throw"); - } -}; + public: + float* operator[](int) const + { + throw std::runtime_error("Test throw"); + } + }; -struct CheckArray2DCloseFixture -{ - CheckArray2DCloseFixture() - : reporter() - , testResults(&reporter) - , line(-1) + struct CheckArray2DCloseFixture { - } + CheckArray2DCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + { + } - void PerformCheckWithNonStdThrow() - { - UnitTest::TestDetails const 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__; - } + void PerformCheckWithNonStdThrow() + { + UnitTest::TestDetails const 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__; + } - void PerformCheckWithStdThrow() - { - UnitTest::TestDetails const testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - const float data[2][2] = { {0, 1}, {2, 3} }; - CHECK_ARRAY2D_CLOSE(data, StdThrowingObject2D(), 2, 2, 0.01f); line = __LINE__; - } + void PerformCheckWithStdThrow() + { + UnitTest::TestDetails const testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + const float data[2][2] = { {0, 1}, {2, 3} }; + CHECK_ARRAY2D_CLOSE(data, StdThrowingObject2D(), 2, 2, 0.01f); line = __LINE__; + } - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; -}; + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); - CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); - CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnException) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnStdException) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); -} + CHECK(testResults.GetFailureCount() > 0); + } -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnExceptionIncludesCheckContents) -{ - PerformCheckWithNonStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject2D()")); -} + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject2D()")); + } -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject2D()")); -} + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject2D()")); + } -TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesWhat) -{ - PerformCheckWithStdThrow(); + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); -} + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); + } } } From b840df2d0d4667f2d04b8d17bbbf84b807421891 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 22:23:26 -0600 Subject: [PATCH 027/184] Change default MemoryOutStream to be a std::ostringstream. This changes restores the default behavior to that of UT++ 1.4. It is accomplished by reintroducing the old UNITTEST_USE_CUSTOM_STREAMS define, commented out, and surrounding the new define in an ifndef block. It was done this way to preserve any unconventional users that were specifying either flag in their build system, instead of in this file. --- config.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/config.h b/config.h index 92706c7..5313b09 100644 --- a/config.h +++ b/config.h @@ -28,13 +28,22 @@ #endif -// MemoryOutStream is a custom reimplementation of parts of std::ostringstream. -// Uncomment this line to have MemoryOutStream implemented in terms of std::ostringstream. +// By default, MemoryOutStream is implemented in terms of std::ostringstream. // This is useful if you are using the CHECK macros on objects that have something like this defined: // std::ostringstream& operator<<(std::ostringstream& s, const YourObject& value) - -//#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - +// +// On the other hand, it can be more expensive. +// Un-comment this line to use the custom MemoryOutStream (no deps on std::ostringstream). + +// #define UNITTEST_USE_CUSTOM_STREAMS + +// Developer note: This dual-macro setup is to preserve compatibility with UnitTest++ 1.4 users +// who may have used or defined UNITTEST_USE_CUSTOM_STREAMS outside of this configuration file, as +// well as Google Code HEAD users that may have used or defined +// UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file. +#ifndef UNITTEST_USE_CUSTOM_STREAMS + #define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM +#endif // DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like // XmlTestReporter. If you don't want to use this functionality, uncomment this line and no STL From 8a58afab17d02e7107b8481c929598d158521941 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 23:26:18 -0600 Subject: [PATCH 028/184] Add install targets and install path customization. This commit adds install() directives to the CMake file. By default, headers will be installed to CMAKE_INSTALL_PREFIX/include/UnitTest++ and libUnitTest++.a will be installed to CMAKE_INSTALL_PREFIX/lib. If the user defines UTPP_USE_PLUS_SIGN=OFF when generating, the ++ will be replaced with PP in both the library file name and the include path. --- CMakeLists.txt | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9210fe6..3e50e0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 2.8.1) project(UnitTest++) +option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON) + # get the main sources -file(GLOB SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp src/*.h) -source_group("" FILES ${SRCS}) +file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.h) +file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp) +source_group("" FILES ${headers_} ${sources_}) # get platform specific sources if (WIN32) @@ -11,19 +14,28 @@ if (WIN32) else() set(PLAT_DIR Posix) endif(WIN32) + file(GLOB PLAT_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${PLAT_DIR}/*.cpp src/${PLAT_DIR}/*.h) source_group(${PLAT_DIR} FILES ${PLAT_SRCS}) # create the lib -add_library(UnitTestPP STATIC ${SRCS} ${PLAT_SRCS}) -set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) +add_library(UnitTestPP STATIC ${headers_} ${sources_} ${PLAT_SRCS}) + +if(${UTPP_USE_PLUS_SIGN}) + set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) +endif() + include_directories(src) # build the test runner file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/tests/*.cpp src/tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTestPP ${TEST_SRCS}) -set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) + +if(${UTPP_USE_PLUS_SIGN}) + set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) +endif() + target_link_libraries(TestUnitTestPP UnitTestPP) # turn on testing @@ -33,3 +45,20 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V) # add the test runner as a test add_test(NAME TestUnitTestPP COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) add_dependencies(check TestUnitTestPP) + + +# add install targets +# need a custom install path? +# define CMAKE_INSTALL_PREFIX to change root folder +# don't want it to go in include/UnitTest++? +# define UTPP_INSTALL_DESTINATION +if (NOT DEFINED UTPP_INSTALL_DESTINATION) + if(${UTPP_USE_PLUS_SIGN}) + set (UTPP_INSTALL_DESTINATION "include/UnitTest++") + else() + set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") + endif() +endif() + +install(TARGETS UnitTestPP DESTINATION lib) +install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) \ No newline at end of file From c702d69a8560a290d2a661d2ef9ba4c4cca96136 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 23:33:33 -0600 Subject: [PATCH 029/184] Revert "Add install targets and install path customization." This reverts commit 1fa77e11c6e3afa9c3f4f54c3c888bf5c713fed5. --- CMakeLists.txt | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e50e0f..9210fe6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 2.8.1) project(UnitTest++) -option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON) - # get the main sources -file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.h) -file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp) -source_group("" FILES ${headers_} ${sources_}) +file(GLOB SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp src/*.h) +source_group("" FILES ${SRCS}) # get platform specific sources if (WIN32) @@ -14,28 +11,19 @@ if (WIN32) else() set(PLAT_DIR Posix) endif(WIN32) - file(GLOB PLAT_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${PLAT_DIR}/*.cpp src/${PLAT_DIR}/*.h) source_group(${PLAT_DIR} FILES ${PLAT_SRCS}) # create the lib -add_library(UnitTestPP STATIC ${headers_} ${sources_} ${PLAT_SRCS}) - -if(${UTPP_USE_PLUS_SIGN}) - set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) -endif() - +add_library(UnitTestPP STATIC ${SRCS} ${PLAT_SRCS}) +set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) include_directories(src) # build the test runner file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/tests/*.cpp src/tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTestPP ${TEST_SRCS}) - -if(${UTPP_USE_PLUS_SIGN}) - set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) -endif() - +set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) target_link_libraries(TestUnitTestPP UnitTestPP) # turn on testing @@ -45,20 +33,3 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V) # add the test runner as a test add_test(NAME TestUnitTestPP COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) add_dependencies(check TestUnitTestPP) - - -# add install targets -# need a custom install path? -# define CMAKE_INSTALL_PREFIX to change root folder -# don't want it to go in include/UnitTest++? -# define UTPP_INSTALL_DESTINATION -if (NOT DEFINED UTPP_INSTALL_DESTINATION) - if(${UTPP_USE_PLUS_SIGN}) - set (UTPP_INSTALL_DESTINATION "include/UnitTest++") - else() - set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") - endif() -endif() - -install(TARGETS UnitTestPP DESTINATION lib) -install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) \ No newline at end of file From 13a6c9e6ada95a291cdcf132ba2a0122f4a924a7 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 23:35:10 -0600 Subject: [PATCH 030/184] Add install targets and install path customization. This commit adds install() directives to the CMake file. By default, headers will be installed to CMAKE_INSTALL_PREFIX/include/UnitTest++ and libUnitTest++.a will be installed to CMAKE_INSTALL_PREFIX/lib. If the user defines UTPP_USE_PLUS_SIGN=OFF when generating, the ++ will be replaced with PP in both the library file name and the include path. --- CMakeLists.txt | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9210fe6..ba5694d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 2.8.1) project(UnitTest++) +option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON) + # get the main sources -file(GLOB SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp src/*.h) -source_group("" FILES ${SRCS}) +file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.h) +file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp) +source_group("" FILES ${headers_} ${sources_}) # get platform specific sources if (WIN32) @@ -11,19 +14,28 @@ if (WIN32) else() set(PLAT_DIR Posix) endif(WIN32) + file(GLOB PLAT_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${PLAT_DIR}/*.cpp src/${PLAT_DIR}/*.h) source_group(${PLAT_DIR} FILES ${PLAT_SRCS}) # create the lib -add_library(UnitTestPP STATIC ${SRCS} ${PLAT_SRCS}) -set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) +add_library(UnitTestPP STATIC ${headers_} ${sources_} ${PLAT_SRCS}) + +if(${UTPP_USE_PLUS_SIGN}) + set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) +endif() + include_directories(src) # build the test runner file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/tests/*.cpp src/tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTestPP ${TEST_SRCS}) -set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) + +if(${UTPP_USE_PLUS_SIGN}) + set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) +endif() + target_link_libraries(TestUnitTestPP UnitTestPP) # turn on testing @@ -33,3 +45,16 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V) # add the test runner as a test add_test(NAME TestUnitTestPP COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) add_dependencies(check TestUnitTestPP) + + +# add install targets +# need a custom install path? +# define CMAKE_INSTALL_PREFIX to change root folder +if(${UTPP_USE_PLUS_SIGN}) + set (UTPP_INSTALL_DESTINATION "include/UnitTest++") +else() + set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") +endif() + +install(TARGETS UnitTestPP DESTINATION lib) +install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) \ No newline at end of file From c3aa1e45a899bd0e746653c397da482371b89c6e Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 19 Feb 2013 23:56:22 -0600 Subject: [PATCH 031/184] Move unittestpp.h to src/UnitTestPP.h and add src/UnitTest++.h. This is a 1.4 compatibility and consistency fix. --- src/UnitTest++.h | 1 + src/UnitTestPP.h | 11 +++++++++++ src/tests/Main.cpp | 2 +- src/tests/TestAssertHandler.cpp | 2 +- src/tests/TestCheckMacros.cpp | 2 +- src/tests/TestChecks.cpp | 2 +- src/tests/TestCompositeTestReporter.cpp | 2 +- src/tests/TestCurrentTest.cpp | 2 +- src/tests/TestDeferredTestReporter.cpp | 2 +- src/tests/TestExceptions.cpp | 2 +- src/tests/TestMemoryOutStream.cpp | 2 +- src/tests/TestTest.cpp | 2 +- src/tests/TestTestList.cpp | 2 +- src/tests/TestTestMacros.cpp | 2 +- src/tests/TestTestResults.cpp | 2 +- src/tests/TestTestRunner.cpp | 2 +- src/tests/TestTestSuite.cpp | 2 +- src/tests/TestTimeConstraint.cpp | 2 +- src/tests/TestTimeConstraintMacro.cpp | 2 +- src/tests/TestUnitTestPP.cpp | 2 +- src/tests/TestXmlTestReporter.cpp | 2 +- unittestpp.h | 11 ----------- 22 files changed, 31 insertions(+), 30 deletions(-) create mode 100644 src/UnitTest++.h create mode 100644 src/UnitTestPP.h delete mode 100644 unittestpp.h diff --git a/src/UnitTest++.h b/src/UnitTest++.h new file mode 100644 index 0000000..1a9fe86 --- /dev/null +++ b/src/UnitTest++.h @@ -0,0 +1 @@ +#include "UnitTestPP.h" \ No newline at end of file diff --git a/src/UnitTestPP.h b/src/UnitTestPP.h new file mode 100644 index 0000000..69dde9b --- /dev/null +++ b/src/UnitTestPP.h @@ -0,0 +1,11 @@ +#ifndef UNITTESTPP_H +#define UNITTESTPP_H + +#include "../config.h" +#include "TestMacros.h" +#include "CheckMacros.h" +#include "TestRunner.h" +#include "TimeConstraint.h" +#include "ReportAssert.h" + +#endif diff --git a/src/tests/Main.cpp b/src/tests/Main.cpp index 47de7db..6e8c891 100644 --- a/src/tests/Main.cpp +++ b/src/tests/Main.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" int main(int, char const *[]) { diff --git a/src/tests/TestAssertHandler.cpp b/src/tests/TestAssertHandler.cpp index 6caba43..30275bc 100644 --- a/src/tests/TestAssertHandler.cpp +++ b/src/tests/TestAssertHandler.cpp @@ -1,5 +1,5 @@ #include "../../config.h" -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../ReportAssert.h" #include "../ReportAssertImpl.h" diff --git a/src/tests/TestCheckMacros.cpp b/src/tests/TestCheckMacros.cpp index c6c727b..be60875 100644 --- a/src/tests/TestCheckMacros.cpp +++ b/src/tests/TestCheckMacros.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../CurrentTest.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestChecks.cpp b/src/tests/TestChecks.cpp index 3d73b99..3059d50 100644 --- a/src/tests/TestChecks.cpp +++ b/src/tests/TestChecks.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "RecordingReporter.h" #include diff --git a/src/tests/TestCompositeTestReporter.cpp b/src/tests/TestCompositeTestReporter.cpp index c3d6a24..9318cc6 100644 --- a/src/tests/TestCompositeTestReporter.cpp +++ b/src/tests/TestCompositeTestReporter.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../CompositeTestReporter.h" using namespace UnitTest; diff --git a/src/tests/TestCurrentTest.cpp b/src/tests/TestCurrentTest.cpp index 35f9c5a..43732a8 100644 --- a/src/tests/TestCurrentTest.cpp +++ b/src/tests/TestCurrentTest.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../CurrentTest.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestDeferredTestReporter.cpp b/src/tests/TestDeferredTestReporter.cpp index a45eb05..0d7775e 100644 --- a/src/tests/TestDeferredTestReporter.cpp +++ b/src/tests/TestDeferredTestReporter.cpp @@ -2,7 +2,7 @@ #ifndef UNITTEST_NO_DEFERRED_REPORTER -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../DeferredTestReporter.h" #include diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index fa8b917..6c0307f 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -1,7 +1,7 @@ #include "../../config.h" #ifndef UNITTEST_NO_EXCEPTIONS -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../CurrentTest.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestMemoryOutStream.cpp b/src/tests/TestMemoryOutStream.cpp index 8ab0d03..27a7ce8 100644 --- a/src/tests/TestMemoryOutStream.cpp +++ b/src/tests/TestMemoryOutStream.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../MemoryOutStream.h" #include diff --git a/src/tests/TestTest.cpp b/src/tests/TestTest.cpp index efa31b8..58b0bc2 100644 --- a/src/tests/TestTest.cpp +++ b/src/tests/TestTest.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../TestReporter.h" #include "../TimeHelpers.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestTestList.cpp b/src/tests/TestTestList.cpp index 59517e7..03828e9 100644 --- a/src/tests/TestTestList.cpp +++ b/src/tests/TestTestList.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../TestList.h" using namespace UnitTest; diff --git a/src/tests/TestTestMacros.cpp b/src/tests/TestTestMacros.cpp index 8ab11d6..4a0f3ea 100644 --- a/src/tests/TestTestMacros.cpp +++ b/src/tests/TestTestMacros.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../TestMacros.h" #include "../TestList.h" #include "../TestResults.h" diff --git a/src/tests/TestTestResults.cpp b/src/tests/TestTestResults.cpp index 38414e5..2b9b703 100644 --- a/src/tests/TestTestResults.cpp +++ b/src/tests/TestTestResults.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../TestResults.h" #include "RecordingReporter.h" diff --git a/src/tests/TestTestRunner.cpp b/src/tests/TestTestRunner.cpp index 5b2d65a..3a98d62 100644 --- a/src/tests/TestTestRunner.cpp +++ b/src/tests/TestTestRunner.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "RecordingReporter.h" #include "../ReportAssert.h" #include "../TestList.h" diff --git a/src/tests/TestTestSuite.cpp b/src/tests/TestTestSuite.cpp index ad7725f..a82b75e 100644 --- a/src/tests/TestTestSuite.cpp +++ b/src/tests/TestTestSuite.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.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) diff --git a/src/tests/TestTimeConstraint.cpp b/src/tests/TestTimeConstraint.cpp index eec7e43..611ee6c 100644 --- a/src/tests/TestTimeConstraint.cpp +++ b/src/tests/TestTimeConstraint.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../TestResults.h" #include "../TimeHelpers.h" #include "RecordingReporter.h" diff --git a/src/tests/TestTimeConstraintMacro.cpp b/src/tests/TestTimeConstraintMacro.cpp index ebb5388..2e710bb 100644 --- a/src/tests/TestTimeConstraintMacro.cpp +++ b/src/tests/TestTimeConstraintMacro.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../TimeHelpers.h" #include "RecordingReporter.h" diff --git a/src/tests/TestUnitTestPP.cpp b/src/tests/TestUnitTestPP.cpp index f38ca93..cb4d0d0 100644 --- a/src/tests/TestUnitTestPP.cpp +++ b/src/tests/TestUnitTestPP.cpp @@ -1,4 +1,4 @@ -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "ScopedCurrentTest.h" // These are sample tests that show the different features of the framework diff --git a/src/tests/TestXmlTestReporter.cpp b/src/tests/TestXmlTestReporter.cpp index ec9cb7a..447acf0 100644 --- a/src/tests/TestXmlTestReporter.cpp +++ b/src/tests/TestXmlTestReporter.cpp @@ -1,7 +1,7 @@ #include "../../config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER -#include "../../unittestpp.h" +#include "../../src/UnitTestPP.h" #include "../XmlTestReporter.h" #include diff --git a/unittestpp.h b/unittestpp.h deleted file mode 100644 index dd3a5de..0000000 --- a/unittestpp.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef UNITTESTPP_H -#define UNITTESTPP_H - -#include "config.h" -#include "src/TestMacros.h" -#include "src/CheckMacros.h" -#include "src/TestRunner.h" -#include "src/TimeConstraint.h" -#include "src/ReportAssert.h" - -#endif From 0f8d425de712a0098cf4a3d43e1150fce06dbf12 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 00:01:55 -0600 Subject: [PATCH 032/184] Move config.h to src/Config.h. This is a 1.4 compatibility and consistency change. --- src/AssertException.h | 2 +- src/Checks.h | 2 +- config.h => src/Config.h | 0 src/DeferredTestReporter.cpp | 2 +- src/DeferredTestReporter.h | 2 +- src/DeferredTestResult.cpp | 2 +- src/DeferredTestResult.h | 2 +- src/ExceptionMacros.h | 2 +- src/ExecuteTest.h | 2 +- src/HelperMacros.h | 2 +- src/MemoryOutStream.h | 2 +- src/ReportAssertImpl.h | 2 +- src/Test.cpp | 2 +- src/TestMacros.h | 2 +- src/TimeHelpers.h | 2 +- src/UnitTestPP.h | 2 +- src/Win32/TimeHelpers.h | 2 +- src/XmlTestReporter.cpp | 2 +- src/XmlTestReporter.h | 2 +- src/tests/TestAssertHandler.cpp | 2 +- src/tests/TestDeferredTestReporter.cpp | 2 +- src/tests/TestExceptions.cpp | 2 +- src/tests/TestXmlTestReporter.cpp | 2 +- 23 files changed, 22 insertions(+), 22 deletions(-) rename config.h => src/Config.h (100%) diff --git a/src/AssertException.h b/src/AssertException.h index 620e397..e5d0705 100644 --- a/src/AssertException.h +++ b/src/AssertException.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_ASSERTEXCEPTION_H #define UNITTEST_ASSERTEXCEPTION_H -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_EXCEPTIONS #include "HelperMacros.h" diff --git a/src/Checks.h b/src/Checks.h index 4eb1842..b2cc4db 100644 --- a/src/Checks.h +++ b/src/Checks.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_CHECKS_H #define UNITTEST_CHECKS_H -#include "../config.h" +#include "Config.h" #include "TestResults.h" #include "MemoryOutStream.h" diff --git a/config.h b/src/Config.h similarity index 100% rename from config.h rename to src/Config.h diff --git a/src/DeferredTestReporter.cpp b/src/DeferredTestReporter.cpp index 4b731f4..60e0ded 100644 --- a/src/DeferredTestReporter.cpp +++ b/src/DeferredTestReporter.cpp @@ -1,4 +1,4 @@ -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER #include "DeferredTestReporter.h" diff --git a/src/DeferredTestReporter.h b/src/DeferredTestReporter.h index ad69b26..757e53f 100644 --- a/src/DeferredTestReporter.h +++ b/src/DeferredTestReporter.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_DEFERREDTESTREPORTER_H #define UNITTEST_DEFERREDTESTREPORTER_H -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER diff --git a/src/DeferredTestResult.cpp b/src/DeferredTestResult.cpp index ae54d38..5071f82 100644 --- a/src/DeferredTestResult.cpp +++ b/src/DeferredTestResult.cpp @@ -1,4 +1,4 @@ -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER #include "DeferredTestResult.h" diff --git a/src/DeferredTestResult.h b/src/DeferredTestResult.h index 6f56621..0929566 100644 --- a/src/DeferredTestResult.h +++ b/src/DeferredTestResult.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_DEFERREDTESTRESULT_H #define UNITTEST_DEFERREDTESTRESULT_H -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER #include "HelperMacros.h" diff --git a/src/ExceptionMacros.h b/src/ExceptionMacros.h index 508150f..e549c2c 100644 --- a/src/ExceptionMacros.h +++ b/src/ExceptionMacros.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_EXCEPTIONMACROS_H #define UNITTEST_EXCEPTIONMACROS_H -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_EXCEPTIONS #define UT_TRY(x) try x diff --git a/src/ExecuteTest.h b/src/ExecuteTest.h index d7abc90..d683dc0 100644 --- a/src/ExecuteTest.h +++ b/src/ExecuteTest.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_EXECUTE_TEST_H #define UNITTEST_EXECUTE_TEST_H -#include "../config.h" +#include "Config.h" #include "ExceptionMacros.h" #include "TestDetails.h" #include "TestResults.h" diff --git a/src/HelperMacros.h b/src/HelperMacros.h index 67e57ed..fb3181d 100644 --- a/src/HelperMacros.h +++ b/src/HelperMacros.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_HELPERMACROS_H #define UNITTEST_HELPERMACROS_H -#include "../config.h" +#include "Config.h" #define UNITTEST_MULTILINE_MACRO_BEGIN do { diff --git a/src/MemoryOutStream.h b/src/MemoryOutStream.h index ef2c86f..0c46f53 100644 --- a/src/MemoryOutStream.h +++ b/src/MemoryOutStream.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_MEMORYOUTSTREAM_H #define UNITTEST_MEMORYOUTSTREAM_H -#include "../config.h" +#include "Config.h" #include "HelperMacros.h" #ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM diff --git a/src/ReportAssertImpl.h b/src/ReportAssertImpl.h index 2f158c5..88efc03 100644 --- a/src/ReportAssertImpl.h +++ b/src/ReportAssertImpl.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_REPORTASSERTIMPL_H #define UNITTEST_REPORTASSERTIMPL_H -#include "../config.h" +#include "Config.h" #include "HelperMacros.h" #ifdef UNITTEST_NO_EXCEPTIONS diff --git a/src/Test.cpp b/src/Test.cpp index 6a270db..6941722 100644 --- a/src/Test.cpp +++ b/src/Test.cpp @@ -1,4 +1,4 @@ -#include "../config.h" +#include "Config.h" #include "Test.h" #include "TestList.h" #include "TestResults.h" diff --git a/src/TestMacros.h b/src/TestMacros.h index 92b11a4..facc94e 100644 --- a/src/TestMacros.h +++ b/src/TestMacros.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_TESTMACROS_H #define UNITTEST_TESTMACROS_H -#include "../config.h" +#include "Config.h" #include "TestSuite.h" #include "ExceptionMacros.h" #include "ExecuteTest.h" diff --git a/src/TimeHelpers.h b/src/TimeHelpers.h index bb5a31a..f34ed00 100644 --- a/src/TimeHelpers.h +++ b/src/TimeHelpers.h @@ -1,4 +1,4 @@ -#include "../config.h" +#include "Config.h" #if defined UNITTEST_POSIX #include "Posix/TimeHelpers.h" diff --git a/src/UnitTestPP.h b/src/UnitTestPP.h index 69dde9b..c9bbc0c 100644 --- a/src/UnitTestPP.h +++ b/src/UnitTestPP.h @@ -1,7 +1,7 @@ #ifndef UNITTESTPP_H #define UNITTESTPP_H -#include "../config.h" +#include "Config.h" #include "TestMacros.h" #include "CheckMacros.h" #include "TestRunner.h" diff --git a/src/Win32/TimeHelpers.h b/src/Win32/TimeHelpers.h index 4fb1b43..2bbe75f 100644 --- a/src/Win32/TimeHelpers.h +++ b/src/Win32/TimeHelpers.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_TIMEHELPERS_H #define UNITTEST_TIMEHELPERS_H -#include "../../config.h" +#include "../Config.h" #include "../HelperMacros.h" #ifdef UNITTEST_MINGW diff --git a/src/XmlTestReporter.cpp b/src/XmlTestReporter.cpp index c5e858b..c3312ea 100644 --- a/src/XmlTestReporter.cpp +++ b/src/XmlTestReporter.cpp @@ -1,4 +1,4 @@ -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER #include "XmlTestReporter.h" diff --git a/src/XmlTestReporter.h b/src/XmlTestReporter.h index 0c3441c..63d424e 100644 --- a/src/XmlTestReporter.h +++ b/src/XmlTestReporter.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_XMLTESTREPORTER_H #define UNITTEST_XMLTESTREPORTER_H -#include "../config.h" +#include "Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER #include "DeferredTestReporter.h" diff --git a/src/tests/TestAssertHandler.cpp b/src/tests/TestAssertHandler.cpp index 30275bc..cc13759 100644 --- a/src/tests/TestAssertHandler.cpp +++ b/src/tests/TestAssertHandler.cpp @@ -1,4 +1,4 @@ -#include "../../config.h" +#include "../Config.h" #include "../../src/UnitTestPP.h" #include "../ReportAssert.h" diff --git a/src/tests/TestDeferredTestReporter.cpp b/src/tests/TestDeferredTestReporter.cpp index 0d7775e..9719973 100644 --- a/src/tests/TestDeferredTestReporter.cpp +++ b/src/tests/TestDeferredTestReporter.cpp @@ -1,4 +1,4 @@ -#include "../../config.h" +#include "../Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER diff --git a/src/tests/TestExceptions.cpp b/src/tests/TestExceptions.cpp index 6c0307f..18ff2ea 100644 --- a/src/tests/TestExceptions.cpp +++ b/src/tests/TestExceptions.cpp @@ -1,4 +1,4 @@ -#include "../../config.h" +#include "../Config.h" #ifndef UNITTEST_NO_EXCEPTIONS #include "../../src/UnitTestPP.h" diff --git a/src/tests/TestXmlTestReporter.cpp b/src/tests/TestXmlTestReporter.cpp index 447acf0..7805bf5 100644 --- a/src/tests/TestXmlTestReporter.cpp +++ b/src/tests/TestXmlTestReporter.cpp @@ -1,4 +1,4 @@ -#include "../../config.h" +#include "../Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER #include "../../src/UnitTestPP.h" From deb7e2736dbe1a822b98978ff6fba709d9c13210 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 00:13:07 -0600 Subject: [PATCH 033/184] Ensure all headers, including platform, are being installed. --- CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba5694d..c7b4a43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,16 +10,17 @@ source_group("" FILES ${headers_} ${sources_}) # get platform specific sources if (WIN32) - set(PLAT_DIR Win32) + set(platformDir_ Win32) else() - set(PLAT_DIR Posix) + set(platformDir_ Posix) endif(WIN32) -file(GLOB PLAT_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${PLAT_DIR}/*.cpp src/${PLAT_DIR}/*.h) -source_group(${PLAT_DIR} FILES ${PLAT_SRCS}) +file(GLOB platformHeaders_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${platformDir_}/*.h) +file(GLOB platformSources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${platformDir_}/*.cpp) +source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_}) # create the lib -add_library(UnitTestPP STATIC ${headers_} ${sources_} ${PLAT_SRCS}) +add_library(UnitTestPP STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_}) if(${UTPP_USE_PLUS_SIGN}) set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) @@ -57,4 +58,5 @@ else() endif() install(TARGETS UnitTestPP DESTINATION lib) -install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) \ No newline at end of file +install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) +install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) \ No newline at end of file From 859e6250d2d1b9d76b8e67132d3eaa4941c6da5c Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 00:22:14 -0600 Subject: [PATCH 034/184] Move src to UnitTest++ and move src/tests to tests. CMakeLists was modified to support this, then include paths for the test executable also had to be modified to include UnitTest++. --- CMakeLists.txt | 12 ++++++------ {src => UnitTest++}/AssertException.cpp | 0 {src => UnitTest++}/AssertException.h | 0 {src => UnitTest++}/CheckMacros.h | 0 {src => UnitTest++}/Checks.cpp | 0 {src => UnitTest++}/Checks.h | 0 {src => UnitTest++}/CompositeTestReporter.cpp | 0 {src => UnitTest++}/CompositeTestReporter.h | 0 {src => UnitTest++}/Config.h | 0 {src => UnitTest++}/CurrentTest.cpp | 0 {src => UnitTest++}/CurrentTest.h | 0 {src => UnitTest++}/DeferredTestReporter.cpp | 0 {src => UnitTest++}/DeferredTestReporter.h | 0 {src => UnitTest++}/DeferredTestResult.cpp | 0 {src => UnitTest++}/DeferredTestResult.h | 0 {src => UnitTest++}/ExceptionMacros.h | 0 {src => UnitTest++}/ExecuteTest.h | 0 {src => UnitTest++}/HelperMacros.h | 0 {src => UnitTest++}/Makefile.am | 0 {src => UnitTest++}/MemoryOutStream.cpp | 0 {src => UnitTest++}/MemoryOutStream.h | 0 {src => UnitTest++}/Posix/SignalTranslator.cpp | 0 {src => UnitTest++}/Posix/SignalTranslator.h | 0 {src => UnitTest++}/Posix/TimeHelpers.cpp | 0 {src => UnitTest++}/Posix/TimeHelpers.h | 0 {src => UnitTest++}/ReportAssert.cpp | 0 {src => UnitTest++}/ReportAssert.h | 0 {src => UnitTest++}/ReportAssertImpl.h | 0 {src => UnitTest++}/Test.cpp | 0 {src => UnitTest++}/Test.h | 0 {src => UnitTest++}/TestDetails.cpp | 0 {src => UnitTest++}/TestDetails.h | 0 {src => UnitTest++}/TestList.cpp | 0 {src => UnitTest++}/TestList.h | 0 {src => UnitTest++}/TestMacros.h | 0 {src => UnitTest++}/TestReporter.cpp | 0 {src => UnitTest++}/TestReporter.h | 0 {src => UnitTest++}/TestReporterStdout.cpp | 0 {src => UnitTest++}/TestReporterStdout.h | 0 {src => UnitTest++}/TestResults.cpp | 0 {src => UnitTest++}/TestResults.h | 0 {src => UnitTest++}/TestRunner.cpp | 0 {src => UnitTest++}/TestRunner.h | 0 {src => UnitTest++}/TestSuite.h | 0 {src => UnitTest++}/TimeConstraint.cpp | 0 {src => UnitTest++}/TimeConstraint.h | 0 {src => UnitTest++}/TimeHelpers.h | 0 {src => UnitTest++}/UnitTest++.h | 0 {src => UnitTest++}/UnitTestPP.h | 0 {src => UnitTest++}/Win32/TimeHelpers.cpp | 0 {src => UnitTest++}/Win32/TimeHelpers.h | 0 {src => UnitTest++}/XmlTestReporter.cpp | 0 {src => UnitTest++}/XmlTestReporter.h | 0 {src => UnitTest++}/unittestpp_vs2005.vcproj | 0 {src => UnitTest++}/unittestpp_vs2008.vcproj | 0 {src/tests => tests}/Main.cpp | 2 +- {src/tests => tests}/RecordingReporter.h | 4 ++-- {src/tests => tests}/ScopedCurrentTest.h | 2 +- {src/tests => tests}/TestAssertHandler.cpp | 10 +++++----- {src/tests => tests}/TestCheckMacros.cpp | 4 ++-- {src/tests => tests}/TestChecks.cpp | 2 +- {src/tests => tests}/TestCompositeTestReporter.cpp | 4 ++-- {src/tests => tests}/TestCurrentTest.cpp | 4 ++-- {src/tests => tests}/TestDeferredTestReporter.cpp | 6 +++--- {src/tests => tests}/TestExceptions.cpp | 6 +++--- {src/tests => tests}/TestMemoryOutStream.cpp | 4 ++-- {src/tests => tests}/TestTest.cpp | 6 +++--- {src/tests => tests}/TestTestList.cpp | 4 ++-- {src/tests => tests}/TestTestMacros.cpp | 12 ++++++------ {src/tests => tests}/TestTestResults.cpp | 4 ++-- {src/tests => tests}/TestTestRunner.cpp | 12 ++++++------ {src/tests => tests}/TestTestSuite.cpp | 2 +- {src/tests => tests}/TestTimeConstraint.cpp | 6 +++--- {src/tests => tests}/TestTimeConstraintMacro.cpp | 4 ++-- {src/tests => tests}/TestUnitTestPP.cpp | 2 +- {src/tests => tests}/TestXmlTestReporter.cpp | 6 +++--- {src/tests => tests}/test-unittestpp_vs2005.vcproj | 0 {src/tests => tests}/test-unittestpp_vs2008.vcproj | 0 78 files changed, 59 insertions(+), 59 deletions(-) rename {src => UnitTest++}/AssertException.cpp (100%) rename {src => UnitTest++}/AssertException.h (100%) rename {src => UnitTest++}/CheckMacros.h (100%) rename {src => UnitTest++}/Checks.cpp (100%) rename {src => UnitTest++}/Checks.h (100%) rename {src => UnitTest++}/CompositeTestReporter.cpp (100%) rename {src => UnitTest++}/CompositeTestReporter.h (100%) rename {src => UnitTest++}/Config.h (100%) rename {src => UnitTest++}/CurrentTest.cpp (100%) rename {src => UnitTest++}/CurrentTest.h (100%) rename {src => UnitTest++}/DeferredTestReporter.cpp (100%) rename {src => UnitTest++}/DeferredTestReporter.h (100%) rename {src => UnitTest++}/DeferredTestResult.cpp (100%) rename {src => UnitTest++}/DeferredTestResult.h (100%) rename {src => UnitTest++}/ExceptionMacros.h (100%) rename {src => UnitTest++}/ExecuteTest.h (100%) rename {src => UnitTest++}/HelperMacros.h (100%) rename {src => UnitTest++}/Makefile.am (100%) rename {src => UnitTest++}/MemoryOutStream.cpp (100%) rename {src => UnitTest++}/MemoryOutStream.h (100%) rename {src => UnitTest++}/Posix/SignalTranslator.cpp (100%) rename {src => UnitTest++}/Posix/SignalTranslator.h (100%) rename {src => UnitTest++}/Posix/TimeHelpers.cpp (100%) rename {src => UnitTest++}/Posix/TimeHelpers.h (100%) rename {src => UnitTest++}/ReportAssert.cpp (100%) rename {src => UnitTest++}/ReportAssert.h (100%) rename {src => UnitTest++}/ReportAssertImpl.h (100%) rename {src => UnitTest++}/Test.cpp (100%) rename {src => UnitTest++}/Test.h (100%) rename {src => UnitTest++}/TestDetails.cpp (100%) rename {src => UnitTest++}/TestDetails.h (100%) rename {src => UnitTest++}/TestList.cpp (100%) rename {src => UnitTest++}/TestList.h (100%) rename {src => UnitTest++}/TestMacros.h (100%) rename {src => UnitTest++}/TestReporter.cpp (100%) rename {src => UnitTest++}/TestReporter.h (100%) rename {src => UnitTest++}/TestReporterStdout.cpp (100%) rename {src => UnitTest++}/TestReporterStdout.h (100%) rename {src => UnitTest++}/TestResults.cpp (100%) rename {src => UnitTest++}/TestResults.h (100%) rename {src => UnitTest++}/TestRunner.cpp (100%) rename {src => UnitTest++}/TestRunner.h (100%) rename {src => UnitTest++}/TestSuite.h (100%) rename {src => UnitTest++}/TimeConstraint.cpp (100%) rename {src => UnitTest++}/TimeConstraint.h (100%) rename {src => UnitTest++}/TimeHelpers.h (100%) rename {src => UnitTest++}/UnitTest++.h (100%) rename {src => UnitTest++}/UnitTestPP.h (100%) rename {src => UnitTest++}/Win32/TimeHelpers.cpp (100%) rename {src => UnitTest++}/Win32/TimeHelpers.h (100%) rename {src => UnitTest++}/XmlTestReporter.cpp (100%) rename {src => UnitTest++}/XmlTestReporter.h (100%) rename {src => UnitTest++}/unittestpp_vs2005.vcproj (100%) rename {src => UnitTest++}/unittestpp_vs2008.vcproj (100%) rename {src/tests => tests}/Main.cpp (66%) rename {src/tests => tests}/RecordingReporter.h (97%) rename {src/tests => tests}/ScopedCurrentTest.h (96%) rename {src/tests => tests}/TestAssertHandler.cpp (93%) rename {src/tests => tests}/TestCheckMacros.cpp (99%) rename {src/tests => tests}/TestChecks.cpp (99%) rename {src/tests => tests}/TestCompositeTestReporter.cpp (98%) rename {src/tests => tests}/TestCurrentTest.cpp (89%) rename {src/tests => tests}/TestDeferredTestReporter.cpp (96%) rename {src/tests => tests}/TestExceptions.cpp (99%) rename {src/tests => tests}/TestMemoryOutStream.cpp (99%) rename {src/tests => tests}/TestTest.cpp (95%) rename {src/tests => tests}/TestTestList.cpp (91%) rename {src/tests => tests}/TestTestMacros.cpp (95%) rename {src/tests => tests}/TestTestResults.cpp (97%) rename {src/tests => tests}/TestTestRunner.cpp (97%) rename {src/tests => tests}/TestTestSuite.cpp (88%) rename {src/tests => tests}/TestTimeConstraint.cpp (93%) rename {src/tests => tests}/TestTimeConstraintMacro.cpp (97%) rename {src/tests => tests}/TestUnitTestPP.cpp (98%) rename {src/tests => tests}/TestXmlTestReporter.cpp (98%) rename {src/tests => tests}/test-unittestpp_vs2005.vcproj (100%) rename {src/tests => tests}/test-unittestpp_vs2008.vcproj (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index c7b4a43..11e3ae9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ project(UnitTest++) option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON) # get the main sources -file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.h) -file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp) +file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.h) +file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.cpp) source_group("" FILES ${headers_} ${sources_}) # get platform specific sources @@ -15,8 +15,8 @@ else() set(platformDir_ Posix) endif(WIN32) -file(GLOB platformHeaders_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${platformDir_}/*.h) -file(GLOB platformSources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${platformDir_}/*.cpp) +file(GLOB platformHeaders_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${platformDir_}/*.h) +file(GLOB platformSources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${platformDir_}/*.cpp) source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_}) # create the lib @@ -26,12 +26,12 @@ if(${UTPP_USE_PLUS_SIGN}) set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) endif() -include_directories(src) # build the test runner -file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/tests/*.cpp src/tests/*.h) +file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTestPP ${TEST_SRCS}) +include_directories(UnitTest++) if(${UTPP_USE_PLUS_SIGN}) set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) diff --git a/src/AssertException.cpp b/UnitTest++/AssertException.cpp similarity index 100% rename from src/AssertException.cpp rename to UnitTest++/AssertException.cpp diff --git a/src/AssertException.h b/UnitTest++/AssertException.h similarity index 100% rename from src/AssertException.h rename to UnitTest++/AssertException.h diff --git a/src/CheckMacros.h b/UnitTest++/CheckMacros.h similarity index 100% rename from src/CheckMacros.h rename to UnitTest++/CheckMacros.h diff --git a/src/Checks.cpp b/UnitTest++/Checks.cpp similarity index 100% rename from src/Checks.cpp rename to UnitTest++/Checks.cpp diff --git a/src/Checks.h b/UnitTest++/Checks.h similarity index 100% rename from src/Checks.h rename to UnitTest++/Checks.h diff --git a/src/CompositeTestReporter.cpp b/UnitTest++/CompositeTestReporter.cpp similarity index 100% rename from src/CompositeTestReporter.cpp rename to UnitTest++/CompositeTestReporter.cpp diff --git a/src/CompositeTestReporter.h b/UnitTest++/CompositeTestReporter.h similarity index 100% rename from src/CompositeTestReporter.h rename to UnitTest++/CompositeTestReporter.h diff --git a/src/Config.h b/UnitTest++/Config.h similarity index 100% rename from src/Config.h rename to UnitTest++/Config.h diff --git a/src/CurrentTest.cpp b/UnitTest++/CurrentTest.cpp similarity index 100% rename from src/CurrentTest.cpp rename to UnitTest++/CurrentTest.cpp diff --git a/src/CurrentTest.h b/UnitTest++/CurrentTest.h similarity index 100% rename from src/CurrentTest.h rename to UnitTest++/CurrentTest.h diff --git a/src/DeferredTestReporter.cpp b/UnitTest++/DeferredTestReporter.cpp similarity index 100% rename from src/DeferredTestReporter.cpp rename to UnitTest++/DeferredTestReporter.cpp diff --git a/src/DeferredTestReporter.h b/UnitTest++/DeferredTestReporter.h similarity index 100% rename from src/DeferredTestReporter.h rename to UnitTest++/DeferredTestReporter.h diff --git a/src/DeferredTestResult.cpp b/UnitTest++/DeferredTestResult.cpp similarity index 100% rename from src/DeferredTestResult.cpp rename to UnitTest++/DeferredTestResult.cpp diff --git a/src/DeferredTestResult.h b/UnitTest++/DeferredTestResult.h similarity index 100% rename from src/DeferredTestResult.h rename to UnitTest++/DeferredTestResult.h diff --git a/src/ExceptionMacros.h b/UnitTest++/ExceptionMacros.h similarity index 100% rename from src/ExceptionMacros.h rename to UnitTest++/ExceptionMacros.h diff --git a/src/ExecuteTest.h b/UnitTest++/ExecuteTest.h similarity index 100% rename from src/ExecuteTest.h rename to UnitTest++/ExecuteTest.h diff --git a/src/HelperMacros.h b/UnitTest++/HelperMacros.h similarity index 100% rename from src/HelperMacros.h rename to UnitTest++/HelperMacros.h diff --git a/src/Makefile.am b/UnitTest++/Makefile.am similarity index 100% rename from src/Makefile.am rename to UnitTest++/Makefile.am diff --git a/src/MemoryOutStream.cpp b/UnitTest++/MemoryOutStream.cpp similarity index 100% rename from src/MemoryOutStream.cpp rename to UnitTest++/MemoryOutStream.cpp diff --git a/src/MemoryOutStream.h b/UnitTest++/MemoryOutStream.h similarity index 100% rename from src/MemoryOutStream.h rename to UnitTest++/MemoryOutStream.h diff --git a/src/Posix/SignalTranslator.cpp b/UnitTest++/Posix/SignalTranslator.cpp similarity index 100% rename from src/Posix/SignalTranslator.cpp rename to UnitTest++/Posix/SignalTranslator.cpp diff --git a/src/Posix/SignalTranslator.h b/UnitTest++/Posix/SignalTranslator.h similarity index 100% rename from src/Posix/SignalTranslator.h rename to UnitTest++/Posix/SignalTranslator.h diff --git a/src/Posix/TimeHelpers.cpp b/UnitTest++/Posix/TimeHelpers.cpp similarity index 100% rename from src/Posix/TimeHelpers.cpp rename to UnitTest++/Posix/TimeHelpers.cpp diff --git a/src/Posix/TimeHelpers.h b/UnitTest++/Posix/TimeHelpers.h similarity index 100% rename from src/Posix/TimeHelpers.h rename to UnitTest++/Posix/TimeHelpers.h diff --git a/src/ReportAssert.cpp b/UnitTest++/ReportAssert.cpp similarity index 100% rename from src/ReportAssert.cpp rename to UnitTest++/ReportAssert.cpp diff --git a/src/ReportAssert.h b/UnitTest++/ReportAssert.h similarity index 100% rename from src/ReportAssert.h rename to UnitTest++/ReportAssert.h diff --git a/src/ReportAssertImpl.h b/UnitTest++/ReportAssertImpl.h similarity index 100% rename from src/ReportAssertImpl.h rename to UnitTest++/ReportAssertImpl.h diff --git a/src/Test.cpp b/UnitTest++/Test.cpp similarity index 100% rename from src/Test.cpp rename to UnitTest++/Test.cpp diff --git a/src/Test.h b/UnitTest++/Test.h similarity index 100% rename from src/Test.h rename to UnitTest++/Test.h diff --git a/src/TestDetails.cpp b/UnitTest++/TestDetails.cpp similarity index 100% rename from src/TestDetails.cpp rename to UnitTest++/TestDetails.cpp diff --git a/src/TestDetails.h b/UnitTest++/TestDetails.h similarity index 100% rename from src/TestDetails.h rename to UnitTest++/TestDetails.h diff --git a/src/TestList.cpp b/UnitTest++/TestList.cpp similarity index 100% rename from src/TestList.cpp rename to UnitTest++/TestList.cpp diff --git a/src/TestList.h b/UnitTest++/TestList.h similarity index 100% rename from src/TestList.h rename to UnitTest++/TestList.h diff --git a/src/TestMacros.h b/UnitTest++/TestMacros.h similarity index 100% rename from src/TestMacros.h rename to UnitTest++/TestMacros.h diff --git a/src/TestReporter.cpp b/UnitTest++/TestReporter.cpp similarity index 100% rename from src/TestReporter.cpp rename to UnitTest++/TestReporter.cpp diff --git a/src/TestReporter.h b/UnitTest++/TestReporter.h similarity index 100% rename from src/TestReporter.h rename to UnitTest++/TestReporter.h diff --git a/src/TestReporterStdout.cpp b/UnitTest++/TestReporterStdout.cpp similarity index 100% rename from src/TestReporterStdout.cpp rename to UnitTest++/TestReporterStdout.cpp diff --git a/src/TestReporterStdout.h b/UnitTest++/TestReporterStdout.h similarity index 100% rename from src/TestReporterStdout.h rename to UnitTest++/TestReporterStdout.h diff --git a/src/TestResults.cpp b/UnitTest++/TestResults.cpp similarity index 100% rename from src/TestResults.cpp rename to UnitTest++/TestResults.cpp diff --git a/src/TestResults.h b/UnitTest++/TestResults.h similarity index 100% rename from src/TestResults.h rename to UnitTest++/TestResults.h diff --git a/src/TestRunner.cpp b/UnitTest++/TestRunner.cpp similarity index 100% rename from src/TestRunner.cpp rename to UnitTest++/TestRunner.cpp diff --git a/src/TestRunner.h b/UnitTest++/TestRunner.h similarity index 100% rename from src/TestRunner.h rename to UnitTest++/TestRunner.h diff --git a/src/TestSuite.h b/UnitTest++/TestSuite.h similarity index 100% rename from src/TestSuite.h rename to UnitTest++/TestSuite.h diff --git a/src/TimeConstraint.cpp b/UnitTest++/TimeConstraint.cpp similarity index 100% rename from src/TimeConstraint.cpp rename to UnitTest++/TimeConstraint.cpp diff --git a/src/TimeConstraint.h b/UnitTest++/TimeConstraint.h similarity index 100% rename from src/TimeConstraint.h rename to UnitTest++/TimeConstraint.h diff --git a/src/TimeHelpers.h b/UnitTest++/TimeHelpers.h similarity index 100% rename from src/TimeHelpers.h rename to UnitTest++/TimeHelpers.h diff --git a/src/UnitTest++.h b/UnitTest++/UnitTest++.h similarity index 100% rename from src/UnitTest++.h rename to UnitTest++/UnitTest++.h diff --git a/src/UnitTestPP.h b/UnitTest++/UnitTestPP.h similarity index 100% rename from src/UnitTestPP.h rename to UnitTest++/UnitTestPP.h diff --git a/src/Win32/TimeHelpers.cpp b/UnitTest++/Win32/TimeHelpers.cpp similarity index 100% rename from src/Win32/TimeHelpers.cpp rename to UnitTest++/Win32/TimeHelpers.cpp diff --git a/src/Win32/TimeHelpers.h b/UnitTest++/Win32/TimeHelpers.h similarity index 100% rename from src/Win32/TimeHelpers.h rename to UnitTest++/Win32/TimeHelpers.h diff --git a/src/XmlTestReporter.cpp b/UnitTest++/XmlTestReporter.cpp similarity index 100% rename from src/XmlTestReporter.cpp rename to UnitTest++/XmlTestReporter.cpp diff --git a/src/XmlTestReporter.h b/UnitTest++/XmlTestReporter.h similarity index 100% rename from src/XmlTestReporter.h rename to UnitTest++/XmlTestReporter.h diff --git a/src/unittestpp_vs2005.vcproj b/UnitTest++/unittestpp_vs2005.vcproj similarity index 100% rename from src/unittestpp_vs2005.vcproj rename to UnitTest++/unittestpp_vs2005.vcproj diff --git a/src/unittestpp_vs2008.vcproj b/UnitTest++/unittestpp_vs2008.vcproj similarity index 100% rename from src/unittestpp_vs2008.vcproj rename to UnitTest++/unittestpp_vs2008.vcproj diff --git a/src/tests/Main.cpp b/tests/Main.cpp similarity index 66% rename from src/tests/Main.cpp rename to tests/Main.cpp index 6e8c891..ae9cc54 100644 --- a/src/tests/Main.cpp +++ b/tests/Main.cpp @@ -1,4 +1,4 @@ -#include "../../src/UnitTestPP.h" +#include "UnitTest++/UnitTestPP.h" int main(int, char const *[]) { diff --git a/src/tests/RecordingReporter.h b/tests/RecordingReporter.h similarity index 97% rename from src/tests/RecordingReporter.h rename to tests/RecordingReporter.h index 982c294..ea899a2 100644 --- a/src/tests/RecordingReporter.h +++ b/tests/RecordingReporter.h @@ -1,10 +1,10 @@ #ifndef UNITTEST_RECORDINGREPORTER_H #define UNITTEST_RECORDINGREPORTER_H -#include "../TestReporter.h" +#include "UnitTest++/TestReporter.h" #include -#include "../TestDetails.h" +#include "UnitTest++/TestDetails.h" struct RecordingReporter : public UnitTest::TestReporter { diff --git a/src/tests/ScopedCurrentTest.h b/tests/ScopedCurrentTest.h similarity index 96% rename from src/tests/ScopedCurrentTest.h rename to tests/ScopedCurrentTest.h index e03ae0a..60b1a8e 100644 --- a/src/tests/ScopedCurrentTest.h +++ b/tests/ScopedCurrentTest.h @@ -1,7 +1,7 @@ #ifndef UNITTEST_SCOPEDCURRENTTEST_H #define UNITTEST_SCOPEDCURRENTTEST_H -#include "../CurrentTest.h" +#include "UnitTest++/CurrentTest.h" #include class ScopedCurrentTest diff --git a/src/tests/TestAssertHandler.cpp b/tests/TestAssertHandler.cpp similarity index 93% rename from src/tests/TestAssertHandler.cpp rename to tests/TestAssertHandler.cpp index cc13759..c9286f3 100644 --- a/src/tests/TestAssertHandler.cpp +++ b/tests/TestAssertHandler.cpp @@ -1,9 +1,9 @@ -#include "../Config.h" -#include "../../src/UnitTestPP.h" +#include "UnitTest++/Config.h" +#include "UnitTest++/UnitTestPP.h" -#include "../ReportAssert.h" -#include "../ReportAssertImpl.h" -#include "../AssertException.h" +#include "UnitTest++/ReportAssert.h" +#include "UnitTest++/ReportAssertImpl.h" +#include "UnitTest++/AssertException.h" #include "RecordingReporter.h" #include diff --git a/src/tests/TestCheckMacros.cpp b/tests/TestCheckMacros.cpp similarity index 99% rename from src/tests/TestCheckMacros.cpp rename to tests/TestCheckMacros.cpp index be60875..45ea0e9 100644 --- a/src/tests/TestCheckMacros.cpp +++ b/tests/TestCheckMacros.cpp @@ -1,5 +1,5 @@ -#include "../../src/UnitTestPP.h" -#include "../CurrentTest.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/CurrentTest.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestChecks.cpp b/tests/TestChecks.cpp similarity index 99% rename from src/tests/TestChecks.cpp rename to tests/TestChecks.cpp index 3059d50..758ca31 100644 --- a/src/tests/TestChecks.cpp +++ b/tests/TestChecks.cpp @@ -1,4 +1,4 @@ -#include "../../src/UnitTestPP.h" +#include "UnitTest++/UnitTestPP.h" #include "RecordingReporter.h" #include diff --git a/src/tests/TestCompositeTestReporter.cpp b/tests/TestCompositeTestReporter.cpp similarity index 98% rename from src/tests/TestCompositeTestReporter.cpp rename to tests/TestCompositeTestReporter.cpp index 9318cc6..9440a9e 100644 --- a/src/tests/TestCompositeTestReporter.cpp +++ b/tests/TestCompositeTestReporter.cpp @@ -1,5 +1,5 @@ -#include "../../src/UnitTestPP.h" -#include "../CompositeTestReporter.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/CompositeTestReporter.h" using namespace UnitTest; diff --git a/src/tests/TestCurrentTest.cpp b/tests/TestCurrentTest.cpp similarity index 89% rename from src/tests/TestCurrentTest.cpp rename to tests/TestCurrentTest.cpp index 43732a8..7de1a72 100644 --- a/src/tests/TestCurrentTest.cpp +++ b/tests/TestCurrentTest.cpp @@ -1,5 +1,5 @@ -#include "../../src/UnitTestPP.h" -#include "../CurrentTest.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/CurrentTest.h" #include "ScopedCurrentTest.h" namespace diff --git a/src/tests/TestDeferredTestReporter.cpp b/tests/TestDeferredTestReporter.cpp similarity index 96% rename from src/tests/TestDeferredTestReporter.cpp rename to tests/TestDeferredTestReporter.cpp index 9719973..60c347c 100644 --- a/src/tests/TestDeferredTestReporter.cpp +++ b/tests/TestDeferredTestReporter.cpp @@ -1,9 +1,9 @@ -#include "../Config.h" +#include "UnitTest++/Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER -#include "../../src/UnitTestPP.h" -#include "../DeferredTestReporter.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/DeferredTestReporter.h" #include namespace UnitTest diff --git a/src/tests/TestExceptions.cpp b/tests/TestExceptions.cpp similarity index 99% rename from src/tests/TestExceptions.cpp rename to tests/TestExceptions.cpp index 18ff2ea..1a0ab04 100644 --- a/src/tests/TestExceptions.cpp +++ b/tests/TestExceptions.cpp @@ -1,8 +1,8 @@ -#include "../Config.h" +#include "UnitTest++/Config.h" #ifndef UNITTEST_NO_EXCEPTIONS -#include "../../src/UnitTestPP.h" -#include "../CurrentTest.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/CurrentTest.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp similarity index 99% rename from src/tests/TestMemoryOutStream.cpp rename to tests/TestMemoryOutStream.cpp index 27a7ce8..74a9a56 100644 --- a/src/tests/TestMemoryOutStream.cpp +++ b/tests/TestMemoryOutStream.cpp @@ -1,6 +1,6 @@ -#include "../../src/UnitTestPP.h" +#include "UnitTest++/UnitTestPP.h" -#include "../MemoryOutStream.h" +#include "UnitTest++/MemoryOutStream.h" #include #include #include diff --git a/src/tests/TestTest.cpp b/tests/TestTest.cpp similarity index 95% rename from src/tests/TestTest.cpp rename to tests/TestTest.cpp index 58b0bc2..2aeab6d 100644 --- a/src/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -1,6 +1,6 @@ -#include "../../src/UnitTestPP.h" -#include "../TestReporter.h" -#include "../TimeHelpers.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/TestReporter.h" +#include "UnitTest++/TimeHelpers.h" #include "ScopedCurrentTest.h" using namespace UnitTest; diff --git a/src/tests/TestTestList.cpp b/tests/TestTestList.cpp similarity index 91% rename from src/tests/TestTestList.cpp rename to tests/TestTestList.cpp index 03828e9..73732c5 100644 --- a/src/tests/TestTestList.cpp +++ b/tests/TestTestList.cpp @@ -1,5 +1,5 @@ -#include "../../src/UnitTestPP.h" -#include "../TestList.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/TestList.h" using namespace UnitTest; diff --git a/src/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp similarity index 95% rename from src/tests/TestTestMacros.cpp rename to tests/TestTestMacros.cpp index 4a0f3ea..4f0cfed 100644 --- a/src/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -1,9 +1,9 @@ -#include "../../src/UnitTestPP.h" -#include "../TestMacros.h" -#include "../TestList.h" -#include "../TestResults.h" -#include "../TestReporter.h" -#include "../ReportAssert.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/TestMacros.h" +#include "UnitTest++/TestList.h" +#include "UnitTest++/TestResults.h" +#include "UnitTest++/TestReporter.h" +#include "UnitTest++/ReportAssert.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestTestResults.cpp b/tests/TestTestResults.cpp similarity index 97% rename from src/tests/TestTestResults.cpp rename to tests/TestTestResults.cpp index 2b9b703..a115687 100644 --- a/src/tests/TestTestResults.cpp +++ b/tests/TestTestResults.cpp @@ -1,5 +1,5 @@ -#include "../../src/UnitTestPP.h" -#include "../TestResults.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/TestResults.h" #include "RecordingReporter.h" using namespace UnitTest; diff --git a/src/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp similarity index 97% rename from src/tests/TestTestRunner.cpp rename to tests/TestTestRunner.cpp index 3a98d62..fa05356 100644 --- a/src/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -1,10 +1,10 @@ -#include "../../src/UnitTestPP.h" +#include "UnitTest++/UnitTestPP.h" #include "RecordingReporter.h" -#include "../ReportAssert.h" -#include "../TestList.h" -#include "../TimeHelpers.h" -#include "../TimeConstraint.h" -#include "../ReportAssertImpl.h" +#include "UnitTest++/ReportAssert.h" +#include "UnitTest++/TestList.h" +#include "UnitTest++/TimeHelpers.h" +#include "UnitTest++/TimeConstraint.h" +#include "UnitTest++/ReportAssertImpl.h" using namespace UnitTest; diff --git a/src/tests/TestTestSuite.cpp b/tests/TestTestSuite.cpp similarity index 88% rename from src/tests/TestTestSuite.cpp rename to tests/TestTestSuite.cpp index a82b75e..ff56089 100644 --- a/src/tests/TestTestSuite.cpp +++ b/tests/TestTestSuite.cpp @@ -1,4 +1,4 @@ -#include "../../src/UnitTestPP.h" +#include "UnitTest++/UnitTestPP.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) diff --git a/src/tests/TestTimeConstraint.cpp b/tests/TestTimeConstraint.cpp similarity index 93% rename from src/tests/TestTimeConstraint.cpp rename to tests/TestTimeConstraint.cpp index 611ee6c..5cb6c16 100644 --- a/src/tests/TestTimeConstraint.cpp +++ b/tests/TestTimeConstraint.cpp @@ -1,6 +1,6 @@ -#include "../../src/UnitTestPP.h" -#include "../TestResults.h" -#include "../TimeHelpers.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/TestResults.h" +#include "UnitTest++/TimeHelpers.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestTimeConstraintMacro.cpp b/tests/TestTimeConstraintMacro.cpp similarity index 97% rename from src/tests/TestTimeConstraintMacro.cpp rename to tests/TestTimeConstraintMacro.cpp index 2e710bb..3caf15d 100644 --- a/src/tests/TestTimeConstraintMacro.cpp +++ b/tests/TestTimeConstraintMacro.cpp @@ -1,5 +1,5 @@ -#include "../../src/UnitTestPP.h" -#include "../TimeHelpers.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/TimeHelpers.h" #include "RecordingReporter.h" #include "ScopedCurrentTest.h" diff --git a/src/tests/TestUnitTestPP.cpp b/tests/TestUnitTestPP.cpp similarity index 98% rename from src/tests/TestUnitTestPP.cpp rename to tests/TestUnitTestPP.cpp index cb4d0d0..3bd6ab7 100644 --- a/src/tests/TestUnitTestPP.cpp +++ b/tests/TestUnitTestPP.cpp @@ -1,4 +1,4 @@ -#include "../../src/UnitTestPP.h" +#include "UnitTest++/UnitTestPP.h" #include "ScopedCurrentTest.h" // These are sample tests that show the different features of the framework diff --git a/src/tests/TestXmlTestReporter.cpp b/tests/TestXmlTestReporter.cpp similarity index 98% rename from src/tests/TestXmlTestReporter.cpp rename to tests/TestXmlTestReporter.cpp index 7805bf5..154ada8 100644 --- a/src/tests/TestXmlTestReporter.cpp +++ b/tests/TestXmlTestReporter.cpp @@ -1,8 +1,8 @@ -#include "../Config.h" +#include "UnitTest++/Config.h" #ifndef UNITTEST_NO_DEFERRED_REPORTER -#include "../../src/UnitTestPP.h" -#include "../XmlTestReporter.h" +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/XmlTestReporter.h" #include diff --git a/src/tests/test-unittestpp_vs2005.vcproj b/tests/test-unittestpp_vs2005.vcproj similarity index 100% rename from src/tests/test-unittestpp_vs2005.vcproj rename to tests/test-unittestpp_vs2005.vcproj diff --git a/src/tests/test-unittestpp_vs2008.vcproj b/tests/test-unittestpp_vs2008.vcproj similarity index 100% rename from src/tests/test-unittestpp_vs2008.vcproj rename to tests/test-unittestpp_vs2008.vcproj From 647ce0a491e46092cf1c15f03b1a18c9c57ca68a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 22:59:01 -0600 Subject: [PATCH 035/184] Rename COPYING to LICENSE; delete NEWS since it was empty anyway. --- LICENSE | 20 ++++++++++++++++++++ NEWS | 0 2 files changed, 20 insertions(+) create mode 100644 LICENSE delete mode 100644 NEWS diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9f96308 --- /dev/null +++ b/LICENSE @@ -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/NEWS b/NEWS deleted file mode 100644 index e69de29..0000000 From e2397508139d54eaab8456321d02a896761f9fa6 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 22:59:33 -0600 Subject: [PATCH 036/184] Delete COPYING (previously renamed to LICENSE). --- COPYING | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 COPYING diff --git a/COPYING b/COPYING deleted file mode 100644 index 9f96308..0000000 --- a/COPYING +++ /dev/null @@ -1,20 +0,0 @@ -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. From e5d732991cb3e357b2087a7b62bea2287f257b79 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 23:04:14 -0600 Subject: [PATCH 037/184] Rename README to README.md --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From 57e049c523c64ac7afdb1fff90e138903146e3ab Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 20 Feb 2013 23:04:28 -0600 Subject: [PATCH 038/184] Add Markdown formatting to README.md --- README.md | 57 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 63c9351..727e010 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,46 @@ -UnitTest++ README -Version: v1.4 -Last update: 2008-10-30 +UnitTest++ +========== -UnitTest++ is free software. You may copy, distribute, and modify it under -the terms of the License contained in the file COPYING distributed +*UnitTest++ is free software. You may copy, distribute, and modify it under +the terms of the License contained in the file LICENSE distributed with this package. This license is the same as the MIT/X Consortium -license. +license.* -See src/tests/TestUnitTest++.cpp for usage. -Authors: -Noel Llopis (llopis@convexhull.com) -Charles Nicholson (charles.nicholson@gmail.com) +### 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 +### Contributors not included in github history ### +* 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) +Historic 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) +### 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) +### 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 @@ -54,7 +53,7 @@ Version 1.2 (2006-10-29) - Posix library name is libUnitTest++.a now - Floating point numbers are postfixed with 'f' in the failure reports -Version 1.1 (2006-04-18) +### 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 @@ -63,6 +62,6 @@ Version 1.1 (2006-04-18) - 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) +### Version 1.0 (2006-03-15) ### - Initial release From c23edddd158cbff185aeed4a0da140ff94909afa Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 23 Mar 2013 22:24:57 -0500 Subject: [PATCH 039/184] - Fixed include path in CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 11e3ae9..ce5af75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ endif() file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTestPP ${TEST_SRCS}) -include_directories(UnitTest++) +include_directories(.) if(${UTPP_USE_PLUS_SIGN}) set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) From ce196f218a59a9440463f510ed9d97ba7d8a6c88 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 01:13:10 -0500 Subject: [PATCH 040/184] Add support and project files for Visual Studio 2012 --- .gitattributes | 1 + .gitignore | 4 + CMakeLists.txt | 17 +- tests/TestTest.cpp | 3 +- vs_projects/vs2012_x64/TestUnitTest++.vcxproj | 299 +++++++++++++++++ .../vs2012_x64/TestUnitTest++.vcxproj.filters | 30 ++ vs_projects/vs2012_x64/UnitTest++.sln | 38 +++ vs_projects/vs2012_x64/UnitTest++.vcxproj | 256 +++++++++++++++ .../vs2012_x64/UnitTest++.vcxproj.filters | 63 ++++ vs_projects/vs2012_x86/TestUnitTest++.vcxproj | 306 ++++++++++++++++++ .../vs2012_x86/TestUnitTest++.vcxproj.filters | 30 ++ vs_projects/vs2012_x86/UnitTest++.sln | 38 +++ vs_projects/vs2012_x86/UnitTest++.vcxproj | 256 +++++++++++++++ .../vs2012_x86/UnitTest++.vcxproj.filters | 63 ++++ 14 files changed, 1395 insertions(+), 9 deletions(-) create mode 100644 vs_projects/vs2012_x64/TestUnitTest++.vcxproj create mode 100644 vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters create mode 100644 vs_projects/vs2012_x64/UnitTest++.sln create mode 100644 vs_projects/vs2012_x64/UnitTest++.vcxproj create mode 100644 vs_projects/vs2012_x64/UnitTest++.vcxproj.filters create mode 100644 vs_projects/vs2012_x86/TestUnitTest++.vcxproj create mode 100644 vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters create mode 100644 vs_projects/vs2012_x86/UnitTest++.sln create mode 100644 vs_projects/vs2012_x86/UnitTest++.vcxproj create mode 100644 vs_projects/vs2012_x86/UnitTest++.vcxproj.filters diff --git a/.gitattributes b/.gitattributes index 615713b..ce46819 100644 --- a/.gitattributes +++ b/.gitattributes @@ -7,6 +7,7 @@ *.sln text eol=crlf *.vcproj text eol=crlf *.vcxproj text eol=crlf +*.vcxproj.filters text eol=crlf # VC6 files *.dsw text eol=crlf diff --git a/.gitignore b/.gitignore index 23d7021..397bce8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ *.suo *.sdf *.opensdf + +# Build output directories Release Debug +MinSizeRel +RelWithDebInfo ipch \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index ce5af75..7b2482d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ source_group("" FILES ${headers_} ${sources_}) # get platform specific sources if (WIN32) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) set(platformDir_ Win32) else() set(platformDir_ Posix) @@ -20,32 +21,32 @@ file(GLOB platformSources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${pla source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_}) # create the lib -add_library(UnitTestPP STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_}) +add_library(UnitTest++ STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_}) if(${UTPP_USE_PLUS_SIGN}) - set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++) + set_target_properties(UnitTest++ PROPERTIES OUTPUT_NAME UnitTest++) endif() # build the test runner file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h) source_group( "" FILES ${TEST_SRCS}) -add_executable(TestUnitTestPP ${TEST_SRCS}) +add_executable(TestUnitTest++ ${TEST_SRCS}) include_directories(.) if(${UTPP_USE_PLUS_SIGN}) - set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++) + set_target_properties(TestUnitTest++ PROPERTIES OUTPUT_NAME TestUnitTest++) endif() -target_link_libraries(TestUnitTestPP UnitTestPP) +target_link_libraries(TestUnitTest++ UnitTest++) # turn on testing enable_testing() add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V) # add the test runner as a test -add_test(NAME TestUnitTestPP COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) -add_dependencies(check TestUnitTestPP) +add_test(NAME TestUnitTest++ COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) +add_dependencies(check TestUnitTest++) # add install targets @@ -57,6 +58,6 @@ else() set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") endif() -install(TARGETS UnitTestPP DESTINATION lib) +install(TARGETS UnitTest++ DESTINATION lib) install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) \ No newline at end of file diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 2aeab6d..5c4f358 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -72,7 +72,7 @@ TEST(ThrowingTestsAreReportedAsFailures) CHECK_EQUAL(1, results.GetFailureCount()); } -#ifndef UNITTEST_MINGW +#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) TEST(CrashingTestsAreReportedAsFailures) { class CrashingTest : public Test @@ -81,6 +81,7 @@ TEST(CrashingTestsAreReportedAsFailures) CrashingTest() : Test("crashing") {} virtual void RunImpl() const { + reinterpret_cast< void (*)() >(0)(); } }; diff --git a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj new file mode 100644 index 0000000..17aef9f --- /dev/null +++ b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj @@ -0,0 +1,299 @@ +サソ + + + + Debug + x64 + + + Release + x64 + + + MinSizeRel + x64 + + + RelWithDebInfo + x64 + + + + {FAE7B8C1-428D-45DB-9A26-751A64C666D1} + Win32Proj + x64 + TestUnitTest++ + + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2012_x64\Debug\ + TestUnitTest++.dir\Debug\ + TestUnitTest++ + .exe + true + true + U:\unittest-cpp-pj\vs_projects\vs2012_x64\Release\ + TestUnitTest++.dir\Release\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2012_x64\MinSizeRel\ + TestUnitTest++.dir\MinSizeRel\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2012_x64\RelWithDebInfo\ + TestUnitTest++.dir\RelWithDebInfo\ + TestUnitTest++ + .exe + true + true + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/TestUnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + 7867CF0A-53DE-4CAD-A141-976283C590C4 + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters new file mode 100644 index 0000000..3cfece1 --- /dev/null +++ b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters @@ -0,0 +1,30 @@ +サソ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2012_x64/UnitTest++.sln b/vs_projects/vs2012_x64/UnitTest++.sln new file mode 100644 index 0000000..43e350c --- /dev/null +++ b/vs_projects/vs2012_x64/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{FAE7B8C1-428D-45DB-9A26-751A64C666D1}" + ProjectSection(ProjectDependencies) = postProject + {7867CF0A-53DE-4CAD-A141-976283C590C4} = {7867CF0A-53DE-4CAD-A141-976283C590C4} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{7867CF0A-53DE-4CAD-A141-976283C590C4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + MinSizeRel|x64 = MinSizeRel|x64 + Release|x64 = Release|x64 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Debug|x64.ActiveCfg = Debug|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Debug|x64.Build.0 = Debug|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Release|x64.ActiveCfg = Release|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Release|x64.Build.0 = Release|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.Debug|x64.ActiveCfg = Debug|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.Debug|x64.Build.0 = Debug|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.Release|x64.ActiveCfg = Release|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.Release|x64.Build.0 = Release|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {7867CF0A-53DE-4CAD-A141-976283C590C4}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2012_x64/UnitTest++.vcxproj b/vs_projects/vs2012_x64/UnitTest++.vcxproj new file mode 100644 index 0000000..7ea763f --- /dev/null +++ b/vs_projects/vs2012_x64/UnitTest++.vcxproj @@ -0,0 +1,256 @@ +サソ + + + + Debug + x64 + + + Release + x64 + + + MinSizeRel + x64 + + + RelWithDebInfo + x64 + + + + {7867CF0A-53DE-4CAD-A141-976283C590C4} + Win32Proj + x64 + UnitTest++ + + + + StaticLibrary + false + MultiByte + v110 + + + StaticLibrary + false + MultiByte + v110 + + + StaticLibrary + false + MultiByte + v110 + + + StaticLibrary + false + MultiByte + v110 + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2012_x64\Debug\ + UnitTest++.dir\Debug\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2012_x64\Release\ + UnitTest++.dir\Release\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2012_x64\MinSizeRel\ + UnitTest++.dir\MinSizeRel\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2012_x64\RelWithDebInfo\ + UnitTest++.dir\RelWithDebInfo\ + UnitTest++ + .lib + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/UnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2012_x64/UnitTest++.vcxproj.filters b/vs_projects/vs2012_x64/UnitTest++.vcxproj.filters new file mode 100644 index 0000000..b692ccf --- /dev/null +++ b/vs_projects/vs2012_x64/UnitTest++.vcxproj.filters @@ -0,0 +1,63 @@ +サソ + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + {6C3785C9-4B23-45F4-871B-C1DD411A4396} + + + diff --git a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj new file mode 100644 index 0000000..f12b1da --- /dev/null +++ b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj @@ -0,0 +1,306 @@ +サソ + + + + Debug + Win32 + + + Release + Win32 + + + MinSizeRel + Win32 + + + RelWithDebInfo + Win32 + + + + {206E8A31-7D19-4632-A9A4-930039BB4A16} + Win32Proj + Win32 + TestUnitTest++ + + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + Application + false + MultiByte + v110 + + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2012_x86\Debug\ + TestUnitTest++.dir\Debug\ + TestUnitTest++ + .exe + true + true + U:\unittest-cpp-pj\vs_projects\vs2012_x86\Release\ + TestUnitTest++.dir\Release\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2012_x86\MinSizeRel\ + TestUnitTest++.dir\MinSizeRel\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2012_x86\RelWithDebInfo\ + TestUnitTest++.dir\RelWithDebInfo\ + TestUnitTest++ + .exe + true + true + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/TestUnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/TestUnitTest++.pdb + 10000000 + Console + + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/TestUnitTest++.pdb + 10000000 + Console + + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/TestUnitTest++.pdb + 10000000 + Console + + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/TestUnitTest++.pdb + 10000000 + Console + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4128153F-6FD2-46E5-9330-3650015B97E1 + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters new file mode 100644 index 0000000..3cfece1 --- /dev/null +++ b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters @@ -0,0 +1,30 @@ +サソ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2012_x86/UnitTest++.sln b/vs_projects/vs2012_x86/UnitTest++.sln new file mode 100644 index 0000000..466e16e --- /dev/null +++ b/vs_projects/vs2012_x86/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{206E8A31-7D19-4632-A9A4-930039BB4A16}" + ProjectSection(ProjectDependencies) = postProject + {4128153F-6FD2-46E5-9330-3650015B97E1} = {4128153F-6FD2-46E5-9330-3650015B97E1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{4128153F-6FD2-46E5-9330-3650015B97E1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + MinSizeRel|Win32 = MinSizeRel|Win32 + Release|Win32 = Release|Win32 + RelWithDebInfo|Win32 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {206E8A31-7D19-4632-A9A4-930039BB4A16}.Debug|Win32.ActiveCfg = Debug|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.Debug|Win32.Build.0 = Debug|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.Release|Win32.ActiveCfg = Release|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.Release|Win32.Build.0 = Release|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {206E8A31-7D19-4632-A9A4-930039BB4A16}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.Debug|Win32.ActiveCfg = Debug|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.Debug|Win32.Build.0 = Debug|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.Release|Win32.ActiveCfg = Release|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.Release|Win32.Build.0 = Release|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {4128153F-6FD2-46E5-9330-3650015B97E1}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2012_x86/UnitTest++.vcxproj b/vs_projects/vs2012_x86/UnitTest++.vcxproj new file mode 100644 index 0000000..471eaaa --- /dev/null +++ b/vs_projects/vs2012_x86/UnitTest++.vcxproj @@ -0,0 +1,256 @@ +サソ + + + + Debug + Win32 + + + Release + Win32 + + + MinSizeRel + Win32 + + + RelWithDebInfo + Win32 + + + + {4128153F-6FD2-46E5-9330-3650015B97E1} + Win32Proj + Win32 + UnitTest++ + + + + StaticLibrary + false + MultiByte + v110 + + + StaticLibrary + false + MultiByte + v110 + + + StaticLibrary + false + MultiByte + v110 + + + StaticLibrary + false + MultiByte + v110 + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2012_x86\Debug\ + UnitTest++.dir\Debug\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2012_x86\Release\ + UnitTest++.dir\Release\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2012_x86\MinSizeRel\ + UnitTest++.dir\MinSizeRel\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2012_x86\RelWithDebInfo\ + UnitTest++.dir\RelWithDebInfo\ + UnitTest++ + .lib + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/UnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2012_x86/UnitTest++.vcxproj.filters b/vs_projects/vs2012_x86/UnitTest++.vcxproj.filters new file mode 100644 index 0000000..7818cf8 --- /dev/null +++ b/vs_projects/vs2012_x86/UnitTest++.vcxproj.filters @@ -0,0 +1,63 @@ +サソ + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + {27C32F86-0D7D-4B85-AF93-E62D39E9D551} + + + From 11405eee0fac7451ed8dccf4a397ceb7d2d56ebb Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 01:31:40 -0500 Subject: [PATCH 041/184] Add *.bat as eol=crlf. --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitattributes b/.gitattributes index ce46819..4d390e4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,3 +12,6 @@ # VC6 files *.dsw text eol=crlf *.dsp text eol=crlf + +# Other 'windows-specific' files +*.bat text eol=crlf \ No newline at end of file From 500bb6ef7db2e8c41bfb563c7130a4d7cc8eac2a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 01:31:51 -0500 Subject: [PATCH 042/184] Add strip_cmake.bat for deleting "extra" files generated by CMake. Note that the solutions/workspaces generated for Visual Studio, by default, will still have the extra projects in them. They must be deleted from the project before running this strip_cmake.bat. TODO: Teach strip_cmake.bat how to actually strip the offending projects from the solutions/workspaces. --- vs_projects/strip_cmake.bat | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 vs_projects/strip_cmake.bat diff --git a/vs_projects/strip_cmake.bat b/vs_projects/strip_cmake.bat new file mode 100644 index 0000000..882499e --- /dev/null +++ b/vs_projects/strip_cmake.bat @@ -0,0 +1,17 @@ +@echo off +setlocal +set slnDir_=%1 + +rem TODO: Use VS automation to remove CMake projects + +rem This batch file tries to delete things from the sub-folders +rem that may or may not be there based on the Visual Studio +rem version in play. I chose to make it quick and dumb so that +rem it can be called on each project folder with no special +rem logic. + +pushd %slnDir_% +del /Q ALL_BUILD.* check.* cmake_install.cmake CMakeCache.txt CTestTestfile.cmake +del /Q INSTALL.* RUN_TESTS.* +rmdir /s /q CMakeFiles +popd \ No newline at end of file From 77e92e35ad2ff076f2a455c6342bdb1739e33fc9 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 01:35:33 -0500 Subject: [PATCH 043/184] Generate new Visual Studio 2010 projects. --- UnitTest++.vsnet2010.sln | 26 -- UnitTest++.vsnet2010.vcxproj | 118 ------- UnitTest++.vsnet2010.vcxproj.filters | 55 ---- vs_projects/vs2010_x64/TestUnitTest++.vcxproj | 295 ++++++++++++++++++ .../vs2010_x64/TestUnitTest++.vcxproj.filters | 30 ++ vs_projects/vs2010_x64/UnitTest++.sln | 38 +++ vs_projects/vs2010_x64/UnitTest++.vcxproj | 252 +++++++++++++++ .../vs2010_x64/UnitTest++.vcxproj.filters | 63 ++++ vs_projects/vs2010_x86/TestUnitTest++.vcxproj | 295 ++++++++++++++++++ .../vs2010_x86/TestUnitTest++.vcxproj.filters | 30 ++ vs_projects/vs2010_x86/UnitTest++.sln | 38 +++ vs_projects/vs2010_x86/UnitTest++.vcxproj | 252 +++++++++++++++ .../vs2010_x86/UnitTest++.vcxproj.filters | 63 ++++ 13 files changed, 1356 insertions(+), 199 deletions(-) delete mode 100644 UnitTest++.vsnet2010.sln delete mode 100644 UnitTest++.vsnet2010.vcxproj delete mode 100644 UnitTest++.vsnet2010.vcxproj.filters create mode 100644 vs_projects/vs2010_x64/TestUnitTest++.vcxproj create mode 100644 vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters create mode 100644 vs_projects/vs2010_x64/UnitTest++.sln create mode 100644 vs_projects/vs2010_x64/UnitTest++.vcxproj create mode 100644 vs_projects/vs2010_x64/UnitTest++.vcxproj.filters create mode 100644 vs_projects/vs2010_x86/TestUnitTest++.vcxproj create mode 100644 vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters create mode 100644 vs_projects/vs2010_x86/UnitTest++.sln create mode 100644 vs_projects/vs2010_x86/UnitTest++.vcxproj create mode 100644 vs_projects/vs2010_x86/UnitTest++.vcxproj.filters diff --git a/UnitTest++.vsnet2010.sln b/UnitTest++.vsnet2010.sln deleted file mode 100644 index 47268f1..0000000 --- a/UnitTest++.vsnet2010.sln +++ /dev/null @@ -1,26 +0,0 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2010", "UnitTest++.vsnet2010.vcxproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2010", "TestUnitTest++.vsnet2010.vcxproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.ActiveCfg = Debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.Build.0 = Debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.ActiveCfg = Release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.Build.0 = Release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.ActiveCfg = Debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.Build.0 = Debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.ActiveCfg = Release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/UnitTest++.vsnet2010.vcxproj b/UnitTest++.vsnet2010.vcxproj deleted file mode 100644 index 9e0816b..0000000 --- a/UnitTest++.vsnet2010.vcxproj +++ /dev/null @@ -1,118 +0,0 @@ -サソ - - - - Debug - Win32 - - - Release - Win32 - - - - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - UnitTestvsnet2005 - Win32Proj - UnitTest++.vsnet2010 - - - - StaticLibrary - Unicode - false - - - StaticLibrary - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\ - obj\$(ProjectName)\$(Configuration)\ - $(SolutionDir)$(Configuration)\ - obj\$(ProjectName)\$(Configuration)\ - - - - Disabled - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - Async - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - EditAndContinue - - - - - MinSpace - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - Async - MultiThreadedDLL - - - Level4 - ProgramDatabase - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/UnitTest++.vsnet2010.vcxproj.filters b/UnitTest++.vsnet2010.vcxproj.filters deleted file mode 100644 index eea216f..0000000 --- a/UnitTest++.vsnet2010.vcxproj.filters +++ /dev/null @@ -1,55 +0,0 @@ -サソ - - - - {574dd04f-2b0e-463b-adf4-d019dba5403f} - - - - - Win32 - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj new file mode 100644 index 0000000..231b6ad --- /dev/null +++ b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj @@ -0,0 +1,295 @@ +サソ + + + + Debug + x64 + + + Release + x64 + + + MinSizeRel + x64 + + + RelWithDebInfo + x64 + + + + {5C5EBB30-ECAF-4BCF-9054-094ED2894699} + Win32Proj + x64 + TestUnitTest++ + + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2010_x64\Debug\ + TestUnitTest++.dir\Debug\ + TestUnitTest++ + .exe + true + true + U:\unittest-cpp-pj\vs_projects\vs2010_x64\Release\ + TestUnitTest++.dir\Release\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2010_x64\MinSizeRel\ + TestUnitTest++.dir\MinSizeRel\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2010_x64\RelWithDebInfo\ + TestUnitTest++.dir\RelWithDebInfo\ + TestUnitTest++ + .exe + true + true + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/TestUnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:x64 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + FB6A3EF4-5303-407E-A45C-687834E9D072 + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters new file mode 100644 index 0000000..3cfece1 --- /dev/null +++ b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters @@ -0,0 +1,30 @@ +サソ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2010_x64/UnitTest++.sln b/vs_projects/vs2010_x64/UnitTest++.sln new file mode 100644 index 0000000..71a48b2 --- /dev/null +++ b/vs_projects/vs2010_x64/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{5C5EBB30-ECAF-4BCF-9054-094ED2894699}" + ProjectSection(ProjectDependencies) = postProject + {FB6A3EF4-5303-407E-A45C-687834E9D072} = {FB6A3EF4-5303-407E-A45C-687834E9D072} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{FB6A3EF4-5303-407E-A45C-687834E9D072}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + MinSizeRel|x64 = MinSizeRel|x64 + Release|x64 = Release|x64 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Debug|x64.ActiveCfg = Debug|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Debug|x64.Build.0 = Debug|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Release|x64.ActiveCfg = Release|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Release|x64.Build.0 = Release|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.Debug|x64.ActiveCfg = Debug|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.Debug|x64.Build.0 = Debug|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.Release|x64.ActiveCfg = Release|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.Release|x64.Build.0 = Release|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {FB6A3EF4-5303-407E-A45C-687834E9D072}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2010_x64/UnitTest++.vcxproj b/vs_projects/vs2010_x64/UnitTest++.vcxproj new file mode 100644 index 0000000..b846709 --- /dev/null +++ b/vs_projects/vs2010_x64/UnitTest++.vcxproj @@ -0,0 +1,252 @@ +サソ + + + + Debug + x64 + + + Release + x64 + + + MinSizeRel + x64 + + + RelWithDebInfo + x64 + + + + {FB6A3EF4-5303-407E-A45C-687834E9D072} + Win32Proj + x64 + UnitTest++ + + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2010_x64\Debug\ + UnitTest++.dir\Debug\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2010_x64\Release\ + UnitTest++.dir\Release\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2010_x64\MinSizeRel\ + UnitTest++.dir\MinSizeRel\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2010_x64\RelWithDebInfo\ + UnitTest++.dir\RelWithDebInfo\ + UnitTest++ + .lib + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/UnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2010_x64/UnitTest++.vcxproj.filters b/vs_projects/vs2010_x64/UnitTest++.vcxproj.filters new file mode 100644 index 0000000..7f071c1 --- /dev/null +++ b/vs_projects/vs2010_x64/UnitTest++.vcxproj.filters @@ -0,0 +1,63 @@ +サソ + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + {DB64CD83-3739-41F0-B91D-D72E42A76AA6} + + + diff --git a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj new file mode 100644 index 0000000..7e58525 --- /dev/null +++ b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj @@ -0,0 +1,295 @@ +サソ + + + + Debug + Win32 + + + Release + Win32 + + + MinSizeRel + Win32 + + + RelWithDebInfo + Win32 + + + + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0} + Win32Proj + Win32 + TestUnitTest++ + + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + Application + false + MultiByte + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2010_x86\Debug\ + TestUnitTest++.dir\Debug\ + TestUnitTest++ + .exe + true + true + U:\unittest-cpp-pj\vs_projects\vs2010_x86\Release\ + TestUnitTest++.dir\Release\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2010_x86\MinSizeRel\ + TestUnitTest++.dir\MinSizeRel\ + TestUnitTest++ + .exe + false + true + U:\unittest-cpp-pj\vs_projects\vs2010_x86\RelWithDebInfo\ + TestUnitTest++.dir\RelWithDebInfo\ + TestUnitTest++ + .exe + true + true + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/TestUnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib + %(AdditionalLibraryDirectories) + false + U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/TestUnitTest++.lib + U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/TestUnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + /machine:X86 /debug %(AdditionalOptions) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib + %(AdditionalLibraryDirectories) + true + U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/TestUnitTest++.lib + true + U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/TestUnitTest++.pdb + 10000000 + Console + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + 59739FC9-D084-4B2E-BFEA-28D91A9BD3F8 + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters new file mode 100644 index 0000000..3cfece1 --- /dev/null +++ b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters @@ -0,0 +1,30 @@ +サソ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2010_x86/UnitTest++.sln b/vs_projects/vs2010_x86/UnitTest++.sln new file mode 100644 index 0000000..93b5868 --- /dev/null +++ b/vs_projects/vs2010_x86/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}" + ProjectSection(ProjectDependencies) = postProject + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8} = {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + MinSizeRel|Win32 = MinSizeRel|Win32 + Release|Win32 = Release|Win32 + RelWithDebInfo|Win32 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Debug|Win32.ActiveCfg = Debug|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Debug|Win32.Build.0 = Debug|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Release|Win32.ActiveCfg = Release|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Release|Win32.Build.0 = Release|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Debug|Win32.ActiveCfg = Debug|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Debug|Win32.Build.0 = Debug|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Release|Win32.ActiveCfg = Release|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Release|Win32.Build.0 = Release|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2010_x86/UnitTest++.vcxproj b/vs_projects/vs2010_x86/UnitTest++.vcxproj new file mode 100644 index 0000000..d767591 --- /dev/null +++ b/vs_projects/vs2010_x86/UnitTest++.vcxproj @@ -0,0 +1,252 @@ +サソ + + + + Debug + Win32 + + + Release + Win32 + + + MinSizeRel + Win32 + + + RelWithDebInfo + Win32 + + + + {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8} + Win32Proj + Win32 + UnitTest++ + + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + StaticLibrary + false + MultiByte + + + + + + + + + <_ProjectFileVersion>10.0.20506.1 + U:\unittest-cpp-pj\vs_projects\vs2010_x86\Debug\ + UnitTest++.dir\Debug\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2010_x86\Release\ + UnitTest++.dir\Release\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2010_x86\MinSizeRel\ + UnitTest++.dir\MinSizeRel\ + UnitTest++ + .lib + U:\unittest-cpp-pj\vs_projects\vs2010_x86\RelWithDebInfo\ + UnitTest++.dir\RelWithDebInfo\ + UnitTest++ + .lib + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + EnableFastChecks + CompileAsCpp + ProgramDatabase + Sync + Disabled + Disabled + NotUsing + MultiThreadedDebugDLL + true + Level3 + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) + Debug + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/UnitTest++.pdb + + + WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + AnySuitable + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) + Release + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + Sync + OnlyExplicitInline + MinSpace + NotUsing + MultiThreadedDLL + true + Level3 + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) + MinSizeRel + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + /Zm1000 %(AdditionalOptions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + CompileAsCpp + ProgramDatabase + Sync + OnlyExplicitInline + MaxSpeed + NotUsing + MultiThreadedDLL + true + Level3 + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) + RelWithDebInfo + $(IntDir) + U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/UnitTest++.pdb + + + WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + + + U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) + $(IntDir) + %(Filename).h + %(Filename).tlb + %(Filename)_i.c + %(Filename)_p.c + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vs_projects/vs2010_x86/UnitTest++.vcxproj.filters b/vs_projects/vs2010_x86/UnitTest++.vcxproj.filters new file mode 100644 index 0000000..2ea1e73 --- /dev/null +++ b/vs_projects/vs2010_x86/UnitTest++.vcxproj.filters @@ -0,0 +1,63 @@ +サソ + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Win32 + + + + + {0E6D11F1-BD64-469A-BBC0-AF98B7FFF0CA} + + + From aaf008f458b5a8b273300662cfa62cbe6a912fb6 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 01:46:01 -0500 Subject: [PATCH 044/184] Generate new Visual Studio 2008 projects. --- .gitignore | 3 + unittestpp_vs2008.sln | 49 --- vs_projects/vs2008_x64/TestUnitTest++.vcproj | 330 ++++++++++++++++ vs_projects/vs2008_x64/UnitTest++.sln | 38 ++ vs_projects/vs2008_x64/UnitTest++.vcproj | 374 +++++++++++++++++++ vs_projects/vs2008_x86/TestUnitTest++.vcproj | 330 ++++++++++++++++ vs_projects/vs2008_x86/UnitTest++.sln | 38 ++ vs_projects/vs2008_x86/UnitTest++.vcproj | 374 +++++++++++++++++++ 8 files changed, 1487 insertions(+), 49 deletions(-) delete mode 100644 unittestpp_vs2008.sln create mode 100644 vs_projects/vs2008_x64/TestUnitTest++.vcproj create mode 100644 vs_projects/vs2008_x64/UnitTest++.sln create mode 100644 vs_projects/vs2008_x64/UnitTest++.vcproj create mode 100644 vs_projects/vs2008_x86/TestUnitTest++.vcproj create mode 100644 vs_projects/vs2008_x86/UnitTest++.sln create mode 100644 vs_projects/vs2008_x86/UnitTest++.vcproj diff --git a/.gitignore b/.gitignore index 397bce8..edfc779 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ *.o *.a + +# Visual Studio temp/user files *.user *.suo *.sdf *.opensdf +*.ncb # Build output directories Release diff --git a/unittestpp_vs2008.sln b/unittestpp_vs2008.sln deleted file mode 100644 index fe863c2..0000000 --- a/unittestpp_vs2008.sln +++ /dev/null @@ -1,49 +0,0 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittestpp_vs2008", "src\unittestpp_vs2008.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-unittestpp_vs2008", "src\tests\test-unittestpp_vs2008.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" - ProjectSection(ProjectDependencies) = postProject - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - win32_dll_vc90_debug|Win32 = win32_dll_vc90_debug|Win32 - win32_dll_vc90_release|Win32 = win32_dll_vc90_release|Win32 - win32_static_vc90_md_debug|Win32 = win32_static_vc90_md_debug|Win32 - win32_static_vc90_md_release|Win32 = win32_static_vc90_md_release|Win32 - win32_static_vc90_mt_debug|Win32 = win32_static_vc90_mt_debug|Win32 - win32_static_vc90_mt_release|Win32 = win32_static_vc90_mt_release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_debug|Win32.ActiveCfg = win32_dll_vc90_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_debug|Win32.Build.0 = win32_dll_vc90_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_release|Win32.ActiveCfg = win32_dll_vc90_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc90_release|Win32.Build.0 = win32_dll_vc90_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_debug|Win32.ActiveCfg = win32_static_vc90_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_debug|Win32.Build.0 = win32_static_vc90_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_release|Win32.ActiveCfg = win32_static_vc90_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_md_release|Win32.Build.0 = win32_static_vc90_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_debug|Win32.ActiveCfg = win32_static_vc90_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_debug|Win32.Build.0 = win32_static_vc90_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_release|Win32.ActiveCfg = win32_static_vc90_mt_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc90_mt_release|Win32.Build.0 = win32_static_vc90_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_debug|Win32.ActiveCfg = win32_dll_vc90_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_debug|Win32.Build.0 = win32_dll_vc90_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_release|Win32.ActiveCfg = win32_dll_vc90_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc90_release|Win32.Build.0 = win32_dll_vc90_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_debug|Win32.ActiveCfg = win32_static_vc90_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_debug|Win32.Build.0 = win32_static_vc90_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_release|Win32.ActiveCfg = win32_static_vc90_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_md_release|Win32.Build.0 = win32_static_vc90_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_debug|Win32.ActiveCfg = win32_static_vc90_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_debug|Win32.Build.0 = win32_static_vc90_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_release|Win32.ActiveCfg = win32_static_vc90_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc90_mt_release|Win32.Build.0 = win32_static_vc90_mt_release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2008_x64/TestUnitTest++.vcproj b/vs_projects/vs2008_x64/TestUnitTest++.vcproj new file mode 100644 index 0000000..c124d92 --- /dev/null +++ b/vs_projects/vs2008_x64/TestUnitTest++.vcproj @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2008_x64/UnitTest++.sln b/vs_projects/vs2008_x64/UnitTest++.sln new file mode 100644 index 0000000..6f6762c --- /dev/null +++ b/vs_projects/vs2008_x64/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{7AAC9879-0F64-49B3-9420-0DB18FB337BF}" + ProjectSection(ProjectDependencies) = postProject + {B8F60BD4-3946-4458-A2B3-72B42A399B82} = {B8F60BD4-3946-4458-A2B3-72B42A399B82} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{B8F60BD4-3946-4458-A2B3-72B42A399B82}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + MinSizeRel|x64 = MinSizeRel|x64 + Release|x64 = Release|x64 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Debug|x64.ActiveCfg = Debug|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Debug|x64.Build.0 = Debug|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Release|x64.ActiveCfg = Release|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Release|x64.Build.0 = Release|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Debug|x64.ActiveCfg = Debug|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Debug|x64.Build.0 = Debug|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Release|x64.ActiveCfg = Release|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Release|x64.Build.0 = Release|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {B8F60BD4-3946-4458-A2B3-72B42A399B82}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2008_x64/UnitTest++.vcproj b/vs_projects/vs2008_x64/UnitTest++.vcproj new file mode 100644 index 0000000..e1ab1bd --- /dev/null +++ b/vs_projects/vs2008_x64/UnitTest++.vcproj @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2008_x86/TestUnitTest++.vcproj b/vs_projects/vs2008_x86/TestUnitTest++.vcproj new file mode 100644 index 0000000..9700001 --- /dev/null +++ b/vs_projects/vs2008_x86/TestUnitTest++.vcproj @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2008_x86/UnitTest++.sln b/vs_projects/vs2008_x86/UnitTest++.sln new file mode 100644 index 0000000..3444310 --- /dev/null +++ b/vs_projects/vs2008_x86/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{52AD06AB-CCF0-447B-AAEE-F072735C7FB1}" + ProjectSection(ProjectDependencies) = postProject + {241694AB-FC8A-4374-A564-BD0D0BC75020} = {241694AB-FC8A-4374-A564-BD0D0BC75020} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{241694AB-FC8A-4374-A564-BD0D0BC75020}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + MinSizeRel|Win32 = MinSizeRel|Win32 + Release|Win32 = Release|Win32 + RelWithDebInfo|Win32 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Debug|Win32.ActiveCfg = Debug|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Debug|Win32.Build.0 = Debug|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Release|Win32.ActiveCfg = Release|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Release|Win32.Build.0 = Release|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.Debug|Win32.ActiveCfg = Debug|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.Debug|Win32.Build.0 = Debug|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.Release|Win32.ActiveCfg = Release|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.Release|Win32.Build.0 = Release|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {241694AB-FC8A-4374-A564-BD0D0BC75020}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2008_x86/UnitTest++.vcproj b/vs_projects/vs2008_x86/UnitTest++.vcproj new file mode 100644 index 0000000..95ae6cf --- /dev/null +++ b/vs_projects/vs2008_x86/UnitTest++.vcproj @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d4551abf58b1d03de41840151a294ac6852f7ffb Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 01:46:31 -0500 Subject: [PATCH 045/184] Remove old TestUnitTest++ 2010 project files. --- TestUnitTest++.vsnet2010.vcxproj | 123 ----------------------- TestUnitTest++.vsnet2010.vcxproj.filters | 26 ----- 2 files changed, 149 deletions(-) delete mode 100644 TestUnitTest++.vsnet2010.vcxproj delete mode 100644 TestUnitTest++.vsnet2010.vcxproj.filters diff --git a/TestUnitTest++.vsnet2010.vcxproj b/TestUnitTest++.vsnet2010.vcxproj deleted file mode 100644 index 0bc8ac1..0000000 --- a/TestUnitTest++.vsnet2010.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ -サソ - - - - Debug - Win32 - - - Release - Win32 - - - - {9CCC3439-309E-4E85-B3B8-CE704D385D48} - TestUnitTestvsnet2005 - Win32Proj - TestUnitTest++.vsnet2010 - - - - Application - Unicode - false - - - Application - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\ - obj\$(ProjectName)\$(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - obj\$(ProjectName)\$(Configuration)\ - false - - - - Disabled - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - Async - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - EditAndContinue - - - true - Console - MachineX86 - - - "$(TargetPath)" - - - - - MaxSpeed - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - Async - MultiThreadedDLL - - - Level4 - ProgramDatabase - - - true - Console - true - true - MachineX86 - - - "$(TargetPath)" - - - - - - - - - - - - - - - - - - - - - - - - - - - - {64a4fefe-0461-4e95-8cc1-91ef5f57dbc6} - - - - - - \ No newline at end of file diff --git a/TestUnitTest++.vsnet2010.vcxproj.filters b/TestUnitTest++.vsnet2010.vcxproj.filters deleted file mode 100644 index 450d1fb..0000000 --- a/TestUnitTest++.vsnet2010.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From 90c1b7a3b7c75b27d1711b5fb380689fd3a99133 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 02:08:36 -0500 Subject: [PATCH 046/184] Generate new Visual Studio 2005 projects. --- UnitTest++/TestReporterStdout.h | 2 +- vs_projects/vs2005_x64/TestUnitTest++.vcproj | 330 ++++++++++++++++ vs_projects/vs2005_x64/UnitTest++.sln | 38 ++ vs_projects/vs2005_x64/UnitTest++.vcproj | 374 +++++++++++++++++++ vs_projects/vs2005_x86/TestUnitTest++.vcproj | 330 ++++++++++++++++ vs_projects/vs2005_x86/UnitTest++.sln | 38 ++ vs_projects/vs2005_x86/UnitTest++.vcproj | 374 +++++++++++++++++++ 7 files changed, 1485 insertions(+), 1 deletion(-) create mode 100644 vs_projects/vs2005_x64/TestUnitTest++.vcproj create mode 100644 vs_projects/vs2005_x64/UnitTest++.sln create mode 100644 vs_projects/vs2005_x64/UnitTest++.vcproj create mode 100644 vs_projects/vs2005_x86/TestUnitTest++.vcproj create mode 100644 vs_projects/vs2005_x86/UnitTest++.sln create mode 100644 vs_projects/vs2005_x86/UnitTest++.vcproj diff --git a/UnitTest++/TestReporterStdout.h b/UnitTest++/TestReporterStdout.h index 457c0b6..e8d7bbf 100644 --- a/UnitTest++/TestReporterStdout.h +++ b/UnitTest++/TestReporterStdout.h @@ -11,7 +11,7 @@ class UNITTEST_LINKAGE TestReporterStdout : public TestReporter 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 const totalTestCount, int const failedTestCount, int const failureCount, float const secondsElapsed); + virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed); }; } diff --git a/vs_projects/vs2005_x64/TestUnitTest++.vcproj b/vs_projects/vs2005_x64/TestUnitTest++.vcproj new file mode 100644 index 0000000..e40a68a --- /dev/null +++ b/vs_projects/vs2005_x64/TestUnitTest++.vcproj @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2005_x64/UnitTest++.sln b/vs_projects/vs2005_x64/UnitTest++.sln new file mode 100644 index 0000000..9fff3bd --- /dev/null +++ b/vs_projects/vs2005_x64/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{9AE72F67-C325-4B4E-A001-6242514071DE}" + ProjectSection(ProjectDependencies) = postProject + {0266798B-A432-430B-9DE2-4351926EA9DE} = {0266798B-A432-430B-9DE2-4351926EA9DE} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{0266798B-A432-430B-9DE2-4351926EA9DE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + MinSizeRel|x64 = MinSizeRel|x64 + Release|x64 = Release|x64 + RelWithDebInfo|x64 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9AE72F67-C325-4B4E-A001-6242514071DE}.Debug|x64.ActiveCfg = Debug|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.Debug|x64.Build.0 = Debug|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.Release|x64.ActiveCfg = Release|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.Release|x64.Build.0 = Release|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {9AE72F67-C325-4B4E-A001-6242514071DE}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.Debug|x64.ActiveCfg = Debug|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.Debug|x64.Build.0 = Debug|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.Release|x64.ActiveCfg = Release|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.Release|x64.Build.0 = Release|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 + {0266798B-A432-430B-9DE2-4351926EA9DE}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2005_x64/UnitTest++.vcproj b/vs_projects/vs2005_x64/UnitTest++.vcproj new file mode 100644 index 0000000..382b863 --- /dev/null +++ b/vs_projects/vs2005_x64/UnitTest++.vcproj @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2005_x86/TestUnitTest++.vcproj b/vs_projects/vs2005_x86/TestUnitTest++.vcproj new file mode 100644 index 0000000..522d871 --- /dev/null +++ b/vs_projects/vs2005_x86/TestUnitTest++.vcproj @@ -0,0 +1,330 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2005_x86/UnitTest++.sln b/vs_projects/vs2005_x86/UnitTest++.sln new file mode 100644 index 0000000..04cb02a --- /dev/null +++ b/vs_projects/vs2005_x86/UnitTest++.sln @@ -0,0 +1,38 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{580F19DE-3641-4DDD-99F5-992777B8789A}" + ProjectSection(ProjectDependencies) = postProject + {74254CA4-A6A2-4867-87B7-5B3A77BDF044} = {74254CA4-A6A2-4867-87B7-5B3A77BDF044} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{74254CA4-A6A2-4867-87B7-5B3A77BDF044}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + MinSizeRel|Win32 = MinSizeRel|Win32 + Release|Win32 = Release|Win32 + RelWithDebInfo|Win32 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {580F19DE-3641-4DDD-99F5-992777B8789A}.Debug|Win32.ActiveCfg = Debug|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.Debug|Win32.Build.0 = Debug|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.Release|Win32.ActiveCfg = Release|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.Release|Win32.Build.0 = Release|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {580F19DE-3641-4DDD-99F5-992777B8789A}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Debug|Win32.ActiveCfg = Debug|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Debug|Win32.Build.0 = Debug|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Release|Win32.ActiveCfg = Release|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Release|Win32.Build.0 = Release|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 + {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2005_x86/UnitTest++.vcproj b/vs_projects/vs2005_x86/UnitTest++.vcproj new file mode 100644 index 0000000..a7e5be7 --- /dev/null +++ b/vs_projects/vs2005_x86/UnitTest++.vcproj @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c39d185b237203e638f1b245d2d0815bc8af2d41 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 02:09:19 -0500 Subject: [PATCH 047/184] Remove old Visual Studio 2005 projects. --- UnitTest++.vsnet2005.sln | 29 ---- UnitTest++.vsnet2005.vcproj | 318 ------------------------------------ unittestpp_vs2005.sln | 49 ------ 3 files changed, 396 deletions(-) delete mode 100644 UnitTest++.vsnet2005.sln delete mode 100644 UnitTest++.vsnet2005.vcproj delete mode 100644 unittestpp_vs2005.sln diff --git a/UnitTest++.vsnet2005.sln b/UnitTest++.vsnet2005.sln deleted file mode 100644 index 382f334..0000000 --- a/UnitTest++.vsnet2005.sln +++ /dev/null @@ -1,29 +0,0 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2005", "UnitTest++.vsnet2005.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2005", "TestUnitTest++.vsnet2005.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" - ProjectSection(ProjectDependencies) = postProject - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.ActiveCfg = Debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Debug|Win32.Build.0 = Debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.ActiveCfg = Release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.Release|Win32.Build.0 = Release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.ActiveCfg = Debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Debug|Win32.Build.0 = Debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.ActiveCfg = Release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/UnitTest++.vsnet2005.vcproj b/UnitTest++.vsnet2005.vcproj deleted file mode 100644 index 7e45646..0000000 --- a/UnitTest++.vsnet2005.vcproj +++ /dev/null @@ -1,318 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/unittestpp_vs2005.sln b/unittestpp_vs2005.sln deleted file mode 100644 index 85c6b09..0000000 --- a/unittestpp_vs2005.sln +++ /dev/null @@ -1,49 +0,0 @@ -サソ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unittestpp_vs2005", "src\unittestpp_vs2005.vcproj", "{64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test-unittestpp_vs2005", "src\tests\test-unittestpp_vs2005.vcproj", "{9CCC3439-309E-4E85-B3B8-CE704D385D48}" - ProjectSection(ProjectDependencies) = postProject - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} = {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - win32_dll_vc80_debug|Win32 = win32_dll_vc80_debug|Win32 - win32_dll_vc80_release|Win32 = win32_dll_vc80_release|Win32 - win32_static_vc80_md_debug|Win32 = win32_static_vc80_md_debug|Win32 - win32_static_vc80_md_release|Win32 = win32_static_vc80_md_release|Win32 - win32_static_vc80_mt_debug|Win32 = win32_static_vc80_mt_debug|Win32 - win32_static_vc80_mt_release|Win32 = win32_static_vc80_mt_release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_debug|Win32.ActiveCfg = win32_dll_vc80_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_debug|Win32.Build.0 = win32_dll_vc80_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_release|Win32.ActiveCfg = win32_dll_vc80_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_dll_vc80_release|Win32.Build.0 = win32_dll_vc80_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_debug|Win32.ActiveCfg = win32_static_vc80_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_debug|Win32.Build.0 = win32_static_vc80_md_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_release|Win32.ActiveCfg = win32_static_vc80_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_md_release|Win32.Build.0 = win32_static_vc80_md_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_debug|Win32.ActiveCfg = win32_static_vc80_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_debug|Win32.Build.0 = win32_static_vc80_mt_debug|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_release|Win32.ActiveCfg = win32_static_vc80_mt_release|Win32 - {64A4FEFE-0461-4E95-8CC1-91EF5F57DBC6}.win32_static_vc80_mt_release|Win32.Build.0 = win32_static_vc80_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_debug|Win32.ActiveCfg = win32_dll_vc80_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_debug|Win32.Build.0 = win32_dll_vc80_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_release|Win32.ActiveCfg = win32_dll_vc80_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_dll_vc80_release|Win32.Build.0 = win32_dll_vc80_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_debug|Win32.ActiveCfg = win32_static_vc80_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_debug|Win32.Build.0 = win32_static_vc80_md_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_release|Win32.ActiveCfg = win32_static_vc80_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_md_release|Win32.Build.0 = win32_static_vc80_md_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_debug|Win32.ActiveCfg = win32_static_vc80_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_debug|Win32.Build.0 = win32_static_vc80_mt_debug|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_release|Win32.ActiveCfg = win32_static_vc80_mt_release|Win32 - {9CCC3439-309E-4E85-B3B8-CE704D385D48}.win32_static_vc80_mt_release|Win32.Build.0 = win32_static_vc80_mt_release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal From caa4df97b0a810e75c191ac362b8c9eb57949bcd Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 02:13:59 -0500 Subject: [PATCH 048/184] Generate new Visual Studio 2003 projects. --- vs_projects/vs2003_x86/TestUnitTest++.vcproj | 329 ++++++++++++++++ vs_projects/vs2003_x86/UnitTest++.sln | 42 +++ vs_projects/vs2003_x86/UnitTest++.vcproj | 373 +++++++++++++++++++ 3 files changed, 744 insertions(+) create mode 100644 vs_projects/vs2003_x86/TestUnitTest++.vcproj create mode 100644 vs_projects/vs2003_x86/UnitTest++.sln create mode 100644 vs_projects/vs2003_x86/UnitTest++.vcproj diff --git a/vs_projects/vs2003_x86/TestUnitTest++.vcproj b/vs_projects/vs2003_x86/TestUnitTest++.vcproj new file mode 100644 index 0000000..d3eea78 --- /dev/null +++ b/vs_projects/vs2003_x86/TestUnitTest++.vcproj @@ -0,0 +1,329 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vs_projects/vs2003_x86/UnitTest++.sln b/vs_projects/vs2003_x86/UnitTest++.sln new file mode 100644 index 0000000..9803357 --- /dev/null +++ b/vs_projects/vs2003_x86/UnitTest++.sln @@ -0,0 +1,42 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{F39EC7C8-6F40-4523-A955-D6E811D0FCDA}" + ProjectSection(ProjectDependencies) = postProject + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83} = {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + MinSizeRel = MinSizeRel + Release = Release + RelWithDebInfo = RelWithDebInfo + EndGlobalSection + GlobalSection(ProjectDependencies) = postSolution + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Debug.ActiveCfg = Debug|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Debug.Build.0 = Debug|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.MinSizeRel.ActiveCfg = MinSizeRel|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.MinSizeRel.Build.0 = MinSizeRel|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Release.ActiveCfg = Release|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Release.Build.0 = Release|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.RelWithDebInfo.ActiveCfg = RelWithDebInfo|Win32 + {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.RelWithDebInfo.Build.0 = RelWithDebInfo|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Debug.ActiveCfg = Debug|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Debug.Build.0 = Debug|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.MinSizeRel.ActiveCfg = MinSizeRel|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.MinSizeRel.Build.0 = MinSizeRel|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Release.ActiveCfg = Release|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Release.Build.0 = Release|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.RelWithDebInfo.ActiveCfg = RelWithDebInfo|Win32 + {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.RelWithDebInfo.Build.0 = RelWithDebInfo|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/vs_projects/vs2003_x86/UnitTest++.vcproj b/vs_projects/vs2003_x86/UnitTest++.vcproj new file mode 100644 index 0000000..652c742 --- /dev/null +++ b/vs_projects/vs2003_x86/UnitTest++.vcproj @@ -0,0 +1,373 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 6824ef6f6d7f20cb7c0d89a1f80e4be8b9212a75 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 02:14:44 -0500 Subject: [PATCH 049/184] Remove missed Visual Studio 2005 file. --- TestUnitTest++.vsnet2005.vcproj | 256 -------------------------------- 1 file changed, 256 deletions(-) delete mode 100644 TestUnitTest++.vsnet2005.vcproj diff --git a/TestUnitTest++.vsnet2005.vcproj b/TestUnitTest++.vsnet2005.vcproj deleted file mode 100644 index 79b7874..0000000 --- a/TestUnitTest++.vsnet2005.vcproj +++ /dev/null @@ -1,256 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From d761d7d7b8fafe182baf2f9643a57dfc97a07d2c Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sun, 24 Mar 2013 02:14:53 -0500 Subject: [PATCH 050/184] Remove old Visual Studio 2003 project files. --- TestUnitTest++.vsnet2003.vcproj | 174 ------------------------ UnitTest++.vsnet2003.sln | 30 ----- UnitTest++.vsnet2003.vcproj | 226 -------------------------------- 3 files changed, 430 deletions(-) delete mode 100644 TestUnitTest++.vsnet2003.vcproj delete mode 100644 UnitTest++.vsnet2003.sln delete mode 100644 UnitTest++.vsnet2003.vcproj diff --git a/TestUnitTest++.vsnet2003.vcproj b/TestUnitTest++.vsnet2003.vcproj deleted file mode 100644 index e596d80..0000000 --- a/TestUnitTest++.vsnet2003.vcproj +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/UnitTest++.vsnet2003.sln b/UnitTest++.vsnet2003.sln deleted file mode 100644 index 265d7ba..0000000 --- a/UnitTest++.vsnet2003.sln +++ /dev/null @@ -1,30 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++.vsnet2003", "UnitTest++.vsnet2003.vcproj", "{7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++.vsnet2003", "TestUnitTest++.vsnet2003.vcproj", "{ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}" - ProjectSection(ProjectDependencies) = postProject - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5} = {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Debug.ActiveCfg = Debug|Win32 - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Debug.Build.0 = Debug|Win32 - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Release.ActiveCfg = Release|Win32 - {7E5DD804-EC63-4FA5-BB6D-53DA86806EF5}.Release.Build.0 = Release|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Debug.ActiveCfg = Debug|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Debug.Build.0 = Debug|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Release.ActiveCfg = Release|Win32 - {ACDF9A6A-874F-49E5-AB7C-74F8150BB4C7}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/UnitTest++.vsnet2003.vcproj b/UnitTest++.vsnet2003.vcproj deleted file mode 100644 index 75c8f2e..0000000 --- a/UnitTest++.vsnet2003.vcproj +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From e90b9e5a63e305c7b3868a7bebff3a134eb7bae3 Mon Sep 17 00:00:00 2001 From: "Victor Lavaud (qdii)" Date: Fri, 29 Mar 2013 20:59:47 +0100 Subject: [PATCH 051/184] Fixed autotools --- Makefile.am | 2 +- UnitTest++/Makefile.am | 4 ++-- configure.ac | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1563f21..18f39ba 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,2 @@ EXTRA_DIST = docs -SUBDIRS = src +SUBDIRS = UnitTest++ diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index c38712e..32bf52b 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,9 +1,9 @@ lib_LTLIBRARIES = libUnitTest++.la pkgincludedir = $(includedir)/UnitTest++ nobase_pkginclude_HEADERS = UnitTest++.h Config.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h -libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp +libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp CompositeTestReporter.cpp libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ check_PROGRAMS = TestUnitTest++ -TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestChecks.cpp tests/TestUnitTest++.cpp tests/TestTest.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestCheckMacros.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestMemoryOutStream.cpp tests/TestDeferredTestReporter.cpp tests/TestXmlTestReporter.cpp tests/TestCurrentTest.cpp +TestUnitTest___SOURCES = $(top_srcdir)/tests/Main.cpp $(top_srcdir)/tests/TestAssertHandler.cpp $(top_srcdir)/tests/TestCheckMacros.cpp $(top_srcdir)/tests/TestChecks.cpp $(top_srcdir)/tests/TestCompositeTestReporter.cpp $(top_srcdir)/tests/TestCurrentTest.cpp $(top_srcdir)/tests/TestDeferredTestReporter.cpp $(top_srcdir)/tests/TestExceptions.cpp $(top_srcdir)/tests/TestMemoryOutStream.cpp $(top_srcdir)/tests/TestTest.cpp $(top_srcdir)/tests/TestTestList.cpp $(top_srcdir)/tests/TestTestMacros.cpp $(top_srcdir)/tests/TestTestResults.cpp $(top_srcdir)/tests/TestTestRunner.cpp $(top_srcdir)/tests/TestTestSuite.cpp $(top_srcdir)/tests/TestTimeConstraint.cpp $(top_srcdir)/tests/TestTimeConstraintMacro.cpp $(top_srcdir)/tests/TestUnitTestPP.cpp $(top_srcdir)/tests/TestXmlTestReporter.cpp TestUnitTest___LDADD = libUnitTest++.la TESTS = TestUnitTest++ diff --git a/configure.ac b/configure.ac index 88ab84c..64ebc93 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.69]) AC_INIT([UnitTest++], [1.4], [victor.lavaud@gmail.com]) -AC_CONFIG_SRCDIR([src/TestDetails.cpp]) +AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE() @@ -29,5 +29,5 @@ AC_TYPE_SIZE_T AC_CHECK_FUNCS([gettimeofday strstr]) AC_CONFIG_FILES([Makefile - src/Makefile]) + UnitTest++/Makefile]) AC_OUTPUT From 0e306b25db3adb9e935cd01dfed03fb179579b69 Mon Sep 17 00:00:00 2001 From: "Victor Lavaud (qdii)" Date: Fri, 29 Mar 2013 21:03:46 +0100 Subject: [PATCH 052/184] Added license (MIT) --- COPYING | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 COPYING diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..9c71e2a --- /dev/null +++ b/COPYING @@ -0,0 +1,25 @@ +Copyright (c) + +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. + +[Except as contained in this notice, the name of +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +from .] From d233fbc1768cacf289de3e0e113613933a104d69 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 10 Apr 2013 22:28:43 -0500 Subject: [PATCH 053/184] Remove COPYING inadvertently merged from #38 --- COPYING | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 COPYING diff --git a/COPYING b/COPYING deleted file mode 100644 index 9c71e2a..0000000 --- a/COPYING +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) - -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. - -[Except as contained in this notice, the name of -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -from .] From f9cfd92f8cef2e6f6786ee17d6561ecc4bc0211a Mon Sep 17 00:00:00 2001 From: Christopher Frederick Date: Thu, 18 Apr 2013 06:46:13 +0900 Subject: [PATCH 054/184] Add .gitignore for Xcode projects --- xcode_projects/.gitignore | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 xcode_projects/.gitignore diff --git a/xcode_projects/.gitignore b/xcode_projects/.gitignore new file mode 100644 index 0000000..aa64f28 --- /dev/null +++ b/xcode_projects/.gitignore @@ -0,0 +1,10 @@ +####################################### +# Temporary OS X files + +.DS_Store + +####################################### +# Personal XCode 4 settings + +xcuserdata +*.xcuserstate From 03503dbeb8a1f8fc6603b38c252f96d6d9d2c3ec Mon Sep 17 00:00:00 2001 From: Christopher Frederick Date: Thu, 18 Apr 2013 11:09:12 +0900 Subject: [PATCH 055/184] Add a new Xcode 4.6 project --- .../UnitTest++.xcodeproj/project.pbxproj | 202 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + 2 files changed, 209 insertions(+) create mode 100644 xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj create mode 100644 xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1075828 --- /dev/null +++ b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj @@ -0,0 +1,202 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXFileReference section */ + 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libUnitTest++.a"; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8347D76C171F8D1C00FE3FC1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 8347D766171F8D1C00FE3FC1 = { + isa = PBXGroup; + children = ( + 8347D770171F8D1C00FE3FC1 /* Products */, + ); + sourceTree = ""; + }; + 8347D770171F8D1C00FE3FC1 /* Products */ = { + isa = PBXGroup; + children = ( + 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8347D76D171F8D1C00FE3FC1 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8347D76E171F8D1C00FE3FC1 /* UnitTest++ */ = { + isa = PBXNativeTarget; + buildConfigurationList = 8347D773171F8D1C00FE3FC1 /* Build configuration list for PBXNativeTarget "UnitTest++" */; + buildPhases = ( + 8347D76B171F8D1C00FE3FC1 /* Sources */, + 8347D76C171F8D1C00FE3FC1 /* Frameworks */, + 8347D76D171F8D1C00FE3FC1 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "UnitTest++"; + productName = "UnitTest++"; + productReference = 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 8347D767171F8D1C00FE3FC1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0460; + ORGANIZATIONNAME = "UnitTest++"; + }; + buildConfigurationList = 8347D76A171F8D1C00FE3FC1 /* Build configuration list for PBXProject "UnitTest++" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 8347D766171F8D1C00FE3FC1; + productRefGroup = 8347D770171F8D1C00FE3FC1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8347D76E171F8D1C00FE3FC1 /* UnitTest++ */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 8347D76B171F8D1C00FE3FC1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 8347D771171F8D1C00FE3FC1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 8347D772171F8D1C00FE3FC1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + SDKROOT = macosx; + }; + name = Release; + }; + 8347D774171F8D1C00FE3FC1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + EXECUTABLE_PREFIX = lib; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 8347D775171F8D1C00FE3FC1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + EXECUTABLE_PREFIX = lib; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 8347D76A171F8D1C00FE3FC1 /* Build configuration list for PBXProject "UnitTest++" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8347D771171F8D1C00FE3FC1 /* Debug */, + 8347D772171F8D1C00FE3FC1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 8347D773171F8D1C00FE3FC1 /* Build configuration list for PBXNativeTarget "UnitTest++" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8347D774171F8D1C00FE3FC1 /* Debug */, + 8347D775171F8D1C00FE3FC1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 8347D767171F8D1C00FE3FC1 /* Project object */; +} diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..241816d --- /dev/null +++ b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + From c74f0cfb801fc6521a5d0ee92085d67c09503aa5 Mon Sep 17 00:00:00 2001 From: Christopher Frederick Date: Thu, 18 Apr 2013 11:26:42 +0900 Subject: [PATCH 056/184] Add UnitTest++ source to the project --- .../UnitTest++.xcodeproj/project.pbxproj | 217 ++++++++++++++++++ 1 file changed, 217 insertions(+) diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj index 1075828..51db5ab 100644 --- a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj +++ b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj @@ -6,8 +6,109 @@ objectVersion = 46; objects = { +/* Begin PBXBuildFile section */ + 83D5FCED171F910E005B0069 /* AssertException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCB5171F910E005B0069 /* AssertException.cpp */; }; + 83D5FCEE171F910E005B0069 /* AssertException.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCB6171F910E005B0069 /* AssertException.h */; }; + 83D5FCEF171F910E005B0069 /* CheckMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCB7171F910E005B0069 /* CheckMacros.h */; }; + 83D5FCF0171F910E005B0069 /* Checks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCB8171F910E005B0069 /* Checks.cpp */; }; + 83D5FCF1171F910E005B0069 /* Checks.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCB9171F910E005B0069 /* Checks.h */; }; + 83D5FCF2171F910E005B0069 /* CompositeTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCBA171F910E005B0069 /* CompositeTestReporter.cpp */; }; + 83D5FCF3171F910E005B0069 /* CompositeTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCBB171F910E005B0069 /* CompositeTestReporter.h */; }; + 83D5FCF4171F910E005B0069 /* Config.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCBC171F910E005B0069 /* Config.h */; }; + 83D5FCF5171F910E005B0069 /* CurrentTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCBD171F910E005B0069 /* CurrentTest.cpp */; }; + 83D5FCF6171F910E005B0069 /* CurrentTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCBE171F910E005B0069 /* CurrentTest.h */; }; + 83D5FCF7171F910E005B0069 /* DeferredTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCBF171F910E005B0069 /* DeferredTestReporter.cpp */; }; + 83D5FCF8171F910E005B0069 /* DeferredTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC0171F910E005B0069 /* DeferredTestReporter.h */; }; + 83D5FCF9171F910E005B0069 /* DeferredTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCC1171F910E005B0069 /* DeferredTestResult.cpp */; }; + 83D5FCFA171F910E005B0069 /* DeferredTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC2171F910E005B0069 /* DeferredTestResult.h */; }; + 83D5FCFB171F910E005B0069 /* ExceptionMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC3171F910E005B0069 /* ExceptionMacros.h */; }; + 83D5FCFC171F910E005B0069 /* ExecuteTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC4171F910E005B0069 /* ExecuteTest.h */; }; + 83D5FCFD171F910E005B0069 /* HelperMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC5171F910E005B0069 /* HelperMacros.h */; }; + 83D5FCFE171F910E005B0069 /* MemoryOutStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCC7171F910E005B0069 /* MemoryOutStream.cpp */; }; + 83D5FCFF171F910E005B0069 /* MemoryOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC8171F910E005B0069 /* MemoryOutStream.h */; }; + 83D5FD00171F910E005B0069 /* SignalTranslator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCCA171F910E005B0069 /* SignalTranslator.cpp */; }; + 83D5FD01171F910E005B0069 /* SignalTranslator.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCCB171F910E005B0069 /* SignalTranslator.h */; }; + 83D5FD02171F910E005B0069 /* TimeHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCCC171F910E005B0069 /* TimeHelpers.cpp */; }; + 83D5FD03171F910E005B0069 /* TimeHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCCD171F910E005B0069 /* TimeHelpers.h */; }; + 83D5FD04171F910E005B0069 /* ReportAssert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCCE171F910E005B0069 /* ReportAssert.cpp */; }; + 83D5FD05171F910E005B0069 /* ReportAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCCF171F910E005B0069 /* ReportAssert.h */; }; + 83D5FD06171F910E005B0069 /* ReportAssertImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD0171F910E005B0069 /* ReportAssertImpl.h */; }; + 83D5FD07171F910E005B0069 /* Test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD1171F910E005B0069 /* Test.cpp */; }; + 83D5FD08171F910E005B0069 /* Test.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD2171F910E005B0069 /* Test.h */; }; + 83D5FD09171F910E005B0069 /* TestDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD3171F910E005B0069 /* TestDetails.cpp */; }; + 83D5FD0A171F910E005B0069 /* TestDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD4171F910E005B0069 /* TestDetails.h */; }; + 83D5FD0B171F910E005B0069 /* TestList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD5171F910E005B0069 /* TestList.cpp */; }; + 83D5FD0C171F910E005B0069 /* TestList.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD6171F910E005B0069 /* TestList.h */; }; + 83D5FD0D171F910E005B0069 /* TestMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD7171F910E005B0069 /* TestMacros.h */; }; + 83D5FD0E171F910E005B0069 /* TestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD8171F910E005B0069 /* TestReporter.cpp */; }; + 83D5FD0F171F910E005B0069 /* TestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD9171F910E005B0069 /* TestReporter.h */; }; + 83D5FD10171F910E005B0069 /* TestReporterStdout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCDA171F910E005B0069 /* TestReporterStdout.cpp */; }; + 83D5FD11171F910E005B0069 /* TestReporterStdout.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCDB171F910E005B0069 /* TestReporterStdout.h */; }; + 83D5FD12171F910E005B0069 /* TestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCDC171F910E005B0069 /* TestResults.cpp */; }; + 83D5FD13171F910E005B0069 /* TestResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCDD171F910E005B0069 /* TestResults.h */; }; + 83D5FD14171F910E005B0069 /* TestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCDE171F910E005B0069 /* TestRunner.cpp */; }; + 83D5FD15171F910E005B0069 /* TestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCDF171F910E005B0069 /* TestRunner.h */; }; + 83D5FD16171F910E005B0069 /* TestSuite.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE0171F910E005B0069 /* TestSuite.h */; }; + 83D5FD17171F910E005B0069 /* TimeConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCE1171F910E005B0069 /* TimeConstraint.cpp */; }; + 83D5FD18171F910E005B0069 /* TimeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE2171F910E005B0069 /* TimeConstraint.h */; }; + 83D5FD19171F910E005B0069 /* TimeHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE3171F910E005B0069 /* TimeHelpers.h */; }; + 83D5FD1A171F910E005B0069 /* UnitTest++.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE4171F910E005B0069 /* UnitTest++.h */; }; + 83D5FD1B171F910E005B0069 /* UnitTestPP.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE5171F910E005B0069 /* UnitTestPP.h */; }; + 83D5FD1E171F910E005B0069 /* XmlTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */; }; + 83D5FD1F171F910E005B0069 /* XmlTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */; }; +/* End PBXBuildFile section */ + /* Begin PBXFileReference section */ 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libUnitTest++.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 83D5FCB5171F910E005B0069 /* AssertException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AssertException.cpp; sourceTree = ""; }; + 83D5FCB6171F910E005B0069 /* AssertException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssertException.h; sourceTree = ""; }; + 83D5FCB7171F910E005B0069 /* CheckMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckMacros.h; sourceTree = ""; }; + 83D5FCB8171F910E005B0069 /* Checks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Checks.cpp; sourceTree = ""; }; + 83D5FCB9171F910E005B0069 /* Checks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Checks.h; sourceTree = ""; }; + 83D5FCBA171F910E005B0069 /* CompositeTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompositeTestReporter.cpp; sourceTree = ""; }; + 83D5FCBB171F910E005B0069 /* CompositeTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompositeTestReporter.h; sourceTree = ""; }; + 83D5FCBC171F910E005B0069 /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = ""; }; + 83D5FCBD171F910E005B0069 /* CurrentTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurrentTest.cpp; sourceTree = ""; }; + 83D5FCBE171F910E005B0069 /* CurrentTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurrentTest.h; sourceTree = ""; }; + 83D5FCBF171F910E005B0069 /* DeferredTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeferredTestReporter.cpp; sourceTree = ""; }; + 83D5FCC0171F910E005B0069 /* DeferredTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeferredTestReporter.h; sourceTree = ""; }; + 83D5FCC1171F910E005B0069 /* DeferredTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeferredTestResult.cpp; sourceTree = ""; }; + 83D5FCC2171F910E005B0069 /* DeferredTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeferredTestResult.h; sourceTree = ""; }; + 83D5FCC3171F910E005B0069 /* ExceptionMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionMacros.h; sourceTree = ""; }; + 83D5FCC4171F910E005B0069 /* ExecuteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecuteTest.h; sourceTree = ""; }; + 83D5FCC5171F910E005B0069 /* HelperMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelperMacros.h; sourceTree = ""; }; + 83D5FCC7171F910E005B0069 /* MemoryOutStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryOutStream.cpp; sourceTree = ""; }; + 83D5FCC8171F910E005B0069 /* MemoryOutStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryOutStream.h; sourceTree = ""; }; + 83D5FCCA171F910E005B0069 /* SignalTranslator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SignalTranslator.cpp; sourceTree = ""; }; + 83D5FCCB171F910E005B0069 /* SignalTranslator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalTranslator.h; sourceTree = ""; }; + 83D5FCCC171F910E005B0069 /* TimeHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeHelpers.cpp; sourceTree = ""; }; + 83D5FCCD171F910E005B0069 /* TimeHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeHelpers.h; sourceTree = ""; }; + 83D5FCCE171F910E005B0069 /* ReportAssert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReportAssert.cpp; sourceTree = ""; }; + 83D5FCCF171F910E005B0069 /* ReportAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportAssert.h; sourceTree = ""; }; + 83D5FCD0171F910E005B0069 /* ReportAssertImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportAssertImpl.h; sourceTree = ""; }; + 83D5FCD1171F910E005B0069 /* Test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Test.cpp; sourceTree = ""; }; + 83D5FCD2171F910E005B0069 /* Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test.h; sourceTree = ""; }; + 83D5FCD3171F910E005B0069 /* TestDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestDetails.cpp; sourceTree = ""; }; + 83D5FCD4171F910E005B0069 /* TestDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestDetails.h; sourceTree = ""; }; + 83D5FCD5171F910E005B0069 /* TestList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestList.cpp; sourceTree = ""; }; + 83D5FCD6171F910E005B0069 /* TestList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestList.h; sourceTree = ""; }; + 83D5FCD7171F910E005B0069 /* TestMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMacros.h; sourceTree = ""; }; + 83D5FCD8171F910E005B0069 /* TestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestReporter.cpp; sourceTree = ""; }; + 83D5FCD9171F910E005B0069 /* TestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestReporter.h; sourceTree = ""; }; + 83D5FCDA171F910E005B0069 /* TestReporterStdout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestReporterStdout.cpp; sourceTree = ""; }; + 83D5FCDB171F910E005B0069 /* TestReporterStdout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestReporterStdout.h; sourceTree = ""; }; + 83D5FCDC171F910E005B0069 /* TestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestResults.cpp; sourceTree = ""; }; + 83D5FCDD171F910E005B0069 /* TestResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestResults.h; sourceTree = ""; }; + 83D5FCDE171F910E005B0069 /* TestRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRunner.cpp; sourceTree = ""; }; + 83D5FCDF171F910E005B0069 /* TestRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestRunner.h; sourceTree = ""; }; + 83D5FCE0171F910E005B0069 /* TestSuite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSuite.h; sourceTree = ""; }; + 83D5FCE1171F910E005B0069 /* TimeConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeConstraint.cpp; sourceTree = ""; }; + 83D5FCE2171F910E005B0069 /* TimeConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeConstraint.h; sourceTree = ""; }; + 83D5FCE3171F910E005B0069 /* TimeHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeHelpers.h; sourceTree = ""; }; + 83D5FCE4171F910E005B0069 /* UnitTest++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UnitTest++.h"; sourceTree = ""; }; + 83D5FCE5171F910E005B0069 /* UnitTestPP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitTestPP.h; sourceTree = ""; }; + 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlTestReporter.cpp; sourceTree = ""; }; + 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlTestReporter.h; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -24,6 +125,7 @@ 8347D766171F8D1C00FE3FC1 = { isa = PBXGroup; children = ( + 83D5FCB4171F910E005B0069 /* UnitTest++ */, 8347D770171F8D1C00FE3FC1 /* Products */, ); sourceTree = ""; @@ -36,6 +138,71 @@ name = Products; sourceTree = ""; }; + 83D5FCB4171F910E005B0069 /* UnitTest++ */ = { + isa = PBXGroup; + children = ( + 83D5FCB5171F910E005B0069 /* AssertException.cpp */, + 83D5FCB6171F910E005B0069 /* AssertException.h */, + 83D5FCB7171F910E005B0069 /* CheckMacros.h */, + 83D5FCB8171F910E005B0069 /* Checks.cpp */, + 83D5FCB9171F910E005B0069 /* Checks.h */, + 83D5FCBA171F910E005B0069 /* CompositeTestReporter.cpp */, + 83D5FCBB171F910E005B0069 /* CompositeTestReporter.h */, + 83D5FCBC171F910E005B0069 /* Config.h */, + 83D5FCBD171F910E005B0069 /* CurrentTest.cpp */, + 83D5FCBE171F910E005B0069 /* CurrentTest.h */, + 83D5FCBF171F910E005B0069 /* DeferredTestReporter.cpp */, + 83D5FCC0171F910E005B0069 /* DeferredTestReporter.h */, + 83D5FCC1171F910E005B0069 /* DeferredTestResult.cpp */, + 83D5FCC2171F910E005B0069 /* DeferredTestResult.h */, + 83D5FCC3171F910E005B0069 /* ExceptionMacros.h */, + 83D5FCC4171F910E005B0069 /* ExecuteTest.h */, + 83D5FCC5171F910E005B0069 /* HelperMacros.h */, + 83D5FCC7171F910E005B0069 /* MemoryOutStream.cpp */, + 83D5FCC8171F910E005B0069 /* MemoryOutStream.h */, + 83D5FCC9171F910E005B0069 /* Posix */, + 83D5FCCE171F910E005B0069 /* ReportAssert.cpp */, + 83D5FCCF171F910E005B0069 /* ReportAssert.h */, + 83D5FCD0171F910E005B0069 /* ReportAssertImpl.h */, + 83D5FCD1171F910E005B0069 /* Test.cpp */, + 83D5FCD2171F910E005B0069 /* Test.h */, + 83D5FCD3171F910E005B0069 /* TestDetails.cpp */, + 83D5FCD4171F910E005B0069 /* TestDetails.h */, + 83D5FCD5171F910E005B0069 /* TestList.cpp */, + 83D5FCD6171F910E005B0069 /* TestList.h */, + 83D5FCD7171F910E005B0069 /* TestMacros.h */, + 83D5FCD8171F910E005B0069 /* TestReporter.cpp */, + 83D5FCD9171F910E005B0069 /* TestReporter.h */, + 83D5FCDA171F910E005B0069 /* TestReporterStdout.cpp */, + 83D5FCDB171F910E005B0069 /* TestReporterStdout.h */, + 83D5FCDC171F910E005B0069 /* TestResults.cpp */, + 83D5FCDD171F910E005B0069 /* TestResults.h */, + 83D5FCDE171F910E005B0069 /* TestRunner.cpp */, + 83D5FCDF171F910E005B0069 /* TestRunner.h */, + 83D5FCE0171F910E005B0069 /* TestSuite.h */, + 83D5FCE1171F910E005B0069 /* TimeConstraint.cpp */, + 83D5FCE2171F910E005B0069 /* TimeConstraint.h */, + 83D5FCE3171F910E005B0069 /* TimeHelpers.h */, + 83D5FCE4171F910E005B0069 /* UnitTest++.h */, + 83D5FCE5171F910E005B0069 /* UnitTestPP.h */, + 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */, + 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */, + ); + name = "UnitTest++"; + path = "../../UnitTest++"; + sourceTree = ""; + }; + 83D5FCC9171F910E005B0069 /* Posix */ = { + isa = PBXGroup; + children = ( + 83D5FCCA171F910E005B0069 /* SignalTranslator.cpp */, + 83D5FCCB171F910E005B0069 /* SignalTranslator.h */, + 83D5FCCC171F910E005B0069 /* TimeHelpers.cpp */, + 83D5FCCD171F910E005B0069 /* TimeHelpers.h */, + ); + path = Posix; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -43,6 +210,36 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + 83D5FCEE171F910E005B0069 /* AssertException.h in Headers */, + 83D5FCEF171F910E005B0069 /* CheckMacros.h in Headers */, + 83D5FCF1171F910E005B0069 /* Checks.h in Headers */, + 83D5FCF3171F910E005B0069 /* CompositeTestReporter.h in Headers */, + 83D5FCF4171F910E005B0069 /* Config.h in Headers */, + 83D5FCF6171F910E005B0069 /* CurrentTest.h in Headers */, + 83D5FCF8171F910E005B0069 /* DeferredTestReporter.h in Headers */, + 83D5FCFA171F910E005B0069 /* DeferredTestResult.h in Headers */, + 83D5FCFB171F910E005B0069 /* ExceptionMacros.h in Headers */, + 83D5FCFC171F910E005B0069 /* ExecuteTest.h in Headers */, + 83D5FCFD171F910E005B0069 /* HelperMacros.h in Headers */, + 83D5FCFF171F910E005B0069 /* MemoryOutStream.h in Headers */, + 83D5FD01171F910E005B0069 /* SignalTranslator.h in Headers */, + 83D5FD03171F910E005B0069 /* TimeHelpers.h in Headers */, + 83D5FD05171F910E005B0069 /* ReportAssert.h in Headers */, + 83D5FD06171F910E005B0069 /* ReportAssertImpl.h in Headers */, + 83D5FD08171F910E005B0069 /* Test.h in Headers */, + 83D5FD0A171F910E005B0069 /* TestDetails.h in Headers */, + 83D5FD0C171F910E005B0069 /* TestList.h in Headers */, + 83D5FD0D171F910E005B0069 /* TestMacros.h in Headers */, + 83D5FD0F171F910E005B0069 /* TestReporter.h in Headers */, + 83D5FD11171F910E005B0069 /* TestReporterStdout.h in Headers */, + 83D5FD13171F910E005B0069 /* TestResults.h in Headers */, + 83D5FD15171F910E005B0069 /* TestRunner.h in Headers */, + 83D5FD16171F910E005B0069 /* TestSuite.h in Headers */, + 83D5FD18171F910E005B0069 /* TimeConstraint.h in Headers */, + 83D5FD19171F910E005B0069 /* TimeHelpers.h in Headers */, + 83D5FD1A171F910E005B0069 /* UnitTest++.h in Headers */, + 83D5FD1B171F910E005B0069 /* UnitTestPP.h in Headers */, + 83D5FD1F171F910E005B0069 /* XmlTestReporter.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -97,6 +294,25 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 83D5FCED171F910E005B0069 /* AssertException.cpp in Sources */, + 83D5FCF0171F910E005B0069 /* Checks.cpp in Sources */, + 83D5FCF2171F910E005B0069 /* CompositeTestReporter.cpp in Sources */, + 83D5FCF5171F910E005B0069 /* CurrentTest.cpp in Sources */, + 83D5FCF7171F910E005B0069 /* DeferredTestReporter.cpp in Sources */, + 83D5FCF9171F910E005B0069 /* DeferredTestResult.cpp in Sources */, + 83D5FCFE171F910E005B0069 /* MemoryOutStream.cpp in Sources */, + 83D5FD00171F910E005B0069 /* SignalTranslator.cpp in Sources */, + 83D5FD02171F910E005B0069 /* TimeHelpers.cpp in Sources */, + 83D5FD04171F910E005B0069 /* ReportAssert.cpp in Sources */, + 83D5FD07171F910E005B0069 /* Test.cpp in Sources */, + 83D5FD09171F910E005B0069 /* TestDetails.cpp in Sources */, + 83D5FD0B171F910E005B0069 /* TestList.cpp in Sources */, + 83D5FD0E171F910E005B0069 /* TestReporter.cpp in Sources */, + 83D5FD10171F910E005B0069 /* TestReporterStdout.cpp in Sources */, + 83D5FD12171F910E005B0069 /* TestResults.cpp in Sources */, + 83D5FD14171F910E005B0069 /* TestRunner.cpp in Sources */, + 83D5FD17171F910E005B0069 /* TimeConstraint.cpp in Sources */, + 83D5FD1E171F910E005B0069 /* XmlTestReporter.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -195,6 +411,7 @@ 8347D775171F8D1C00FE3FC1 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; From 532914d9b58e7996ac4d39835b99e7f195eaf31b Mon Sep 17 00:00:00 2001 From: Christopher Frederick Date: Thu, 18 Apr 2013 11:28:43 +0900 Subject: [PATCH 057/184] Add a target for TestUnitTest++ TestUnitTest++ is a command-line tool. --- .../xcode4-6/TestUnitTest++/TestUnitTest__.1 | 79 +++++++++++++++++ .../xcode4-6/TestUnitTest++/main.cpp | 18 ++++ .../UnitTest++.xcodeproj/project.pbxproj | 84 +++++++++++++++++++ 3 files changed, 181 insertions(+) create mode 100644 xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 create mode 100644 xcode_projects/xcode4-6/TestUnitTest++/main.cpp diff --git a/xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 b/xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 new file mode 100644 index 0000000..1931763 --- /dev/null +++ b/xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 @@ -0,0 +1,79 @@ +.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. +.\"See Also: +.\"man mdoc.samples for a complete listing of options +.\"man mdoc for the short list of editing options +.\"/usr/share/misc/mdoc.template +.Dd 2013/04/18 \" DATE +.Dt TestUnitTest++ 1 \" Program name and manual section number +.Os Darwin +.Sh NAME \" Section Header - required - don't modify +.Nm TestUnitTest++, +.\" The following lines are read in generating the apropos(man -k) database. Use only key +.\" words here as the database is built based on the words here and in the .ND line. +.Nm Other_name_for_same_program(), +.Nm Yet another name for the same program. +.\" Use .Nm macro to designate other names for the documented program. +.Nd This line parsed for whatis database. +.Sh SYNOPSIS \" Section Header - required - don't modify +.Nm +.Op Fl abcd \" [-abcd] +.Op Fl a Ar path \" [-a path] +.Op Ar file \" [file] +.Op Ar \" [file ...] +.Ar arg0 \" Underlined argument - use .Ar anywhere to underline +arg2 ... \" Arguments +.Sh DESCRIPTION \" Section Header - required - don't modify +Use the .Nm macro to refer to your program throughout the man page like such: +.Nm +Underlining is accomplished with the .Ar macro like this: +.Ar underlined text . +.Pp \" Inserts a space +A list of items with descriptions: +.Bl -tag -width -indent \" Begins a tagged list +.It item a \" Each item preceded by .It macro +Description of item a +.It item b +Description of item b +.El \" Ends the list +.Pp +A list of flags and their descriptions: +.Bl -tag -width -indent \" Differs from above in tag removed +.It Fl a \"-a flag as a list item +Description of -a flag +.It Fl b +Description of -b flag +.El \" Ends the list +.Pp +.\" .Sh ENVIRONMENT \" May not be needed +.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 +.\" .It Ev ENV_VAR_1 +.\" Description of ENV_VAR_1 +.\" .It Ev ENV_VAR_2 +.\" Description of ENV_VAR_2 +.\" .El +.Sh FILES \" File used or created by the topic of the man page +.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact +.It Pa /usr/share/file_name +FILE_1 description +.It Pa /Users/joeuser/Library/really_long_file_name +FILE_2 description +.El \" Ends the list +.\" .Sh DIAGNOSTICS \" May not be needed +.\" .Bl -diag +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .It Diagnostic Tag +.\" Diagnostic informtion here. +.\" .El +.Sh SEE ALSO +.\" List links in ascending order by section, alphabetically within a section. +.\" Please do not reference files that do not exist without filing a bug report +.Xr a 1 , +.Xr b 1 , +.Xr c 1 , +.Xr a 2 , +.Xr b 2 , +.Xr a 3 , +.Xr b 3 +.\" .Sh BUGS \" Document known, unremedied bugs +.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/xcode_projects/xcode4-6/TestUnitTest++/main.cpp b/xcode_projects/xcode4-6/TestUnitTest++/main.cpp new file mode 100644 index 0000000..81cc522 --- /dev/null +++ b/xcode_projects/xcode4-6/TestUnitTest++/main.cpp @@ -0,0 +1,18 @@ +// +// main.cpp +// TestUnitTest++ +// +// Created by Christopher Frederick on 2013/04/18. +// Copyright (c) 2013 UnitTest++. All rights reserved. +// + +#include + +int main(int argc, const char * argv[]) +{ + + // insert code here... + std::cout << "Hello, World!\n"; + return 0; +} + diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj index 51db5ab..30461b1 100644 --- a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj +++ b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj @@ -56,8 +56,23 @@ 83D5FD1B171F910E005B0069 /* UnitTestPP.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE5171F910E005B0069 /* UnitTestPP.h */; }; 83D5FD1E171F910E005B0069 /* XmlTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */; }; 83D5FD1F171F910E005B0069 /* XmlTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */; }; + 83D5FD27171F91B7005B0069 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD26171F91B7005B0069 /* main.cpp */; }; + 83D5FD29171F91B7005B0069 /* TestUnitTest__.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83D5FD28171F91B7005B0069 /* TestUnitTest__.1 */; }; /* End PBXBuildFile section */ +/* Begin PBXCopyFilesBuildPhase section */ + 83D5FD22171F91B6005B0069 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + 83D5FD29171F91B7005B0069 /* TestUnitTest__.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libUnitTest++.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 83D5FCB5171F910E005B0069 /* AssertException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AssertException.cpp; sourceTree = ""; }; @@ -109,6 +124,9 @@ 83D5FCE5171F910E005B0069 /* UnitTestPP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitTestPP.h; sourceTree = ""; }; 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlTestReporter.cpp; sourceTree = ""; }; 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlTestReporter.h; sourceTree = ""; }; + 83D5FD24171F91B7005B0069 /* TestUnitTest++ */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "TestUnitTest++"; sourceTree = BUILT_PRODUCTS_DIR; }; + 83D5FD26171F91B7005B0069 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + 83D5FD28171F91B7005B0069 /* TestUnitTest__.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = TestUnitTest__.1; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -119,6 +137,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 83D5FD21171F91B6005B0069 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -126,6 +151,7 @@ isa = PBXGroup; children = ( 83D5FCB4171F910E005B0069 /* UnitTest++ */, + 83D5FD25171F91B7005B0069 /* TestUnitTest++ */, 8347D770171F8D1C00FE3FC1 /* Products */, ); sourceTree = ""; @@ -134,6 +160,7 @@ isa = PBXGroup; children = ( 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */, + 83D5FD24171F91B7005B0069 /* TestUnitTest++ */, ); name = Products; sourceTree = ""; @@ -203,6 +230,15 @@ path = Posix; sourceTree = ""; }; + 83D5FD25171F91B7005B0069 /* TestUnitTest++ */ = { + isa = PBXGroup; + children = ( + 83D5FD26171F91B7005B0069 /* main.cpp */, + 83D5FD28171F91B7005B0069 /* TestUnitTest__.1 */, + ); + path = "TestUnitTest++"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -263,6 +299,23 @@ productReference = 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */; productType = "com.apple.product-type.library.static"; }; + 83D5FD23171F91B6005B0069 /* TestUnitTest++ */ = { + isa = PBXNativeTarget; + buildConfigurationList = 83D5FD2A171F91B7005B0069 /* Build configuration list for PBXNativeTarget "TestUnitTest++" */; + buildPhases = ( + 83D5FD20171F91B6005B0069 /* Sources */, + 83D5FD21171F91B6005B0069 /* Frameworks */, + 83D5FD22171F91B6005B0069 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "TestUnitTest++"; + productName = "TestUnitTest++"; + productReference = 83D5FD24171F91B7005B0069 /* TestUnitTest++ */; + productType = "com.apple.product-type.tool"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -285,6 +338,7 @@ projectRoot = ""; targets = ( 8347D76E171F8D1C00FE3FC1 /* UnitTest++ */, + 83D5FD23171F91B6005B0069 /* TestUnitTest++ */, ); }; /* End PBXProject section */ @@ -316,6 +370,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 83D5FD20171F91B6005B0069 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 83D5FD27171F91B7005B0069 /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -392,6 +454,20 @@ }; name = Release; }; + 83D5FD2B171F91B7005B0069 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 83D5FD2C171F91B7005B0069 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -413,6 +489,14 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 83D5FD2A171F91B7005B0069 /* Build configuration list for PBXNativeTarget "TestUnitTest++" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 83D5FD2B171F91B7005B0069 /* Debug */, + 83D5FD2C171F91B7005B0069 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; /* End XCConfigurationList section */ }; rootObject = 8347D767171F8D1C00FE3FC1 /* Project object */; From c3e4f2b8cb6a68462605142616ddc5a72696e7c4 Mon Sep 17 00:00:00 2001 From: Christopher Frederick Date: Thu, 18 Apr 2013 11:41:49 +0900 Subject: [PATCH 058/184] Update TestUnitTest++ to use existing code - Add files from the tests directory - Add $(SRCROOT)/../../ to the include paths - Link to libUnitTest++.a - Remove the TestUnitTest++ group (with main.cpp and TestUnitTest__.1) that was automatically generated by Xcode --- .../xcode4-6/TestUnitTest++/TestUnitTest__.1 | 79 --------------- .../xcode4-6/TestUnitTest++/main.cpp | 18 ---- .../UnitTest++.xcodeproj/project.pbxproj | 99 ++++++++++++++++--- 3 files changed, 88 insertions(+), 108 deletions(-) delete mode 100644 xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 delete mode 100644 xcode_projects/xcode4-6/TestUnitTest++/main.cpp diff --git a/xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 b/xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 deleted file mode 100644 index 1931763..0000000 --- a/xcode_projects/xcode4-6/TestUnitTest++/TestUnitTest__.1 +++ /dev/null @@ -1,79 +0,0 @@ -.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. -.\"See Also: -.\"man mdoc.samples for a complete listing of options -.\"man mdoc for the short list of editing options -.\"/usr/share/misc/mdoc.template -.Dd 2013/04/18 \" DATE -.Dt TestUnitTest++ 1 \" Program name and manual section number -.Os Darwin -.Sh NAME \" Section Header - required - don't modify -.Nm TestUnitTest++, -.\" The following lines are read in generating the apropos(man -k) database. Use only key -.\" words here as the database is built based on the words here and in the .ND line. -.Nm Other_name_for_same_program(), -.Nm Yet another name for the same program. -.\" Use .Nm macro to designate other names for the documented program. -.Nd This line parsed for whatis database. -.Sh SYNOPSIS \" Section Header - required - don't modify -.Nm -.Op Fl abcd \" [-abcd] -.Op Fl a Ar path \" [-a path] -.Op Ar file \" [file] -.Op Ar \" [file ...] -.Ar arg0 \" Underlined argument - use .Ar anywhere to underline -arg2 ... \" Arguments -.Sh DESCRIPTION \" Section Header - required - don't modify -Use the .Nm macro to refer to your program throughout the man page like such: -.Nm -Underlining is accomplished with the .Ar macro like this: -.Ar underlined text . -.Pp \" Inserts a space -A list of items with descriptions: -.Bl -tag -width -indent \" Begins a tagged list -.It item a \" Each item preceded by .It macro -Description of item a -.It item b -Description of item b -.El \" Ends the list -.Pp -A list of flags and their descriptions: -.Bl -tag -width -indent \" Differs from above in tag removed -.It Fl a \"-a flag as a list item -Description of -a flag -.It Fl b -Description of -b flag -.El \" Ends the list -.Pp -.\" .Sh ENVIRONMENT \" May not be needed -.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 -.\" .It Ev ENV_VAR_1 -.\" Description of ENV_VAR_1 -.\" .It Ev ENV_VAR_2 -.\" Description of ENV_VAR_2 -.\" .El -.Sh FILES \" File used or created by the topic of the man page -.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact -.It Pa /usr/share/file_name -FILE_1 description -.It Pa /Users/joeuser/Library/really_long_file_name -FILE_2 description -.El \" Ends the list -.\" .Sh DIAGNOSTICS \" May not be needed -.\" .Bl -diag -.\" .It Diagnostic Tag -.\" Diagnostic informtion here. -.\" .It Diagnostic Tag -.\" Diagnostic informtion here. -.\" .El -.Sh SEE ALSO -.\" List links in ascending order by section, alphabetically within a section. -.\" Please do not reference files that do not exist without filing a bug report -.Xr a 1 , -.Xr b 1 , -.Xr c 1 , -.Xr a 2 , -.Xr b 2 , -.Xr a 3 , -.Xr b 3 -.\" .Sh BUGS \" Document known, unremedied bugs -.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/xcode_projects/xcode4-6/TestUnitTest++/main.cpp b/xcode_projects/xcode4-6/TestUnitTest++/main.cpp deleted file mode 100644 index 81cc522..0000000 --- a/xcode_projects/xcode4-6/TestUnitTest++/main.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.cpp -// TestUnitTest++ -// -// Created by Christopher Frederick on 2013/04/18. -// Copyright (c) 2013 UnitTest++. All rights reserved. -// - -#include - -int main(int argc, const char * argv[]) -{ - - // insert code here... - std::cout << "Hello, World!\n"; - return 0; -} - diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj index 30461b1..2a06528 100644 --- a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj +++ b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj @@ -56,8 +56,26 @@ 83D5FD1B171F910E005B0069 /* UnitTestPP.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE5171F910E005B0069 /* UnitTestPP.h */; }; 83D5FD1E171F910E005B0069 /* XmlTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */; }; 83D5FD1F171F910E005B0069 /* XmlTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */; }; - 83D5FD27171F91B7005B0069 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD26171F91B7005B0069 /* main.cpp */; }; - 83D5FD29171F91B7005B0069 /* TestUnitTest__.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 83D5FD28171F91B7005B0069 /* TestUnitTest__.1 */; }; + 83D5FD45171F9218005B0069 /* Main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD2E171F9218005B0069 /* Main.cpp */; }; + 83D5FD46171F9218005B0069 /* TestAssertHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD33171F9218005B0069 /* TestAssertHandler.cpp */; }; + 83D5FD47171F9218005B0069 /* TestCheckMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD34171F9218005B0069 /* TestCheckMacros.cpp */; }; + 83D5FD48171F9218005B0069 /* TestChecks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD35171F9218005B0069 /* TestChecks.cpp */; }; + 83D5FD49171F9218005B0069 /* TestCompositeTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD36171F9218005B0069 /* TestCompositeTestReporter.cpp */; }; + 83D5FD4A171F9218005B0069 /* TestCurrentTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD37171F9218005B0069 /* TestCurrentTest.cpp */; }; + 83D5FD4B171F9218005B0069 /* TestDeferredTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD38171F9218005B0069 /* TestDeferredTestReporter.cpp */; }; + 83D5FD4C171F9218005B0069 /* TestExceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD39171F9218005B0069 /* TestExceptions.cpp */; }; + 83D5FD4D171F9218005B0069 /* TestMemoryOutStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3A171F9218005B0069 /* TestMemoryOutStream.cpp */; }; + 83D5FD4E171F9218005B0069 /* TestTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3B171F9218005B0069 /* TestTest.cpp */; }; + 83D5FD4F171F9218005B0069 /* TestTestList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3C171F9218005B0069 /* TestTestList.cpp */; }; + 83D5FD50171F9218005B0069 /* TestTestMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3D171F9218005B0069 /* TestTestMacros.cpp */; }; + 83D5FD51171F9218005B0069 /* TestTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3E171F9218005B0069 /* TestTestResults.cpp */; }; + 83D5FD52171F9218005B0069 /* TestTestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3F171F9218005B0069 /* TestTestRunner.cpp */; }; + 83D5FD53171F9218005B0069 /* TestTestSuite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD40171F9218005B0069 /* TestTestSuite.cpp */; }; + 83D5FD54171F9218005B0069 /* TestTimeConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD41171F9218005B0069 /* TestTimeConstraint.cpp */; }; + 83D5FD55171F9218005B0069 /* TestTimeConstraintMacro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD42171F9218005B0069 /* TestTimeConstraintMacro.cpp */; }; + 83D5FD56171F9218005B0069 /* TestUnitTestPP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD43171F9218005B0069 /* TestUnitTestPP.cpp */; }; + 83D5FD57171F9218005B0069 /* TestXmlTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD44171F9218005B0069 /* TestXmlTestReporter.cpp */; }; + 83D5FD58171F9494005B0069 /* libUnitTest++.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -67,7 +85,6 @@ dstPath = /usr/share/man/man1/; dstSubfolderSpec = 0; files = ( - 83D5FD29171F91B7005B0069 /* TestUnitTest__.1 in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 1; }; @@ -125,8 +142,27 @@ 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlTestReporter.cpp; sourceTree = ""; }; 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlTestReporter.h; sourceTree = ""; }; 83D5FD24171F91B7005B0069 /* TestUnitTest++ */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "TestUnitTest++"; sourceTree = BUILT_PRODUCTS_DIR; }; - 83D5FD26171F91B7005B0069 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; - 83D5FD28171F91B7005B0069 /* TestUnitTest__.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = TestUnitTest__.1; sourceTree = ""; }; + 83D5FD2E171F9218005B0069 /* Main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Main.cpp; sourceTree = ""; }; + 83D5FD2F171F9218005B0069 /* RecordingReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordingReporter.h; sourceTree = ""; }; + 83D5FD30171F9218005B0069 /* ScopedCurrentTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedCurrentTest.h; sourceTree = ""; }; + 83D5FD33171F9218005B0069 /* TestAssertHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestAssertHandler.cpp; sourceTree = ""; }; + 83D5FD34171F9218005B0069 /* TestCheckMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCheckMacros.cpp; sourceTree = ""; }; + 83D5FD35171F9218005B0069 /* TestChecks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestChecks.cpp; sourceTree = ""; }; + 83D5FD36171F9218005B0069 /* TestCompositeTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCompositeTestReporter.cpp; sourceTree = ""; }; + 83D5FD37171F9218005B0069 /* TestCurrentTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCurrentTest.cpp; sourceTree = ""; }; + 83D5FD38171F9218005B0069 /* TestDeferredTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestDeferredTestReporter.cpp; sourceTree = ""; }; + 83D5FD39171F9218005B0069 /* TestExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestExceptions.cpp; sourceTree = ""; }; + 83D5FD3A171F9218005B0069 /* TestMemoryOutStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMemoryOutStream.cpp; sourceTree = ""; }; + 83D5FD3B171F9218005B0069 /* TestTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTest.cpp; sourceTree = ""; }; + 83D5FD3C171F9218005B0069 /* TestTestList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestList.cpp; sourceTree = ""; }; + 83D5FD3D171F9218005B0069 /* TestTestMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestMacros.cpp; sourceTree = ""; }; + 83D5FD3E171F9218005B0069 /* TestTestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestResults.cpp; sourceTree = ""; }; + 83D5FD3F171F9218005B0069 /* TestTestRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestRunner.cpp; sourceTree = ""; }; + 83D5FD40171F9218005B0069 /* TestTestSuite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestSuite.cpp; sourceTree = ""; }; + 83D5FD41171F9218005B0069 /* TestTimeConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTimeConstraint.cpp; sourceTree = ""; }; + 83D5FD42171F9218005B0069 /* TestTimeConstraintMacro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTimeConstraintMacro.cpp; sourceTree = ""; }; + 83D5FD43171F9218005B0069 /* TestUnitTestPP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestUnitTestPP.cpp; sourceTree = ""; }; + 83D5FD44171F9218005B0069 /* TestXmlTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestXmlTestReporter.cpp; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -141,6 +177,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 83D5FD58171F9494005B0069 /* libUnitTest++.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -151,7 +188,7 @@ isa = PBXGroup; children = ( 83D5FCB4171F910E005B0069 /* UnitTest++ */, - 83D5FD25171F91B7005B0069 /* TestUnitTest++ */, + 83D5FD2D171F9218005B0069 /* tests */, 8347D770171F8D1C00FE3FC1 /* Products */, ); sourceTree = ""; @@ -230,13 +267,33 @@ path = Posix; sourceTree = ""; }; - 83D5FD25171F91B7005B0069 /* TestUnitTest++ */ = { + 83D5FD2D171F9218005B0069 /* tests */ = { isa = PBXGroup; children = ( - 83D5FD26171F91B7005B0069 /* main.cpp */, - 83D5FD28171F91B7005B0069 /* TestUnitTest__.1 */, + 83D5FD2E171F9218005B0069 /* Main.cpp */, + 83D5FD2F171F9218005B0069 /* RecordingReporter.h */, + 83D5FD30171F9218005B0069 /* ScopedCurrentTest.h */, + 83D5FD33171F9218005B0069 /* TestAssertHandler.cpp */, + 83D5FD34171F9218005B0069 /* TestCheckMacros.cpp */, + 83D5FD35171F9218005B0069 /* TestChecks.cpp */, + 83D5FD36171F9218005B0069 /* TestCompositeTestReporter.cpp */, + 83D5FD37171F9218005B0069 /* TestCurrentTest.cpp */, + 83D5FD38171F9218005B0069 /* TestDeferredTestReporter.cpp */, + 83D5FD39171F9218005B0069 /* TestExceptions.cpp */, + 83D5FD3A171F9218005B0069 /* TestMemoryOutStream.cpp */, + 83D5FD3B171F9218005B0069 /* TestTest.cpp */, + 83D5FD3C171F9218005B0069 /* TestTestList.cpp */, + 83D5FD3D171F9218005B0069 /* TestTestMacros.cpp */, + 83D5FD3E171F9218005B0069 /* TestTestResults.cpp */, + 83D5FD3F171F9218005B0069 /* TestTestRunner.cpp */, + 83D5FD40171F9218005B0069 /* TestTestSuite.cpp */, + 83D5FD41171F9218005B0069 /* TestTimeConstraint.cpp */, + 83D5FD42171F9218005B0069 /* TestTimeConstraintMacro.cpp */, + 83D5FD43171F9218005B0069 /* TestUnitTestPP.cpp */, + 83D5FD44171F9218005B0069 /* TestXmlTestReporter.cpp */, ); - path = "TestUnitTest++"; + name = tests; + path = ../../tests; sourceTree = ""; }; /* End PBXGroup section */ @@ -374,7 +431,25 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 83D5FD27171F91B7005B0069 /* main.cpp in Sources */, + 83D5FD45171F9218005B0069 /* Main.cpp in Sources */, + 83D5FD46171F9218005B0069 /* TestAssertHandler.cpp in Sources */, + 83D5FD47171F9218005B0069 /* TestCheckMacros.cpp in Sources */, + 83D5FD48171F9218005B0069 /* TestChecks.cpp in Sources */, + 83D5FD49171F9218005B0069 /* TestCompositeTestReporter.cpp in Sources */, + 83D5FD4A171F9218005B0069 /* TestCurrentTest.cpp in Sources */, + 83D5FD4B171F9218005B0069 /* TestDeferredTestReporter.cpp in Sources */, + 83D5FD4C171F9218005B0069 /* TestExceptions.cpp in Sources */, + 83D5FD4D171F9218005B0069 /* TestMemoryOutStream.cpp in Sources */, + 83D5FD4E171F9218005B0069 /* TestTest.cpp in Sources */, + 83D5FD4F171F9218005B0069 /* TestTestList.cpp in Sources */, + 83D5FD50171F9218005B0069 /* TestTestMacros.cpp in Sources */, + 83D5FD51171F9218005B0069 /* TestTestResults.cpp in Sources */, + 83D5FD52171F9218005B0069 /* TestTestRunner.cpp in Sources */, + 83D5FD53171F9218005B0069 /* TestTestSuite.cpp in Sources */, + 83D5FD54171F9218005B0069 /* TestTimeConstraint.cpp in Sources */, + 83D5FD55171F9218005B0069 /* TestTimeConstraintMacro.cpp in Sources */, + 83D5FD56171F9218005B0069 /* TestUnitTestPP.cpp in Sources */, + 83D5FD57171F9218005B0069 /* TestXmlTestReporter.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -457,6 +532,7 @@ 83D5FD2B171F91B7005B0069 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -464,6 +540,7 @@ 83D5FD2C171F91B7005B0069 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + HEADER_SEARCH_PATHS = "$(SRCROOT)/../../"; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; From db52c49adca0b5cfd66c8341e5aec63e3c949956 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 22:19:41 -0500 Subject: [PATCH 059/184] Remove old docs folder. --- docs/UnitTest++.html | 260 ------------------------------------------- 1 file changed, 260 deletions(-) delete mode 100644 docs/UnitTest++.html diff --git a/docs/UnitTest++.html b/docs/UnitTest++.html deleted file mode 100644 index 1cb2ff9..0000000 --- a/docs/UnitTest++.html +++ /dev/null @@ -1,260 +0,0 @@ - - - UnitTest++ in brief - - -

UnitTest++ in brief

-

Introduction

-

This little document serves as bare-bones documentation for UnitTest++.

- -

For background, goals and license details, see:

- - - -

The documentation, while sparse, aims to be practical, so it should give you enough info to get started using UnitTest++ as fast as possible.

- -

Building UnitTest++

-

Building UnitTest++ will be specific to each platform and build environment, but it should be straightforward.

- -

Building with Visual Studio

-

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.

- -

Building with Make

-

The bundled makefile is written to build with g++. It also needs sed installed in the path, and to be able to use the mv and rm shell commands. The makefile should be usable on most Posix-like platforms.

- -

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.

- -

Packaging

-

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 UnitTest++/src/ and its per-platform subfolders. The tests directory only contains the unit tests for the library, and need not be included.

- -

Using UnitTest++

-

The source code for UnitTest++ comes with a full test suite written using UnitTest++. This is a great place to learn techniques for testing. There is one sample .cpp file: UnitTest++/src/tests/TestUnitTestPP.cpp. 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.

- -

Getting started

-

Listed below is a minimal C++ program to run a failing test through UnitTest++.

- -
-  // test.cpp
-  #include <unittestpp.h>
-
-  TEST(FailSpectacularly)
-  {
-    CHECK(false);
-  }
-
-  int main()
-  {
-    return UnitTest::RunAllTests();
-  }
-
- -

unittestpp.h 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 UnitTest, so you need to either qualify their full names (as with RunAllTests() in the example) or add a using namespace UnitTest; statement in your .cpp files. Note that any mention of UnitTest++ functions and classes in this document assume that the UnitTest namespace has been opened.

- -

Compiling and linking this program with UnitTest++'s static library into an executable, and running it, will produce the following output (details may vary):

- -
-  .\test.cpp(5): error: Failure in FailSpectacularly: false
-  FAILED: 1 out of 1 tests failed (1 failures).
-  Test time: 0.00 seconds.
-
- -

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.

- -

Test macros

-

To add a test, simply put the following code in a .cpp file of your choice:

- -
-  TEST(YourTestName)
-  {
-  }
-
- -

The TEST 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 RunAllTests().

- -

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 TEST_FIXTURE 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.

- -
-  struct SomeFixture
-  {
-    SomeFixture() { /* some setup */ }
-    ~SomeFixture() { /* some teardown */ }
-
-    int testData;
-  };
- 
-  TEST_FIXTURE(SomeFixture, YourTestName)
-  {
-    int temp = testData;
-  }
-
- -

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.

- -

Suite macros

-

Tests can be grouped into suites, using the SUITE macro. A suite serves as a namespace for test names, so that the same test name can be used in two difference contexts.

- -
-  SUITE(YourSuiteName)
-  {
-    TEST(YourTestName)
-    {
-    }
-
-    TEST(YourOtherTestName)
-    {
-    }
-  }
-
- -

This will place the tests into a C++ namespace called YourSuiteName, and make the suite name available to UnitTest++. RunAllTests() can be called for a specific suite name, so you can use this to build named groups of tests to be run together.

- -

Simple check macros

-

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.

- -

The most basic variety is the boolean CHECK macro:

- -
-  CHECK(false); // fails
-
- -

It will fail if the boolean expression evaluates to false.

- -

For equality checks, it's generally better to use CHECK_EQUAL:

- -
-  CHECK_EQUAL(10, 20); // fails
-  CHECK_EQUAL("foo", "bar"); // fails
-
- -

Note how CHECK_EQUAL is overloaded for C strings, so you don't have to resort to strcmp or similar. There is no facility for case-insensitive comparison or string searches, so you may have to drop down to a plain boolean CHECK with help from the CRT:

- -
-  CHECK(std::strstr("zaza", "az") != 0); // succeeds
-
- -

For floating-point comparison, equality isn't necessarily well-defined, so you should prefer the CHECK_CLOSE macro:

- -
-  CHECK_CLOSE(3.14, 3.1415, 0.01); // succeeds
-
- -

All of the macros are tailored to avoid unintended side-effects, for example:

- -
-  TEST(CheckMacrosHaveNoSideEffects)
-  {
-    int i = 4;
-    CHECK_EQUAL(5, ++i); // succeeds
-    CHECK_EQUAL(5, i); // succeeds
-  }
-
- -

The check macros guarantee that the ++i expression isn't repeated internally, as demonstrated above.

- -

Array check macros

-

There is a set of check macros for array comparison as well:

- -
-  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
-
- -

The array equal macro compares elements using operator==, so CHECK_ARRAY_EQUAL won't work for an array of C strings, for example.

- -

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.

- -

Note that the one-dimensional array macros work for std::vector as well, as it can be indexed just as a C array.

- -

Exception check macros

-

Finally, there's a CHECK_THROW macro, which asserts that its enclosed expression throws the specified type:

- -
-  struct TestException {};
-  CHECK_THROW(throw TestException(), TestException); // succeeds
-
- -

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 what() method for std::exception derivatives or just a plain message for unknown exception types.

- -

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.

- -

Time constraints

-

UnitTest++ can fail a test if it takes too long to complete, using so-called time constraints.

- -

They come in two flavors; local and global time constraints.

- -

Local time constraints are limited to the current scope, like so:

- -
-  TEST(YourTimedTest)
-  {
-     // Lengthy setup...
-
-     {
-        UNITTEST_TIME_CONSTRAINT(50);
-
-        // Do time-critical stuff
-     }
-
-     // Lengthy teardown...
-  }
-
- -

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.

- -

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 RunAllTests().

- -

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 UNITTEST_TIME_CONSTRAINT_EXEMPT macro anywhere inside the test body.

- -
-  TEST(NotoriouslySlowTest)
-  {
-     UNITTEST_TIME_CONSTRAINT_EXEMPT();
-
-     // Oh boy, this is going to take a while
-     ...
-  }
-
- -

Test runners

-

The RunAllTests() 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.

- -
-  int RunAllTests(TestReporter& reporter, TestList const& list, char const* suiteName, int const maxTestTimeInMs);
-
- -

If you attempt to pass custom parameters to RunAllTests(), note that the list parameter should have the value Test::GetTestList().

- -

The parameterless RunAllTests() is a simple wrapper for this one, with sensible defaults.

- -

Example setup

-

How to create a new test project varies depending on your environment, but here are some directions on common file structure and usage.

- -

The general idea is that you keep one Main.cpp file with the entry-point which calls RunAllTests().

- -

Then you can simply compile and link new .cpp files at will, typically one per test suite.

- -
-   + ShaverTests/
-   |
-   +- Main.cpp
-   |
-   +- TestBrush.cpp   
-   +- TestEngine.cpp
-   +- TestRazor.cpp   
-
- -

Each of the Test*.cpp files will contain one or more TEST macro incantations with the associated test code. There are no source-level dependencies between Main.cpp and Test*.cpp, as the TEST macro handles the registration and setup necessary for RunAllTests() to find all tests compiled into the same final executable.

- -

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 TESTs and calls RunAllTests() at one point or another, it will be handled by UnitTest++.

- -

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.

- - - \ No newline at end of file From 71f986568e4c21ac07bfce3c24d60e1d263406b8 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 22:24:22 -0500 Subject: [PATCH 060/184] Add https://github.com/unittest-cpp/unittest-cpp.wiki.git as submodule 'docs'. --- .gitmodules | 3 +++ docs | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 docs diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d3c2970 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs"] + path = docs + url = https://github.com/unittest-cpp/unittest-cpp.wiki.git diff --git a/docs b/docs new file mode 160000 index 0000000..f6e8e69 --- /dev/null +++ b/docs @@ -0,0 +1 @@ +Subproject commit f6e8e6920f8e23e55a5b5d7ab9e2cd7727a39b00 From b10efb4ca460b295e0c8ad70d2c0547a9e30982c Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 22:38:43 -0500 Subject: [PATCH 061/184] Add Documentation, Pre-requisites, and Downloading instructions to main README. --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 727e010..e2bb3db 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,58 @@ UnitTest++ -========== +=========== +UnitTest++ is a lightweight unit testing framework for C++. It was designed to do test-driven development on a wide variety of platforms. Simplicity, portability, speed, and small footprint are all very important aspects of UnitTest++. UnitTest++ is ANSI portable C++ and makes minimal use of advanced library and languages features, which means it should be easily portable to just about any platform. Out of the box, the following platforms are supported: + +* Windows +* Linux +* Mac OS X + +Documentation +-------------- +The full documenation for building and using UnitTest++ can be found on the [GitHub wiki page](https://github.com/unittest-cpp/unittest-cpp/wiki). The contents of this wiki are also included as a git submodule under the `docs` folder, so version-specific Markdown documentation is always available along with the download. + +Pre-requisites +--------------- +While there are currently some bundled makefiles and projects, UnitTest++ is primarily built and supported using [CMake](http://cmake.org). + +Downloading +------------ +### Latest (HEAD) ### + +Via git: + + git clone https://github.com/unittest-cpp/unittest-cpp + +Via svn: + + svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp + +### Latest release (v1.4) ### + +Via git: + + git clone https://github.com/unittest-cpp/unittest-cpp + cd unittest-cpp + git checkout v1.4 + +Via svn: + + svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.4 unittest-cpp + +License +--------- *UnitTest++ is free software. You may copy, distribute, and modify it under the terms of the License contained in the file LICENSE distributed with this package. This license is the same as the MIT/X Consortium license.* +Contributors +-------------- +### Current Maintainers: ### +* Patrick Johnmeyer (pjohnmeyer@gmail.com) @pjohnmeyer +* Charles Nicholson (charles.nicholson@gmail.com) @charlesnicholson -### Authors: ### +### Original Authors: ### * Noel Llopis (llopis@convexhull.com) * Charles Nicholson (charles.nicholson@gmail.com) From a0badc46e8b0807a68056e5b81e409178f4691d3 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 22:45:11 -0500 Subject: [PATCH 062/184] Add link to contributor graph under 'Contributors'. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e2bb3db..ed3e086 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ license.* Contributors -------------- +### [GitHub Contributor Graph](https://github.com/unittest-cpp/unittest-cpp/contributors) ### + ### Current Maintainers: ### * Patrick Johnmeyer (pjohnmeyer@gmail.com) @pjohnmeyer * Charles Nicholson (charles.nicholson@gmail.com) @charlesnicholson From 20f1ccd20f95798d1b95094ebf236aae4477e3b5 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 23:13:57 -0500 Subject: [PATCH 063/184] Incorporate new commits in wiki. --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index f6e8e69..e97ed5f 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f6e8e6920f8e23e55a5b5d7ab9e2cd7727a39b00 +Subproject commit e97ed5ff1ea00cbe66a08d6e691ec3294aabe43a From 315535bbefa02a852714e6bd178d2e08190c31b6 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 23:22:20 -0500 Subject: [PATCH 064/184] Incorporate latest wiki docs. --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index e97ed5f..77f069c 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit e97ed5ff1ea00cbe66a08d6e691ec3294aabe43a +Subproject commit 77f069c194b93f6f21c5a666ff33d257a41ef45a From b8cd1d300b65f9d4d15558f2229fec90550f661a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 8 May 2013 23:34:47 -0500 Subject: [PATCH 065/184] Fix spelling error in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ed3e086..97d5d27 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ UnitTest++ is a lightweight unit testing framework for C++. It was designed to d Documentation -------------- -The full documenation for building and using UnitTest++ can be found on the [GitHub wiki page](https://github.com/unittest-cpp/unittest-cpp/wiki). The contents of this wiki are also included as a git submodule under the `docs` folder, so version-specific Markdown documentation is always available along with the download. +The full documentation for building and using UnitTest++ can be found on the [GitHub wiki page](https://github.com/unittest-cpp/unittest-cpp/wiki). The contents of this wiki are also included as a git submodule under the `docs` folder, so version-specific Markdown documentation is always available along with the download. Pre-requisites --------------- From 23127fe5b954d8fb77d86f24ac49aa0d635ea602 Mon Sep 17 00:00:00 2001 From: Martin Moene Date: Thu, 9 May 2013 11:12:29 +0200 Subject: [PATCH 066/184] Add changes required to compile with MS VC6 Add macro UNITTEST_COMPILER_IS_MSVC6 Add macro UNIITEST_NS_QUAL_STD(fun) Avoid __pragma() Skip tests with long long --- UnitTest++/Config.h | 12 +++++++++++- UnitTest++/DeferredTestResult.cpp | 2 +- UnitTest++/HelperMacros.h | 2 +- tests/TestChecks.cpp | 4 ++-- tests/TestMemoryOutStream.cpp | 2 ++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index 5313b09..4f695f7 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -7,7 +7,8 @@ #pragma warning(disable:4702) // unreachable code #pragma warning(disable:4722) // destructor never returns, potential memory leak - #if (_MSC_VER == 1200) // VC6 +#if (_MSC_VER == 1200) // VC6 + #define UNITTEST_COMPILER_IS_MSVC6 #pragma warning(disable:4786) #pragma warning(disable:4290) #endif @@ -60,4 +61,13 @@ //#define UNITTEST_NO_EXCEPTIONS + +// std namespace qualification: used for functions like strcpy that +// may live in std:: namespace (cstring header). +#if defined( UNITTEST_COMPILER_IS_MSVC6 ) + #define UNIITEST_NS_QUAL_STD(x) x +#else + #define UNIITEST_NS_QUAL_STD(x) ::std::x +#endif + #endif diff --git a/UnitTest++/DeferredTestResult.cpp b/UnitTest++/DeferredTestResult.cpp index 5071f82..cdad9eb 100644 --- a/UnitTest++/DeferredTestResult.cpp +++ b/UnitTest++/DeferredTestResult.cpp @@ -16,7 +16,7 @@ DeferredTestFailure::DeferredTestFailure() DeferredTestFailure::DeferredTestFailure(int lineNumber_, const char* failureStr_) : lineNumber(lineNumber_) { - std::strcpy(failureStr, failureStr_); + UNIITEST_NS_QUAL_STD(strcpy)(failureStr, failureStr_); } DeferredTestResult::DeferredTestResult() diff --git a/UnitTest++/HelperMacros.h b/UnitTest++/HelperMacros.h index fb3181d..699d99d 100644 --- a/UnitTest++/HelperMacros.h +++ b/UnitTest++/HelperMacros.h @@ -5,7 +5,7 @@ #define UNITTEST_MULTILINE_MACRO_BEGIN do { -#ifdef UNITTEST_WIN32 +#if defined(UNITTEST_WIN32) && !defined(UNITTEST_COMPILER_IS_MSVC6) #define UNITTEST_MULTILINE_MACRO_END \ } __pragma(warning(push)) __pragma(warning(disable:4127)) while (0) __pragma(warning(pop)) #else diff --git a/tests/TestChecks.cpp b/tests/TestChecks.cpp index 758ca31..9554b31 100644 --- a/tests/TestChecks.cpp +++ b/tests/TestChecks.cpp @@ -150,7 +150,7 @@ TEST(CheckCloseWithNaNFails) { const unsigned int bitpattern = 0xFFFFFFFF; float nan; - std::memcpy(&nan, &bitpattern, sizeof(bitpattern)); + UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern)); TestResults results; CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0)); @@ -161,7 +161,7 @@ TEST(CheckCloseWithNaNAgainstItselfFails) { const unsigned int bitpattern = 0xFFFFFFFF; float nan; - std::memcpy(&nan, &bitpattern, sizeof(bitpattern)); + UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern)); TestResults results; CheckClose(results, nan, nan, 0.1f, TestDetails("", "", "", 0)); diff --git a/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp index 74a9a56..9b2aa1f 100644 --- a/tests/TestMemoryOutStream.cpp +++ b/tests/TestMemoryOutStream.cpp @@ -167,6 +167,7 @@ TEST(StreamingMinUnsignedLongWritesCorrectCharacters) CHECK_EQUAL("0", stream.GetText()); } +#ifndef UNITTEST_COMPILER_IS_MSVC6 TEST(StreamingLongLongWritesCorrectCharacters) { MemoryOutStream stream; @@ -214,6 +215,7 @@ TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) stream << (unsigned long long)0ull; CHECK_EQUAL("0", stream.GetText()); } +#endif TEST(StreamingFloatWritesCorrectCharacters) { From 49fb0ce68af8e1a7406098b28526ff5df8c86dda Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 9 May 2013 07:17:00 -0500 Subject: [PATCH 067/184] Add 'empty' builds directory per the wiki. (The folder is not actually empty as it includes a .gitignore.) --- builds/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 builds/.gitignore diff --git a/builds/.gitignore b/builds/.gitignore new file mode 100644 index 0000000..5e7d273 --- /dev/null +++ b/builds/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore From 65d2e03ec92baf18c635c95d2f810a522b3a115c Mon Sep 17 00:00:00 2001 From: Martin Moene Date: Fri, 10 May 2013 11:32:15 +0200 Subject: [PATCH 068/184] Adapt MemoryOutStream for VC6 __int64 type --- UnitTest++/MemoryOutStream.cpp | 35 ++++++++++++++++++++++++++++++++++ UnitTest++/MemoryOutStream.h | 20 ++++++++++++++++--- tests/TestMemoryOutStream.cpp | 20 ++++++++++++++----- 3 files changed, 67 insertions(+), 8 deletions(-) diff --git a/UnitTest++/MemoryOutStream.cpp b/UnitTest++/MemoryOutStream.cpp index 3c112b6..319dfda 100644 --- a/UnitTest++/MemoryOutStream.cpp +++ b/UnitTest++/MemoryOutStream.cpp @@ -16,6 +16,33 @@ void MemoryOutStream::Clear() m_text = this->str(); } +#ifdef UNITTEST_COMPILER_IS_MSVC6 + +#define snprintf _snprintf + +template +std::ostream& FormatToStream(std::ostream& stream, char const* format, ValueType const& value) +{ + using namespace std; + + const size_t BUFFER_SIZE=32; + char txt[BUFFER_SIZE]; + snprintf(txt, BUFFER_SIZE, format, value); + return stream << txt; +} + +std::ostream& operator<<(std::ostream& stream, __int64 const n) +{ + return FormatToStream(stream, "%I64d", n); +} + +std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n) +{ + return FormatToStream(stream, "%I64u", n); +} + +#endif + } #else @@ -108,7 +135,11 @@ MemoryOutStream& MemoryOutStream::operator <<(unsigned long const n) return *this; } +#ifdef UNITTEST_COMPILER_IS_MSVC6 +MemoryOutStream& MemoryOutStream::operator <<(__int64 const n) +#else MemoryOutStream& MemoryOutStream::operator <<(long long const n) +#endif { #ifdef UNITTEST_WIN32 FormatToStream(*this, "%I64d", n); @@ -119,7 +150,11 @@ MemoryOutStream& MemoryOutStream::operator <<(long long const n) return *this; } +#ifdef UNITTEST_COMPILER_IS_MSVC6 +MemoryOutStream& MemoryOutStream::operator <<(unsigned __int64 const n) +#else MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) +#endif { #ifdef UNITTEST_WIN32 FormatToStream(*this, "%I64u", n); diff --git a/UnitTest++/MemoryOutStream.h b/UnitTest++/MemoryOutStream.h index 0c46f53..b9cea19 100644 --- a/UnitTest++/MemoryOutStream.h +++ b/UnitTest++/MemoryOutStream.h @@ -26,12 +26,21 @@ class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream mutable std::string m_text; }; +#ifdef UNITTEST_COMPILER_IS_MSVC6 +std::ostream& operator<<(std::ostream& stream, __int64 const n); +std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n); +#endif + } #else #include +#ifdef UNITTEST_COMPILER_IS_MSVC6 +namespace std {} +#endif + namespace UnitTest { @@ -47,10 +56,15 @@ class UNITTEST_LINKAGE MemoryOutStream MemoryOutStream& operator <<(char const* txt); MemoryOutStream& operator <<(int n); MemoryOutStream& operator <<(long n); - MemoryOutStream& operator <<(long long n); MemoryOutStream& operator <<(unsigned long n); - MemoryOutStream& operator <<(unsigned long long n); - MemoryOutStream& operator <<(float f); +#ifdef UNITTEST_COMPILER_IS_MSVC6 + MemoryOutStream& operator <<(__int64 n); + MemoryOutStream& operator <<(unsigned __int64 n); +#else + MemoryOutStream& operator <<(long long n); + MemoryOutStream& operator <<(unsigned long long n); +#endif + MemoryOutStream& operator <<(float f); MemoryOutStream& operator <<(double d); MemoryOutStream& operator <<(void const* p); MemoryOutStream& operator <<(unsigned int s); diff --git a/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp index 9b2aa1f..ff1e920 100644 --- a/tests/TestMemoryOutStream.cpp +++ b/tests/TestMemoryOutStream.cpp @@ -167,12 +167,15 @@ TEST(StreamingMinUnsignedLongWritesCorrectCharacters) CHECK_EQUAL("0", stream.GetText()); } -#ifndef UNITTEST_COMPILER_IS_MSVC6 TEST(StreamingLongLongWritesCorrectCharacters) { MemoryOutStream stream; +#ifdef UNITTEST_COMPILER_IS_MSVC6 + stream << (__int64)-12345i64; +#else stream << (long long)-12345ll; - CHECK_EQUAL("-12345", stream.GetText()); +#endif + CHECK_EQUAL("-12345", stream.GetText()); } #ifdef LLONG_MAX @@ -196,8 +199,12 @@ TEST(StreamingMinLongLongWritesCorrectCharacters) TEST(StreamingUnsignedLongLongWritesCorrectCharacters) { MemoryOutStream stream; - stream << (unsigned long long)85899ull; - CHECK_EQUAL("85899", stream.GetText()); +#ifdef UNITTEST_COMPILER_IS_MSVC6 + stream << (unsigned __int64)85899ui64; +#else + stream << (unsigned long long)85899ull; +#endif + CHECK_EQUAL("85899", stream.GetText()); } #ifdef ULLONG_MAX @@ -212,10 +219,13 @@ TEST(StreamingMaxUnsignedLongLongWritesCorrectCharacters) TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) { MemoryOutStream stream; +#ifdef UNITTEST_COMPILER_IS_MSVC6 + stream << (unsigned __int64)0ui64; +#else stream << (unsigned long long)0ull; +#endif CHECK_EQUAL("0", stream.GetText()); } -#endif TEST(StreamingFloatWritesCorrectCharacters) { From bd1239bff7ee0ed10a30db9dbd5af2d0027cd161 Mon Sep 17 00:00:00 2001 From: Lijo Antony Date: Sun, 9 Jun 2013 23:25:35 +0400 Subject: [PATCH 069/184] Integrating test failure in to QtCreator IDE build errors --- UnitTest++/TestReporterStdout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UnitTest++/TestReporterStdout.cpp b/UnitTest++/TestReporterStdout.cpp index c519e76..daa1b30 100644 --- a/UnitTest++/TestReporterStdout.cpp +++ b/UnitTest++/TestReporterStdout.cpp @@ -13,13 +13,13 @@ 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"; + char const* const errorFormat = "%s:%d:%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); + fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure); } void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/) From cda955dee400de54d3079337481b588ffb04f286 Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Sat, 20 Jul 2013 13:12:47 +0900 Subject: [PATCH 070/184] Fix autotools configuration * Add some headers to the list of installed files. * Specify the "foreign" strictness so that automake does not complain about missing files. * Specify a directory for m4 macros as suggested by libtoolize. * Add autotools-generated files to gitignore. --- .gitignore | 29 ++++++++++++++++++++++++++++- Makefile.am | 1 + UnitTest++/Makefile.am | 2 +- configure.ac | 3 ++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index edfc779..49c8320 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.o *.a +*.lo +*.la # Visual Studio temp/user files *.user @@ -13,4 +15,29 @@ Release Debug MinSizeRel RelWithDebInfo -ipch \ No newline at end of file +ipch + +# files generated by autotools +/aclocal.m4 +/autom4te.cache +/config.guess +/config.h +/config.h.in +/config.status +/config.sub +/configure +/depcomp +/install-sh +/libtool +/ltmain.sh +/m4 +/missing +/stamp-h* +/test-driver +/UnitTest++/TestUnitTest++ +Makefile +Makefile.in +.deps +.libs +*.log +*.trs diff --git a/Makefile.am b/Makefile.am index 18f39ba..aac5b88 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,3 @@ +ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = docs SUBDIRS = UnitTest++ diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index 32bf52b..5ae9399 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,6 +1,6 @@ lib_LTLIBRARIES = libUnitTest++.la pkgincludedir = $(includedir)/UnitTest++ -nobase_pkginclude_HEADERS = UnitTest++.h Config.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h +nobase_pkginclude_HEADERS = UnitTest++.h UnitTestPP.h Config.h HelperMacros.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h ExceptionMacros.h ReportAssert.h ReportAssertImpl.h CompositeTestReporter.h libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp CompositeTestReporter.cpp libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ check_PROGRAMS = TestUnitTest++ diff --git a/configure.ac b/configure.ac index 64ebc93..b486107 100644 --- a/configure.ac +++ b/configure.ac @@ -4,9 +4,10 @@ AC_PREREQ([2.69]) AC_INIT([UnitTest++], [1.4], [victor.lavaud@gmail.com]) AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) +AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE() +AM_INIT_AUTOMAKE([foreign]) LT_INIT() AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:0]) From 311f4df4ebb40eb0ab82e068408811bfd04cbb88 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 23 Aug 2013 22:36:50 -0500 Subject: [PATCH 071/184] Replace absolute paths with relative paths in Visual Studio project files (untested). --- vs_projects/vs2003_x86/TestUnitTest++.vcproj | 98 ++++++------- vs_projects/vs2003_x86/UnitTest++.vcproj | 134 +++++++++--------- vs_projects/vs2005_x64/TestUnitTest++.vcproj | 98 ++++++------- vs_projects/vs2005_x64/UnitTest++.vcproj | 134 +++++++++--------- vs_projects/vs2005_x86/TestUnitTest++.vcproj | 98 ++++++------- vs_projects/vs2005_x86/UnitTest++.vcproj | 134 +++++++++--------- vs_projects/vs2008_x64/TestUnitTest++.vcproj | 98 ++++++------- vs_projects/vs2008_x64/UnitTest++.vcproj | 134 +++++++++--------- vs_projects/vs2008_x86/TestUnitTest++.vcproj | 98 ++++++------- vs_projects/vs2008_x86/UnitTest++.vcproj | 134 +++++++++--------- vs_projects/vs2010_x64/TestUnitTest++.vcxproj | 8 +- vs_projects/vs2010_x64/UnitTest++.vcxproj | 8 +- vs_projects/vs2010_x86/TestUnitTest++.vcxproj | 8 +- vs_projects/vs2010_x86/UnitTest++.vcxproj | 8 +- vs_projects/vs2012_x64/TestUnitTest++.vcxproj | 8 +- vs_projects/vs2012_x64/UnitTest++.vcxproj | 8 +- vs_projects/vs2012_x86/TestUnitTest++.vcxproj | 8 +- vs_projects/vs2012_x86/UnitTest++.vcxproj | 8 +- 18 files changed, 612 insertions(+), 612 deletions(-) diff --git a/vs_projects/vs2003_x86/TestUnitTest++.vcproj b/vs_projects/vs2003_x86/TestUnitTest++.vcproj index d3eea78..4cc0a43 100644 --- a/vs_projects/vs2003_x86/TestUnitTest++.vcproj +++ b/vs_projects/vs2003_x86/TestUnitTest++.vcproj @@ -20,7 +20,7 @@ + ImportLibrary="..\..\vs_projects\vs2003_x86\Debug\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2003_x86\Release\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2003_x86\MinSizeRel\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2003_x86\RelWithDebInfo\TestUnitTest++.lib"/> + RelativePath="..\..\tests\Main.cpp"> + RelativePath="..\..\tests\TestAssertHandler.cpp"> + RelativePath="..\..\tests\TestCheckMacros.cpp"> + RelativePath="..\..\tests\TestChecks.cpp"> + RelativePath="..\..\tests\TestCompositeTestReporter.cpp"> + RelativePath="..\..\tests\TestCurrentTest.cpp"> + RelativePath="..\..\tests\TestDeferredTestReporter.cpp"> + RelativePath="..\..\tests\TestExceptions.cpp"> + RelativePath="..\..\tests\TestMemoryOutStream.cpp"> + RelativePath="..\..\tests\TestTest.cpp"> + RelativePath="..\..\tests\TestTestList.cpp"> + RelativePath="..\..\tests\TestTestMacros.cpp"> + RelativePath="..\..\tests\TestTestResults.cpp"> + RelativePath="..\..\tests\TestTestRunner.cpp"> + RelativePath="..\..\tests\TestTestSuite.cpp"> + RelativePath="..\..\tests\TestTimeConstraint.cpp"> + RelativePath="..\..\tests\TestTimeConstraintMacro.cpp"> + RelativePath="..\..\tests\TestUnitTestPP.cpp"> + RelativePath="..\..\tests\TestXmlTestReporter.cpp"> + RelativePath="..\..\tests\RecordingReporter.h"> + RelativePath="..\..\tests\ScopedCurrentTest.h"> diff --git a/vs_projects/vs2003_x86/UnitTest++.vcproj b/vs_projects/vs2003_x86/UnitTest++.vcproj index 652c742..6f39862 100644 --- a/vs_projects/vs2003_x86/UnitTest++.vcproj +++ b/vs_projects/vs2003_x86/UnitTest++.vcproj @@ -20,7 +20,7 @@ + OutputFile="..\..\vs_projects\vs2003_x86\Debug\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2003_x86\Release\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2003_x86\MinSizeRel\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2003_x86\RelWithDebInfo\UnitTest++.lib"/> + RelativePath="..\..\UnitTest++\AssertException.h"> + RelativePath="..\..\UnitTest++\CheckMacros.h"> + RelativePath="..\..\UnitTest++\Checks.h"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.h"> + RelativePath="..\..\UnitTest++\Config.h"> + RelativePath="..\..\UnitTest++\CurrentTest.h"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.h"> + RelativePath="..\..\UnitTest++\DeferredTestResult.h"> + RelativePath="..\..\UnitTest++\ExceptionMacros.h"> + RelativePath="..\..\UnitTest++\ExecuteTest.h"> + RelativePath="..\..\UnitTest++\HelperMacros.h"> + RelativePath="..\..\UnitTest++\MemoryOutStream.h"> + RelativePath="..\..\UnitTest++\ReportAssert.h"> + RelativePath="..\..\UnitTest++\ReportAssertImpl.h"> + RelativePath="..\..\UnitTest++\Test.h"> + RelativePath="..\..\UnitTest++\TestDetails.h"> + RelativePath="..\..\UnitTest++\TestList.h"> + RelativePath="..\..\UnitTest++\TestMacros.h"> + RelativePath="..\..\UnitTest++\TestReporter.h"> + RelativePath="..\..\UnitTest++\TestReporterStdout.h"> + RelativePath="..\..\UnitTest++\TestResults.h"> + RelativePath="..\..\UnitTest++\TestRunner.h"> + RelativePath="..\..\UnitTest++\TestSuite.h"> + RelativePath="..\..\UnitTest++\TimeConstraint.h"> + RelativePath="..\..\UnitTest++\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\UnitTest++.h"> + RelativePath="..\..\UnitTest++\UnitTestPP.h"> + RelativePath="..\..\UnitTest++\XmlTestReporter.h"> + RelativePath="..\..\UnitTest++\AssertException.cpp"> + RelativePath="..\..\UnitTest++\Checks.cpp"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.cpp"> + RelativePath="..\..\UnitTest++\CurrentTest.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestResult.cpp"> + RelativePath="..\..\UnitTest++\MemoryOutStream.cpp"> + RelativePath="..\..\UnitTest++\ReportAssert.cpp"> + RelativePath="..\..\UnitTest++\Test.cpp"> + RelativePath="..\..\UnitTest++\TestDetails.cpp"> + RelativePath="..\..\UnitTest++\TestList.cpp"> + RelativePath="..\..\UnitTest++\TestReporter.cpp"> + RelativePath="..\..\UnitTest++\TestReporterStdout.cpp"> + RelativePath="..\..\UnitTest++\TestResults.cpp"> + RelativePath="..\..\UnitTest++\TestRunner.cpp"> + RelativePath="..\..\UnitTest++\TimeConstraint.cpp"> + RelativePath="..\..\UnitTest++\XmlTestReporter.cpp"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.cpp"> diff --git a/vs_projects/vs2005_x64/TestUnitTest++.vcproj b/vs_projects/vs2005_x64/TestUnitTest++.vcproj index e40a68a..ce54f3d 100644 --- a/vs_projects/vs2005_x64/TestUnitTest++.vcproj +++ b/vs_projects/vs2005_x64/TestUnitTest++.vcproj @@ -21,7 +21,7 @@ + ImportLibrary="..\..\vs_projects\vs2005_x64\Debug\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2005_x64\Release\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2005_x64\MinSizeRel\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2005_x64\RelWithDebInfo\TestUnitTest++.lib"/> + RelativePath="..\..\tests\Main.cpp"> + RelativePath="..\..\tests\TestAssertHandler.cpp"> + RelativePath="..\..\tests\TestCheckMacros.cpp"> + RelativePath="..\..\tests\TestChecks.cpp"> + RelativePath="..\..\tests\TestCompositeTestReporter.cpp"> + RelativePath="..\..\tests\TestCurrentTest.cpp"> + RelativePath="..\..\tests\TestDeferredTestReporter.cpp"> + RelativePath="..\..\tests\TestExceptions.cpp"> + RelativePath="..\..\tests\TestMemoryOutStream.cpp"> + RelativePath="..\..\tests\TestTest.cpp"> + RelativePath="..\..\tests\TestTestList.cpp"> + RelativePath="..\..\tests\TestTestMacros.cpp"> + RelativePath="..\..\tests\TestTestResults.cpp"> + RelativePath="..\..\tests\TestTestRunner.cpp"> + RelativePath="..\..\tests\TestTestSuite.cpp"> + RelativePath="..\..\tests\TestTimeConstraint.cpp"> + RelativePath="..\..\tests\TestTimeConstraintMacro.cpp"> + RelativePath="..\..\tests\TestUnitTestPP.cpp"> + RelativePath="..\..\tests\TestXmlTestReporter.cpp"> + RelativePath="..\..\tests\RecordingReporter.h"> + RelativePath="..\..\tests\ScopedCurrentTest.h"> diff --git a/vs_projects/vs2005_x64/UnitTest++.vcproj b/vs_projects/vs2005_x64/UnitTest++.vcproj index 382b863..9a8b47a 100644 --- a/vs_projects/vs2005_x64/UnitTest++.vcproj +++ b/vs_projects/vs2005_x64/UnitTest++.vcproj @@ -21,7 +21,7 @@ + OutputFile="..\..\vs_projects\vs2005_x64\Debug\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2005_x64\Release\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2005_x64\MinSizeRel\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2005_x64\RelWithDebInfo\UnitTest++.lib"/> + RelativePath="..\..\UnitTest++\AssertException.h"> + RelativePath="..\..\UnitTest++\CheckMacros.h"> + RelativePath="..\..\UnitTest++\Checks.h"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.h"> + RelativePath="..\..\UnitTest++\Config.h"> + RelativePath="..\..\UnitTest++\CurrentTest.h"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.h"> + RelativePath="..\..\UnitTest++\DeferredTestResult.h"> + RelativePath="..\..\UnitTest++\ExceptionMacros.h"> + RelativePath="..\..\UnitTest++\ExecuteTest.h"> + RelativePath="..\..\UnitTest++\HelperMacros.h"> + RelativePath="..\..\UnitTest++\MemoryOutStream.h"> + RelativePath="..\..\UnitTest++\ReportAssert.h"> + RelativePath="..\..\UnitTest++\ReportAssertImpl.h"> + RelativePath="..\..\UnitTest++\Test.h"> + RelativePath="..\..\UnitTest++\TestDetails.h"> + RelativePath="..\..\UnitTest++\TestList.h"> + RelativePath="..\..\UnitTest++\TestMacros.h"> + RelativePath="..\..\UnitTest++\TestReporter.h"> + RelativePath="..\..\UnitTest++\TestReporterStdout.h"> + RelativePath="..\..\UnitTest++\TestResults.h"> + RelativePath="..\..\UnitTest++\TestRunner.h"> + RelativePath="..\..\UnitTest++\TestSuite.h"> + RelativePath="..\..\UnitTest++\TimeConstraint.h"> + RelativePath="..\..\UnitTest++\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\UnitTest++.h"> + RelativePath="..\..\UnitTest++\UnitTestPP.h"> + RelativePath="..\..\UnitTest++\XmlTestReporter.h"> + RelativePath="..\..\UnitTest++\AssertException.cpp"> + RelativePath="..\..\UnitTest++\Checks.cpp"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.cpp"> + RelativePath="..\..\UnitTest++\CurrentTest.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestResult.cpp"> + RelativePath="..\..\UnitTest++\MemoryOutStream.cpp"> + RelativePath="..\..\UnitTest++\ReportAssert.cpp"> + RelativePath="..\..\UnitTest++\Test.cpp"> + RelativePath="..\..\UnitTest++\TestDetails.cpp"> + RelativePath="..\..\UnitTest++\TestList.cpp"> + RelativePath="..\..\UnitTest++\TestReporter.cpp"> + RelativePath="..\..\UnitTest++\TestReporterStdout.cpp"> + RelativePath="..\..\UnitTest++\TestResults.cpp"> + RelativePath="..\..\UnitTest++\TestRunner.cpp"> + RelativePath="..\..\UnitTest++\TimeConstraint.cpp"> + RelativePath="..\..\UnitTest++\XmlTestReporter.cpp"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.cpp"> diff --git a/vs_projects/vs2005_x86/TestUnitTest++.vcproj b/vs_projects/vs2005_x86/TestUnitTest++.vcproj index 522d871..7d06e22 100644 --- a/vs_projects/vs2005_x86/TestUnitTest++.vcproj +++ b/vs_projects/vs2005_x86/TestUnitTest++.vcproj @@ -21,7 +21,7 @@ + ImportLibrary="..\..\vs_projects\vs2005_x86\Debug\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2005_x86\Release\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2005_x86\MinSizeRel\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2005_x86\RelWithDebInfo\TestUnitTest++.lib"/> + RelativePath="..\..\tests\Main.cpp"> + RelativePath="..\..\tests\TestAssertHandler.cpp"> + RelativePath="..\..\tests\TestCheckMacros.cpp"> + RelativePath="..\..\tests\TestChecks.cpp"> + RelativePath="..\..\tests\TestCompositeTestReporter.cpp"> + RelativePath="..\..\tests\TestCurrentTest.cpp"> + RelativePath="..\..\tests\TestDeferredTestReporter.cpp"> + RelativePath="..\..\tests\TestExceptions.cpp"> + RelativePath="..\..\tests\TestMemoryOutStream.cpp"> + RelativePath="..\..\tests\TestTest.cpp"> + RelativePath="..\..\tests\TestTestList.cpp"> + RelativePath="..\..\tests\TestTestMacros.cpp"> + RelativePath="..\..\tests\TestTestResults.cpp"> + RelativePath="..\..\tests\TestTestRunner.cpp"> + RelativePath="..\..\tests\TestTestSuite.cpp"> + RelativePath="..\..\tests\TestTimeConstraint.cpp"> + RelativePath="..\..\tests\TestTimeConstraintMacro.cpp"> + RelativePath="..\..\tests\TestUnitTestPP.cpp"> + RelativePath="..\..\tests\TestXmlTestReporter.cpp"> + RelativePath="..\..\tests\RecordingReporter.h"> + RelativePath="..\..\tests\ScopedCurrentTest.h"> diff --git a/vs_projects/vs2005_x86/UnitTest++.vcproj b/vs_projects/vs2005_x86/UnitTest++.vcproj index a7e5be7..3182eb8 100644 --- a/vs_projects/vs2005_x86/UnitTest++.vcproj +++ b/vs_projects/vs2005_x86/UnitTest++.vcproj @@ -21,7 +21,7 @@ + OutputFile="..\..\vs_projects\vs2005_x86\Debug\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2005_x86\Release\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2005_x86\MinSizeRel\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2005_x86\RelWithDebInfo\UnitTest++.lib"/> + RelativePath="..\..\UnitTest++\AssertException.h"> + RelativePath="..\..\UnitTest++\CheckMacros.h"> + RelativePath="..\..\UnitTest++\Checks.h"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.h"> + RelativePath="..\..\UnitTest++\Config.h"> + RelativePath="..\..\UnitTest++\CurrentTest.h"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.h"> + RelativePath="..\..\UnitTest++\DeferredTestResult.h"> + RelativePath="..\..\UnitTest++\ExceptionMacros.h"> + RelativePath="..\..\UnitTest++\ExecuteTest.h"> + RelativePath="..\..\UnitTest++\HelperMacros.h"> + RelativePath="..\..\UnitTest++\MemoryOutStream.h"> + RelativePath="..\..\UnitTest++\ReportAssert.h"> + RelativePath="..\..\UnitTest++\ReportAssertImpl.h"> + RelativePath="..\..\UnitTest++\Test.h"> + RelativePath="..\..\UnitTest++\TestDetails.h"> + RelativePath="..\..\UnitTest++\TestList.h"> + RelativePath="..\..\UnitTest++\TestMacros.h"> + RelativePath="..\..\UnitTest++\TestReporter.h"> + RelativePath="..\..\UnitTest++\TestReporterStdout.h"> + RelativePath="..\..\UnitTest++\TestResults.h"> + RelativePath="..\..\UnitTest++\TestRunner.h"> + RelativePath="..\..\UnitTest++\TestSuite.h"> + RelativePath="..\..\UnitTest++\TimeConstraint.h"> + RelativePath="..\..\UnitTest++\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\UnitTest++.h"> + RelativePath="..\..\UnitTest++\UnitTestPP.h"> + RelativePath="..\..\UnitTest++\XmlTestReporter.h"> + RelativePath="..\..\UnitTest++\AssertException.cpp"> + RelativePath="..\..\UnitTest++\Checks.cpp"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.cpp"> + RelativePath="..\..\UnitTest++\CurrentTest.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestResult.cpp"> + RelativePath="..\..\UnitTest++\MemoryOutStream.cpp"> + RelativePath="..\..\UnitTest++\ReportAssert.cpp"> + RelativePath="..\..\UnitTest++\Test.cpp"> + RelativePath="..\..\UnitTest++\TestDetails.cpp"> + RelativePath="..\..\UnitTest++\TestList.cpp"> + RelativePath="..\..\UnitTest++\TestReporter.cpp"> + RelativePath="..\..\UnitTest++\TestReporterStdout.cpp"> + RelativePath="..\..\UnitTest++\TestResults.cpp"> + RelativePath="..\..\UnitTest++\TestRunner.cpp"> + RelativePath="..\..\UnitTest++\TimeConstraint.cpp"> + RelativePath="..\..\UnitTest++\XmlTestReporter.cpp"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.cpp"> diff --git a/vs_projects/vs2008_x64/TestUnitTest++.vcproj b/vs_projects/vs2008_x64/TestUnitTest++.vcproj index c124d92..a9421ba 100644 --- a/vs_projects/vs2008_x64/TestUnitTest++.vcproj +++ b/vs_projects/vs2008_x64/TestUnitTest++.vcproj @@ -21,7 +21,7 @@ + ImportLibrary="..\..\vs_projects\vs2008_x64\Debug\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2008_x64\Release\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2008_x64\MinSizeRel\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2008_x64\RelWithDebInfo\TestUnitTest++.lib"/> + RelativePath="..\..\tests\Main.cpp"> + RelativePath="..\..\tests\TestAssertHandler.cpp"> + RelativePath="..\..\tests\TestCheckMacros.cpp"> + RelativePath="..\..\tests\TestChecks.cpp"> + RelativePath="..\..\tests\TestCompositeTestReporter.cpp"> + RelativePath="..\..\tests\TestCurrentTest.cpp"> + RelativePath="..\..\tests\TestDeferredTestReporter.cpp"> + RelativePath="..\..\tests\TestExceptions.cpp"> + RelativePath="..\..\tests\TestMemoryOutStream.cpp"> + RelativePath="..\..\tests\TestTest.cpp"> + RelativePath="..\..\tests\TestTestList.cpp"> + RelativePath="..\..\tests\TestTestMacros.cpp"> + RelativePath="..\..\tests\TestTestResults.cpp"> + RelativePath="..\..\tests\TestTestRunner.cpp"> + RelativePath="..\..\tests\TestTestSuite.cpp"> + RelativePath="..\..\tests\TestTimeConstraint.cpp"> + RelativePath="..\..\tests\TestTimeConstraintMacro.cpp"> + RelativePath="..\..\tests\TestUnitTestPP.cpp"> + RelativePath="..\..\tests\TestXmlTestReporter.cpp"> + RelativePath="..\..\tests\RecordingReporter.h"> + RelativePath="..\..\tests\ScopedCurrentTest.h"> diff --git a/vs_projects/vs2008_x64/UnitTest++.vcproj b/vs_projects/vs2008_x64/UnitTest++.vcproj index e1ab1bd..5e1bf77 100644 --- a/vs_projects/vs2008_x64/UnitTest++.vcproj +++ b/vs_projects/vs2008_x64/UnitTest++.vcproj @@ -21,7 +21,7 @@ + OutputFile="..\..\vs_projects\vs2008_x64\Debug\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2008_x64\Release\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2008_x64\MinSizeRel\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2008_x64\RelWithDebInfo\UnitTest++.lib"/> + RelativePath="..\..\UnitTest++\AssertException.h"> + RelativePath="..\..\UnitTest++\CheckMacros.h"> + RelativePath="..\..\UnitTest++\Checks.h"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.h"> + RelativePath="..\..\UnitTest++\Config.h"> + RelativePath="..\..\UnitTest++\CurrentTest.h"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.h"> + RelativePath="..\..\UnitTest++\DeferredTestResult.h"> + RelativePath="..\..\UnitTest++\ExceptionMacros.h"> + RelativePath="..\..\UnitTest++\ExecuteTest.h"> + RelativePath="..\..\UnitTest++\HelperMacros.h"> + RelativePath="..\..\UnitTest++\MemoryOutStream.h"> + RelativePath="..\..\UnitTest++\ReportAssert.h"> + RelativePath="..\..\UnitTest++\ReportAssertImpl.h"> + RelativePath="..\..\UnitTest++\Test.h"> + RelativePath="..\..\UnitTest++\TestDetails.h"> + RelativePath="..\..\UnitTest++\TestList.h"> + RelativePath="..\..\UnitTest++\TestMacros.h"> + RelativePath="..\..\UnitTest++\TestReporter.h"> + RelativePath="..\..\UnitTest++\TestReporterStdout.h"> + RelativePath="..\..\UnitTest++\TestResults.h"> + RelativePath="..\..\UnitTest++\TestRunner.h"> + RelativePath="..\..\UnitTest++\TestSuite.h"> + RelativePath="..\..\UnitTest++\TimeConstraint.h"> + RelativePath="..\..\UnitTest++\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\UnitTest++.h"> + RelativePath="..\..\UnitTest++\UnitTestPP.h"> + RelativePath="..\..\UnitTest++\XmlTestReporter.h"> + RelativePath="..\..\UnitTest++\AssertException.cpp"> + RelativePath="..\..\UnitTest++\Checks.cpp"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.cpp"> + RelativePath="..\..\UnitTest++\CurrentTest.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestResult.cpp"> + RelativePath="..\..\UnitTest++\MemoryOutStream.cpp"> + RelativePath="..\..\UnitTest++\ReportAssert.cpp"> + RelativePath="..\..\UnitTest++\Test.cpp"> + RelativePath="..\..\UnitTest++\TestDetails.cpp"> + RelativePath="..\..\UnitTest++\TestList.cpp"> + RelativePath="..\..\UnitTest++\TestReporter.cpp"> + RelativePath="..\..\UnitTest++\TestReporterStdout.cpp"> + RelativePath="..\..\UnitTest++\TestResults.cpp"> + RelativePath="..\..\UnitTest++\TestRunner.cpp"> + RelativePath="..\..\UnitTest++\TimeConstraint.cpp"> + RelativePath="..\..\UnitTest++\XmlTestReporter.cpp"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.cpp"> diff --git a/vs_projects/vs2008_x86/TestUnitTest++.vcproj b/vs_projects/vs2008_x86/TestUnitTest++.vcproj index 9700001..6bdee7c 100644 --- a/vs_projects/vs2008_x86/TestUnitTest++.vcproj +++ b/vs_projects/vs2008_x86/TestUnitTest++.vcproj @@ -21,7 +21,7 @@ + ImportLibrary="..\..\vs_projects\vs2008_x86\Debug\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2008_x86\Release\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2008_x86\MinSizeRel\TestUnitTest++.lib"/> + ImportLibrary="..\..\vs_projects\vs2008_x86\RelWithDebInfo\TestUnitTest++.lib"/> + RelativePath="..\..\tests\Main.cpp"> + RelativePath="..\..\tests\TestAssertHandler.cpp"> + RelativePath="..\..\tests\TestCheckMacros.cpp"> + RelativePath="..\..\tests\TestChecks.cpp"> + RelativePath="..\..\tests\TestCompositeTestReporter.cpp"> + RelativePath="..\..\tests\TestCurrentTest.cpp"> + RelativePath="..\..\tests\TestDeferredTestReporter.cpp"> + RelativePath="..\..\tests\TestExceptions.cpp"> + RelativePath="..\..\tests\TestMemoryOutStream.cpp"> + RelativePath="..\..\tests\TestTest.cpp"> + RelativePath="..\..\tests\TestTestList.cpp"> + RelativePath="..\..\tests\TestTestMacros.cpp"> + RelativePath="..\..\tests\TestTestResults.cpp"> + RelativePath="..\..\tests\TestTestRunner.cpp"> + RelativePath="..\..\tests\TestTestSuite.cpp"> + RelativePath="..\..\tests\TestTimeConstraint.cpp"> + RelativePath="..\..\tests\TestTimeConstraintMacro.cpp"> + RelativePath="..\..\tests\TestUnitTestPP.cpp"> + RelativePath="..\..\tests\TestXmlTestReporter.cpp"> + RelativePath="..\..\tests\RecordingReporter.h"> + RelativePath="..\..\tests\ScopedCurrentTest.h"> diff --git a/vs_projects/vs2008_x86/UnitTest++.vcproj b/vs_projects/vs2008_x86/UnitTest++.vcproj index 95ae6cf..3e2fe4a 100644 --- a/vs_projects/vs2008_x86/UnitTest++.vcproj +++ b/vs_projects/vs2008_x86/UnitTest++.vcproj @@ -21,7 +21,7 @@ + OutputFile="..\..\vs_projects\vs2008_x86\Debug\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2008_x86\Release\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2008_x86\MinSizeRel\UnitTest++.lib"/> + OutputFile="..\..\vs_projects\vs2008_x86\RelWithDebInfo\UnitTest++.lib"/> + RelativePath="..\..\UnitTest++\AssertException.h"> + RelativePath="..\..\UnitTest++\CheckMacros.h"> + RelativePath="..\..\UnitTest++\Checks.h"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.h"> + RelativePath="..\..\UnitTest++\Config.h"> + RelativePath="..\..\UnitTest++\CurrentTest.h"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.h"> + RelativePath="..\..\UnitTest++\DeferredTestResult.h"> + RelativePath="..\..\UnitTest++\ExceptionMacros.h"> + RelativePath="..\..\UnitTest++\ExecuteTest.h"> + RelativePath="..\..\UnitTest++\HelperMacros.h"> + RelativePath="..\..\UnitTest++\MemoryOutStream.h"> + RelativePath="..\..\UnitTest++\ReportAssert.h"> + RelativePath="..\..\UnitTest++\ReportAssertImpl.h"> + RelativePath="..\..\UnitTest++\Test.h"> + RelativePath="..\..\UnitTest++\TestDetails.h"> + RelativePath="..\..\UnitTest++\TestList.h"> + RelativePath="..\..\UnitTest++\TestMacros.h"> + RelativePath="..\..\UnitTest++\TestReporter.h"> + RelativePath="..\..\UnitTest++\TestReporterStdout.h"> + RelativePath="..\..\UnitTest++\TestResults.h"> + RelativePath="..\..\UnitTest++\TestRunner.h"> + RelativePath="..\..\UnitTest++\TestSuite.h"> + RelativePath="..\..\UnitTest++\TimeConstraint.h"> + RelativePath="..\..\UnitTest++\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\UnitTest++.h"> + RelativePath="..\..\UnitTest++\UnitTestPP.h"> + RelativePath="..\..\UnitTest++\XmlTestReporter.h"> + RelativePath="..\..\UnitTest++\AssertException.cpp"> + RelativePath="..\..\UnitTest++\Checks.cpp"> + RelativePath="..\..\UnitTest++\CompositeTestReporter.cpp"> + RelativePath="..\..\UnitTest++\CurrentTest.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestReporter.cpp"> + RelativePath="..\..\UnitTest++\DeferredTestResult.cpp"> + RelativePath="..\..\UnitTest++\MemoryOutStream.cpp"> + RelativePath="..\..\UnitTest++\ReportAssert.cpp"> + RelativePath="..\..\UnitTest++\Test.cpp"> + RelativePath="..\..\UnitTest++\TestDetails.cpp"> + RelativePath="..\..\UnitTest++\TestList.cpp"> + RelativePath="..\..\UnitTest++\TestReporter.cpp"> + RelativePath="..\..\UnitTest++\TestReporterStdout.cpp"> + RelativePath="..\..\UnitTest++\TestResults.cpp"> + RelativePath="..\..\UnitTest++\TestRunner.cpp"> + RelativePath="..\..\UnitTest++\TimeConstraint.cpp"> + RelativePath="..\..\UnitTest++\XmlTestReporter.cpp"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.h"> + RelativePath="..\..\UnitTest++\Win32\TimeHelpers.cpp"> diff --git a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj index 231b6ad..ca55cae 100644 --- a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj +++ b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj @@ -53,25 +53,25 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2010_x64\Debug\ + ..\..\vs_projects\vs2010_x64\Debug\ TestUnitTest++.dir\Debug\ TestUnitTest++ .exe true true - U:\unittest-cpp-pj\vs_projects\vs2010_x64\Release\ + ..\..\vs_projects\vs2010_x64\Release\ TestUnitTest++.dir\Release\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2010_x64\MinSizeRel\ + ..\..\vs_projects\vs2010_x64\MinSizeRel\ TestUnitTest++.dir\MinSizeRel\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2010_x64\RelWithDebInfo\ + ..\..\vs_projects\vs2010_x64\RelWithDebInfo\ TestUnitTest++.dir\RelWithDebInfo\ TestUnitTest++ .exe diff --git a/vs_projects/vs2010_x64/UnitTest++.vcxproj b/vs_projects/vs2010_x64/UnitTest++.vcxproj index b846709..029c9ef 100644 --- a/vs_projects/vs2010_x64/UnitTest++.vcxproj +++ b/vs_projects/vs2010_x64/UnitTest++.vcxproj @@ -53,19 +53,19 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2010_x64\Debug\ + ..\..\vs_projects\vs2010_x64\Debug\ UnitTest++.dir\Debug\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2010_x64\Release\ + ..\..\vs_projects\vs2010_x64\Release\ UnitTest++.dir\Release\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2010_x64\MinSizeRel\ + ..\..\vs_projects\vs2010_x64\MinSizeRel\ UnitTest++.dir\MinSizeRel\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2010_x64\RelWithDebInfo\ + ..\..\vs_projects\vs2010_x64\RelWithDebInfo\ UnitTest++.dir\RelWithDebInfo\ UnitTest++ .lib diff --git a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj index 7e58525..137b0a5 100644 --- a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj +++ b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj @@ -53,25 +53,25 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2010_x86\Debug\ + ..\..\vs_projects\vs2010_x86\Debug\ TestUnitTest++.dir\Debug\ TestUnitTest++ .exe true true - U:\unittest-cpp-pj\vs_projects\vs2010_x86\Release\ + ..\..\vs_projects\vs2010_x86\Release\ TestUnitTest++.dir\Release\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2010_x86\MinSizeRel\ + ..\..\vs_projects\vs2010_x86\MinSizeRel\ TestUnitTest++.dir\MinSizeRel\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2010_x86\RelWithDebInfo\ + ..\..\vs_projects\vs2010_x86\RelWithDebInfo\ TestUnitTest++.dir\RelWithDebInfo\ TestUnitTest++ .exe diff --git a/vs_projects/vs2010_x86/UnitTest++.vcxproj b/vs_projects/vs2010_x86/UnitTest++.vcxproj index d767591..11f8996 100644 --- a/vs_projects/vs2010_x86/UnitTest++.vcxproj +++ b/vs_projects/vs2010_x86/UnitTest++.vcxproj @@ -53,19 +53,19 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2010_x86\Debug\ + ..\..\vs_projects\vs2010_x86\Debug\ UnitTest++.dir\Debug\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2010_x86\Release\ + ..\..\vs_projects\vs2010_x86\Release\ UnitTest++.dir\Release\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2010_x86\MinSizeRel\ + ..\..\vs_projects\vs2010_x86\MinSizeRel\ UnitTest++.dir\MinSizeRel\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2010_x86\RelWithDebInfo\ + ..\..\vs_projects\vs2010_x86\RelWithDebInfo\ UnitTest++.dir\RelWithDebInfo\ UnitTest++ .lib diff --git a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj index 17aef9f..cf04ea0 100644 --- a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj +++ b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj @@ -57,25 +57,25 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2012_x64\Debug\ + ..\..\vs_projects\vs2012_x64\Debug\ TestUnitTest++.dir\Debug\ TestUnitTest++ .exe true true - U:\unittest-cpp-pj\vs_projects\vs2012_x64\Release\ + ..\..\vs_projects\vs2012_x64\Release\ TestUnitTest++.dir\Release\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2012_x64\MinSizeRel\ + ..\..\vs_projects\vs2012_x64\MinSizeRel\ TestUnitTest++.dir\MinSizeRel\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2012_x64\RelWithDebInfo\ + ..\..\vs_projects\vs2012_x64\RelWithDebInfo\ TestUnitTest++.dir\RelWithDebInfo\ TestUnitTest++ .exe diff --git a/vs_projects/vs2012_x64/UnitTest++.vcxproj b/vs_projects/vs2012_x64/UnitTest++.vcxproj index 7ea763f..3285c87 100644 --- a/vs_projects/vs2012_x64/UnitTest++.vcxproj +++ b/vs_projects/vs2012_x64/UnitTest++.vcxproj @@ -57,19 +57,19 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2012_x64\Debug\ + ..\..\vs_projects\vs2012_x64\Debug\ UnitTest++.dir\Debug\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2012_x64\Release\ + ..\..\vs_projects\vs2012_x64\Release\ UnitTest++.dir\Release\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2012_x64\MinSizeRel\ + ..\..\vs_projects\vs2012_x64\MinSizeRel\ UnitTest++.dir\MinSizeRel\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2012_x64\RelWithDebInfo\ + ..\..\vs_projects\vs2012_x64\RelWithDebInfo\ UnitTest++.dir\RelWithDebInfo\ UnitTest++ .lib diff --git a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj index f12b1da..aa63b05 100644 --- a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj +++ b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj @@ -58,25 +58,25 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2012_x86\Debug\ + ..\..\vs_projects\vs2012_x86\Debug\ TestUnitTest++.dir\Debug\ TestUnitTest++ .exe true true - U:\unittest-cpp-pj\vs_projects\vs2012_x86\Release\ + ..\..\vs_projects\vs2012_x86\Release\ TestUnitTest++.dir\Release\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2012_x86\MinSizeRel\ + ..\..\vs_projects\vs2012_x86\MinSizeRel\ TestUnitTest++.dir\MinSizeRel\ TestUnitTest++ .exe false true - U:\unittest-cpp-pj\vs_projects\vs2012_x86\RelWithDebInfo\ + ..\..\vs_projects\vs2012_x86\RelWithDebInfo\ TestUnitTest++.dir\RelWithDebInfo\ TestUnitTest++ .exe diff --git a/vs_projects/vs2012_x86/UnitTest++.vcxproj b/vs_projects/vs2012_x86/UnitTest++.vcxproj index 471eaaa..aab2c24 100644 --- a/vs_projects/vs2012_x86/UnitTest++.vcxproj +++ b/vs_projects/vs2012_x86/UnitTest++.vcxproj @@ -57,19 +57,19 @@ <_ProjectFileVersion>10.0.20506.1 - U:\unittest-cpp-pj\vs_projects\vs2012_x86\Debug\ + ..\..\vs_projects\vs2012_x86\Debug\ UnitTest++.dir\Debug\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2012_x86\Release\ + ..\..\vs_projects\vs2012_x86\Release\ UnitTest++.dir\Release\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2012_x86\MinSizeRel\ + ..\..\vs_projects\vs2012_x86\MinSizeRel\ UnitTest++.dir\MinSizeRel\ UnitTest++ .lib - U:\unittest-cpp-pj\vs_projects\vs2012_x86\RelWithDebInfo\ + ..\..\vs_projects\vs2012_x86\RelWithDebInfo\ UnitTest++.dir\RelWithDebInfo\ UnitTest++ .lib From 1fdc44246d0aab4eda10120e997280bfc0437732 Mon Sep 17 00:00:00 2001 From: warmist Date: Mon, 6 Jan 2014 14:02:59 +0200 Subject: [PATCH 072/184] Fix crash bug in msvc fprintf had incorrect number of arguments. --- UnitTest++/TestReporterStdout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/UnitTest++/TestReporterStdout.cpp b/UnitTest++/TestReporterStdout.cpp index daa1b30..7d08903 100644 --- a/UnitTest++/TestReporterStdout.cpp +++ b/UnitTest++/TestReporterStdout.cpp @@ -12,14 +12,14 @@ namespace UnitTest { void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure) { + using namespace std; #if defined(__APPLE__) || defined(__GNUG__) char const* const errorFormat = "%s:%d:%d: error: Failure in %s: %s\n"; + fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure); #else char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n"; + fprintf(stderr, errorFormat, details.filename, details.lineNumber, details.testName, failure); #endif - - using namespace std; - fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure); } void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/) From 7b47f1c59a92730a39a967460d542f259b787c8f Mon Sep 17 00:00:00 2001 From: Nathan Lapierre Date: Thu, 5 Jun 2014 02:06:44 -0300 Subject: [PATCH 073/184] fix broken tests --- tests/TestTestRunner.cpp | 582 +++++++++++++++++++-------------------- 1 file changed, 284 insertions(+), 298 deletions(-) diff --git a/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp index fa05356..8a69241 100644 --- a/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -1,328 +1,314 @@ -#include "UnitTest++/UnitTestPP.h" +#include "../UnitTest++.h" #include "RecordingReporter.h" -#include "UnitTest++/ReportAssert.h" -#include "UnitTest++/TestList.h" -#include "UnitTest++/TimeHelpers.h" -#include "UnitTest++/TimeConstraint.h" -#include "UnitTest++/ReportAssertImpl.h" +#include "../ReportAssert.h" +#include "../TestList.h" +#include "../TimeHelpers.h" +#include "../TimeConstraint.h" using namespace UnitTest; namespace { - -struct TestRunnerFixture -{ - TestRunnerFixture() - : runner(reporter) - { - s_testRunnerFixtureTestResults = runner.GetTestResults(); - } - - static TestResults* s_testRunnerFixtureTestResults; - - RecordingReporter reporter; - TestList list; - TestRunner runner; -}; - -TestResults* TestRunnerFixture::s_testRunnerFixtureTestResults = NULL; - -struct MockTest : public Test -{ - MockTest(char const* testName, bool const success_, bool const assert_, int const count_ = 1) + + 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() const + { + TestResults& testResults_ = *CurrentTest::Results(); + 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 FixtureBase { + explicit FixtureBase() : runner(reporter) { } + template + int RunTestsIf(TestList const& list, char const* suiteName, + const Predicate& predicate, int maxTestTimeInMs) + { + TestResults* oldResults = CurrentTest::Results(); + const TestDetails* oldDetails = CurrentTest::Details(); + int result = runner.RunTestsIf(list, suiteName, predicate, maxTestTimeInMs); + CurrentTest::Results() = oldResults; + CurrentTest::Details() = oldDetails; + return result; + } + TestRunner runner; + RecordingReporter reporter; + }; + + struct TestRunnerFixture : public FixtureBase + { + TestList list; + }; + + TEST_FIXTURE(TestRunnerFixture, TestStartIsReportedCorrectly) { - m_isMockTest = true; + MockTest test("goodtest", true, false); + list.Add(&test); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(1, reporter.testRunCount); + CHECK_EQUAL("goodtest", reporter.lastStartedTest); } - - virtual void RunImpl() const + + TEST_FIXTURE(TestRunnerFixture, TestFinishIsReportedCorrectly) { - TestResults* testResults = TestRunnerFixture::s_testRunnerFixtureTestResults; - - for (int i=0; i < count; ++i) + MockTest test("goodtest", true, false); + list.Add(&test); + + 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() const { - if (asserted) - Detail::ReportAssertEx(testResults, &m_details, "desc", "file", 0); - else if (!success) - testResults->OnTestFailure(m_details, "message"); + TimeHelpers::SleepMs(20); } + }; + + TEST_FIXTURE(TestRunnerFixture, TestFinishIsCalledWithCorrectTime) + { + SlowTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 0); + CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= 0.050f); } - - bool const success; - bool const asserted; - int const count; -}; - -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() const + + TEST_FIXTURE(TestRunnerFixture, FailureCountIsZeroWhenNoTestsAreRun) { - TimeHelpers::SleepMs(20); + CHECK_EQUAL(0, RunTestsIf(list, NULL, True(), 0)); + CHECK_EQUAL(0, reporter.testRunCount); + CHECK_EQUAL(0, reporter.testFailedCount); } -}; - -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, AssertingTestAbortsAsSoonAsAssertIsHit) -{ - MockTest test("test", false, true, 3); - list.Add(&test); - runner.RunTestsIf(list, NULL, True(), 0); - CHECK_EQUAL(1, reporter.summaryFailureCount); -} - -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")); -} - - -namespace SlowTestHelper -{ - TestRunnerFixture testRunnerFixture; - - TEST_EX(SlowExemptedTest, testRunnerFixture.list) + + TEST_FIXTURE(TestRunnerFixture, CallsReportFailureOncePerFailingTest) { - UNITTEST_TIME_CONSTRAINT_EXEMPT(); - TimeHelpers::SleepMs(20); + 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, RunTestsIf(list, NULL, True(), 0)); + CHECK_EQUAL(2, reporter.testFailedCount); + } + + TEST_FIXTURE(TestRunnerFixture, TestsThatAssertAreReportedAsFailing) + { + MockTest test("test", true, true); + list.Add(&test); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(1, reporter.testFailedCount); } - class Fixture {}; - TEST_FIXTURE_EX(Fixture, SlowExemptedTest, testRunnerFixture.list) + TEST_FIXTURE(TestRunnerFixture, ReporterNotifiedOfTestCount) { - UNITTEST_TIME_CONSTRAINT_EXEMPT(); - TimeHelpers::SleepMs(20); + MockTest test1("test", true, false); + MockTest test2("test", true, false); + MockTest test3("test", true, false); + list.Add(&test1); + list.Add(&test2); + list.Add(&test3); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(3, reporter.summaryTotalTestCount); } -} - -TEST(SlowTestsWithTimeExemptionPass) -{ - SlowTestHelper::testRunnerFixture.runner.RunTestsIf(SlowTestHelper::testRunnerFixture.list, NULL, True(), 3); - CHECK_EQUAL(0, SlowTestHelper::testRunnerFixture.reporter.testFailedCount); -} - -struct TestSuiteFixture -{ - TestSuiteFixture() + + 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); + + 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); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(5, reporter.summaryFailureCount); + } + + TEST_FIXTURE(TestRunnerFixture, SlowTestPassesForHighTimeThreshold) + { + SlowTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(0, reporter.testFailedCount); + } + + TEST_FIXTURE(TestRunnerFixture, SlowTestFailsForLowTimeThreshold) + { + SlowTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 3); + CHECK_EQUAL(1, reporter.testFailedCount); + } + + TEST_FIXTURE(TestRunnerFixture, SlowTestHasCorrectFailureInformation) + { + SlowTest test; + list.Add(&test); + + 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() const + { + UNITTEST_TIME_CONSTRAINT_EXEMPT(); + TimeHelpers::SleepMs(20); + } + }; + + SlowExemptedTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 3); + CHECK_EQUAL(0, reporter.testFailedCount); + } + + struct TestSuiteFixture : FixtureBase + { + TestSuiteFixture() : test1("TestInDefaultSuite") , test2("TestInOtherSuite", "OtherSuite") , test3("SecondTestInDefaultSuite") - , runner(reporter) + { + list.Add(&test1); + list.Add(&test2); + } + + Test test1; + Test test2; + Test test3; + TestList list; + }; + + TEST_FIXTURE(TestSuiteFixture, TestRunnerRunsAllSuitesIfNullSuiteIsPassed) { - list.Add(&test1); - list.Add(&test2); + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(2, reporter.summaryTotalTestCount); } - - 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); -} - -} + TEST_FIXTURE(TestSuiteFixture,TestRunnerRunsOnlySpecifiedSuite) + { + 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); + + 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); + + RunTestsIf(list, "suite", RunTestIfNameIs("goodtest"), 0); + + CHECK_EQUAL(1, reporter.testRunCount); + CHECK_EQUAL("goodtest", reporter.lastStartedTest); + CHECK_EQUAL("suite", reporter.lastStartedSuite); + } + +} \ No newline at end of file From 6ea2db4cb175b8af4013532e4959278c088e3bdd Mon Sep 17 00:00:00 2001 From: Nathan Lapierre Date: Thu, 5 Jun 2014 02:07:49 -0300 Subject: [PATCH 074/184] keep absolute path --- tests/TestTestRunner.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp index 8a69241..f489f81 100644 --- a/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -1,9 +1,10 @@ -#include "../UnitTest++.h" +#include "UnitTest++/UnitTestPP.h" #include "RecordingReporter.h" -#include "../ReportAssert.h" -#include "../TestList.h" -#include "../TimeHelpers.h" -#include "../TimeConstraint.h" +#include "UnitTest++/ReportAssert.h" +#include "UnitTest++/TestList.h" +#include "UnitTest++/TimeHelpers.h" +#include "UnitTest++/TimeConstraint.h" +#include "UnitTest++/ReportAssertImpl.h" using namespace UnitTest; From 1fe3d727769cfa51593b3aef9ce590c4210b8d77 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 27 Jun 2014 22:42:53 -0500 Subject: [PATCH 075/184] Reformatted code from #54. --- tests/TestTestRunner.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp index f489f81..6f7c1bb 100644 --- a/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -24,12 +24,17 @@ namespace virtual void RunImpl() const { TestResults& testResults_ = *CurrentTest::Results(); + for (int i=0; i < count; ++i) { if (asserted) + { ReportAssert("desc", "file", 0); + } else if (!success) + { testResults_.OnTestFailure(m_details, "message"); + } } } @@ -38,8 +43,13 @@ namespace int const count; }; - struct FixtureBase { - explicit FixtureBase() : runner(reporter) { } + struct FixtureBase + { + FixtureBase() + : runner(reporter) + { + } + template int RunTestsIf(TestList const& list, char const* suiteName, const Predicate& predicate, int maxTestTimeInMs) @@ -51,6 +61,7 @@ namespace CurrentTest::Details() = oldDetails; return result; } + TestRunner runner; RecordingReporter reporter; }; @@ -83,7 +94,11 @@ namespace class SlowTest : public Test { public: - SlowTest() : Test("slow", "somesuite", "filename", 123) {} + SlowTest() + : Test("slow", "somesuite", "filename", 123) + { + } + virtual void RunImpl() const { TimeHelpers::SleepMs(20); @@ -277,7 +292,7 @@ namespace Test fail("fail"); CHECK(predicate(&pass)); - CHECK(!predicate(&fail)); + CHECK(!predicate(&fail)); } TEST_FIXTURE(TestRunnerFixture, TestRunnerRunsTestsThatPassPredicate) From 719a6e4bf56314b5b7150180fce7eb780dc59622 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 7 Nov 2014 23:47:37 -0600 Subject: [PATCH 076/184] Remove vs_projects and xcode_projects --- vs_projects/strip_cmake.bat | 17 - vs_projects/vs2003_x86/TestUnitTest++.vcproj | 329 ---------- vs_projects/vs2003_x86/UnitTest++.sln | 42 -- vs_projects/vs2003_x86/UnitTest++.vcproj | 373 ----------- vs_projects/vs2005_x64/TestUnitTest++.vcproj | 330 ---------- vs_projects/vs2005_x64/UnitTest++.sln | 38 -- vs_projects/vs2005_x64/UnitTest++.vcproj | 374 ----------- vs_projects/vs2005_x86/TestUnitTest++.vcproj | 330 ---------- vs_projects/vs2005_x86/UnitTest++.sln | 38 -- vs_projects/vs2005_x86/UnitTest++.vcproj | 374 ----------- vs_projects/vs2008_x64/TestUnitTest++.vcproj | 330 ---------- vs_projects/vs2008_x64/UnitTest++.sln | 38 -- vs_projects/vs2008_x64/UnitTest++.vcproj | 374 ----------- vs_projects/vs2008_x86/TestUnitTest++.vcproj | 330 ---------- vs_projects/vs2008_x86/UnitTest++.sln | 38 -- vs_projects/vs2008_x86/UnitTest++.vcproj | 374 ----------- vs_projects/vs2010_x64/TestUnitTest++.vcxproj | 295 --------- .../vs2010_x64/TestUnitTest++.vcxproj.filters | 30 - vs_projects/vs2010_x64/UnitTest++.sln | 38 -- vs_projects/vs2010_x64/UnitTest++.vcxproj | 252 -------- .../vs2010_x64/UnitTest++.vcxproj.filters | 63 -- vs_projects/vs2010_x86/TestUnitTest++.vcxproj | 295 --------- .../vs2010_x86/TestUnitTest++.vcxproj.filters | 30 - vs_projects/vs2010_x86/UnitTest++.sln | 38 -- vs_projects/vs2010_x86/UnitTest++.vcxproj | 252 -------- .../vs2010_x86/UnitTest++.vcxproj.filters | 63 -- vs_projects/vs2012_x64/TestUnitTest++.vcxproj | 299 --------- .../vs2012_x64/TestUnitTest++.vcxproj.filters | 30 - vs_projects/vs2012_x64/UnitTest++.sln | 38 -- vs_projects/vs2012_x64/UnitTest++.vcxproj | 256 -------- .../vs2012_x64/UnitTest++.vcxproj.filters | 63 -- vs_projects/vs2012_x86/TestUnitTest++.vcxproj | 306 --------- .../vs2012_x86/TestUnitTest++.vcxproj.filters | 30 - vs_projects/vs2012_x86/UnitTest++.sln | 38 -- vs_projects/vs2012_x86/UnitTest++.vcxproj | 256 -------- .../vs2012_x86/UnitTest++.vcxproj.filters | 63 -- xcode_projects/.gitignore | 10 - .../UnitTest++.xcodeproj/project.pbxproj | 580 ------------------ .../contents.xcworkspacedata | 7 - 39 files changed, 7061 deletions(-) delete mode 100644 vs_projects/strip_cmake.bat delete mode 100644 vs_projects/vs2003_x86/TestUnitTest++.vcproj delete mode 100644 vs_projects/vs2003_x86/UnitTest++.sln delete mode 100644 vs_projects/vs2003_x86/UnitTest++.vcproj delete mode 100644 vs_projects/vs2005_x64/TestUnitTest++.vcproj delete mode 100644 vs_projects/vs2005_x64/UnitTest++.sln delete mode 100644 vs_projects/vs2005_x64/UnitTest++.vcproj delete mode 100644 vs_projects/vs2005_x86/TestUnitTest++.vcproj delete mode 100644 vs_projects/vs2005_x86/UnitTest++.sln delete mode 100644 vs_projects/vs2005_x86/UnitTest++.vcproj delete mode 100644 vs_projects/vs2008_x64/TestUnitTest++.vcproj delete mode 100644 vs_projects/vs2008_x64/UnitTest++.sln delete mode 100644 vs_projects/vs2008_x64/UnitTest++.vcproj delete mode 100644 vs_projects/vs2008_x86/TestUnitTest++.vcproj delete mode 100644 vs_projects/vs2008_x86/UnitTest++.sln delete mode 100644 vs_projects/vs2008_x86/UnitTest++.vcproj delete mode 100644 vs_projects/vs2010_x64/TestUnitTest++.vcxproj delete mode 100644 vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2010_x64/UnitTest++.sln delete mode 100644 vs_projects/vs2010_x64/UnitTest++.vcxproj delete mode 100644 vs_projects/vs2010_x64/UnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2010_x86/TestUnitTest++.vcxproj delete mode 100644 vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2010_x86/UnitTest++.sln delete mode 100644 vs_projects/vs2010_x86/UnitTest++.vcxproj delete mode 100644 vs_projects/vs2010_x86/UnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2012_x64/TestUnitTest++.vcxproj delete mode 100644 vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2012_x64/UnitTest++.sln delete mode 100644 vs_projects/vs2012_x64/UnitTest++.vcxproj delete mode 100644 vs_projects/vs2012_x64/UnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2012_x86/TestUnitTest++.vcxproj delete mode 100644 vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters delete mode 100644 vs_projects/vs2012_x86/UnitTest++.sln delete mode 100644 vs_projects/vs2012_x86/UnitTest++.vcxproj delete mode 100644 vs_projects/vs2012_x86/UnitTest++.vcxproj.filters delete mode 100644 xcode_projects/.gitignore delete mode 100644 xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj delete mode 100644 xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/vs_projects/strip_cmake.bat b/vs_projects/strip_cmake.bat deleted file mode 100644 index 882499e..0000000 --- a/vs_projects/strip_cmake.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -setlocal -set slnDir_=%1 - -rem TODO: Use VS automation to remove CMake projects - -rem This batch file tries to delete things from the sub-folders -rem that may or may not be there based on the Visual Studio -rem version in play. I chose to make it quick and dumb so that -rem it can be called on each project folder with no special -rem logic. - -pushd %slnDir_% -del /Q ALL_BUILD.* check.* cmake_install.cmake CMakeCache.txt CTestTestfile.cmake -del /Q INSTALL.* RUN_TESTS.* -rmdir /s /q CMakeFiles -popd \ No newline at end of file diff --git a/vs_projects/vs2003_x86/TestUnitTest++.vcproj b/vs_projects/vs2003_x86/TestUnitTest++.vcproj deleted file mode 100644 index 4cc0a43..0000000 --- a/vs_projects/vs2003_x86/TestUnitTest++.vcproj +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2003_x86/UnitTest++.sln b/vs_projects/vs2003_x86/UnitTest++.sln deleted file mode 100644 index 9803357..0000000 --- a/vs_projects/vs2003_x86/UnitTest++.sln +++ /dev/null @@ -1,42 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{F39EC7C8-6F40-4523-A955-D6E811D0FCDA}" - ProjectSection(ProjectDependencies) = postProject - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83} = {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - MinSizeRel = MinSizeRel - Release = Release - RelWithDebInfo = RelWithDebInfo - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Debug.ActiveCfg = Debug|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Debug.Build.0 = Debug|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.MinSizeRel.ActiveCfg = MinSizeRel|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.MinSizeRel.Build.0 = MinSizeRel|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Release.ActiveCfg = Release|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.Release.Build.0 = Release|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.RelWithDebInfo.ActiveCfg = RelWithDebInfo|Win32 - {F39EC7C8-6F40-4523-A955-D6E811D0FCDA}.RelWithDebInfo.Build.0 = RelWithDebInfo|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Debug.ActiveCfg = Debug|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Debug.Build.0 = Debug|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.MinSizeRel.ActiveCfg = MinSizeRel|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.MinSizeRel.Build.0 = MinSizeRel|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Release.ActiveCfg = Release|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.Release.Build.0 = Release|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.RelWithDebInfo.ActiveCfg = RelWithDebInfo|Win32 - {F1511AAB-B257-4A50-AFE5-CA8DB30DDB83}.RelWithDebInfo.Build.0 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2003_x86/UnitTest++.vcproj b/vs_projects/vs2003_x86/UnitTest++.vcproj deleted file mode 100644 index 6f39862..0000000 --- a/vs_projects/vs2003_x86/UnitTest++.vcproj +++ /dev/null @@ -1,373 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2005_x64/TestUnitTest++.vcproj b/vs_projects/vs2005_x64/TestUnitTest++.vcproj deleted file mode 100644 index ce54f3d..0000000 --- a/vs_projects/vs2005_x64/TestUnitTest++.vcproj +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2005_x64/UnitTest++.sln b/vs_projects/vs2005_x64/UnitTest++.sln deleted file mode 100644 index 9fff3bd..0000000 --- a/vs_projects/vs2005_x64/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{9AE72F67-C325-4B4E-A001-6242514071DE}" - ProjectSection(ProjectDependencies) = postProject - {0266798B-A432-430B-9DE2-4351926EA9DE} = {0266798B-A432-430B-9DE2-4351926EA9DE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{0266798B-A432-430B-9DE2-4351926EA9DE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - MinSizeRel|x64 = MinSizeRel|x64 - Release|x64 = Release|x64 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9AE72F67-C325-4B4E-A001-6242514071DE}.Debug|x64.ActiveCfg = Debug|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.Debug|x64.Build.0 = Debug|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.Release|x64.ActiveCfg = Release|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.Release|x64.Build.0 = Release|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {9AE72F67-C325-4B4E-A001-6242514071DE}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.Debug|x64.ActiveCfg = Debug|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.Debug|x64.Build.0 = Debug|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.Release|x64.ActiveCfg = Release|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.Release|x64.Build.0 = Release|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {0266798B-A432-430B-9DE2-4351926EA9DE}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2005_x64/UnitTest++.vcproj b/vs_projects/vs2005_x64/UnitTest++.vcproj deleted file mode 100644 index 9a8b47a..0000000 --- a/vs_projects/vs2005_x64/UnitTest++.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2005_x86/TestUnitTest++.vcproj b/vs_projects/vs2005_x86/TestUnitTest++.vcproj deleted file mode 100644 index 7d06e22..0000000 --- a/vs_projects/vs2005_x86/TestUnitTest++.vcproj +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2005_x86/UnitTest++.sln b/vs_projects/vs2005_x86/UnitTest++.sln deleted file mode 100644 index 04cb02a..0000000 --- a/vs_projects/vs2005_x86/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{580F19DE-3641-4DDD-99F5-992777B8789A}" - ProjectSection(ProjectDependencies) = postProject - {74254CA4-A6A2-4867-87B7-5B3A77BDF044} = {74254CA4-A6A2-4867-87B7-5B3A77BDF044} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{74254CA4-A6A2-4867-87B7-5B3A77BDF044}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - MinSizeRel|Win32 = MinSizeRel|Win32 - Release|Win32 = Release|Win32 - RelWithDebInfo|Win32 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {580F19DE-3641-4DDD-99F5-992777B8789A}.Debug|Win32.ActiveCfg = Debug|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.Debug|Win32.Build.0 = Debug|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.Release|Win32.ActiveCfg = Release|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.Release|Win32.Build.0 = Release|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {580F19DE-3641-4DDD-99F5-992777B8789A}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Debug|Win32.ActiveCfg = Debug|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Debug|Win32.Build.0 = Debug|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Release|Win32.ActiveCfg = Release|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.Release|Win32.Build.0 = Release|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {74254CA4-A6A2-4867-87B7-5B3A77BDF044}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2005_x86/UnitTest++.vcproj b/vs_projects/vs2005_x86/UnitTest++.vcproj deleted file mode 100644 index 3182eb8..0000000 --- a/vs_projects/vs2005_x86/UnitTest++.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2008_x64/TestUnitTest++.vcproj b/vs_projects/vs2008_x64/TestUnitTest++.vcproj deleted file mode 100644 index a9421ba..0000000 --- a/vs_projects/vs2008_x64/TestUnitTest++.vcproj +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2008_x64/UnitTest++.sln b/vs_projects/vs2008_x64/UnitTest++.sln deleted file mode 100644 index 6f6762c..0000000 --- a/vs_projects/vs2008_x64/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{7AAC9879-0F64-49B3-9420-0DB18FB337BF}" - ProjectSection(ProjectDependencies) = postProject - {B8F60BD4-3946-4458-A2B3-72B42A399B82} = {B8F60BD4-3946-4458-A2B3-72B42A399B82} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{B8F60BD4-3946-4458-A2B3-72B42A399B82}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - MinSizeRel|x64 = MinSizeRel|x64 - Release|x64 = Release|x64 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Debug|x64.ActiveCfg = Debug|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Debug|x64.Build.0 = Debug|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Release|x64.ActiveCfg = Release|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.Release|x64.Build.0 = Release|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {7AAC9879-0F64-49B3-9420-0DB18FB337BF}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Debug|x64.ActiveCfg = Debug|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Debug|x64.Build.0 = Debug|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Release|x64.ActiveCfg = Release|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.Release|x64.Build.0 = Release|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {B8F60BD4-3946-4458-A2B3-72B42A399B82}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2008_x64/UnitTest++.vcproj b/vs_projects/vs2008_x64/UnitTest++.vcproj deleted file mode 100644 index 5e1bf77..0000000 --- a/vs_projects/vs2008_x64/UnitTest++.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2008_x86/TestUnitTest++.vcproj b/vs_projects/vs2008_x86/TestUnitTest++.vcproj deleted file mode 100644 index 6bdee7c..0000000 --- a/vs_projects/vs2008_x86/TestUnitTest++.vcproj +++ /dev/null @@ -1,330 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2008_x86/UnitTest++.sln b/vs_projects/vs2008_x86/UnitTest++.sln deleted file mode 100644 index 3444310..0000000 --- a/vs_projects/vs2008_x86/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcproj", "{52AD06AB-CCF0-447B-AAEE-F072735C7FB1}" - ProjectSection(ProjectDependencies) = postProject - {241694AB-FC8A-4374-A564-BD0D0BC75020} = {241694AB-FC8A-4374-A564-BD0D0BC75020} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcproj", "{241694AB-FC8A-4374-A564-BD0D0BC75020}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - MinSizeRel|Win32 = MinSizeRel|Win32 - Release|Win32 = Release|Win32 - RelWithDebInfo|Win32 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Debug|Win32.ActiveCfg = Debug|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Debug|Win32.Build.0 = Debug|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Release|Win32.ActiveCfg = Release|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.Release|Win32.Build.0 = Release|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {52AD06AB-CCF0-447B-AAEE-F072735C7FB1}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.Debug|Win32.ActiveCfg = Debug|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.Debug|Win32.Build.0 = Debug|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.Release|Win32.ActiveCfg = Release|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.Release|Win32.Build.0 = Release|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {241694AB-FC8A-4374-A564-BD0D0BC75020}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2008_x86/UnitTest++.vcproj b/vs_projects/vs2008_x86/UnitTest++.vcproj deleted file mode 100644 index 3e2fe4a..0000000 --- a/vs_projects/vs2008_x86/UnitTest++.vcproj +++ /dev/null @@ -1,374 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj deleted file mode 100644 index ca55cae..0000000 --- a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj +++ /dev/null @@ -1,295 +0,0 @@ -サソ - - - - Debug - x64 - - - Release - x64 - - - MinSizeRel - x64 - - - RelWithDebInfo - x64 - - - - {5C5EBB30-ECAF-4BCF-9054-094ED2894699} - Win32Proj - x64 - TestUnitTest++ - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2010_x64\Debug\ - TestUnitTest++.dir\Debug\ - TestUnitTest++ - .exe - true - true - ..\..\vs_projects\vs2010_x64\Release\ - TestUnitTest++.dir\Release\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2010_x64\MinSizeRel\ - TestUnitTest++.dir\MinSizeRel\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2010_x64\RelWithDebInfo\ - TestUnitTest++.dir\RelWithDebInfo\ - TestUnitTest++ - .exe - true - true - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/TestUnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - FB6A3EF4-5303-407E-A45C-687834E9D072 - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters b/vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters deleted file mode 100644 index 3cfece1..0000000 --- a/vs_projects/vs2010_x64/TestUnitTest++.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2010_x64/UnitTest++.sln b/vs_projects/vs2010_x64/UnitTest++.sln deleted file mode 100644 index 71a48b2..0000000 --- a/vs_projects/vs2010_x64/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{5C5EBB30-ECAF-4BCF-9054-094ED2894699}" - ProjectSection(ProjectDependencies) = postProject - {FB6A3EF4-5303-407E-A45C-687834E9D072} = {FB6A3EF4-5303-407E-A45C-687834E9D072} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{FB6A3EF4-5303-407E-A45C-687834E9D072}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - MinSizeRel|x64 = MinSizeRel|x64 - Release|x64 = Release|x64 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Debug|x64.ActiveCfg = Debug|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Debug|x64.Build.0 = Debug|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Release|x64.ActiveCfg = Release|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.Release|x64.Build.0 = Release|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {5C5EBB30-ECAF-4BCF-9054-094ED2894699}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.Debug|x64.ActiveCfg = Debug|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.Debug|x64.Build.0 = Debug|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.Release|x64.ActiveCfg = Release|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.Release|x64.Build.0 = Release|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {FB6A3EF4-5303-407E-A45C-687834E9D072}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2010_x64/UnitTest++.vcxproj b/vs_projects/vs2010_x64/UnitTest++.vcxproj deleted file mode 100644 index 029c9ef..0000000 --- a/vs_projects/vs2010_x64/UnitTest++.vcxproj +++ /dev/null @@ -1,252 +0,0 @@ -サソ - - - - Debug - x64 - - - Release - x64 - - - MinSizeRel - x64 - - - RelWithDebInfo - x64 - - - - {FB6A3EF4-5303-407E-A45C-687834E9D072} - Win32Proj - x64 - UnitTest++ - - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2010_x64\Debug\ - UnitTest++.dir\Debug\ - UnitTest++ - .lib - ..\..\vs_projects\vs2010_x64\Release\ - UnitTest++.dir\Release\ - UnitTest++ - .lib - ..\..\vs_projects\vs2010_x64\MinSizeRel\ - UnitTest++.dir\MinSizeRel\ - UnitTest++ - .lib - ..\..\vs_projects\vs2010_x64\RelWithDebInfo\ - UnitTest++.dir\RelWithDebInfo\ - UnitTest++ - .lib - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Debug/UnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/Release/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/MinSizeRel/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x64/RelWithDebInfo/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2010_x64/UnitTest++.vcxproj.filters b/vs_projects/vs2010_x64/UnitTest++.vcxproj.filters deleted file mode 100644 index 7f071c1..0000000 --- a/vs_projects/vs2010_x64/UnitTest++.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - {DB64CD83-3739-41F0-B91D-D72E42A76AA6} - - - diff --git a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj deleted file mode 100644 index 137b0a5..0000000 --- a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj +++ /dev/null @@ -1,295 +0,0 @@ -サソ - - - - Debug - Win32 - - - Release - Win32 - - - MinSizeRel - Win32 - - - RelWithDebInfo - Win32 - - - - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0} - Win32Proj - Win32 - TestUnitTest++ - - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - Application - false - MultiByte - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2010_x86\Debug\ - TestUnitTest++.dir\Debug\ - TestUnitTest++ - .exe - true - true - ..\..\vs_projects\vs2010_x86\Release\ - TestUnitTest++.dir\Release\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2010_x86\MinSizeRel\ - TestUnitTest++.dir\MinSizeRel\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2010_x86\RelWithDebInfo\ - TestUnitTest++.dir\RelWithDebInfo\ - TestUnitTest++ - .exe - true - true - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/TestUnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - 59739FC9-D084-4B2E-BFEA-28D91A9BD3F8 - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters b/vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters deleted file mode 100644 index 3cfece1..0000000 --- a/vs_projects/vs2010_x86/TestUnitTest++.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2010_x86/UnitTest++.sln b/vs_projects/vs2010_x86/UnitTest++.sln deleted file mode 100644 index 93b5868..0000000 --- a/vs_projects/vs2010_x86/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}" - ProjectSection(ProjectDependencies) = postProject - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8} = {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - MinSizeRel|Win32 = MinSizeRel|Win32 - Release|Win32 = Release|Win32 - RelWithDebInfo|Win32 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Debug|Win32.ActiveCfg = Debug|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Debug|Win32.Build.0 = Debug|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Release|Win32.ActiveCfg = Release|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.Release|Win32.Build.0 = Release|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {EF97DD98-4A0A-4AEF-A834-A0DC02FAFFC0}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Debug|Win32.ActiveCfg = Debug|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Debug|Win32.Build.0 = Debug|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Release|Win32.ActiveCfg = Release|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.Release|Win32.Build.0 = Release|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2010_x86/UnitTest++.vcxproj b/vs_projects/vs2010_x86/UnitTest++.vcxproj deleted file mode 100644 index 11f8996..0000000 --- a/vs_projects/vs2010_x86/UnitTest++.vcxproj +++ /dev/null @@ -1,252 +0,0 @@ -サソ - - - - Debug - Win32 - - - Release - Win32 - - - MinSizeRel - Win32 - - - RelWithDebInfo - Win32 - - - - {59739FC9-D084-4B2E-BFEA-28D91A9BD3F8} - Win32Proj - Win32 - UnitTest++ - - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - StaticLibrary - false - MultiByte - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2010_x86\Debug\ - UnitTest++.dir\Debug\ - UnitTest++ - .lib - ..\..\vs_projects\vs2010_x86\Release\ - UnitTest++.dir\Release\ - UnitTest++ - .lib - ..\..\vs_projects\vs2010_x86\MinSizeRel\ - UnitTest++.dir\MinSizeRel\ - UnitTest++ - .lib - ..\..\vs_projects\vs2010_x86\RelWithDebInfo\ - UnitTest++.dir\RelWithDebInfo\ - UnitTest++ - .lib - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Debug/UnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/Release/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/MinSizeRel/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2010_x86/RelWithDebInfo/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2010_x86/UnitTest++.vcxproj.filters b/vs_projects/vs2010_x86/UnitTest++.vcxproj.filters deleted file mode 100644 index 2ea1e73..0000000 --- a/vs_projects/vs2010_x86/UnitTest++.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - {0E6D11F1-BD64-469A-BBC0-AF98B7FFF0CA} - - - diff --git a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj deleted file mode 100644 index cf04ea0..0000000 --- a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj +++ /dev/null @@ -1,299 +0,0 @@ -サソ - - - - Debug - x64 - - - Release - x64 - - - MinSizeRel - x64 - - - RelWithDebInfo - x64 - - - - {FAE7B8C1-428D-45DB-9A26-751A64C666D1} - Win32Proj - x64 - TestUnitTest++ - - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2012_x64\Debug\ - TestUnitTest++.dir\Debug\ - TestUnitTest++ - .exe - true - true - ..\..\vs_projects\vs2012_x64\Release\ - TestUnitTest++.dir\Release\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2012_x64\MinSizeRel\ - TestUnitTest++.dir\MinSizeRel\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2012_x64\RelWithDebInfo\ - TestUnitTest++.dir\RelWithDebInfo\ - TestUnitTest++ - .exe - true - true - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/TestUnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:x64 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/TestUnitTest++.pdb - 10000000 - Console - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - 7867CF0A-53DE-4CAD-A141-976283C590C4 - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters b/vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters deleted file mode 100644 index 3cfece1..0000000 --- a/vs_projects/vs2012_x64/TestUnitTest++.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2012_x64/UnitTest++.sln b/vs_projects/vs2012_x64/UnitTest++.sln deleted file mode 100644 index 43e350c..0000000 --- a/vs_projects/vs2012_x64/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{FAE7B8C1-428D-45DB-9A26-751A64C666D1}" - ProjectSection(ProjectDependencies) = postProject - {7867CF0A-53DE-4CAD-A141-976283C590C4} = {7867CF0A-53DE-4CAD-A141-976283C590C4} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{7867CF0A-53DE-4CAD-A141-976283C590C4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - MinSizeRel|x64 = MinSizeRel|x64 - Release|x64 = Release|x64 - RelWithDebInfo|x64 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Debug|x64.ActiveCfg = Debug|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Debug|x64.Build.0 = Debug|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Release|x64.ActiveCfg = Release|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.Release|x64.Build.0 = Release|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {FAE7B8C1-428D-45DB-9A26-751A64C666D1}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.Debug|x64.ActiveCfg = Debug|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.Debug|x64.Build.0 = Debug|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.MinSizeRel|x64.ActiveCfg = MinSizeRel|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.MinSizeRel|x64.Build.0 = MinSizeRel|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.Release|x64.ActiveCfg = Release|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.Release|x64.Build.0 = Release|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64 - {7867CF0A-53DE-4CAD-A141-976283C590C4}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2012_x64/UnitTest++.vcxproj b/vs_projects/vs2012_x64/UnitTest++.vcxproj deleted file mode 100644 index 3285c87..0000000 --- a/vs_projects/vs2012_x64/UnitTest++.vcxproj +++ /dev/null @@ -1,256 +0,0 @@ -サソ - - - - Debug - x64 - - - Release - x64 - - - MinSizeRel - x64 - - - RelWithDebInfo - x64 - - - - {7867CF0A-53DE-4CAD-A141-976283C590C4} - Win32Proj - x64 - UnitTest++ - - - - StaticLibrary - false - MultiByte - v110 - - - StaticLibrary - false - MultiByte - v110 - - - StaticLibrary - false - MultiByte - v110 - - - StaticLibrary - false - MultiByte - v110 - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2012_x64\Debug\ - UnitTest++.dir\Debug\ - UnitTest++ - .lib - ..\..\vs_projects\vs2012_x64\Release\ - UnitTest++.dir\Release\ - UnitTest++ - .lib - ..\..\vs_projects\vs2012_x64\MinSizeRel\ - UnitTest++.dir\MinSizeRel\ - UnitTest++ - .lib - ..\..\vs_projects\vs2012_x64\RelWithDebInfo\ - UnitTest++.dir\RelWithDebInfo\ - UnitTest++ - .lib - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Debug/UnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/Release/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/MinSizeRel/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x64/RelWithDebInfo/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2012_x64/UnitTest++.vcxproj.filters b/vs_projects/vs2012_x64/UnitTest++.vcxproj.filters deleted file mode 100644 index b692ccf..0000000 --- a/vs_projects/vs2012_x64/UnitTest++.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - {6C3785C9-4B23-45F4-871B-C1DD411A4396} - - - diff --git a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj deleted file mode 100644 index aa63b05..0000000 --- a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj +++ /dev/null @@ -1,306 +0,0 @@ -サソ - - - - Debug - Win32 - - - Release - Win32 - - - MinSizeRel - Win32 - - - RelWithDebInfo - Win32 - - - - {206E8A31-7D19-4632-A9A4-930039BB4A16} - Win32Proj - Win32 - TestUnitTest++ - - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - Application - false - MultiByte - v110 - - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2012_x86\Debug\ - TestUnitTest++.dir\Debug\ - TestUnitTest++ - .exe - true - true - ..\..\vs_projects\vs2012_x86\Release\ - TestUnitTest++.dir\Release\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2012_x86\MinSizeRel\ - TestUnitTest++.dir\MinSizeRel\ - TestUnitTest++ - .exe - false - true - ..\..\vs_projects\vs2012_x86\RelWithDebInfo\ - TestUnitTest++.dir\RelWithDebInfo\ - TestUnitTest++ - .exe - true - true - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/TestUnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Debug\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/TestUnitTest++.pdb - 10000000 - Console - - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;Release\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/TestUnitTest++.pdb - 10000000 - Console - - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;MinSizeRel\UnitTest++.lib - %(AdditionalLibraryDirectories) - false - U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/TestUnitTest++.lib - U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/TestUnitTest++.pdb - 10000000 - Console - - - - - false - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/TestUnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - /machine:X86 /debug %(AdditionalOptions) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib;RelWithDebInfo\UnitTest++.lib - %(AdditionalLibraryDirectories) - true - U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/TestUnitTest++.lib - true - U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/TestUnitTest++.pdb - 10000000 - Console - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4128153F-6FD2-46E5-9330-3650015B97E1 - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters b/vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters deleted file mode 100644 index 3cfece1..0000000 --- a/vs_projects/vs2012_x86/TestUnitTest++.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/vs_projects/vs2012_x86/UnitTest++.sln b/vs_projects/vs2012_x86/UnitTest++.sln deleted file mode 100644 index 466e16e..0000000 --- a/vs_projects/vs2012_x86/UnitTest++.sln +++ /dev/null @@ -1,38 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestUnitTest++", "TestUnitTest++.vcxproj", "{206E8A31-7D19-4632-A9A4-930039BB4A16}" - ProjectSection(ProjectDependencies) = postProject - {4128153F-6FD2-46E5-9330-3650015B97E1} = {4128153F-6FD2-46E5-9330-3650015B97E1} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest++", "UnitTest++.vcxproj", "{4128153F-6FD2-46E5-9330-3650015B97E1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - MinSizeRel|Win32 = MinSizeRel|Win32 - Release|Win32 = Release|Win32 - RelWithDebInfo|Win32 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {206E8A31-7D19-4632-A9A4-930039BB4A16}.Debug|Win32.ActiveCfg = Debug|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.Debug|Win32.Build.0 = Debug|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.Release|Win32.ActiveCfg = Release|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.Release|Win32.Build.0 = Release|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {206E8A31-7D19-4632-A9A4-930039BB4A16}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.Debug|Win32.ActiveCfg = Debug|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.Debug|Win32.Build.0 = Debug|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.MinSizeRel|Win32.ActiveCfg = MinSizeRel|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.MinSizeRel|Win32.Build.0 = MinSizeRel|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.Release|Win32.ActiveCfg = Release|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.Release|Win32.Build.0 = Release|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.RelWithDebInfo|Win32.ActiveCfg = RelWithDebInfo|Win32 - {4128153F-6FD2-46E5-9330-3650015B97E1}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vs_projects/vs2012_x86/UnitTest++.vcxproj b/vs_projects/vs2012_x86/UnitTest++.vcxproj deleted file mode 100644 index aab2c24..0000000 --- a/vs_projects/vs2012_x86/UnitTest++.vcxproj +++ /dev/null @@ -1,256 +0,0 @@ -サソ - - - - Debug - Win32 - - - Release - Win32 - - - MinSizeRel - Win32 - - - RelWithDebInfo - Win32 - - - - {4128153F-6FD2-46E5-9330-3650015B97E1} - Win32Proj - Win32 - UnitTest++ - - - - StaticLibrary - false - MultiByte - v110 - - - StaticLibrary - false - MultiByte - v110 - - - StaticLibrary - false - MultiByte - v110 - - - StaticLibrary - false - MultiByte - v110 - - - - - - - - - <_ProjectFileVersion>10.0.20506.1 - ..\..\vs_projects\vs2012_x86\Debug\ - UnitTest++.dir\Debug\ - UnitTest++ - .lib - ..\..\vs_projects\vs2012_x86\Release\ - UnitTest++.dir\Release\ - UnitTest++ - .lib - ..\..\vs_projects\vs2012_x86\MinSizeRel\ - UnitTest++.dir\MinSizeRel\ - UnitTest++ - .lib - ..\..\vs_projects\vs2012_x86\RelWithDebInfo\ - UnitTest++.dir\RelWithDebInfo\ - UnitTest++ - .lib - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - EnableFastChecks - CompileAsCpp - ProgramDatabase - Sync - Disabled - Disabled - NotUsing - MultiThreadedDebugDLL - true - Level3 - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions) - Debug - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Debug/UnitTest++.pdb - - - WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - AnySuitable - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="Release";%(PreprocessorDefinitions) - Release - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/Release/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - Sync - OnlyExplicitInline - MinSpace - NotUsing - MultiThreadedDLL - true - Level3 - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions) - MinSizeRel - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/MinSizeRel/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - /Zm1000 %(AdditionalOptions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - CompileAsCpp - ProgramDatabase - Sync - OnlyExplicitInline - MaxSpeed - NotUsing - MultiThreadedDLL - true - Level3 - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions) - RelWithDebInfo - $(IntDir) - U:/unittest-cpp-pj/vs_projects/vs2012_x86/RelWithDebInfo/UnitTest++.pdb - - - WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_DEPRECATE;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions) - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - - - U:/unittest-cpp-pj/.;%(AdditionalIncludeDirectories) - $(IntDir) - %(Filename).h - %(Filename).tlb - %(Filename)_i.c - %(Filename)_p.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vs_projects/vs2012_x86/UnitTest++.vcxproj.filters b/vs_projects/vs2012_x86/UnitTest++.vcxproj.filters deleted file mode 100644 index 7818cf8..0000000 --- a/vs_projects/vs2012_x86/UnitTest++.vcxproj.filters +++ /dev/null @@ -1,63 +0,0 @@ -サソ - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Win32 - - - - - {27C32F86-0D7D-4B85-AF93-E62D39E9D551} - - - diff --git a/xcode_projects/.gitignore b/xcode_projects/.gitignore deleted file mode 100644 index aa64f28..0000000 --- a/xcode_projects/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -####################################### -# Temporary OS X files - -.DS_Store - -####################################### -# Personal XCode 4 settings - -xcuserdata -*.xcuserstate diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj deleted file mode 100644 index 2a06528..0000000 --- a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.pbxproj +++ /dev/null @@ -1,580 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 83D5FCED171F910E005B0069 /* AssertException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCB5171F910E005B0069 /* AssertException.cpp */; }; - 83D5FCEE171F910E005B0069 /* AssertException.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCB6171F910E005B0069 /* AssertException.h */; }; - 83D5FCEF171F910E005B0069 /* CheckMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCB7171F910E005B0069 /* CheckMacros.h */; }; - 83D5FCF0171F910E005B0069 /* Checks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCB8171F910E005B0069 /* Checks.cpp */; }; - 83D5FCF1171F910E005B0069 /* Checks.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCB9171F910E005B0069 /* Checks.h */; }; - 83D5FCF2171F910E005B0069 /* CompositeTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCBA171F910E005B0069 /* CompositeTestReporter.cpp */; }; - 83D5FCF3171F910E005B0069 /* CompositeTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCBB171F910E005B0069 /* CompositeTestReporter.h */; }; - 83D5FCF4171F910E005B0069 /* Config.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCBC171F910E005B0069 /* Config.h */; }; - 83D5FCF5171F910E005B0069 /* CurrentTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCBD171F910E005B0069 /* CurrentTest.cpp */; }; - 83D5FCF6171F910E005B0069 /* CurrentTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCBE171F910E005B0069 /* CurrentTest.h */; }; - 83D5FCF7171F910E005B0069 /* DeferredTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCBF171F910E005B0069 /* DeferredTestReporter.cpp */; }; - 83D5FCF8171F910E005B0069 /* DeferredTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC0171F910E005B0069 /* DeferredTestReporter.h */; }; - 83D5FCF9171F910E005B0069 /* DeferredTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCC1171F910E005B0069 /* DeferredTestResult.cpp */; }; - 83D5FCFA171F910E005B0069 /* DeferredTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC2171F910E005B0069 /* DeferredTestResult.h */; }; - 83D5FCFB171F910E005B0069 /* ExceptionMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC3171F910E005B0069 /* ExceptionMacros.h */; }; - 83D5FCFC171F910E005B0069 /* ExecuteTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC4171F910E005B0069 /* ExecuteTest.h */; }; - 83D5FCFD171F910E005B0069 /* HelperMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC5171F910E005B0069 /* HelperMacros.h */; }; - 83D5FCFE171F910E005B0069 /* MemoryOutStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCC7171F910E005B0069 /* MemoryOutStream.cpp */; }; - 83D5FCFF171F910E005B0069 /* MemoryOutStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCC8171F910E005B0069 /* MemoryOutStream.h */; }; - 83D5FD00171F910E005B0069 /* SignalTranslator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCCA171F910E005B0069 /* SignalTranslator.cpp */; }; - 83D5FD01171F910E005B0069 /* SignalTranslator.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCCB171F910E005B0069 /* SignalTranslator.h */; }; - 83D5FD02171F910E005B0069 /* TimeHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCCC171F910E005B0069 /* TimeHelpers.cpp */; }; - 83D5FD03171F910E005B0069 /* TimeHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCCD171F910E005B0069 /* TimeHelpers.h */; }; - 83D5FD04171F910E005B0069 /* ReportAssert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCCE171F910E005B0069 /* ReportAssert.cpp */; }; - 83D5FD05171F910E005B0069 /* ReportAssert.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCCF171F910E005B0069 /* ReportAssert.h */; }; - 83D5FD06171F910E005B0069 /* ReportAssertImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD0171F910E005B0069 /* ReportAssertImpl.h */; }; - 83D5FD07171F910E005B0069 /* Test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD1171F910E005B0069 /* Test.cpp */; }; - 83D5FD08171F910E005B0069 /* Test.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD2171F910E005B0069 /* Test.h */; }; - 83D5FD09171F910E005B0069 /* TestDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD3171F910E005B0069 /* TestDetails.cpp */; }; - 83D5FD0A171F910E005B0069 /* TestDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD4171F910E005B0069 /* TestDetails.h */; }; - 83D5FD0B171F910E005B0069 /* TestList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD5171F910E005B0069 /* TestList.cpp */; }; - 83D5FD0C171F910E005B0069 /* TestList.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD6171F910E005B0069 /* TestList.h */; }; - 83D5FD0D171F910E005B0069 /* TestMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD7171F910E005B0069 /* TestMacros.h */; }; - 83D5FD0E171F910E005B0069 /* TestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCD8171F910E005B0069 /* TestReporter.cpp */; }; - 83D5FD0F171F910E005B0069 /* TestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCD9171F910E005B0069 /* TestReporter.h */; }; - 83D5FD10171F910E005B0069 /* TestReporterStdout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCDA171F910E005B0069 /* TestReporterStdout.cpp */; }; - 83D5FD11171F910E005B0069 /* TestReporterStdout.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCDB171F910E005B0069 /* TestReporterStdout.h */; }; - 83D5FD12171F910E005B0069 /* TestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCDC171F910E005B0069 /* TestResults.cpp */; }; - 83D5FD13171F910E005B0069 /* TestResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCDD171F910E005B0069 /* TestResults.h */; }; - 83D5FD14171F910E005B0069 /* TestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCDE171F910E005B0069 /* TestRunner.cpp */; }; - 83D5FD15171F910E005B0069 /* TestRunner.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCDF171F910E005B0069 /* TestRunner.h */; }; - 83D5FD16171F910E005B0069 /* TestSuite.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE0171F910E005B0069 /* TestSuite.h */; }; - 83D5FD17171F910E005B0069 /* TimeConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCE1171F910E005B0069 /* TimeConstraint.cpp */; }; - 83D5FD18171F910E005B0069 /* TimeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE2171F910E005B0069 /* TimeConstraint.h */; }; - 83D5FD19171F910E005B0069 /* TimeHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE3171F910E005B0069 /* TimeHelpers.h */; }; - 83D5FD1A171F910E005B0069 /* UnitTest++.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE4171F910E005B0069 /* UnitTest++.h */; }; - 83D5FD1B171F910E005B0069 /* UnitTestPP.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCE5171F910E005B0069 /* UnitTestPP.h */; }; - 83D5FD1E171F910E005B0069 /* XmlTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */; }; - 83D5FD1F171F910E005B0069 /* XmlTestReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */; }; - 83D5FD45171F9218005B0069 /* Main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD2E171F9218005B0069 /* Main.cpp */; }; - 83D5FD46171F9218005B0069 /* TestAssertHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD33171F9218005B0069 /* TestAssertHandler.cpp */; }; - 83D5FD47171F9218005B0069 /* TestCheckMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD34171F9218005B0069 /* TestCheckMacros.cpp */; }; - 83D5FD48171F9218005B0069 /* TestChecks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD35171F9218005B0069 /* TestChecks.cpp */; }; - 83D5FD49171F9218005B0069 /* TestCompositeTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD36171F9218005B0069 /* TestCompositeTestReporter.cpp */; }; - 83D5FD4A171F9218005B0069 /* TestCurrentTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD37171F9218005B0069 /* TestCurrentTest.cpp */; }; - 83D5FD4B171F9218005B0069 /* TestDeferredTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD38171F9218005B0069 /* TestDeferredTestReporter.cpp */; }; - 83D5FD4C171F9218005B0069 /* TestExceptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD39171F9218005B0069 /* TestExceptions.cpp */; }; - 83D5FD4D171F9218005B0069 /* TestMemoryOutStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3A171F9218005B0069 /* TestMemoryOutStream.cpp */; }; - 83D5FD4E171F9218005B0069 /* TestTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3B171F9218005B0069 /* TestTest.cpp */; }; - 83D5FD4F171F9218005B0069 /* TestTestList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3C171F9218005B0069 /* TestTestList.cpp */; }; - 83D5FD50171F9218005B0069 /* TestTestMacros.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3D171F9218005B0069 /* TestTestMacros.cpp */; }; - 83D5FD51171F9218005B0069 /* TestTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3E171F9218005B0069 /* TestTestResults.cpp */; }; - 83D5FD52171F9218005B0069 /* TestTestRunner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD3F171F9218005B0069 /* TestTestRunner.cpp */; }; - 83D5FD53171F9218005B0069 /* TestTestSuite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD40171F9218005B0069 /* TestTestSuite.cpp */; }; - 83D5FD54171F9218005B0069 /* TestTimeConstraint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD41171F9218005B0069 /* TestTimeConstraint.cpp */; }; - 83D5FD55171F9218005B0069 /* TestTimeConstraintMacro.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD42171F9218005B0069 /* TestTimeConstraintMacro.cpp */; }; - 83D5FD56171F9218005B0069 /* TestUnitTestPP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD43171F9218005B0069 /* TestUnitTestPP.cpp */; }; - 83D5FD57171F9218005B0069 /* TestXmlTestReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83D5FD44171F9218005B0069 /* TestXmlTestReporter.cpp */; }; - 83D5FD58171F9494005B0069 /* libUnitTest++.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 83D5FD22171F91B6005B0069 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libUnitTest++.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 83D5FCB5171F910E005B0069 /* AssertException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AssertException.cpp; sourceTree = ""; }; - 83D5FCB6171F910E005B0069 /* AssertException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssertException.h; sourceTree = ""; }; - 83D5FCB7171F910E005B0069 /* CheckMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckMacros.h; sourceTree = ""; }; - 83D5FCB8171F910E005B0069 /* Checks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Checks.cpp; sourceTree = ""; }; - 83D5FCB9171F910E005B0069 /* Checks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Checks.h; sourceTree = ""; }; - 83D5FCBA171F910E005B0069 /* CompositeTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompositeTestReporter.cpp; sourceTree = ""; }; - 83D5FCBB171F910E005B0069 /* CompositeTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompositeTestReporter.h; sourceTree = ""; }; - 83D5FCBC171F910E005B0069 /* Config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = ""; }; - 83D5FCBD171F910E005B0069 /* CurrentTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CurrentTest.cpp; sourceTree = ""; }; - 83D5FCBE171F910E005B0069 /* CurrentTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CurrentTest.h; sourceTree = ""; }; - 83D5FCBF171F910E005B0069 /* DeferredTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeferredTestReporter.cpp; sourceTree = ""; }; - 83D5FCC0171F910E005B0069 /* DeferredTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeferredTestReporter.h; sourceTree = ""; }; - 83D5FCC1171F910E005B0069 /* DeferredTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeferredTestResult.cpp; sourceTree = ""; }; - 83D5FCC2171F910E005B0069 /* DeferredTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeferredTestResult.h; sourceTree = ""; }; - 83D5FCC3171F910E005B0069 /* ExceptionMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionMacros.h; sourceTree = ""; }; - 83D5FCC4171F910E005B0069 /* ExecuteTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecuteTest.h; sourceTree = ""; }; - 83D5FCC5171F910E005B0069 /* HelperMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HelperMacros.h; sourceTree = ""; }; - 83D5FCC7171F910E005B0069 /* MemoryOutStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryOutStream.cpp; sourceTree = ""; }; - 83D5FCC8171F910E005B0069 /* MemoryOutStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryOutStream.h; sourceTree = ""; }; - 83D5FCCA171F910E005B0069 /* SignalTranslator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SignalTranslator.cpp; sourceTree = ""; }; - 83D5FCCB171F910E005B0069 /* SignalTranslator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalTranslator.h; sourceTree = ""; }; - 83D5FCCC171F910E005B0069 /* TimeHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeHelpers.cpp; sourceTree = ""; }; - 83D5FCCD171F910E005B0069 /* TimeHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeHelpers.h; sourceTree = ""; }; - 83D5FCCE171F910E005B0069 /* ReportAssert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReportAssert.cpp; sourceTree = ""; }; - 83D5FCCF171F910E005B0069 /* ReportAssert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportAssert.h; sourceTree = ""; }; - 83D5FCD0171F910E005B0069 /* ReportAssertImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReportAssertImpl.h; sourceTree = ""; }; - 83D5FCD1171F910E005B0069 /* Test.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Test.cpp; sourceTree = ""; }; - 83D5FCD2171F910E005B0069 /* Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test.h; sourceTree = ""; }; - 83D5FCD3171F910E005B0069 /* TestDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestDetails.cpp; sourceTree = ""; }; - 83D5FCD4171F910E005B0069 /* TestDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestDetails.h; sourceTree = ""; }; - 83D5FCD5171F910E005B0069 /* TestList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestList.cpp; sourceTree = ""; }; - 83D5FCD6171F910E005B0069 /* TestList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestList.h; sourceTree = ""; }; - 83D5FCD7171F910E005B0069 /* TestMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMacros.h; sourceTree = ""; }; - 83D5FCD8171F910E005B0069 /* TestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestReporter.cpp; sourceTree = ""; }; - 83D5FCD9171F910E005B0069 /* TestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestReporter.h; sourceTree = ""; }; - 83D5FCDA171F910E005B0069 /* TestReporterStdout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestReporterStdout.cpp; sourceTree = ""; }; - 83D5FCDB171F910E005B0069 /* TestReporterStdout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestReporterStdout.h; sourceTree = ""; }; - 83D5FCDC171F910E005B0069 /* TestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestResults.cpp; sourceTree = ""; }; - 83D5FCDD171F910E005B0069 /* TestResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestResults.h; sourceTree = ""; }; - 83D5FCDE171F910E005B0069 /* TestRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestRunner.cpp; sourceTree = ""; }; - 83D5FCDF171F910E005B0069 /* TestRunner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestRunner.h; sourceTree = ""; }; - 83D5FCE0171F910E005B0069 /* TestSuite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSuite.h; sourceTree = ""; }; - 83D5FCE1171F910E005B0069 /* TimeConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeConstraint.cpp; sourceTree = ""; }; - 83D5FCE2171F910E005B0069 /* TimeConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeConstraint.h; sourceTree = ""; }; - 83D5FCE3171F910E005B0069 /* TimeHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeHelpers.h; sourceTree = ""; }; - 83D5FCE4171F910E005B0069 /* UnitTest++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UnitTest++.h"; sourceTree = ""; }; - 83D5FCE5171F910E005B0069 /* UnitTestPP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnitTestPP.h; sourceTree = ""; }; - 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XmlTestReporter.cpp; sourceTree = ""; }; - 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XmlTestReporter.h; sourceTree = ""; }; - 83D5FD24171F91B7005B0069 /* TestUnitTest++ */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "TestUnitTest++"; sourceTree = BUILT_PRODUCTS_DIR; }; - 83D5FD2E171F9218005B0069 /* Main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Main.cpp; sourceTree = ""; }; - 83D5FD2F171F9218005B0069 /* RecordingReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecordingReporter.h; sourceTree = ""; }; - 83D5FD30171F9218005B0069 /* ScopedCurrentTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScopedCurrentTest.h; sourceTree = ""; }; - 83D5FD33171F9218005B0069 /* TestAssertHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestAssertHandler.cpp; sourceTree = ""; }; - 83D5FD34171F9218005B0069 /* TestCheckMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCheckMacros.cpp; sourceTree = ""; }; - 83D5FD35171F9218005B0069 /* TestChecks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestChecks.cpp; sourceTree = ""; }; - 83D5FD36171F9218005B0069 /* TestCompositeTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCompositeTestReporter.cpp; sourceTree = ""; }; - 83D5FD37171F9218005B0069 /* TestCurrentTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestCurrentTest.cpp; sourceTree = ""; }; - 83D5FD38171F9218005B0069 /* TestDeferredTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestDeferredTestReporter.cpp; sourceTree = ""; }; - 83D5FD39171F9218005B0069 /* TestExceptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestExceptions.cpp; sourceTree = ""; }; - 83D5FD3A171F9218005B0069 /* TestMemoryOutStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMemoryOutStream.cpp; sourceTree = ""; }; - 83D5FD3B171F9218005B0069 /* TestTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTest.cpp; sourceTree = ""; }; - 83D5FD3C171F9218005B0069 /* TestTestList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestList.cpp; sourceTree = ""; }; - 83D5FD3D171F9218005B0069 /* TestTestMacros.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestMacros.cpp; sourceTree = ""; }; - 83D5FD3E171F9218005B0069 /* TestTestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestResults.cpp; sourceTree = ""; }; - 83D5FD3F171F9218005B0069 /* TestTestRunner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestRunner.cpp; sourceTree = ""; }; - 83D5FD40171F9218005B0069 /* TestTestSuite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTestSuite.cpp; sourceTree = ""; }; - 83D5FD41171F9218005B0069 /* TestTimeConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTimeConstraint.cpp; sourceTree = ""; }; - 83D5FD42171F9218005B0069 /* TestTimeConstraintMacro.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestTimeConstraintMacro.cpp; sourceTree = ""; }; - 83D5FD43171F9218005B0069 /* TestUnitTestPP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestUnitTestPP.cpp; sourceTree = ""; }; - 83D5FD44171F9218005B0069 /* TestXmlTestReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestXmlTestReporter.cpp; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8347D76C171F8D1C00FE3FC1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 83D5FD21171F91B6005B0069 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 83D5FD58171F9494005B0069 /* libUnitTest++.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 8347D766171F8D1C00FE3FC1 = { - isa = PBXGroup; - children = ( - 83D5FCB4171F910E005B0069 /* UnitTest++ */, - 83D5FD2D171F9218005B0069 /* tests */, - 8347D770171F8D1C00FE3FC1 /* Products */, - ); - sourceTree = ""; - }; - 8347D770171F8D1C00FE3FC1 /* Products */ = { - isa = PBXGroup; - children = ( - 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */, - 83D5FD24171F91B7005B0069 /* TestUnitTest++ */, - ); - name = Products; - sourceTree = ""; - }; - 83D5FCB4171F910E005B0069 /* UnitTest++ */ = { - isa = PBXGroup; - children = ( - 83D5FCB5171F910E005B0069 /* AssertException.cpp */, - 83D5FCB6171F910E005B0069 /* AssertException.h */, - 83D5FCB7171F910E005B0069 /* CheckMacros.h */, - 83D5FCB8171F910E005B0069 /* Checks.cpp */, - 83D5FCB9171F910E005B0069 /* Checks.h */, - 83D5FCBA171F910E005B0069 /* CompositeTestReporter.cpp */, - 83D5FCBB171F910E005B0069 /* CompositeTestReporter.h */, - 83D5FCBC171F910E005B0069 /* Config.h */, - 83D5FCBD171F910E005B0069 /* CurrentTest.cpp */, - 83D5FCBE171F910E005B0069 /* CurrentTest.h */, - 83D5FCBF171F910E005B0069 /* DeferredTestReporter.cpp */, - 83D5FCC0171F910E005B0069 /* DeferredTestReporter.h */, - 83D5FCC1171F910E005B0069 /* DeferredTestResult.cpp */, - 83D5FCC2171F910E005B0069 /* DeferredTestResult.h */, - 83D5FCC3171F910E005B0069 /* ExceptionMacros.h */, - 83D5FCC4171F910E005B0069 /* ExecuteTest.h */, - 83D5FCC5171F910E005B0069 /* HelperMacros.h */, - 83D5FCC7171F910E005B0069 /* MemoryOutStream.cpp */, - 83D5FCC8171F910E005B0069 /* MemoryOutStream.h */, - 83D5FCC9171F910E005B0069 /* Posix */, - 83D5FCCE171F910E005B0069 /* ReportAssert.cpp */, - 83D5FCCF171F910E005B0069 /* ReportAssert.h */, - 83D5FCD0171F910E005B0069 /* ReportAssertImpl.h */, - 83D5FCD1171F910E005B0069 /* Test.cpp */, - 83D5FCD2171F910E005B0069 /* Test.h */, - 83D5FCD3171F910E005B0069 /* TestDetails.cpp */, - 83D5FCD4171F910E005B0069 /* TestDetails.h */, - 83D5FCD5171F910E005B0069 /* TestList.cpp */, - 83D5FCD6171F910E005B0069 /* TestList.h */, - 83D5FCD7171F910E005B0069 /* TestMacros.h */, - 83D5FCD8171F910E005B0069 /* TestReporter.cpp */, - 83D5FCD9171F910E005B0069 /* TestReporter.h */, - 83D5FCDA171F910E005B0069 /* TestReporterStdout.cpp */, - 83D5FCDB171F910E005B0069 /* TestReporterStdout.h */, - 83D5FCDC171F910E005B0069 /* TestResults.cpp */, - 83D5FCDD171F910E005B0069 /* TestResults.h */, - 83D5FCDE171F910E005B0069 /* TestRunner.cpp */, - 83D5FCDF171F910E005B0069 /* TestRunner.h */, - 83D5FCE0171F910E005B0069 /* TestSuite.h */, - 83D5FCE1171F910E005B0069 /* TimeConstraint.cpp */, - 83D5FCE2171F910E005B0069 /* TimeConstraint.h */, - 83D5FCE3171F910E005B0069 /* TimeHelpers.h */, - 83D5FCE4171F910E005B0069 /* UnitTest++.h */, - 83D5FCE5171F910E005B0069 /* UnitTestPP.h */, - 83D5FCEB171F910E005B0069 /* XmlTestReporter.cpp */, - 83D5FCEC171F910E005B0069 /* XmlTestReporter.h */, - ); - name = "UnitTest++"; - path = "../../UnitTest++"; - sourceTree = ""; - }; - 83D5FCC9171F910E005B0069 /* Posix */ = { - isa = PBXGroup; - children = ( - 83D5FCCA171F910E005B0069 /* SignalTranslator.cpp */, - 83D5FCCB171F910E005B0069 /* SignalTranslator.h */, - 83D5FCCC171F910E005B0069 /* TimeHelpers.cpp */, - 83D5FCCD171F910E005B0069 /* TimeHelpers.h */, - ); - path = Posix; - sourceTree = ""; - }; - 83D5FD2D171F9218005B0069 /* tests */ = { - isa = PBXGroup; - children = ( - 83D5FD2E171F9218005B0069 /* Main.cpp */, - 83D5FD2F171F9218005B0069 /* RecordingReporter.h */, - 83D5FD30171F9218005B0069 /* ScopedCurrentTest.h */, - 83D5FD33171F9218005B0069 /* TestAssertHandler.cpp */, - 83D5FD34171F9218005B0069 /* TestCheckMacros.cpp */, - 83D5FD35171F9218005B0069 /* TestChecks.cpp */, - 83D5FD36171F9218005B0069 /* TestCompositeTestReporter.cpp */, - 83D5FD37171F9218005B0069 /* TestCurrentTest.cpp */, - 83D5FD38171F9218005B0069 /* TestDeferredTestReporter.cpp */, - 83D5FD39171F9218005B0069 /* TestExceptions.cpp */, - 83D5FD3A171F9218005B0069 /* TestMemoryOutStream.cpp */, - 83D5FD3B171F9218005B0069 /* TestTest.cpp */, - 83D5FD3C171F9218005B0069 /* TestTestList.cpp */, - 83D5FD3D171F9218005B0069 /* TestTestMacros.cpp */, - 83D5FD3E171F9218005B0069 /* TestTestResults.cpp */, - 83D5FD3F171F9218005B0069 /* TestTestRunner.cpp */, - 83D5FD40171F9218005B0069 /* TestTestSuite.cpp */, - 83D5FD41171F9218005B0069 /* TestTimeConstraint.cpp */, - 83D5FD42171F9218005B0069 /* TestTimeConstraintMacro.cpp */, - 83D5FD43171F9218005B0069 /* TestUnitTestPP.cpp */, - 83D5FD44171F9218005B0069 /* TestXmlTestReporter.cpp */, - ); - name = tests; - path = ../../tests; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8347D76D171F8D1C00FE3FC1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 83D5FCEE171F910E005B0069 /* AssertException.h in Headers */, - 83D5FCEF171F910E005B0069 /* CheckMacros.h in Headers */, - 83D5FCF1171F910E005B0069 /* Checks.h in Headers */, - 83D5FCF3171F910E005B0069 /* CompositeTestReporter.h in Headers */, - 83D5FCF4171F910E005B0069 /* Config.h in Headers */, - 83D5FCF6171F910E005B0069 /* CurrentTest.h in Headers */, - 83D5FCF8171F910E005B0069 /* DeferredTestReporter.h in Headers */, - 83D5FCFA171F910E005B0069 /* DeferredTestResult.h in Headers */, - 83D5FCFB171F910E005B0069 /* ExceptionMacros.h in Headers */, - 83D5FCFC171F910E005B0069 /* ExecuteTest.h in Headers */, - 83D5FCFD171F910E005B0069 /* HelperMacros.h in Headers */, - 83D5FCFF171F910E005B0069 /* MemoryOutStream.h in Headers */, - 83D5FD01171F910E005B0069 /* SignalTranslator.h in Headers */, - 83D5FD03171F910E005B0069 /* TimeHelpers.h in Headers */, - 83D5FD05171F910E005B0069 /* ReportAssert.h in Headers */, - 83D5FD06171F910E005B0069 /* ReportAssertImpl.h in Headers */, - 83D5FD08171F910E005B0069 /* Test.h in Headers */, - 83D5FD0A171F910E005B0069 /* TestDetails.h in Headers */, - 83D5FD0C171F910E005B0069 /* TestList.h in Headers */, - 83D5FD0D171F910E005B0069 /* TestMacros.h in Headers */, - 83D5FD0F171F910E005B0069 /* TestReporter.h in Headers */, - 83D5FD11171F910E005B0069 /* TestReporterStdout.h in Headers */, - 83D5FD13171F910E005B0069 /* TestResults.h in Headers */, - 83D5FD15171F910E005B0069 /* TestRunner.h in Headers */, - 83D5FD16171F910E005B0069 /* TestSuite.h in Headers */, - 83D5FD18171F910E005B0069 /* TimeConstraint.h in Headers */, - 83D5FD19171F910E005B0069 /* TimeHelpers.h in Headers */, - 83D5FD1A171F910E005B0069 /* UnitTest++.h in Headers */, - 83D5FD1B171F910E005B0069 /* UnitTestPP.h in Headers */, - 83D5FD1F171F910E005B0069 /* XmlTestReporter.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8347D76E171F8D1C00FE3FC1 /* UnitTest++ */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8347D773171F8D1C00FE3FC1 /* Build configuration list for PBXNativeTarget "UnitTest++" */; - buildPhases = ( - 8347D76B171F8D1C00FE3FC1 /* Sources */, - 8347D76C171F8D1C00FE3FC1 /* Frameworks */, - 8347D76D171F8D1C00FE3FC1 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "UnitTest++"; - productName = "UnitTest++"; - productReference = 8347D76F171F8D1C00FE3FC1 /* libUnitTest++.a */; - productType = "com.apple.product-type.library.static"; - }; - 83D5FD23171F91B6005B0069 /* TestUnitTest++ */ = { - isa = PBXNativeTarget; - buildConfigurationList = 83D5FD2A171F91B7005B0069 /* Build configuration list for PBXNativeTarget "TestUnitTest++" */; - buildPhases = ( - 83D5FD20171F91B6005B0069 /* Sources */, - 83D5FD21171F91B6005B0069 /* Frameworks */, - 83D5FD22171F91B6005B0069 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "TestUnitTest++"; - productName = "TestUnitTest++"; - productReference = 83D5FD24171F91B7005B0069 /* TestUnitTest++ */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 8347D767171F8D1C00FE3FC1 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0460; - ORGANIZATIONNAME = "UnitTest++"; - }; - buildConfigurationList = 8347D76A171F8D1C00FE3FC1 /* Build configuration list for PBXProject "UnitTest++" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 8347D766171F8D1C00FE3FC1; - productRefGroup = 8347D770171F8D1C00FE3FC1 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8347D76E171F8D1C00FE3FC1 /* UnitTest++ */, - 83D5FD23171F91B6005B0069 /* TestUnitTest++ */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 8347D76B171F8D1C00FE3FC1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 83D5FCED171F910E005B0069 /* AssertException.cpp in Sources */, - 83D5FCF0171F910E005B0069 /* Checks.cpp in Sources */, - 83D5FCF2171F910E005B0069 /* CompositeTestReporter.cpp in Sources */, - 83D5FCF5171F910E005B0069 /* CurrentTest.cpp in Sources */, - 83D5FCF7171F910E005B0069 /* DeferredTestReporter.cpp in Sources */, - 83D5FCF9171F910E005B0069 /* DeferredTestResult.cpp in Sources */, - 83D5FCFE171F910E005B0069 /* MemoryOutStream.cpp in Sources */, - 83D5FD00171F910E005B0069 /* SignalTranslator.cpp in Sources */, - 83D5FD02171F910E005B0069 /* TimeHelpers.cpp in Sources */, - 83D5FD04171F910E005B0069 /* ReportAssert.cpp in Sources */, - 83D5FD07171F910E005B0069 /* Test.cpp in Sources */, - 83D5FD09171F910E005B0069 /* TestDetails.cpp in Sources */, - 83D5FD0B171F910E005B0069 /* TestList.cpp in Sources */, - 83D5FD0E171F910E005B0069 /* TestReporter.cpp in Sources */, - 83D5FD10171F910E005B0069 /* TestReporterStdout.cpp in Sources */, - 83D5FD12171F910E005B0069 /* TestResults.cpp in Sources */, - 83D5FD14171F910E005B0069 /* TestRunner.cpp in Sources */, - 83D5FD17171F910E005B0069 /* TimeConstraint.cpp in Sources */, - 83D5FD1E171F910E005B0069 /* XmlTestReporter.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 83D5FD20171F91B6005B0069 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 83D5FD45171F9218005B0069 /* Main.cpp in Sources */, - 83D5FD46171F9218005B0069 /* TestAssertHandler.cpp in Sources */, - 83D5FD47171F9218005B0069 /* TestCheckMacros.cpp in Sources */, - 83D5FD48171F9218005B0069 /* TestChecks.cpp in Sources */, - 83D5FD49171F9218005B0069 /* TestCompositeTestReporter.cpp in Sources */, - 83D5FD4A171F9218005B0069 /* TestCurrentTest.cpp in Sources */, - 83D5FD4B171F9218005B0069 /* TestDeferredTestReporter.cpp in Sources */, - 83D5FD4C171F9218005B0069 /* TestExceptions.cpp in Sources */, - 83D5FD4D171F9218005B0069 /* TestMemoryOutStream.cpp in Sources */, - 83D5FD4E171F9218005B0069 /* TestTest.cpp in Sources */, - 83D5FD4F171F9218005B0069 /* TestTestList.cpp in Sources */, - 83D5FD50171F9218005B0069 /* TestTestMacros.cpp in Sources */, - 83D5FD51171F9218005B0069 /* TestTestResults.cpp in Sources */, - 83D5FD52171F9218005B0069 /* TestTestRunner.cpp in Sources */, - 83D5FD53171F9218005B0069 /* TestTestSuite.cpp in Sources */, - 83D5FD54171F9218005B0069 /* TestTimeConstraint.cpp in Sources */, - 83D5FD55171F9218005B0069 /* TestTimeConstraintMacro.cpp in Sources */, - 83D5FD56171F9218005B0069 /* TestUnitTestPP.cpp in Sources */, - 83D5FD57171F9218005B0069 /* TestXmlTestReporter.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 8347D771171F8D1C00FE3FC1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 8347D772171F8D1C00FE3FC1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ARCHS = "$(ARCHS_STANDARD_64_BIT)"; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; - }; - name = Release; - }; - 8347D774171F8D1C00FE3FC1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 8347D775171F8D1C00FE3FC1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - 83D5FD2B171F91B7005B0069 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = "$(SRCROOT)/../../"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 83D5FD2C171F91B7005B0069 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - HEADER_SEARCH_PATHS = "$(SRCROOT)/../../"; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 8347D76A171F8D1C00FE3FC1 /* Build configuration list for PBXProject "UnitTest++" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8347D771171F8D1C00FE3FC1 /* Debug */, - 8347D772171F8D1C00FE3FC1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8347D773171F8D1C00FE3FC1 /* Build configuration list for PBXNativeTarget "UnitTest++" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8347D774171F8D1C00FE3FC1 /* Debug */, - 8347D775171F8D1C00FE3FC1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83D5FD2A171F91B7005B0069 /* Build configuration list for PBXNativeTarget "TestUnitTest++" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83D5FD2B171F91B7005B0069 /* Debug */, - 83D5FD2C171F91B7005B0069 /* Release */, - ); - defaultConfigurationIsVisible = 0; - }; -/* End XCConfigurationList section */ - }; - rootObject = 8347D767171F8D1C00FE3FC1 /* Project object */; -} diff --git a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 241816d..0000000 --- a/xcode_projects/xcode4-6/UnitTest++.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - From 493c05527e7ab7ca20c044cd2a74c20f86e121e5 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 7 Nov 2014 23:49:58 -0600 Subject: [PATCH 077/184] Remove all Visual Studio 6 project files. --- TestUnitTestPP_vs6.dsp | 169 --------------------------- UnitTestPP_vs6.dsp | 260 ----------------------------------------- UnitTestPP_vs6.dsw | 44 ------- 3 files changed, 473 deletions(-) delete mode 100644 TestUnitTestPP_vs6.dsp delete mode 100644 UnitTestPP_vs6.dsp delete mode 100644 UnitTestPP_vs6.dsw diff --git a/TestUnitTestPP_vs6.dsp b/TestUnitTestPP_vs6.dsp deleted file mode 100644 index 6e0f85f..0000000 --- a/TestUnitTestPP_vs6.dsp +++ /dev/null @@ -1,169 +0,0 @@ -# Microsoft Developer Studio Project File - Name="TestUnitTestPP_vs6" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** 編集しないでください ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=TestUnitTestPP_vs6 - Win32 Debug -!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 -!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください -!MESSAGE -!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak". -!MESSAGE -!MESSAGE NMAKE の実行時に構成を指定できます -!MESSAGE コマンド ライン上でマクロの設定を定義します。例: -!MESSAGE -!MESSAGE NMAKE /f "TestUnitTestPP_vs6.mak" CFG="TestUnitTestPP_vs6 - Win32 Debug" -!MESSAGE -!MESSAGE 選択可能なビルド モード: -!MESSAGE -!MESSAGE "TestUnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Console Application" 用) -!MESSAGE "TestUnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Console Application" 用) -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "TestUnitTestPP_vs6 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "TestUnitTestPP_vs6 - Win32 Release" -# Name "TestUnitTestPP_vs6 - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\tests\Main.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestAssertHandler.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestCheckMacros.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestChecks.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestCurrentTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestDeferredTestReporter.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestMemoryOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestList.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestMacros.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestResults.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestRunner.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTestSuite.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTimeConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestTimeConstraintMacro.cpp -# End Source File -# Begin Source File - -SOURCE=".\src\tests\TestUnitTestPP.cpp" -# End Source File -# Begin Source File - -SOURCE=.\src\tests\TestXmlTestReporter.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\src\tests\RecordingReporter.h -# End Source File -# Begin Source File - -SOURCE=.\src\tests\ScopedCurrentTest.h -# End Source File -# End Group -# End Target -# End Project diff --git a/UnitTestPP_vs6.dsp b/UnitTestPP_vs6.dsp deleted file mode 100644 index b9014cd..0000000 --- a/UnitTestPP_vs6.dsp +++ /dev/null @@ -1,260 +0,0 @@ -# Microsoft Developer Studio Project File - Name="UnitTestPP_vs6" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** 編集しないでください ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=UnitTestPP_vs6 - Win32 Debug -!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 -!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください -!MESSAGE -!MESSAGE NMAKE /f "UnitTestPP_vs6.mak". -!MESSAGE -!MESSAGE NMAKE の実行時に構成を指定できます -!MESSAGE コマンド ライン上でマクロの設定を定義します。例: -!MESSAGE -!MESSAGE NMAKE /f "UnitTestPP_vs6.mak" CFG="UnitTestPP_vs6 - Win32 Debug" -!MESSAGE -!MESSAGE 選択可能なビルド モード: -!MESSAGE -!MESSAGE "UnitTestPP_vs6 - Win32 Release" ("Win32 (x86) Static Library" 用) -!MESSAGE "UnitTestPP_vs6 - Win32 Debug" ("Win32 (x86) Static Library" 用) -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "UnitTestPP_vs6 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x411 /d "NDEBUG" -# ADD RSC /l 0x411 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "UnitTestPP_vs6 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x411 /d "_DEBUG" -# ADD RSC /l 0x411 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "UnitTestPP_vs6 - Win32 Release" -# Name "UnitTestPP_vs6 - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\src\AssertException.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\Checks.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\CurrentTest.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestReporter.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestResult.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\MemoryOutStream.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\ReportAssert.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\Test.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestDetails.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestList.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporter.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporterStdout.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestResults.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TestRunner.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\TimeConstraint.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\XmlTestReporter.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\src\AssertException.h -# End Source File -# Begin Source File - -SOURCE=.\src\CheckMacros.h -# End Source File -# Begin Source File - -SOURCE=.\src\Checks.h -# End Source File -# Begin Source File - -SOURCE=.\src\Config.h -# End Source File -# Begin Source File - -SOURCE=.\src\CurrentTest.h -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestReporter.h -# End Source File -# Begin Source File - -SOURCE=.\src\DeferredTestResult.h -# End Source File -# Begin Source File - -SOURCE=.\src\ExecuteTest.h -# End Source File -# Begin Source File - -SOURCE=.\src\MemoryOutStream.h -# End Source File -# Begin Source File - -SOURCE=.\src\ReportAssert.h -# End Source File -# Begin Source File - -SOURCE=.\src\Test.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestDetails.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestList.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestMacros.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporter.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestReporterStdout.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestResults.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestRunner.h -# End Source File -# Begin Source File - -SOURCE=.\src\TestSuite.h -# End Source File -# Begin Source File - -SOURCE=.\src\TimeConstraint.h -# End Source File -# Begin Source File - -SOURCE=.\src\TimeHelpers.h -# End Source File -# Begin Source File - -SOURCE=".\src\unittestpp.h" -# End Source File -# Begin Source File - -SOURCE=.\src\XmlTestReporter.h -# End Source File -# End Group -# Begin Group "Win32" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\src\Win32\TimeHelpers.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\Win32\TimeHelpers.h -# End Source File -# End Group -# End Target -# End Project diff --git a/UnitTestPP_vs6.dsw b/UnitTestPP_vs6.dsw deleted file mode 100644 index 7afab45..0000000 --- a/UnitTestPP_vs6.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# 警告: このワークスペース ファイル を編集または削除しないでください! - -############################################################################### - -Project: "TestUnitTestPP_vs6"=".\TestUnitTestPP_vs6.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name UnitTestPP_vs6 - End Project Dependency -}}} - -############################################################################### - -Project: "UnitTestPP_vs6"=".\UnitTestPP_vs6.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - From 19fd65743b4ecfa158a3a2f63220b5fed46f2ba8 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 8 Nov 2014 00:24:51 -0600 Subject: [PATCH 078/184] Remove lurking tests/*.vcproj files. --- tests/test-unittestpp_vs2005.vcproj | 580 ---------------------------- tests/test-unittestpp_vs2008.vcproj | 569 --------------------------- 2 files changed, 1149 deletions(-) delete mode 100644 tests/test-unittestpp_vs2005.vcproj delete mode 100644 tests/test-unittestpp_vs2008.vcproj diff --git a/tests/test-unittestpp_vs2005.vcproj b/tests/test-unittestpp_vs2005.vcproj deleted file mode 100644 index fd855f2..0000000 --- a/tests/test-unittestpp_vs2005.vcproj +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test-unittestpp_vs2008.vcproj b/tests/test-unittestpp_vs2008.vcproj deleted file mode 100644 index 93fc202..0000000 --- a/tests/test-unittestpp_vs2008.vcproj +++ /dev/null @@ -1,569 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From db377423a37a3540cb35707cc0b3b922a10946fd Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 19 Dec 2014 11:51:26 -0600 Subject: [PATCH 079/184] Update AUTHORS and configure.ac AUTHORS now references readme.md for the contributor list and identifies pjohnmeyer@gmail.com as the maintainer. configure.ac was modified to version 1.4.1 to differentiate between 1.4 and HEAD, and to prepare for the upcoming 1.5. Fixes #55. --- AUTHORS | 6 ++---- configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1bebc1c..ea32dd9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,3 @@ - Noel Llopis (llopis@convexhull.com) - Charles Nicholson (charles.nicholson@gmail.com) +See README.md for the historic contributor list. -But they have been unactive for years. -The maintainer of this fork is Victor Lavaud (victor.lavaud@gmail.com) +The maintainer of UnitTest++ is Patrick Johnmeyer (pjohnmeyer@gmail.com). diff --git a/configure.ac b/configure.ac index b486107..6bdb316 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([UnitTest++], [1.4], [victor.lavaud@gmail.com]) +AC_INIT([UnitTest++], [1.4.1], [pjohnmeyer@gmail.com]) AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -10,7 +10,7 @@ AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign]) LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:0]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:1]) # Checks for programs. AC_PROG_CXX From d310c03eea6badc8aadd39347fb8a9194610f328 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 3 Apr 2015 23:27:32 -0500 Subject: [PATCH 080/184] Add missing headers to Makefile. Closes #42. --- UnitTest++/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index 5ae9399..399a022 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,6 +1,6 @@ lib_LTLIBRARIES = libUnitTest++.la pkgincludedir = $(includedir)/UnitTest++ -nobase_pkginclude_HEADERS = UnitTest++.h UnitTestPP.h Config.h HelperMacros.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h ExceptionMacros.h ReportAssert.h ReportAssertImpl.h CompositeTestReporter.h +nobase_pkginclude_HEADERS = UnitTest++.h UnitTestPP.h Config.h HelperMacros.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h ExceptionMacros.h ReportAssert.h ReportAssertImpl.h TestReporter.h TestReporterStdout.h CompositeTestReporter.h DeferredTestReporter.h DeferredTestResult.h libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp CompositeTestReporter.cpp libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ check_PROGRAMS = TestUnitTest++ From bd11339b2dc925093da4cbd48c6413812ddebe27 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 4 Apr 2015 00:56:40 -0500 Subject: [PATCH 081/184] Disable CrashingTests... in debug. After some consideration I decided to just remove this test in debug configurations. Many debuggers will behave as XCode does and try to 'catch' this by default. The test still works in release configs. Fixes #45. --- tests/TestTest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 5c4f358..49529eb 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -73,6 +73,8 @@ TEST(ThrowingTestsAreReportedAsFailures) } #if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) +// Skip this test in debug because some debuggers don't like it. +#if defined(NDEBUG) TEST(CrashingTestsAreReportedAsFailures) { class CrashingTest : public Test @@ -96,6 +98,7 @@ TEST(CrashingTestsAreReportedAsFailures) } #endif #endif +#endif TEST(TestWithUnspecifiedSuiteGetsDefaultSuite) { From 2ee151af764e5ed78b3cd6fcedf5fbc71331a623 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 4 Apr 2015 01:31:04 -0500 Subject: [PATCH 082/184] Change unit tests to run as post-build step. This is how it used to be in most of the old project files. The CMake conversion required the tests to be run manually after the build, either by running the binary directly or by calling CTest. This commit removes the 'dependency' on CTest and restores the old build process. --- CMakeLists.txt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b2482d..f94881b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,14 +40,10 @@ endif() target_link_libraries(TestUnitTest++ UnitTest++) -# turn on testing -enable_testing() -add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V) - -# add the test runner as a test -add_test(NAME TestUnitTest++ COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH}) -add_dependencies(check TestUnitTest++) - +# run unit tests as post build step +add_custom_command(TARGET TestUnitTest++ + POST_BUILD COMMAND TestUnitTest++ + COMMENT "Running unit tests") # add install targets # need a custom install path? From 53598bdeb621632614964446c289552d383d618b Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 4 Apr 2015 01:58:43 -0500 Subject: [PATCH 083/184] Update wiki docs submodule. --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 77f069c..a099468 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 77f069c194b93f6f21c5a666ff33d257a41ef45a +Subproject commit a099468e3d5623c880cb00458df6017fdf6acdf6 From 7549615b31feb2f650c173a97dcb1ff48bd1cab8 Mon Sep 17 00:00:00 2001 From: Saul Beniquez Date: Mon, 6 Apr 2015 22:33:45 -0400 Subject: [PATCH 084/184] Adding conditional automake directives to allow Win32 compilation on win32-mingw/cygwin-mingw systems. --- Makefile.am | 4 +++- UnitTest++/Makefile.am | 27 ++++++++++++++++++--------- configure.ac | 6 +++--- tests/Makefile.am | 4 ++++ 4 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 tests/Makefile.am diff --git a/Makefile.am b/Makefile.am index aac5b88..e26a370 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 EXTRA_DIST = docs -SUBDIRS = UnitTest++ + +include UnitTest++/Makefile.am +include tests/Makefile.am diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index 399a022..2a009ef 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,9 +1,18 @@ -lib_LTLIBRARIES = libUnitTest++.la -pkgincludedir = $(includedir)/UnitTest++ -nobase_pkginclude_HEADERS = UnitTest++.h UnitTestPP.h Config.h HelperMacros.h Test.h TestDetails.h TestList.h TestSuite.h TestResults.h TestMacros.h CheckMacros.h TestRunner.h TimeConstraint.h ExecuteTest.h AssertException.h MemoryOutStream.h CurrentTest.h Posix/SignalTranslator.h Checks.h TimeHelpers.h Posix/TimeHelpers.h ExceptionMacros.h ReportAssert.h ReportAssertImpl.h TestReporter.h TestReporterStdout.h CompositeTestReporter.h DeferredTestReporter.h DeferredTestResult.h -libUnitTest___la_SOURCES = AssertException.cpp Test.cpp Checks.cpp TestRunner.cpp TestResults.cpp TestReporter.cpp TestReporterStdout.cpp ReportAssert.cpp TestList.cpp TimeConstraint.cpp TestDetails.cpp MemoryOutStream.cpp DeferredTestReporter.cpp DeferredTestResult.cpp XmlTestReporter.cpp CurrentTest.cpp Posix/SignalTranslator.cpp Posix/TimeHelpers.cpp CompositeTestReporter.cpp -libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ -check_PROGRAMS = TestUnitTest++ -TestUnitTest___SOURCES = $(top_srcdir)/tests/Main.cpp $(top_srcdir)/tests/TestAssertHandler.cpp $(top_srcdir)/tests/TestCheckMacros.cpp $(top_srcdir)/tests/TestChecks.cpp $(top_srcdir)/tests/TestCompositeTestReporter.cpp $(top_srcdir)/tests/TestCurrentTest.cpp $(top_srcdir)/tests/TestDeferredTestReporter.cpp $(top_srcdir)/tests/TestExceptions.cpp $(top_srcdir)/tests/TestMemoryOutStream.cpp $(top_srcdir)/tests/TestTest.cpp $(top_srcdir)/tests/TestTestList.cpp $(top_srcdir)/tests/TestTestMacros.cpp $(top_srcdir)/tests/TestTestResults.cpp $(top_srcdir)/tests/TestTestRunner.cpp $(top_srcdir)/tests/TestTestSuite.cpp $(top_srcdir)/tests/TestTimeConstraint.cpp $(top_srcdir)/tests/TestTimeConstraintMacro.cpp $(top_srcdir)/tests/TestUnitTestPP.cpp $(top_srcdir)/tests/TestXmlTestReporter.cpp -TestUnitTest___LDADD = libUnitTest++.la -TESTS = TestUnitTest++ +lib_LTLIBRARIES = UnitTest++/libUnitTest++.la +pkgincludedir = $(includedir)/UnitTest++/ +nobase_pkginclude_HEADERS = UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/Config.h UnitTest++/HelperMacros.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestSuite.h UnitTest++/TestResults.h UnitTest++/TestMacros.h UnitTest++/CheckMacros.h UnitTest++/TestRunner.h UnitTest++/TimeConstraint.h UnitTest++/ExecuteTest.h UnitTest++/AssertException.h UnitTest++/MemoryOutStream.h UnitTest++/CurrentTest.h UnitTest++/Checks.h UnitTest++/TimeHelpers.h UnitTest++/ExceptionMacros.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/CompositeTestReporter.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h +UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Test.cpp UnitTest++/Checks.cpp UnitTest++/TestRunner.cpp UnitTest++/TestResults.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/ReportAssert.cpp UnitTest++/TestList.cpp UnitTest++/TimeConstraint.cpp UnitTest++/TestDetails.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/XmlTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/CompositeTestReporter.cpp +UnitTest___libUnitTest___la_CPPFLAGS = + +if WINDOWS +nobase_pkginclude_HEADERS += UnitTest++/Win32/TimeHelpers.h +UnitTest___libUnitTest___la_SOURCES += UnitTest++/Win32/TimeHelpers.cpp +else +nobase_pkginclude_HEADERS += UnitTest++/Posix/SignalTranslator.h UnitTest++/Posix/TimeHelpers.h +UnitTest___libUnitTest___la_SOURCES += UnitTest++/Posix/SignalTranslator.cpp UnitTest++/Posix/TimeHelpers.cpp +UnitTest___libUnitTest___la_CPPFLAGS += -DUNITTEST_POSIX +endif + +UnitTest___libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ + + diff --git a/configure.ac b/configure.ac index 6bdb316..c7c0127 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,8 @@ AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) -AM_INIT_AUTOMAKE([foreign]) +AM_INIT_AUTOMAKE([foreign subdir-objects]) +AM_CONDITIONAL([WINDOWS], [test "$OS" == "Windows_NT"]) LT_INIT() AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:1]) @@ -29,6 +30,5 @@ AC_TYPE_SIZE_T # Checks for library functions. AC_CHECK_FUNCS([gettimeofday strstr]) -AC_CONFIG_FILES([Makefile - UnitTest++/Makefile]) +AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..5306292 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,4 @@ +check_PROGRAMS = UnitTest++/TestUnitTest++ +UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp +UnitTest___TestUnitTest___LDADD = UnitTest++/libUnitTest++.la +TESTS = UnitTest++/TestUnitTest++ From 9257dc7febabda21f126e904b505d9b2561be819 Mon Sep 17 00:00:00 2001 From: Saul Beniquez Date: Tue, 7 Apr 2015 09:34:52 -0400 Subject: [PATCH 085/184] Removing duplicated UNITTEST_POSIX #define from cmdline -D flags --- UnitTest++/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index 2a009ef..eaf8cc6 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -10,7 +10,6 @@ UnitTest___libUnitTest___la_SOURCES += UnitTest++/Win32/TimeHelpers.cpp else nobase_pkginclude_HEADERS += UnitTest++/Posix/SignalTranslator.h UnitTest++/Posix/TimeHelpers.h UnitTest___libUnitTest___la_SOURCES += UnitTest++/Posix/SignalTranslator.cpp UnitTest++/Posix/TimeHelpers.cpp -UnitTest___libUnitTest___la_CPPFLAGS += -DUNITTEST_POSIX endif UnitTest___libUnitTest___la_LDFLAGS = -version-number @LIBUNITTEST_SO_VERSION@ From c0e97bf082451f60102e99e85bbffd7853774ee5 Mon Sep 17 00:00:00 2001 From: Saul Beniquez Date: Tue, 7 Apr 2015 12:48:47 -0400 Subject: [PATCH 086/184] [UnitTest++] Removing a spurrious UnitTest___libUnitTest___la_CPPFLAGS assignment --- UnitTest++/Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index eaf8cc6..32f6477 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -2,7 +2,6 @@ lib_LTLIBRARIES = UnitTest++/libUnitTest++.la pkgincludedir = $(includedir)/UnitTest++/ nobase_pkginclude_HEADERS = UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/Config.h UnitTest++/HelperMacros.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestSuite.h UnitTest++/TestResults.h UnitTest++/TestMacros.h UnitTest++/CheckMacros.h UnitTest++/TestRunner.h UnitTest++/TimeConstraint.h UnitTest++/ExecuteTest.h UnitTest++/AssertException.h UnitTest++/MemoryOutStream.h UnitTest++/CurrentTest.h UnitTest++/Checks.h UnitTest++/TimeHelpers.h UnitTest++/ExceptionMacros.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/CompositeTestReporter.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Test.cpp UnitTest++/Checks.cpp UnitTest++/TestRunner.cpp UnitTest++/TestResults.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/ReportAssert.cpp UnitTest++/TestList.cpp UnitTest++/TimeConstraint.cpp UnitTest++/TestDetails.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/XmlTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/CompositeTestReporter.cpp -UnitTest___libUnitTest___la_CPPFLAGS = if WINDOWS nobase_pkginclude_HEADERS += UnitTest++/Win32/TimeHelpers.h From 2d493d802017845b4f3b722480e9ee34ebe833d0 Mon Sep 17 00:00:00 2001 From: Saul Beniquez Date: Sun, 19 Apr 2015 18:44:44 -0400 Subject: [PATCH 087/184] Using the $host variable to detect win32 compilers. This is a more portable solution for platform detection in autoconf. Tested on Linux, Cygwin and Cygwin-to-Mingw32 cross-compilation. --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c7c0127..63a816e 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,8 @@ AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign subdir-objects]) -AM_CONDITIONAL([WINDOWS], [test "$OS" == "Windows_NT"]) +AM_CONDITIONAL([WINDOWS], + [test "${host#*mingw}" != "${host}" -o "${host#*msvc}" != "${host}"]) LT_INIT() AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:1]) From edf1e370ef62b2b4100cd75f677b07a37e29b66f Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 25 Apr 2015 02:30:22 -0500 Subject: [PATCH 088/184] Updating docs submodule reference. --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index a099468..0aa16ab 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit a099468e3d5623c880cb00458df6017fdf6acdf6 +Subproject commit 0aa16abcb2d2516de4ca09c0c5d397243522e7c0 From 4b8d3a741863a628db743538de28d63ff1cb8ee2 Mon Sep 17 00:00:00 2001 From: Ben Hymers Date: Mon, 27 Apr 2015 08:52:29 +0100 Subject: [PATCH 089/184] Add AppVeyor configuration file, appveyor.yml Builds project files with cmake, then builds those with VS2013. OS is Windows Server 2012. Debug and Release configurations are both built. --- appveyor.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..c36218a --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,14 @@ +os: + - Windows Server 2012 R2 + +install: + # Generate solution files using cmake, in 'builds' directory. + # No need to create it because it's part of the repo. + - cd builds && cmake -G "Visual Studio 12" ../ && cd .. + +configuration: + - Debug + - Release + +build: + project: builds/UnitTest++.sln From 76e9982dd4f2b6e48f73ff73b4fb3867a4e98d87 Mon Sep 17 00:00:00 2001 From: Ben Hymers Date: Mon, 27 Apr 2015 09:09:35 +0100 Subject: [PATCH 090/184] Add Travis CI configuration file, .travis.yml Builds using CMAKE then GCC and Clang, in Debug and Release configurations --- .travis.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..64fb7c7 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: cpp + +# Build with gcc and clang. +compiler: + - gcc + - clang + +# Build both debug and release configurations, through use of an environment variable in the build matrix. +env: + - CONFIGURATION=Debug + - CONFIGURATION=Release + +# Run cmake to generate makefiles in 'builds' directory. +# No need to create it because it's part of the repo. +# Pass along configuration type to cmake +before_script: + - cd builds && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$CONFIGURATION ../ && cd .. + +# Run make in the directory containing generated makefiles. +script: + - make -C builds From 67013d4b88fdb7af7e7f20953771556f58e2e563 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 14 Jul 2015 20:49:26 -0500 Subject: [PATCH 091/184] Add tiny comment change to trigger Travis. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 64fb7c7..4a44b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ env: # Run cmake to generate makefiles in 'builds' directory. # No need to create it because it's part of the repo. -# Pass along configuration type to cmake +# Pass along configuration type to cmake. before_script: - cd builds && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$CONFIGURATION ../ && cd .. From ae24d94242a6afe27149722ad290e3e34ccb74ca Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 14 Jul 2015 20:58:37 -0500 Subject: [PATCH 092/184] Add travis and appveyor badges to README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 97d5d27..5b9ef61 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://travis-ci.org/unittest-cpp/unittest-cpp.svg?branch=master)](https://travis-ci.org/unittest-cpp/unittest-cpp) +[![Build status](https://ci.appveyor.com/api/projects/status/ffs2k8dddts5cyok/branch/master?svg=true)](https://ci.appveyor.com/project/pjohnmeyer/unittest-cpp/branch/master) + UnitTest++ =========== From c4e36176d989f53cab34152a1b4fc6b1136b4cd9 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Thu, 17 Sep 2015 17:28:44 -0500 Subject: [PATCH 093/184] Disable tests in TestTestMacros.cpp which throw exceptions from user defined destructors. In accordance with the C++11 standard, Visual Studio 2015 adds an implicit 'noexcept' to all user defined destructors. Any destructor throwing an exception causes abort() to be called on the process. This commit fixes #76. --- tests/TestTestMacros.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index 4f0cfed..9a2cad2 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -136,6 +136,11 @@ TEST(FixturesWithThrowingCtorsAreFailures) CHECK(strstr(reporter.lastFailedMessage, "while constructing fixture")); } +// Visual Studio 2015 in compliance with C++11 standard +// implicitly adds a 'noexcept' to all user defined +// destructors. Any exceptions thrown from destructors +// cause abort() to be called on the process. +#if(_MSC_VER < 1900) struct FixtureDtorThrows { ~FixtureDtorThrows() { throw "exception"; } @@ -161,6 +166,7 @@ TEST(FixturesWithThrowingDtorsAreFailures) CHECK_EQUAL(1, failureCount); CHECK(strstr(reporter.lastFailedMessage, "while destroying fixture")); } +#endif const int FailingLine = 123; From 5e52ae70dc0fab34cf11a2ede8d76182773c05d4 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Tue, 22 Sep 2015 08:31:26 +0200 Subject: [PATCH 094/184] =?UTF-8?q?Add=20pkg=20config=20file=20(with=20hel?= =?UTF-8?q?p=20from=20Vicente=20Adolfo=20Bolea=20S=C3=A1nchez)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Makefile.am | 3 +++ UnitTest++.pc.in | 11 +++++++++++ configure.ac | 1 + 4 files changed, 16 insertions(+) create mode 100644 UnitTest++.pc.in diff --git a/.gitignore b/.gitignore index 49c8320..c36c64c 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ Makefile.in .libs *.log *.trs +*.pc diff --git a/Makefile.am b/Makefile.am index e26a370..18db0ef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,3 +3,6 @@ EXTRA_DIST = docs include UnitTest++/Makefile.am include tests/Makefile.am + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = UnitTest++.pc diff --git a/UnitTest++.pc.in b/UnitTest++.pc.in new file mode 100644 index 0000000..5020a22 --- /dev/null +++ b/UnitTest++.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: UnitTest++ +Description: UnitTest++ is a simple C++ Unit Test Framework +URL: https://github.com/unittest-cpp/unittest-cpp +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lUnitTest++ +Cflags: -I${includedir}/ diff --git a/configure.ac b/configure.ac index 63a816e..a6e069d 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ AC_INIT([UnitTest++], [1.4.1], [pjohnmeyer@gmail.com]) AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([UnitTest++.pc]) AM_INIT_AUTOMAKE([foreign subdir-objects]) AM_CONDITIONAL([WINDOWS], From 0a14abb0a52cdfc9c849aadd121a07eb9e32c2a5 Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Wed, 19 Aug 2015 12:20:43 -0700 Subject: [PATCH 095/184] Added support for VS2015 --- CMakeLists.txt | 15 +++++++++++++++ UnitTest++/TimeConstraint.cpp | 4 ++-- UnitTest++/TimeConstraint.h | 8 ++++---- tests/TestTestMacros.cpp | 26 +++++++++++++++++++++++++- tests/TestTimeConstraint.cpp | 8 ++++---- 5 files changed, 50 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f94881b..c573ef9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,21 @@ project(UnitTest++) option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON) +if(MSVC14 OR MSVC12) + # has the support we need +else() + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + if(COMPILER_SUPPORTS_CXX14) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + elseif(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + endif() +endif() + # get the main sources file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.h) file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.cpp) diff --git a/UnitTest++/TimeConstraint.cpp b/UnitTest++/TimeConstraint.cpp index 1c12d83..f806aeb 100644 --- a/UnitTest++/TimeConstraint.cpp +++ b/UnitTest++/TimeConstraint.cpp @@ -6,8 +6,8 @@ namespace UnitTest { -TimeConstraint::TimeConstraint(int ms, TestDetails const& details) - : m_details(details) +TimeConstraint::TimeConstraint(int ms, TestDetails const& details, int lineNumber) + : m_details(details, lineNumber) , m_maxMs(ms) { m_timer.Start(); diff --git a/UnitTest++/TimeConstraint.h b/UnitTest++/TimeConstraint.h index 8c06913..cf6d68a 100644 --- a/UnitTest++/TimeConstraint.h +++ b/UnitTest++/TimeConstraint.h @@ -3,16 +3,16 @@ #include "TimeHelpers.h" #include "HelperMacros.h" +#include "TestDetails.h" namespace UnitTest { class TestResults; -class TestDetails; class UNITTEST_LINKAGE TimeConstraint { public: - TimeConstraint(int ms, TestDetails const& details); + TimeConstraint(int ms, TestDetails const& details, int lineNumber); ~TimeConstraint(); private: @@ -20,12 +20,12 @@ class UNITTEST_LINKAGE TimeConstraint TimeConstraint(TimeConstraint const&); Timer m_timer; - TestDetails const& m_details; + TestDetails const m_details; int const m_maxMs; }; #define UNITTEST_TIME_CONSTRAINT(ms) \ - UnitTest::TimeConstraint unitTest__timeConstraint__(ms, UnitTest::TestDetails(m_details, __LINE__)) + UnitTest::TimeConstraint unitTest__timeConstraint__(ms, m_details, __LINE__) #define UNITTEST_TIME_CONSTRAINT_EXEMPT() \ UNITTEST_MULTILINE_MACRO_BEGIN \ diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index 4f0cfed..2ed9659 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -10,6 +10,30 @@ using namespace UnitTest; using namespace std; +/* test for c++11 support */ +#ifndef _MSC_VER + + /* Test for clang >= 3.3 */ + #ifdef __clang__ + #if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 ))) + #define _NOEXCEPT_OP(x) noexcept(x) + #else + #define _NOEXCEPT_OP(x) + #endif + #endif + + #ifndef __clang__ + /* Test for GCC >= 4.8.0 */ + #ifdef __GNUC__ + #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 )) + #define _NOEXCEPT_OP(x) noexcept(x) + #else + #define _NOEXCEPT_OP(x) + #endif + #endif + #endif +#endif + namespace { TestList list1; @@ -138,7 +162,7 @@ TEST(FixturesWithThrowingCtorsAreFailures) struct FixtureDtorThrows { - ~FixtureDtorThrows() { throw "exception"; } + ~FixtureDtorThrows() _NOEXCEPT_OP(false) { throw "exception"; } }; TestList throwingFixtureTestList2; diff --git a/tests/TestTimeConstraint.cpp b/tests/TestTimeConstraint.cpp index 5cb6c16..ab93a05 100644 --- a/tests/TestTimeConstraint.cpp +++ b/tests/TestTimeConstraint.cpp @@ -14,7 +14,7 @@ TEST(TimeConstraintSucceedsWithFastTest) TestResults result; { ScopedCurrentTest scopedResult(result); - TimeConstraint t(200, TestDetails("", "", "", 0)); + TimeConstraint t(200, TestDetails("", "", "", 0), 0); TimeHelpers::SleepMs(5); } CHECK_EQUAL(0, result.GetFailureCount()); @@ -25,7 +25,7 @@ TEST(TimeConstraintFailsWithSlowTest) TestResults result; { ScopedCurrentTest scopedResult(result); - TimeConstraint t(10, TestDetails("", "", "", 0)); + TimeConstraint t(10, TestDetails("", "", "", 0),0); TimeHelpers::SleepMs(20); } CHECK_EQUAL(1, result.GetFailureCount()); @@ -39,7 +39,7 @@ TEST(TimeConstraintFailureIncludesCorrectData) ScopedCurrentTest scopedResult(result); TestDetails const details("testname", "suitename", "filename", 10); - TimeConstraint t(10, details); + TimeConstraint t(10, details,10); TimeHelpers::SleepMs(20); } @@ -56,7 +56,7 @@ TEST(TimeConstraintFailureIncludesTimeoutInformation) TestResults result(&reporter); { ScopedCurrentTest scopedResult(result); - TimeConstraint t(10, TestDetails("", "", "", 0)); + TimeConstraint t(10, TestDetails("", "", "", 0),0); TimeHelpers::SleepMs(20); } From c5a3903bf944a832a2ef746d8d48f04aeb9f9c76 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 4 Nov 2015 12:04:13 -0600 Subject: [PATCH 096/184] Prepare v1.5.0 tag. --- README.md | 12 +++++++++--- configure.ac | 4 ++-- docs | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5b9ef61..5ec57bc 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,17 @@ Via svn: svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp -### Latest release (v1.4) ### +### Latest release (v1.5.0) ### Via git: git clone https://github.com/unittest-cpp/unittest-cpp cd unittest-cpp - git checkout v1.4 + git checkout v1.5.0 Via svn: - svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.4 unittest-cpp + svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.5.0 unittest-cpp License --------- @@ -77,6 +77,12 @@ Contributors Historic release notes ---------------------- +### Version 1.5 (2015-11-04) ### +- Visual Studio 2015 support +- CMake-based build management +- Integration of SourceForge and Google Code versions of the project +- [Full List](https://github.com/unittest-cpp/unittest-cpp/issues?q=is%3Aissue+is%3Aclosed+milestone%3A1.5.0) + ### Version 1.4 (2008-10-30) ### - CHECK macros work at arbitrary stack depth from inside TESTs. - Remove obsolete TEST_UTILITY macros diff --git a/configure.ac b/configure.ac index 63a816e..c46ffa5 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([UnitTest++], [1.4.1], [pjohnmeyer@gmail.com]) +AC_INIT([UnitTest++], [1.5.0], [pjohnmeyer@gmail.com]) AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -12,7 +12,7 @@ AM_CONDITIONAL([WINDOWS], [test "${host#*mingw}" != "${host}" -o "${host#*msvc}" != "${host}"]) LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [1:4:1]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [1:5:0]) # Checks for programs. AC_PROG_CXX diff --git a/docs b/docs index 0aa16ab..8d4ad23 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 0aa16abcb2d2516de4ca09c0c5d397243522e7c0 +Subproject commit 8d4ad2348f13d35ed7af7c11d6dad2f5ed67f6b4 From 4fccb7687508a27a794339e5a4aea3707cc2827d Mon Sep 17 00:00:00 2001 From: grahamreeds Date: Thu, 12 Nov 2015 12:01:07 +0000 Subject: [PATCH 097/184] Removed conditional compile around FixtureDtorThrows structure. Added a preprocessor block for _MSC_VER noexcept support. --- tests/TestTestMacros.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index f2fcbf0..9bf7b91 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -32,6 +32,15 @@ using namespace std; #endif #endif #endif + +#elif _MSC_VER + + #if (_MSC_VER > 1800) + #define _NOEXCEPT_OP(x) noexcept(x) + #else + #define _NOEXCEPT_OP(x) + #endif + #endif namespace { @@ -160,11 +169,6 @@ TEST(FixturesWithThrowingCtorsAreFailures) CHECK(strstr(reporter.lastFailedMessage, "while constructing fixture")); } -// Visual Studio 2015 in compliance with C++11 standard -// implicitly adds a 'noexcept' to all user defined -// destructors. Any exceptions thrown from destructors -// cause abort() to be called on the process. -#if(_MSC_VER < 1900) struct FixtureDtorThrows { ~FixtureDtorThrows() _NOEXCEPT_OP(false) { throw "exception"; } @@ -190,7 +194,6 @@ TEST(FixturesWithThrowingDtorsAreFailures) CHECK_EQUAL(1, failureCount); CHECK(strstr(reporter.lastFailedMessage, "while destroying fixture")); } -#endif const int FailingLine = 123; From 014d6e48f8c1a68f27bcdb966602743cc098ecf5 Mon Sep 17 00:00:00 2001 From: Richard Powell Date: Wed, 16 Dec 2015 06:53:06 -0800 Subject: [PATCH 098/184] adding an explicit cast for the conversion from int to useconds_t in TimeHelpers::SleepMS. --- UnitTest++/Posix/TimeHelpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest++/Posix/TimeHelpers.cpp b/UnitTest++/Posix/TimeHelpers.cpp index 65c6393..f977ca7 100644 --- a/UnitTest++/Posix/TimeHelpers.cpp +++ b/UnitTest++/Posix/TimeHelpers.cpp @@ -27,7 +27,7 @@ double Timer::GetTimeInMs() const void TimeHelpers::SleepMs(int ms) { - usleep(ms * 1000); + usleep(static_cast(ms * 1000)); } } From 44aa33b02b29860b3060f60014ed95b27a730afa Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 19:50:23 -0600 Subject: [PATCH 099/184] Reduce possible timing test failures TestFinishIsCalledWithCorrectTime was reliant on SleepMs(20) waking up before a certain threshold was hit, which is not reliable. This change uses the actual time of running tests as the top threshold; not a great improvement but a good quick fix. Fixes #90 --- tests/TestTestRunner.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp index 6f7c1bb..0b1f04f 100644 --- a/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -110,8 +110,15 @@ namespace SlowTest test; list.Add(&test); + // Using UnitTest::Timer here is arguably a bit hokey and self-recursive, but + // it should guarantee that the test time recorded is less than that plus the + // overhead of RunTestsIf -- the only thing we can reliably assert without + // reworking the test to not use sleeps at all + Timer actual; + actual.Start(); RunTestsIf(list, NULL, True(), 0); - CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= 0.050f); + + CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= actual.GetTimeInMs()); } TEST_FIXTURE(TestRunnerFixture, FailureCountIsZeroWhenNoTestsAreRun) From 6e1d0f48ab9ad6ac6528e31ccd9d49d07239a618 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 20:05:53 -0600 Subject: [PATCH 100/184] Fix comment in TestTestRunner.cpp "Self-recursive" didn't make much sense. --- tests/TestTestRunner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp index 0b1f04f..d4982a4 100644 --- a/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -110,7 +110,7 @@ namespace SlowTest test; list.Add(&test); - // Using UnitTest::Timer here is arguably a bit hokey and self-recursive, but + // Using UnitTest::Timer here is arguably a bit hokey and self-referential, but // it should guarantee that the test time recorded is less than that plus the // overhead of RunTestsIf -- the only thing we can reliably assert without // reworking the test to not use sleeps at all @@ -334,4 +334,4 @@ namespace CHECK_EQUAL("suite", reporter.lastStartedSuite); } -} \ No newline at end of file +} From b47b4f7e8535346e7b3202df562849ac597b2523 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 22:15:10 -0600 Subject: [PATCH 101/184] Add uncrustify config and run first pass. --- .uncrustify | 488 ++++++++++++ UnitTest++/AssertException.cpp | 10 +- UnitTest++/AssertException.h | 12 +- UnitTest++/CheckMacros.h | 288 +++---- UnitTest++/Checks.cpp | 84 +- UnitTest++/Checks.h | 214 +++--- UnitTest++/CompositeTestReporter.cpp | 99 ++- UnitTest++/CompositeTestReporter.h | 48 +- UnitTest++/Config.h | 40 +- UnitTest++/CurrentTest.cpp | 20 +- UnitTest++/CurrentTest.h | 14 +- UnitTest++/DeferredTestReporter.cpp | 16 +- UnitTest++/DeferredTestReporter.h | 26 +- UnitTest++/DeferredTestResult.cpp | 63 +- UnitTest++/DeferredTestResult.h | 50 +- UnitTest++/ExceptionMacros.h | 16 +- UnitTest++/ExecuteTest.h | 72 +- UnitTest++/HelperMacros.h | 62 +- UnitTest++/MemoryOutStream.cpp | 372 ++++----- UnitTest++/MemoryOutStream.h | 108 +-- UnitTest++/Posix/SignalTranslator.cpp | 60 +- UnitTest++/Posix/SignalTranslator.h | 60 +- UnitTest++/Posix/TimeHelpers.cpp | 52 +- UnitTest++/Posix/TimeHelpers.h | 32 +- UnitTest++/ReportAssert.cpp | 99 +-- UnitTest++/ReportAssert.h | 2 +- UnitTest++/ReportAssertImpl.h | 52 +- UnitTest++/Test.cpp | 41 +- UnitTest++/Test.h | 34 +- UnitTest++/TestDetails.cpp | 30 +- UnitTest++/TestDetails.h | 28 +- UnitTest++/TestList.cpp | 53 +- UnitTest++/TestList.h | 32 +- UnitTest++/TestMacros.h | 164 ++-- UnitTest++/TestReporter.cpp | 5 +- UnitTest++/TestReporter.h | 20 +- UnitTest++/TestReporterStdout.cpp | 64 +- UnitTest++/TestReporterStdout.h | 18 +- UnitTest++/TestResults.cpp | 99 ++- UnitTest++/TestResults.h | 42 +- UnitTest++/TestRunner.cpp | 136 ++-- UnitTest++/TestRunner.h | 96 +-- UnitTest++/TestSuite.h | 10 +- UnitTest++/TimeConstraint.cpp | 34 +- UnitTest++/TimeConstraint.h | 48 +- UnitTest++/TimeHelpers.h | 4 +- UnitTest++/Win32/TimeHelpers.cpp | 80 +- UnitTest++/Win32/TimeHelpers.h | 48 +- UnitTest++/XmlTestReporter.cpp | 201 +++-- UnitTest++/XmlTestReporter.h | 40 +- tests/Main.cpp | 2 +- tests/RecordingReporter.h | 162 ++-- tests/ScopedCurrentTest.h | 39 +- tests/TestAssertHandler.cpp | 237 +++--- tests/TestCheckMacros.cpp | 1014 ++++++++++++------------- tests/TestChecks.cpp | 610 +++++++-------- tests/TestCompositeTestReporter.cpp | 333 ++++---- tests/TestCurrentTest.cpp | 46 +- tests/TestDeferredTestReporter.cpp | 215 +++--- tests/TestExceptions.cpp | 990 ++++++++++++------------ tests/TestMemoryOutStream.cpp | 642 ++++++++-------- tests/TestTest.cpp | 228 +++--- tests/TestTestList.cpp | 80 +- tests/TestTestMacros.cpp | 390 +++++----- tests/TestTestResults.cpp | 200 ++--- tests/TestTestRunner.cpp | 636 ++++++++-------- tests/TestTestSuite.cpp | 5 +- tests/TestTimeConstraint.cpp | 96 +-- tests/TestTimeConstraintMacro.cpp | 156 ++-- tests/TestUnitTestPP.cpp | 273 ++++--- tests/TestXmlTestReporter.cpp | 335 ++++---- 71 files changed, 5460 insertions(+), 5015 deletions(-) create mode 100644 .uncrustify diff --git a/.uncrustify b/.uncrustify new file mode 100644 index 0000000..1d7e5d6 --- /dev/null +++ b/.uncrustify @@ -0,0 +1,488 @@ +# Uncrustify 0.61 +newlines = auto +input_tab_size = 4 +output_tab_size = 3 +string_escape_char = 92 +string_escape_char2 = 0 +tok_split_gte = false +utf8_bom = remove +utf8_byte = false +utf8_force = false +indent_columns = 3 +indent_continue = 0 +indent_with_tabs = 0 +indent_cmt_with_tabs = false +indent_align_string = false +indent_xml_string = 0 +indent_brace = 0 +indent_braces = false +indent_braces_no_func = false +indent_braces_no_class = false +indent_braces_no_struct = false +indent_brace_parent = false +indent_paren_open_brace = false +indent_namespace = true +indent_namespace_single_indent = false +indent_namespace_level = 0 +indent_namespace_limit = 0 +indent_extern = false +indent_class = true +indent_class_colon = false +indent_constr_colon = false +indent_ctor_init_leading = 1 +indent_ctor_init = 0 +indent_else_if = false +indent_var_def_blk = 0 +indent_var_def_cont = false +indent_func_def_force_col1 = false +indent_func_call_param = false +indent_func_def_param = false +indent_func_proto_param = false +indent_func_class_param = false +indent_func_ctor_var_param = false +indent_template_param = false +indent_func_param_double = false +indent_func_const = 0 +indent_func_throw = 0 +indent_member = indent_columns +indent_sing_line_comments = 0 +indent_relative_single_line_comments = true +indent_switch_case = 0 +indent_case_shift = 0 +indent_case_brace = 0 +indent_col1_comment = false +indent_label = 1 +indent_access_spec = -3 +indent_access_spec_body = false +indent_paren_nl = false +indent_paren_close = 0 +indent_comma_paren = false +indent_bool_paren = false +indent_first_bool_expr = false +indent_square_nl = false +indent_preserve_sql = false +indent_align_assign = true +indent_oc_block = false +indent_oc_block_msg = 0 +indent_oc_msg_colon = 0 +indent_oc_msg_prioritize_first_colon = true +indent_oc_block_msg_xcode_style = false +indent_oc_block_msg_from_keyword = false +indent_oc_block_msg_from_colon = false +indent_oc_block_msg_from_caret = false +indent_oc_block_msg_from_brace = false +sp_arith = ignore +sp_assign = ignore +sp_cpp_lambda_assign = ignore +sp_cpp_lambda_paren = ignore +sp_assign_default = ignore +sp_before_assign = ignore +sp_after_assign = ignore +sp_enum_paren = ignore +sp_enum_assign = ignore +sp_enum_before_assign = ignore +sp_enum_after_assign = ignore +sp_pp_concat = add +sp_pp_stringify = ignore +sp_before_pp_stringify = ignore +sp_bool = ignore +sp_compare = ignore +sp_inside_paren = ignore +sp_paren_paren = ignore +sp_cparen_oparen = ignore +sp_balance_nested_parens = false +sp_paren_brace = ignore +sp_before_ptr_star = ignore +sp_before_unnamed_ptr_star = ignore +sp_between_ptr_star = ignore +sp_after_ptr_star = ignore +sp_after_ptr_star_qualifier = ignore +sp_after_ptr_star_func = ignore +sp_ptr_star_paren = ignore +sp_before_ptr_star_func = ignore +sp_before_byref = ignore +sp_before_unnamed_byref = ignore +sp_after_byref = ignore +sp_after_byref_func = ignore +sp_before_byref_func = ignore +sp_after_type = force +sp_before_template_paren = ignore +sp_template_angle = ignore +sp_before_angle = ignore +sp_inside_angle = ignore +sp_after_angle = ignore +sp_angle_paren = ignore +sp_angle_word = ignore +sp_angle_shift = add +sp_permit_cpp11_shift = false +sp_before_sparen = ignore +sp_inside_sparen = ignore +sp_inside_sparen_close = ignore +sp_inside_sparen_open = ignore +sp_after_sparen = ignore +sp_sparen_brace = ignore +sp_invariant_paren = ignore +sp_after_invariant_paren = ignore +sp_special_semi = ignore +sp_before_semi = remove +sp_before_semi_for = ignore +sp_before_semi_for_empty = ignore +sp_after_semi = add +sp_after_semi_for = force +sp_after_semi_for_empty = ignore +sp_before_square = ignore +sp_before_squares = ignore +sp_inside_square = ignore +sp_after_comma = ignore +sp_before_comma = remove +sp_paren_comma = force +sp_before_ellipsis = ignore +sp_after_class_colon = ignore +sp_before_class_colon = ignore +sp_after_constr_colon = ignore +sp_before_constr_colon = ignore +sp_before_case_colon = remove +sp_after_operator = ignore +sp_after_operator_sym = ignore +sp_after_cast = ignore +sp_inside_paren_cast = ignore +sp_cpp_cast_paren = ignore +sp_sizeof_paren = ignore +sp_after_tag = ignore +sp_inside_braces_enum = ignore +sp_inside_braces_struct = ignore +sp_inside_braces = ignore +sp_inside_braces_empty = ignore +sp_type_func = ignore +sp_func_proto_paren = ignore +sp_func_def_paren = ignore +sp_inside_fparens = ignore +sp_inside_fparen = ignore +sp_inside_tparen = ignore +sp_after_tparen_close = ignore +sp_square_fparen = ignore +sp_fparen_brace = ignore +sp_fparen_dbrace = ignore +sp_func_call_paren = ignore +sp_func_call_paren_empty = ignore +sp_func_call_user_paren = ignore +sp_func_class_paren = ignore +sp_return_paren = ignore +sp_attribute_paren = ignore +sp_defined_paren = ignore +sp_throw_paren = ignore +sp_after_throw = ignore +sp_catch_paren = ignore +sp_version_paren = ignore +sp_scope_paren = ignore +sp_macro = ignore +sp_macro_func = ignore +sp_else_brace = ignore +sp_brace_else = ignore +sp_brace_typedef = ignore +sp_catch_brace = ignore +sp_brace_catch = ignore +sp_finally_brace = ignore +sp_brace_finally = ignore +sp_try_brace = ignore +sp_getset_brace = ignore +sp_word_brace = add +sp_word_brace_ns = add +sp_before_dc = ignore +sp_after_dc = ignore +sp_d_array_colon = ignore +sp_not = remove +sp_inv = remove +sp_addr = remove +sp_member = remove +sp_deref = remove +sp_sign = remove +sp_incdec = remove +sp_before_nl_cont = add +sp_after_oc_scope = ignore +sp_after_oc_colon = ignore +sp_before_oc_colon = ignore +sp_after_oc_dict_colon = ignore +sp_before_oc_dict_colon = ignore +sp_after_send_oc_colon = ignore +sp_before_send_oc_colon = ignore +sp_after_oc_type = ignore +sp_after_oc_return_type = ignore +sp_after_oc_at_sel = ignore +sp_after_oc_at_sel_parens = ignore +sp_inside_oc_at_sel_parens = ignore +sp_before_oc_block_caret = ignore +sp_after_oc_block_caret = ignore +sp_after_oc_msg_receiver = ignore +sp_after_oc_property = ignore +sp_cond_colon = ignore +sp_cond_colon_before = ignore +sp_cond_colon_after = ignore +sp_cond_question = ignore +sp_cond_question_before = ignore +sp_cond_question_after = ignore +sp_cond_ternary_short = ignore +sp_case_label = ignore +sp_range = ignore +sp_after_for_colon = ignore +sp_before_for_colon = ignore +sp_extern_paren = ignore +sp_cmt_cpp_start = ignore +sp_endif_cmt = ignore +sp_after_new = ignore +sp_before_tr_emb_cmt = ignore +sp_num_before_tr_emb_cmt = 0 +sp_annotation_paren = ignore +align_keep_tabs = false +align_with_tabs = false +align_on_tabstop = false +align_number_left = false +align_keep_extra_space = false +align_func_params = false +align_same_func_call_params = false +align_var_def_span = 0 +align_var_def_star_style = 0 +align_var_def_amp_style = 0 +align_var_def_thresh = 0 +align_var_def_gap = 0 +align_var_def_colon = false +align_var_def_attribute = false +align_var_def_inline = false +align_assign_span = 0 +align_assign_thresh = 0 +align_enum_equ_span = 0 +align_enum_equ_thresh = 0 +align_var_struct_span = 0 +align_var_struct_thresh = 0 +align_var_struct_gap = 0 +align_struct_init_span = 0 +align_typedef_gap = 0 +align_typedef_span = 0 +align_typedef_func = 0 +align_typedef_star_style = 0 +align_typedef_amp_style = 0 +align_right_cmt_span = 0 +align_right_cmt_mix = false +align_right_cmt_gap = 0 +align_right_cmt_at_col = 0 +align_func_proto_span = 0 +align_func_proto_gap = 0 +align_on_operator = false +align_mix_var_proto = false +align_single_line_func = false +align_single_line_brace = false +align_single_line_brace_gap = 0 +align_oc_msg_spec_span = 0 +align_nl_cont = true +align_pp_define_together = false +align_pp_define_gap = 0 +align_pp_define_span = 0 +align_left_shift = true +align_oc_msg_colon_span = 0 +align_oc_msg_colon_first = false +align_oc_decl_colon = false +nl_collapse_empty_body = true +nl_assign_leave_one_liners = false +nl_class_leave_one_liners = false +nl_enum_leave_one_liners = false +nl_getset_leave_one_liners = false +nl_func_leave_one_liners = false +nl_cpp_lambda_leave_one_liners = false +nl_if_leave_one_liners = false +nl_oc_msg_leave_one_liner = false +nl_start_of_file = ignore +nl_start_of_file_min = 0 +nl_end_of_file = ignore +nl_end_of_file_min = 0 +nl_assign_brace = ignore +nl_assign_square = ignore +nl_after_square_assign = ignore +nl_func_var_def_blk = 0 +nl_typedef_blk_start = 0 +nl_typedef_blk_end = 0 +nl_typedef_blk_in = 0 +nl_var_def_blk_start = 0 +nl_var_def_blk_end = 0 +nl_var_def_blk_in = 0 +nl_fcall_brace = ignore +nl_enum_brace = ignore +nl_struct_brace = ignore +nl_union_brace = ignore +nl_if_brace = ignore +nl_brace_else = ignore +nl_elseif_brace = ignore +nl_else_brace = ignore +nl_else_if = ignore +nl_brace_finally = ignore +nl_finally_brace = ignore +nl_try_brace = ignore +nl_getset_brace = ignore +nl_for_brace = ignore +nl_catch_brace = ignore +nl_brace_catch = ignore +nl_brace_square = ignore +nl_brace_fparen = ignore +nl_while_brace = ignore +nl_scope_brace = ignore +nl_unittest_brace = ignore +nl_version_brace = ignore +nl_using_brace = ignore +nl_brace_brace = ignore +nl_do_brace = ignore +nl_brace_while = ignore +nl_switch_brace = ignore +nl_multi_line_cond = false +nl_multi_line_define = false +nl_before_case = false +nl_before_throw = ignore +nl_after_case = false +nl_case_colon_brace = ignore +nl_namespace_brace = ignore +nl_template_class = ignore +nl_class_brace = ignore +nl_class_init_args = ignore +nl_constr_init_args = ignore +nl_func_type_name = ignore +nl_func_type_name_class = ignore +nl_func_scope_name = ignore +nl_func_proto_type_name = ignore +nl_func_paren = ignore +nl_func_def_paren = ignore +nl_func_decl_start = ignore +nl_func_def_start = ignore +nl_func_decl_start_single = ignore +nl_func_def_start_single = ignore +nl_func_decl_args = ignore +nl_func_def_args = ignore +nl_func_decl_end = ignore +nl_func_def_end = ignore +nl_func_decl_end_single = ignore +nl_func_def_end_single = ignore +nl_func_decl_empty = ignore +nl_func_def_empty = ignore +nl_oc_msg_args = false +nl_fdef_brace = ignore +nl_cpp_ldef_brace = ignore +nl_return_expr = ignore +nl_after_semicolon = false +nl_paren_dbrace_open = ignore +nl_after_brace_open = false +nl_after_brace_open_cmt = false +nl_after_vbrace_open = false +nl_after_vbrace_open_empty = false +nl_after_brace_close = false +nl_after_vbrace_close = false +nl_brace_struct_var = ignore +nl_define_macro = false +nl_squeeze_ifdef = false +nl_before_if = ignore +nl_after_if = ignore +nl_before_for = ignore +nl_after_for = ignore +nl_before_while = ignore +nl_after_while = ignore +nl_before_switch = ignore +nl_after_switch = ignore +nl_before_do = ignore +nl_after_do = ignore +nl_ds_struct_enum_cmt = false +nl_ds_struct_enum_close_brace = false +nl_class_colon = ignore +nl_constr_colon = ignore +nl_create_if_one_liner = false +nl_create_for_one_liner = false +nl_create_while_one_liner = false +pos_arith = ignore +pos_assign = ignore +pos_bool = ignore +pos_compare = ignore +pos_conditional = ignore +pos_comma = ignore +pos_class_comma = ignore +pos_constr_comma = ignore +pos_class_colon = ignore +pos_constr_colon = ignore +code_width = 0 +ls_for_split_full = false +ls_func_split_full = false +ls_code_width = false +nl_max = 0 +nl_after_func_proto = 0 +nl_after_func_proto_group = 0 +nl_after_func_body = 0 +nl_after_func_body_class = 0 +nl_after_func_body_one_liner = 0 +nl_before_block_comment = 0 +nl_before_c_comment = 0 +nl_before_cpp_comment = 0 +nl_after_multiline_comment = false +nl_after_struct = 0 +nl_after_class = 0 +nl_before_access_spec = 0 +nl_after_access_spec = 0 +nl_comment_func_def = 0 +nl_after_try_catch_finally = 0 +nl_around_cs_property = 0 +nl_between_get_set = 0 +nl_property_brace = ignore +eat_blanks_after_open_brace = false +eat_blanks_before_close_brace = false +nl_remove_extra_newlines = 0 +nl_before_return = false +nl_after_return = false +nl_after_annotation = ignore +nl_between_annotation = ignore +mod_full_brace_do = ignore +mod_full_brace_for = ignore +mod_full_brace_function = ignore +mod_full_brace_if = ignore +mod_full_brace_if_chain = false +mod_full_brace_nl = 0 +mod_full_brace_while = ignore +mod_full_brace_using = ignore +mod_paren_on_return = ignore +mod_pawn_semicolon = false +mod_full_paren_if_bool = false +mod_remove_extra_semicolon = false +mod_add_long_function_closebrace_comment = 0 +mod_add_long_namespace_closebrace_comment = 0 +mod_add_long_switch_closebrace_comment = 0 +mod_add_long_ifdef_endif_comment = 0 +mod_add_long_ifdef_else_comment = 0 +mod_sort_import = false +mod_sort_using = false +mod_sort_include = false +mod_move_case_break = false +mod_case_brace = ignore +mod_remove_empty_return = false +cmt_width = 0 +cmt_reflow_mode = 0 +cmt_convert_tab_to_spaces = false +cmt_indent_multi = true +cmt_c_group = false +cmt_c_nl_start = false +cmt_c_nl_end = false +cmt_cpp_group = false +cmt_cpp_nl_start = false +cmt_cpp_nl_end = false +cmt_cpp_to_c = false +cmt_star_cont = false +cmt_sp_before_star_cont = 0 +cmt_sp_after_star_cont = 0 +cmt_multi_check_last = true +cmt_insert_file_header = "" +cmt_insert_file_footer = "" +cmt_insert_func_header = "" +cmt_insert_class_header = "" +cmt_insert_oc_msg_header = "" +cmt_insert_before_preproc = false +pp_indent = add +pp_indent_at_level = true +pp_indent_count = 0 +pp_space = ignore +pp_space_count = 0 +pp_indent_region = 0 +pp_region_indent_code = false +pp_indent_if = 0 +pp_if_indent_code = false +pp_define_at_level = true diff --git a/UnitTest++/AssertException.cpp b/UnitTest++/AssertException.cpp index 9a7d78f..29b3939 100644 --- a/UnitTest++/AssertException.cpp +++ b/UnitTest++/AssertException.cpp @@ -4,13 +4,11 @@ namespace UnitTest { -AssertException::AssertException() -{ -} + AssertException::AssertException() + {} -AssertException::~AssertException() throw() -{ -} + AssertException::~AssertException() throw() + {} } diff --git a/UnitTest++/AssertException.h b/UnitTest++/AssertException.h index e5d0705..e604f63 100644 --- a/UnitTest++/AssertException.h +++ b/UnitTest++/AssertException.h @@ -9,12 +9,12 @@ namespace UnitTest { -class UNITTEST_LINKAGE AssertException : public std::exception -{ -public: - AssertException(); - virtual ~AssertException() throw(); -}; + class UNITTEST_LINKAGE AssertException : public std::exception + { + public: + AssertException(); + virtual ~AssertException() throw(); + }; } diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index 9d6a759..b2a0654 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -1,4 +1,4 @@ -#ifndef UNITTEST_CHECKMACROS_H +#ifndef UNITTEST_CHECKMACROS_H #define UNITTEST_CHECKMACROS_H #include "HelperMacros.h" @@ -11,169 +11,169 @@ #include "ReportAssertImpl.h" #ifdef CHECK - #error UnitTest++ redefines CHECK +#error UnitTest++ redefines CHECK #endif #ifdef CHECK_EQUAL - #error UnitTest++ redefines CHECK_EQUAL +#error UnitTest++ redefines CHECK_EQUAL #endif #ifdef CHECK_CLOSE - #error UnitTest++ redefines CHECK_CLOSE +#error UnitTest++ redefines CHECK_CLOSE #endif #ifdef CHECK_ARRAY_EQUAL - #error UnitTest++ redefines CHECK_ARRAY_EQUAL +#error UnitTest++ redefines CHECK_ARRAY_EQUAL #endif #ifdef CHECK_ARRAY_CLOSE - #error UnitTest++ redefines CHECK_ARRAY_CLOSE +#error UnitTest++ redefines CHECK_ARRAY_CLOSE #endif #ifdef CHECK_ARRAY2D_CLOSE - #error UnitTest++ redefines CHECK_ARRAY2D_CLOSE +#error UnitTest++ redefines CHECK_ARRAY2D_CLOSE #endif -#define CHECK(value) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - if (!UnitTest::Check(value)) \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK(" #value ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_EQUAL(expected, actual) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_CLOSE(expected, actual, tolerance) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_ARRAY_EQUAL(expected, actual, count) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END - -#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"); \ - }) \ - UNITTEST_MULTILINE_MACRO_END +#define CHECK(value) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + if (!UnitTest::Check(value)) \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK(" #value ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_EQUAL(expected, actual) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_CLOSE(expected, actual, tolerance) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_ARRAY_EQUAL(expected, actual, count) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END + +#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"); \ + }) \ + UNITTEST_MULTILINE_MACRO_END // CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h) #ifndef UNITTEST_NO_EXCEPTIONS -#define CHECK_THROW(expression, ExpectedExceptionType) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - 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"); \ - UNITTEST_MULTILINE_MACRO_END - - -#define CHECK_ASSERT(expression) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UnitTest::Detail::ExpectAssert(true); \ - CHECK_THROW(expression, UnitTest::AssertException); \ - UnitTest::Detail::ExpectAssert(false); \ - UNITTEST_MULTILINE_MACRO_END +#define CHECK_THROW(expression, ExpectedExceptionType) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + 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"); \ + UNITTEST_MULTILINE_MACRO_END + + +#define CHECK_ASSERT(expression) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UnitTest::Detail::ExpectAssert(true); \ + CHECK_THROW(expression, UnitTest::AssertException); \ + UnitTest::Detail::ExpectAssert(false); \ + UNITTEST_MULTILINE_MACRO_END #endif #endif diff --git a/UnitTest++/Checks.cpp b/UnitTest++/Checks.cpp index 3e09231..9c0a960 100644 --- a/UnitTest++/Checks.cpp +++ b/UnitTest++/Checks.cpp @@ -3,48 +3,48 @@ namespace UnitTest { -namespace { - -void CheckStringsEqual(TestResults& results, char const* expected, char const* actual, - TestDetails const& details) -{ - using namespace std; - - if ((expected && actual) ? strcmp(expected, actual) : (expected || actual)) - { - UnitTest::MemoryOutStream stream; - stream << "Expected " << (expected ? expected : "") << " but was " << (actual ? 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); -} + namespace { + + void CheckStringsEqual(TestResults& results, char const* expected, char const* actual, + TestDetails const& details) + { + using namespace std; + + if ((expected && actual) ? strcmp(expected, actual) : (expected || actual)) + { + UnitTest::MemoryOutStream stream; + stream << "Expected " << (expected ? expected : "") << " but was " << (actual ? 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/UnitTest++/Checks.h b/UnitTest++/Checks.h index b2cc4db..5b09768 100644 --- a/UnitTest++/Checks.h +++ b/UnitTest++/Checks.h @@ -8,150 +8,150 @@ namespace UnitTest { -template< typename Value > -bool Check(Value const value) -{ - return !!value; // doing double negative to avoid silly VS warnings -} + 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; + 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()); - } -} + results.OnTestFailure(details, stream.GetText()); + } + } -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details); + UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char const* actual, TestDetails const& details); -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details); + UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char* actual, TestDetails const& details); -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details); + UNITTEST_LINKAGE void CheckEqual(TestResults& results, char* expected, char const* actual, TestDetails const& details); -UNITTEST_LINKAGE void CheckEqual(TestResults& results, char const* expected, char* actual, TestDetails const& details); + UNITTEST_LINKAGE 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 > + 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, 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; + 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]); - stream << "Expected [ "; + if (!equal) + { + UnitTest::MemoryOutStream stream; - for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex) + stream << "Expected [ "; + + for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex) stream << expected[expectedIndex] << " "; - stream << "] but was [ "; + stream << "] but was [ "; - for (int actualIndex = 0; actualIndex < count; ++actualIndex) + 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 << "]"; + + 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 [ "; + stream << "] +/- " << tolerance << " but was [ "; - for (int actualIndex = 0; actualIndex < count; ++actualIndex) + for (int actualIndex = 0; actualIndex < count; ++actualIndex) stream << actual[actualIndex] << " "; - stream << "]"; + stream << "]"; - results.OnTestFailure(details, stream.GetText()); - } -} + 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); + 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; + if (!equal) + { + UnitTest::MemoryOutStream stream; - stream << "Expected [ "; + stream << "Expected [ "; - for (int expectedRow = 0; expectedRow < rows; ++expectedRow) - { + for (int expectedRow = 0; expectedRow < rows; ++expectedRow) + { stream << "[ "; for (int expectedColumn = 0; expectedColumn < columns; ++expectedColumn) - stream << expected[expectedRow][expectedColumn] << " "; + stream << expected[expectedRow][expectedColumn] << " "; stream << "] "; - } + } - stream << "] +/- " << tolerance << " but was [ "; + stream << "] +/- " << tolerance << " but was [ "; - for (int actualRow = 0; actualRow < rows; ++actualRow) - { + for (int actualRow = 0; actualRow < rows; ++actualRow) + { stream << "[ "; for (int actualColumn = 0; actualColumn < columns; ++actualColumn) - stream << actual[actualRow][actualColumn] << " "; + stream << actual[actualRow][actualColumn] << " "; stream << "] "; - } + } - stream << "]"; + stream << "]"; - results.OnTestFailure(details, stream.GetText()); - } -} + results.OnTestFailure(details, stream.GetText()); + } + } } diff --git a/UnitTest++/CompositeTestReporter.cpp b/UnitTest++/CompositeTestReporter.cpp index 2dd2ffc..53769f0 100644 --- a/UnitTest++/CompositeTestReporter.cpp +++ b/UnitTest++/CompositeTestReporter.cpp @@ -3,65 +3,64 @@ namespace UnitTest { -CompositeTestReporter::CompositeTestReporter() - : m_reporterCount(0) -{ -} + CompositeTestReporter::CompositeTestReporter() + : m_reporterCount(0) + {} -int CompositeTestReporter::GetReporterCount() const -{ - return m_reporterCount; -} + int CompositeTestReporter::GetReporterCount() const + { + return m_reporterCount; + } -bool CompositeTestReporter::AddReporter(TestReporter* reporter) -{ - if (m_reporterCount == kMaxReporters) - return false; + bool CompositeTestReporter::AddReporter(TestReporter* reporter) + { + if (m_reporterCount == kMaxReporters) + return false; - m_reporters[m_reporterCount++] = reporter; - return true; -} + m_reporters[m_reporterCount++] = reporter; + return true; + } -bool CompositeTestReporter::RemoveReporter(TestReporter* reporter) -{ - for (int index = 0; index < m_reporterCount; ++index) - { - if (m_reporters[index] == reporter) - { + bool CompositeTestReporter::RemoveReporter(TestReporter* reporter) + { + for (int index = 0; index < m_reporterCount; ++index) + { + if (m_reporters[index] == reporter) + { m_reporters[index] = m_reporters[m_reporterCount - 1]; - --m_reporterCount; - return true; - } - } + --m_reporterCount; + return true; + } + } - return false; -} + return false; + } -void CompositeTestReporter::ReportFailure(TestDetails const& details, char const* failure) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportFailure(details, failure); -} + void CompositeTestReporter::ReportFailure(TestDetails const& details, char const* failure) + { + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportFailure(details, failure); + } -void CompositeTestReporter::ReportTestStart(TestDetails const& test) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportTestStart(test); -} + void CompositeTestReporter::ReportTestStart(TestDetails const& test) + { + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportTestStart(test); + } -void CompositeTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportTestFinish(test, secondsElapsed); -} + void CompositeTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) + { + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportTestFinish(test, secondsElapsed); + } -void CompositeTestReporter::ReportSummary(int totalTestCount, - int failedTestCount, - int failureCount, - float secondsElapsed) -{ - for (int index = 0; index < m_reporterCount; ++index) - m_reporters[index]->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); -} + void CompositeTestReporter::ReportSummary(int totalTestCount, + int failedTestCount, + int failureCount, + float secondsElapsed) + { + for (int index = 0; index < m_reporterCount; ++index) + m_reporters[index]->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); + } } diff --git a/UnitTest++/CompositeTestReporter.h b/UnitTest++/CompositeTestReporter.h index a9a0d29..c7e1e6b 100644 --- a/UnitTest++/CompositeTestReporter.h +++ b/UnitTest++/CompositeTestReporter.h @@ -5,30 +5,30 @@ namespace UnitTest { -class UNITTEST_LINKAGE CompositeTestReporter : public TestReporter -{ -public: - CompositeTestReporter(); - - int GetReporterCount() const; - bool AddReporter(TestReporter* reporter); - bool RemoveReporter(TestReporter* reporter); - - 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); - -private: - enum { kMaxReporters = 16 }; - TestReporter* m_reporters[kMaxReporters]; - int m_reporterCount; - - // revoked - CompositeTestReporter(const CompositeTestReporter&); - CompositeTestReporter& operator =(const CompositeTestReporter&); -}; + class UNITTEST_LINKAGE CompositeTestReporter : public TestReporter + { + public: + CompositeTestReporter(); + + int GetReporterCount() const; + bool AddReporter(TestReporter* reporter); + bool RemoveReporter(TestReporter* reporter); + + 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); + + private: + enum { kMaxReporters = 16 }; + TestReporter* m_reporters[kMaxReporters]; + int m_reporterCount; + + // revoked + CompositeTestReporter(const CompositeTestReporter&); + CompositeTestReporter& operator =(const CompositeTestReporter&); + }; } -#endif +#endif diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index 4f695f7..f6757c3 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -4,35 +4,35 @@ // Standard defines documented here: http://predef.sourceforge.net #if defined(_MSC_VER) - #pragma warning(disable:4702) // unreachable code - #pragma warning(disable:4722) // destructor never returns, potential memory leak +#pragma warning(disable:4702)// unreachable code +#pragma warning(disable:4722)// destructor never returns, potential memory leak #if (_MSC_VER == 1200) // VC6 - #define UNITTEST_COMPILER_IS_MSVC6 - #pragma warning(disable:4786) - #pragma warning(disable:4290) - #endif - - #ifdef _USRDLL - #define UNITTEST_WIN32_DLL - #endif - #define UNITTEST_WIN32 +#define UNITTEST_COMPILER_IS_MSVC6 +#pragma warning(disable:4786) +#pragma warning(disable:4290) +#endif + +#ifdef _USRDLL +#define UNITTEST_WIN32_DLL +#endif +#define UNITTEST_WIN32 #endif #if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \ - defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) - #define UNITTEST_POSIX + defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#define UNITTEST_POSIX #endif #if defined(__MINGW32__) - #define UNITTEST_MINGW +#define UNITTEST_MINGW #endif // By default, MemoryOutStream is implemented in terms of std::ostringstream. // This is useful if you are using the CHECK macros on objects that have something like this defined: // std::ostringstream& operator<<(std::ostringstream& s, const YourObject& value) -// +// // On the other hand, it can be more expensive. // Un-comment this line to use the custom MemoryOutStream (no deps on std::ostringstream). @@ -43,7 +43,7 @@ // well as Google Code HEAD users that may have used or defined // UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file. #ifndef UNITTEST_USE_CUSTOM_STREAMS - #define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM +#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM #endif // DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like @@ -55,19 +55,19 @@ // By default, asserts that you report via UnitTest::ReportAssert() abort the current test and // continue to the next one by throwing an exception, which unwinds the stack naturally, destroying -// all auto variables on its way back down. If you don't want to (or can't) use exceptions for your +// all auto variables on its way back down. If you don't want to (or can't) use exceptions for your // platform/compiler, uncomment this line. All exception code will be removed from UnitTest++, // assert recovery will be done via setjmp/longjmp, and NO correct stack unwinding will happen! //#define UNITTEST_NO_EXCEPTIONS -// std namespace qualification: used for functions like strcpy that +// std namespace qualification: used for functions like strcpy that // may live in std:: namespace (cstring header). #if defined( UNITTEST_COMPILER_IS_MSVC6 ) - #define UNIITEST_NS_QUAL_STD(x) x +#define UNIITEST_NS_QUAL_STD(x) x #else - #define UNIITEST_NS_QUAL_STD(x) ::std::x +#define UNIITEST_NS_QUAL_STD(x) ::std::x #endif #endif diff --git a/UnitTest++/CurrentTest.cpp b/UnitTest++/CurrentTest.cpp index dd9d245..b1b1995 100644 --- a/UnitTest++/CurrentTest.cpp +++ b/UnitTest++/CurrentTest.cpp @@ -3,16 +3,16 @@ namespace UnitTest { -UNITTEST_LINKAGE TestResults*& CurrentTest::Results() -{ - static TestResults* testResults = NULL; - return testResults; -} + UNITTEST_LINKAGE TestResults*& CurrentTest::Results() + { + static TestResults* testResults = NULL; + return testResults; + } -UNITTEST_LINKAGE const TestDetails*& CurrentTest::Details() -{ - static const TestDetails* testDetails = NULL; - return testDetails; -} + UNITTEST_LINKAGE const TestDetails*& CurrentTest::Details() + { + static const TestDetails* testDetails = NULL; + return testDetails; + } } diff --git a/UnitTest++/CurrentTest.h b/UnitTest++/CurrentTest.h index 642b9dc..54c40ac 100644 --- a/UnitTest++/CurrentTest.h +++ b/UnitTest++/CurrentTest.h @@ -5,14 +5,14 @@ namespace UnitTest { -class TestResults; -class TestDetails; + class TestResults; + class TestDetails; -namespace CurrentTest -{ - UNITTEST_LINKAGE TestResults*& Results(); - UNITTEST_LINKAGE const TestDetails*& Details(); -} + namespace CurrentTest + { + UNITTEST_LINKAGE TestResults*& Results(); + UNITTEST_LINKAGE const TestDetails*& Details(); + } } diff --git a/UnitTest++/DeferredTestReporter.cpp b/UnitTest++/DeferredTestReporter.cpp index 60e0ded..165e542 100644 --- a/UnitTest++/DeferredTestReporter.cpp +++ b/UnitTest++/DeferredTestReporter.cpp @@ -8,26 +8,26 @@ using namespace UnitTest; void DeferredTestReporter::ReportTestStart(TestDetails const& details) { - m_results.push_back(DeferredTestResult(details.suiteName, details.testName)); + 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(DeferredTestFailure(details.lineNumber, failure)); - r.failureFile = details.filename; + DeferredTestResult& r = m_results.back(); + r.failed = true; + r.failures.push_back(DeferredTestFailure(details.lineNumber, failure)); + r.failureFile = details.filename; } void DeferredTestReporter::ReportTestFinish(TestDetails const&, float secondsElapsed) { - DeferredTestResult& r = m_results.back(); - r.timeElapsed = secondsElapsed; + DeferredTestResult& r = m_results.back(); + r.timeElapsed = secondsElapsed; } DeferredTestReporter::DeferredTestResultList& DeferredTestReporter::GetResults() { - return m_results; + return m_results; } #endif diff --git a/UnitTest++/DeferredTestReporter.h b/UnitTest++/DeferredTestReporter.h index 757e53f..51ac866 100644 --- a/UnitTest++/DeferredTestReporter.h +++ b/UnitTest++/DeferredTestReporter.h @@ -15,19 +15,19 @@ UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestResult); namespace UnitTest { -class UNITTEST_LINKAGE 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; -}; + class UNITTEST_LINKAGE 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; + }; } diff --git a/UnitTest++/DeferredTestResult.cpp b/UnitTest++/DeferredTestResult.cpp index cdad9eb..9a3ee93 100644 --- a/UnitTest++/DeferredTestResult.cpp +++ b/UnitTest++/DeferredTestResult.cpp @@ -7,39 +7,36 @@ namespace UnitTest { -DeferredTestFailure::DeferredTestFailure() - : lineNumber(-1) -{ - failureStr[0] = '\0'; -} - -DeferredTestFailure::DeferredTestFailure(int lineNumber_, const char* failureStr_) - : lineNumber(lineNumber_) -{ - UNIITEST_NS_QUAL_STD(strcpy)(failureStr, failureStr_); -} - -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) -{ -} - -DeferredTestResult::~DeferredTestResult() -{ -} + DeferredTestFailure::DeferredTestFailure() + : lineNumber(-1) + { + failureStr[0] = '\0'; + } + + DeferredTestFailure::DeferredTestFailure(int lineNumber_, const char* failureStr_) + : lineNumber(lineNumber_) + { + UNIITEST_NS_QUAL_STD(strcpy)(failureStr, failureStr_); + } + + 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) + {} + + DeferredTestResult::~DeferredTestResult() + {} } diff --git a/UnitTest++/DeferredTestResult.h b/UnitTest++/DeferredTestResult.h index 0929566..e0d74ef 100644 --- a/UnitTest++/DeferredTestResult.h +++ b/UnitTest++/DeferredTestResult.h @@ -11,15 +11,15 @@ namespace UnitTest { -class UNITTEST_LINKAGE DeferredTestFailure -{ -public: - DeferredTestFailure(); - DeferredTestFailure(int lineNumber_, const char* failureStr_); + class UNITTEST_LINKAGE DeferredTestFailure + { + public: + DeferredTestFailure(); + DeferredTestFailure(int lineNumber_, const char* failureStr_); - int lineNumber; - char failureStr[1024]; -}; + int lineNumber; + char failureStr[1024]; + }; } @@ -28,23 +28,23 @@ UNITTEST_STDVECTOR_LINKAGE(UnitTest::DeferredTestFailure); namespace UnitTest { -class UNITTEST_LINKAGE DeferredTestResult -{ -public: - DeferredTestResult(); - DeferredTestResult(char const* suite, char const* test); - ~DeferredTestResult(); - - std::string suiteName; - std::string testName; - std::string failureFile; - - typedef std::vector< DeferredTestFailure > FailureVec; - FailureVec failures; - - float timeElapsed; - bool failed; -}; + class UNITTEST_LINKAGE DeferredTestResult + { + public: + DeferredTestResult(); + DeferredTestResult(char const* suite, char const* test); + ~DeferredTestResult(); + + std::string suiteName; + std::string testName; + std::string failureFile; + + typedef std::vector< DeferredTestFailure > FailureVec; + FailureVec failures; + + float timeElapsed; + bool failed; + }; } diff --git a/UnitTest++/ExceptionMacros.h b/UnitTest++/ExceptionMacros.h index e549c2c..0cc5a1c 100644 --- a/UnitTest++/ExceptionMacros.h +++ b/UnitTest++/ExceptionMacros.h @@ -4,15 +4,15 @@ #include "Config.h" #ifndef UNITTEST_NO_EXCEPTIONS - #define UT_TRY(x) try x - #define UT_THROW(x) throw x - #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody - #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody +#define UT_TRY(x) try x +#define UT_THROW(x) throw x +#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody +#define UT_CATCH_ALL(CatchBody) catch(...) CatchBody #else - #define UT_TRY(x) x - #define UT_THROW(x) - #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) - #define UT_CATCH_ALL(CatchBody) +#define UT_TRY(x) x +#define UT_THROW(x) +#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) +#define UT_CATCH_ALL(CatchBody) #endif #endif diff --git a/UnitTest++/ExecuteTest.h b/UnitTest++/ExecuteTest.h index d683dc0..7bfb99d 100644 --- a/UnitTest++/ExecuteTest.h +++ b/UnitTest++/ExecuteTest.h @@ -10,49 +10,49 @@ #include "CurrentTest.h" #ifdef UNITTEST_NO_EXCEPTIONS - #include "ReportAssertImpl.h" +#include "ReportAssertImpl.h" #endif #ifdef UNITTEST_POSIX - #include "Posix/SignalTranslator.h" +#include "Posix/SignalTranslator.h" #endif namespace UnitTest { -template< typename T > -void ExecuteTest(T& testObject, TestDetails const& details, bool isMockTest) -{ - if (isMockTest == false) - CurrentTest::Details() = &details; - -#ifdef UNITTEST_NO_EXCEPTIONS - if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0) - { -#endif -#ifndef UNITTEST_POSIX - UT_TRY({ testObject.RunImpl(); }) -#else - UT_TRY - ({ - UNITTEST_THROW_SIGNALS_POSIX_ONLY - testObject.RunImpl(); - }) -#endif - UT_CATCH(AssertException, e, { (void)e; }) - UT_CATCH(std::exception, e, - { - MemoryOutStream stream; - stream << "Unhandled exception: " << e.what(); - CurrentTest::Results()->OnTestFailure(details, stream.GetText()); - }) - UT_CATCH_ALL - ({ - CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed"); - }) -#ifdef UNITTEST_NO_EXCEPTIONS - } -#endif -} + template< typename T > + void ExecuteTest(T& testObject, TestDetails const& details, bool isMockTest) + { + if (isMockTest == false) + CurrentTest::Details() = &details; + + #ifdef UNITTEST_NO_EXCEPTIONS + if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0) + { + #endif + #ifndef UNITTEST_POSIX + UT_TRY({ testObject.RunImpl(); }) + #else + UT_TRY + ({ + UNITTEST_THROW_SIGNALS_POSIX_ONLY + testObject.RunImpl(); + }) + #endif + UT_CATCH(AssertException, e, { (void)e; }) + UT_CATCH(std::exception, e, + { + MemoryOutStream stream; + stream << "Unhandled exception: " << e.what(); + CurrentTest::Results()->OnTestFailure(details, stream.GetText()); + }) + UT_CATCH_ALL + ({ + CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed"); + }) + #ifdef UNITTEST_NO_EXCEPTIONS + } + #endif + } } diff --git a/UnitTest++/HelperMacros.h b/UnitTest++/HelperMacros.h index 699d99d..c94abce 100644 --- a/UnitTest++/HelperMacros.h +++ b/UnitTest++/HelperMacros.h @@ -6,47 +6,47 @@ #define UNITTEST_MULTILINE_MACRO_BEGIN do { #if defined(UNITTEST_WIN32) && !defined(UNITTEST_COMPILER_IS_MSVC6) - #define UNITTEST_MULTILINE_MACRO_END \ - } __pragma(warning(push)) __pragma(warning(disable:4127)) while (0) __pragma(warning(pop)) +#define UNITTEST_MULTILINE_MACRO_END \ + } __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop)) #else - #define UNITTEST_MULTILINE_MACRO_END } while(0) +#define UNITTEST_MULTILINE_MACRO_END } while(0) #endif #ifdef UNITTEST_WIN32_DLL - #define UNITTEST_IMPORT __declspec(dllimport) - #define UNITTEST_EXPORT __declspec(dllexport) - - #ifdef UNITTEST_DLL_EXPORT - #define UNITTEST_LINKAGE UNITTEST_EXPORT - #define UNITTEST_IMPEXP_TEMPLATE - #else - #define UNITTEST_LINKAGE UNITTEST_IMPORT - #define UNITTEST_IMPEXP_TEMPLATE extern - #endif - - #define UNITTEST_STDVECTOR_LINKAGE(T) \ - __pragma(warning(push)) \ - __pragma(warning(disable:4231)) \ - UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ - UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ - __pragma(warning(pop)) +#define UNITTEST_IMPORT __declspec(dllimport) +#define UNITTEST_EXPORT __declspec(dllexport) + +#ifdef UNITTEST_DLL_EXPORT +#define UNITTEST_LINKAGE UNITTEST_EXPORT +#define UNITTEST_IMPEXP_TEMPLATE +#else +#define UNITTEST_LINKAGE UNITTEST_IMPORT +#define UNITTEST_IMPEXP_TEMPLATE extern +#endif + +#define UNITTEST_STDVECTOR_LINKAGE(T) \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4231)) \ + UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ + UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ + __pragma(warning(pop)) #else - #define UNITTEST_IMPORT - #define UNITTEST_EXPORT - #define UNITTEST_LINKAGE - #define UNITTEST_IMPEXP_TEMPLATE - #define UNITTEST_STDVECTOR_LINKAGE(T) +#define UNITTEST_IMPORT +#define UNITTEST_EXPORT +#define UNITTEST_LINKAGE +#define UNITTEST_IMPEXP_TEMPLATE +#define UNITTEST_STDVECTOR_LINKAGE(T) #endif #ifdef UNITTEST_WIN32 - #define UNITTEST_JMPBUF jmp_buf - #define UNITTEST_SETJMP setjmp - #define UNITTEST_LONGJMP longjmp +#define UNITTEST_JMPBUF jmp_buf +#define UNITTEST_SETJMP setjmp +#define UNITTEST_LONGJMP longjmp #elif defined UNITTEST_POSIX - #define UNITTEST_JMPBUF std::jmp_buf - #define UNITTEST_SETJMP setjmp - #define UNITTEST_LONGJMP std::longjmp +#define UNITTEST_JMPBUF std::jmp_buf +#define UNITTEST_SETJMP setjmp +#define UNITTEST_LONGJMP std::longjmp #endif #endif diff --git a/UnitTest++/MemoryOutStream.cpp b/UnitTest++/MemoryOutStream.cpp index 319dfda..787351c 100644 --- a/UnitTest++/MemoryOutStream.cpp +++ b/UnitTest++/MemoryOutStream.cpp @@ -4,44 +4,44 @@ namespace UnitTest { -char const* MemoryOutStream::GetText() const -{ - m_text = this->str(); - return m_text.c_str(); -} + char const* MemoryOutStream::GetText() const + { + m_text = this->str(); + return m_text.c_str(); + } -void MemoryOutStream::Clear() -{ - this->str(std::string()); - m_text = this->str(); -} + void MemoryOutStream::Clear() + { + this->str(std::string()); + m_text = this->str(); + } -#ifdef UNITTEST_COMPILER_IS_MSVC6 + #ifdef UNITTEST_COMPILER_IS_MSVC6 -#define snprintf _snprintf + #define snprintf _snprintf -template -std::ostream& FormatToStream(std::ostream& stream, char const* format, ValueType const& value) -{ - using namespace std; - - const size_t BUFFER_SIZE=32; - char txt[BUFFER_SIZE]; - snprintf(txt, BUFFER_SIZE, format, value); - return stream << txt; -} + template + std::ostream& FormatToStream(std::ostream& stream, char const* format, ValueType const& value) + { + using namespace std; -std::ostream& operator<<(std::ostream& stream, __int64 const n) -{ - return FormatToStream(stream, "%I64d", n); -} + const size_t BUFFER_SIZE=32; + char txt[BUFFER_SIZE]; + snprintf(txt, BUFFER_SIZE, format, value); + return stream << txt; + } -std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n) -{ - return FormatToStream(stream, "%I64u", n); -} + std::ostream& operator<<(std::ostream& stream, __int64 const n) + { + return FormatToStream(stream, "%I64d", n); + } -#endif + std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n) + { + return FormatToStream(stream, "%I64u", n); + } + + #endif } @@ -56,161 +56,161 @@ std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n) namespace UnitTest { -namespace { - -template -void FormatToStream(MemoryOutStream& stream, char const* format, ValueType const& value) -{ - using namespace std; - - const size_t BUFFER_SIZE=32; - char txt[BUFFER_SIZE]; - snprintf(txt, BUFFER_SIZE, 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; -} - -void MemoryOutStream::Clear() -{ - m_buffer[0] = '\0'; -} - -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; -} - -#ifdef UNITTEST_COMPILER_IS_MSVC6 -MemoryOutStream& MemoryOutStream::operator <<(__int64 const n) -#else -MemoryOutStream& MemoryOutStream::operator <<(long long const n) -#endif -{ -#ifdef UNITTEST_WIN32 - FormatToStream(*this, "%I64d", n); -#else - FormatToStream(*this, "%lld", n); -#endif - - return *this; -} - -#ifdef UNITTEST_COMPILER_IS_MSVC6 -MemoryOutStream& MemoryOutStream::operator <<(unsigned __int64 const n) -#else -MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) -#endif -{ -#ifdef UNITTEST_WIN32 - FormatToStream(*this, "%I64u", n); -#else - FormatToStream(*this, "%llu", n); -#endif - - return *this; -} - -MemoryOutStream& MemoryOutStream::operator <<(float const f) -{ - FormatToStream(*this, "%0.6f", 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, "%0.6f", 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; -} + namespace { + + template + void FormatToStream(MemoryOutStream& stream, char const* format, ValueType const& value) + { + using namespace std; + + const size_t BUFFER_SIZE=32; + char txt[BUFFER_SIZE]; + snprintf(txt, BUFFER_SIZE, 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; + } + + void MemoryOutStream::Clear() + { + m_buffer[0] = '\0'; + } + + 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; + } + + #ifdef UNITTEST_COMPILER_IS_MSVC6 + MemoryOutStream& MemoryOutStream::operator <<(__int64 const n) + #else + MemoryOutStream& MemoryOutStream::operator <<(long long const n) + #endif + { + #ifdef UNITTEST_WIN32 + FormatToStream(*this, "%I64d", n); + #else + FormatToStream(*this, "%lld", n); + #endif + + return *this; + } + + #ifdef UNITTEST_COMPILER_IS_MSVC6 + MemoryOutStream& MemoryOutStream::operator <<(unsigned __int64 const n) + #else + MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) + #endif + { + #ifdef UNITTEST_WIN32 + FormatToStream(*this, "%I64u", n); + #else + FormatToStream(*this, "%llu", n); + #endif + + return *this; + } + + MemoryOutStream& MemoryOutStream::operator <<(float const f) + { + FormatToStream(*this, "%0.6f", 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, "%0.6f", 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; + } } diff --git a/UnitTest++/MemoryOutStream.h b/UnitTest++/MemoryOutStream.h index b9cea19..893a829 100644 --- a/UnitTest++/MemoryOutStream.h +++ b/UnitTest++/MemoryOutStream.h @@ -11,25 +11,25 @@ namespace UnitTest { -class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream -{ -public: - MemoryOutStream() {} - ~MemoryOutStream() {} - void Clear(); - char const* GetText() const; - -private: - MemoryOutStream(MemoryOutStream const&); - void operator =(MemoryOutStream const&); - - mutable std::string m_text; -}; - -#ifdef UNITTEST_COMPILER_IS_MSVC6 -std::ostream& operator<<(std::ostream& stream, __int64 const n); -std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n); -#endif + class UNITTEST_LINKAGE MemoryOutStream : public std::ostringstream + { + public: + MemoryOutStream() {} + ~MemoryOutStream() {} + void Clear(); + char const* GetText() const; + + private: + MemoryOutStream(MemoryOutStream const&); + void operator =(MemoryOutStream const&); + + mutable std::string m_text; + }; + + #ifdef UNITTEST_COMPILER_IS_MSVC6 + std::ostream& operator<<(std::ostream& stream, __int64 const n); + std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n); + #endif } @@ -44,41 +44,41 @@ namespace std {} namespace UnitTest { -class UNITTEST_LINKAGE MemoryOutStream -{ -public: - explicit MemoryOutStream(int const size = 256); - ~MemoryOutStream(); - - void Clear(); - char const* GetText() const; - - MemoryOutStream& operator <<(char const* txt); - MemoryOutStream& operator <<(int n); - MemoryOutStream& operator <<(long n); - MemoryOutStream& operator <<(unsigned long n); -#ifdef UNITTEST_COMPILER_IS_MSVC6 - MemoryOutStream& operator <<(__int64 n); - MemoryOutStream& operator <<(unsigned __int64 n); -#else - MemoryOutStream& operator <<(long long n); - MemoryOutStream& operator <<(unsigned long long n); -#endif - 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; -}; + class UNITTEST_LINKAGE MemoryOutStream + { + public: + explicit MemoryOutStream(int const size = 256); + ~MemoryOutStream(); + + void Clear(); + char const* GetText() const; + + MemoryOutStream& operator <<(char const* txt); + MemoryOutStream& operator <<(int n); + MemoryOutStream& operator <<(long n); + MemoryOutStream& operator <<(unsigned long n); + #ifdef UNITTEST_COMPILER_IS_MSVC6 + MemoryOutStream& operator <<(__int64 n); + MemoryOutStream& operator <<(unsigned __int64 n); + #else + MemoryOutStream& operator <<(long long n); + MemoryOutStream& operator <<(unsigned long long n); + #endif + 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; + }; } diff --git a/UnitTest++/Posix/SignalTranslator.cpp b/UnitTest++/Posix/SignalTranslator.cpp index 3689c8c..4039896 100644 --- a/UnitTest++/Posix/SignalTranslator.cpp +++ b/UnitTest++/Posix/SignalTranslator.cpp @@ -2,45 +2,45 @@ namespace UnitTest { -sigjmp_buf* SignalTranslator::s_jumpTarget = 0; + sigjmp_buf* SignalTranslator::s_jumpTarget = 0; -namespace { + namespace { -void SignalHandler(int sig) -{ - siglongjmp(*SignalTranslator::s_jumpTarget, sig ); -} + void SignalHandler(int sig) + { + siglongjmp(*SignalTranslator::s_jumpTarget, sig ); + } -} + } -SignalTranslator::SignalTranslator() -{ - m_oldJumpTarget = s_jumpTarget; - s_jumpTarget = &m_currentJumpTarget; + 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 ); + 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 ); -} + 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 ); + 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; -} + s_jumpTarget = m_oldJumpTarget; + } } diff --git a/UnitTest++/Posix/SignalTranslator.h b/UnitTest++/Posix/SignalTranslator.h index 50da5f9..107f362 100644 --- a/UnitTest++/Posix/SignalTranslator.h +++ b/UnitTest++/Posix/SignalTranslator.h @@ -6,36 +6,36 @@ 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_POSIX_ONLY \ - UnitTest::SignalTranslator sig; \ - if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ - throw ("Unhandled system exception"); + 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_POSIX_ONLY \ + UnitTest::SignalTranslator sig; \ + if (UNITTEST_EXTENSION sigsetjmp(*UnitTest::SignalTranslator::s_jumpTarget, 1) != 0) \ + throw ("Unhandled system exception"); } diff --git a/UnitTest++/Posix/TimeHelpers.cpp b/UnitTest++/Posix/TimeHelpers.cpp index f977ca7..d9a78eb 100644 --- a/UnitTest++/Posix/TimeHelpers.cpp +++ b/UnitTest++/Posix/TimeHelpers.cpp @@ -3,31 +3,31 @@ namespace UnitTest { -Timer::Timer() -{ - m_startTime.tv_sec = 0; - m_startTime.tv_usec = 0; -} - -void Timer::Start() -{ - gettimeofday(&m_startTime, 0); -} - -double Timer::GetTimeInMs() const -{ - struct timeval currentTime; - gettimeofday(¤tTime, 0); - - double const dsecs = currentTime.tv_sec - m_startTime.tv_sec; - double const dus = currentTime.tv_usec - m_startTime.tv_usec; - - return (dsecs * 1000.0) + (dus / 1000.0); -} - -void TimeHelpers::SleepMs(int ms) -{ - usleep(static_cast(ms * 1000)); -} + Timer::Timer() + { + m_startTime.tv_sec = 0; + m_startTime.tv_usec = 0; + } + + void Timer::Start() + { + gettimeofday(&m_startTime, 0); + } + + double Timer::GetTimeInMs() const + { + struct timeval currentTime; + gettimeofday(¤tTime, 0); + + double const dsecs = currentTime.tv_sec - m_startTime.tv_sec; + double const dus = currentTime.tv_usec - m_startTime.tv_usec; + + return (dsecs * 1000.0) + (dus / 1000.0); + } + + void TimeHelpers::SleepMs(int ms) + { + usleep(static_cast(ms * 1000)); + } } diff --git a/UnitTest++/Posix/TimeHelpers.h b/UnitTest++/Posix/TimeHelpers.h index 0de4b1a..630260d 100644 --- a/UnitTest++/Posix/TimeHelpers.h +++ b/UnitTest++/Posix/TimeHelpers.h @@ -5,22 +5,22 @@ namespace UnitTest { -class Timer -{ -public: - Timer(); - void Start(); - double GetTimeInMs() const; - -private: - struct timeval m_startTime; -}; - - -namespace TimeHelpers -{ - void SleepMs(int ms); -} + class Timer + { + public: + Timer(); + void Start(); + double GetTimeInMs() const; + + private: + struct timeval m_startTime; + }; + + + namespace TimeHelpers + { + void SleepMs(int ms); + } } diff --git a/UnitTest++/ReportAssert.cpp b/UnitTest++/ReportAssert.cpp index 7a9a63a..1e07160 100644 --- a/UnitTest++/ReportAssert.cpp +++ b/UnitTest++/ReportAssert.cpp @@ -6,65 +6,66 @@ #include "TestDetails.h" #ifdef UNITTEST_NO_EXCEPTIONS - #include "ReportAssertImpl.h" +#include "ReportAssertImpl.h" #endif namespace UnitTest { -namespace -{ - bool& AssertExpectedFlag() - { - static bool s_assertExpected = false; - return s_assertExpected; - } -} + namespace + { + bool& AssertExpectedFlag() + { + static bool s_assertExpected = false; + return s_assertExpected; + } + } -UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber) -{ - Detail::ReportAssertEx(CurrentTest::Results(), CurrentTest::Details(), - description, filename, lineNumber); -} + UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber) + { + Detail::ReportAssertEx(CurrentTest::Results(), CurrentTest::Details(), + description, filename, lineNumber); + } -namespace Detail { + namespace Detail { -#ifdef UNITTEST_NO_EXCEPTIONS -UNITTEST_JMPBUF* GetAssertJmpBuf() -{ - static UNITTEST_JMPBUF s_jmpBuf; - return &s_jmpBuf; -} -#endif + #ifdef UNITTEST_NO_EXCEPTIONS + UNITTEST_JMPBUF* GetAssertJmpBuf() + { + static UNITTEST_JMPBUF s_jmpBuf; + return &s_jmpBuf; + } + #endif -UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, - const TestDetails* testDetails, - char const* description, - char const* filename, - int lineNumber) -{ - if (AssertExpectedFlag() == false) - { - TestDetails assertDetails(testDetails->testName, testDetails->suiteName, filename, lineNumber); - testResults->OnTestFailure(assertDetails, description); - } + UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, + const TestDetails* testDetails, + char const* description, + char const* filename, + int lineNumber) + { + if (AssertExpectedFlag() == false) + { + TestDetails assertDetails(testDetails->testName, testDetails->suiteName, filename, lineNumber); + testResults->OnTestFailure(assertDetails, description); + } - ExpectAssert(false); + ExpectAssert(false); -#ifndef UNITTEST_NO_EXCEPTIONS - throw AssertException(); -#else - UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); -#endif -} + #ifndef UNITTEST_NO_EXCEPTIONS + throw AssertException(); + #else + UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); + #endif + } -UNITTEST_LINKAGE void ExpectAssert(bool expected) -{ - AssertExpectedFlag() = expected; -} + UNITTEST_LINKAGE void ExpectAssert(bool expected) + { + AssertExpectedFlag() = expected; + } -UNITTEST_LINKAGE bool AssertExpected() -{ - return AssertExpectedFlag(); -} + UNITTEST_LINKAGE bool AssertExpected() + { + return AssertExpectedFlag(); + } -}} + } +} diff --git a/UnitTest++/ReportAssert.h b/UnitTest++/ReportAssert.h index 0b5d6dd..c22faab 100644 --- a/UnitTest++/ReportAssert.h +++ b/UnitTest++/ReportAssert.h @@ -5,7 +5,7 @@ namespace UnitTest { -UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber); + UNITTEST_LINKAGE void ReportAssert(char const* description, char const* filename, int lineNumber); } diff --git a/UnitTest++/ReportAssertImpl.h b/UnitTest++/ReportAssertImpl.h index 88efc03..e8ecc29 100644 --- a/UnitTest++/ReportAssertImpl.h +++ b/UnitTest++/ReportAssertImpl.h @@ -5,42 +5,42 @@ #include "HelperMacros.h" #ifdef UNITTEST_NO_EXCEPTIONS - #include +#include #endif namespace UnitTest { -class TestResults; -class TestDetails; + class TestResults; + class TestDetails; -namespace Detail { + namespace Detail { -UNITTEST_LINKAGE void ExpectAssert(bool expected); + UNITTEST_LINKAGE void ExpectAssert(bool expected); -UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, - const TestDetails* testDetails, - char const* description, - char const* filename, - int lineNumber); + UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, + const TestDetails* testDetails, + char const* description, + char const* filename, + int lineNumber); -UNITTEST_LINKAGE bool AssertExpected(); + UNITTEST_LINKAGE bool AssertExpected(); -#ifdef UNITTEST_NO_EXCEPTIONS - UNITTEST_LINKAGE UNITTEST_JMPBUF* GetAssertJmpBuf(); - - #ifdef UNITTEST_WIN32 - #define UNITTEST_SET_ASSERT_JUMP_TARGET() \ - __pragma(warning(push)) __pragma(warning(disable:4611)) \ - UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) \ - __pragma(warning(pop)) - #else - #define UNITTEST_SET_ASSERT_JUMP_TARGET() UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) - #endif - - #define UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET() UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), 1) -#endif + #ifdef UNITTEST_NO_EXCEPTIONS + UNITTEST_LINKAGE UNITTEST_JMPBUF* GetAssertJmpBuf(); -} + #ifdef UNITTEST_WIN32 + #define UNITTEST_SET_ASSERT_JUMP_TARGET() \ + __pragma(warning(push)) __pragma(warning(disable: 4611)) \ + UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) \ + __pragma(warning(pop)) + #else + #define UNITTEST_SET_ASSERT_JUMP_TARGET() UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) + #endif + + #define UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET() UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), 1) + #endif + + } } #endif diff --git a/UnitTest++/Test.cpp b/UnitTest++/Test.cpp index 6941722..82ed710 100644 --- a/UnitTest++/Test.cpp +++ b/UnitTest++/Test.cpp @@ -7,35 +7,32 @@ #include "ExecuteTest.h" #ifdef UNITTEST_POSIX - #include "Posix/SignalTranslator.h" +#include "Posix/SignalTranslator.h" #endif namespace UnitTest { -TestList& Test::GetTestList() -{ - static TestList s_list; - return s_list; -} + 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) - , m_nextTest(0) - , m_isMockTest(false) -{ -} + Test::Test(char const* testName, char const* suiteName, char const* filename, int lineNumber) + : m_details(testName, suiteName, filename, lineNumber) + , m_nextTest(0) + , m_isMockTest(false) + {} -Test::~Test() -{ -} + Test::~Test() + {} -void Test::Run() -{ - ExecuteTest(*this, m_details, m_isMockTest); -} + void Test::Run() + { + ExecuteTest(*this, m_details, m_isMockTest); + } -void Test::RunImpl() const -{ -} + void Test::RunImpl() const + {} } diff --git a/UnitTest++/Test.h b/UnitTest++/Test.h index bf7c4a3..beb0769 100644 --- a/UnitTest++/Test.h +++ b/UnitTest++/Test.h @@ -5,29 +5,29 @@ namespace UnitTest { -class TestResults; -class TestList; + class TestResults; + class TestList; -class UNITTEST_LINKAGE Test -{ -public: - explicit Test(char const* testName, char const* suiteName = "DefaultSuite", char const* filename = "", int lineNumber = 0); - virtual ~Test(); - void Run(); + class UNITTEST_LINKAGE 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* m_nextTest; + TestDetails const m_details; + Test* m_nextTest; - mutable bool m_isMockTest; + mutable bool m_isMockTest; - static TestList& GetTestList(); + static TestList& GetTestList(); - virtual void RunImpl() const; + virtual void RunImpl() const; -private: - Test(Test const&); - Test& operator =(Test const&); -}; + private: + Test(Test const&); + Test& operator =(Test const&); + }; } diff --git a/UnitTest++/TestDetails.cpp b/UnitTest++/TestDetails.cpp index 3af0446..deb6639 100644 --- a/UnitTest++/TestDetails.cpp +++ b/UnitTest++/TestDetails.cpp @@ -2,23 +2,21 @@ namespace UnitTest { -TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_) - : suiteName(suiteName_) - , testName(testName_) - , filename(filename_) - , lineNumber(lineNumber_) - , timeConstraintExempt(false) -{ -} + TestDetails::TestDetails(char const* testName_, char const* suiteName_, char const* filename_, int lineNumber_) + : suiteName(suiteName_) + , testName(testName_) + , filename(filename_) + , lineNumber(lineNumber_) + , timeConstraintExempt(false) + {} -TestDetails::TestDetails(const TestDetails& details, int lineNumber_) - : suiteName(details.suiteName) - , testName(details.testName) - , filename(details.filename) - , lineNumber(lineNumber_) - , timeConstraintExempt(details.timeConstraintExempt) -{ -} + TestDetails::TestDetails(const TestDetails& details, int lineNumber_) + : suiteName(details.suiteName) + , testName(details.testName) + , filename(details.filename) + , lineNumber(lineNumber_) + , timeConstraintExempt(details.timeConstraintExempt) + {} } diff --git a/UnitTest++/TestDetails.h b/UnitTest++/TestDetails.h index eb7d596..cf6f1d3 100644 --- a/UnitTest++/TestDetails.h +++ b/UnitTest++/TestDetails.h @@ -5,22 +5,22 @@ namespace UnitTest { -class UNITTEST_LINKAGE TestDetails -{ -public: - TestDetails(char const* testName, char const* suiteName, char const* filename, int lineNumber); - TestDetails(const TestDetails& details, int lineNumber); + class UNITTEST_LINKAGE 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; - mutable bool timeConstraintExempt; + char const* const suiteName; + char const* const testName; + char const* const filename; + int const lineNumber; + mutable bool timeConstraintExempt; - TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind -private: - TestDetails& operator=(TestDetails const&); -}; + TestDetails(TestDetails const&); // Why is it public? --> http://gcc.gnu.org/bugs.html#cxx_rvalbind + private: + TestDetails& operator=(TestDetails const&); + }; } diff --git a/UnitTest++/TestList.cpp b/UnitTest++/TestList.cpp index 4583cbb..a2bc4b7 100644 --- a/UnitTest++/TestList.cpp +++ b/UnitTest++/TestList.cpp @@ -5,35 +5,34 @@ namespace UnitTest { -TestList::TestList() - : m_head(0) - , m_tail(0) -{ -} + 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->m_nextTest = test; - m_tail = test; - } -} + void TestList::Add(Test* test) + { + if (m_tail == 0) + { + assert(m_head == 0); + m_head = test; + m_tail = test; + } + else + { + m_tail->m_nextTest = test; + m_tail = test; + } + } -Test* TestList::GetHead() const -{ - return m_head; -} + Test* TestList::GetHead() const + { + return m_head; + } -ListAdder::ListAdder(TestList& list, Test* test) -{ - list.Add(test); -} + ListAdder::ListAdder(TestList& list, Test* test) + { + list.Add(test); + } } diff --git a/UnitTest++/TestList.h b/UnitTest++/TestList.h index a001d3f..d52ab51 100644 --- a/UnitTest++/TestList.h +++ b/UnitTest++/TestList.h @@ -5,27 +5,27 @@ namespace UnitTest { -class Test; + class Test; -class UNITTEST_LINKAGE TestList -{ -public: - TestList(); - void Add (Test* test); + class UNITTEST_LINKAGE TestList + { + public: + TestList(); + void Add (Test* test); - Test* GetHead() const; + Test* GetHead() const; -private: - Test* m_head; - Test* m_tail; -}; + private: + Test* m_head; + Test* m_tail; + }; -class UNITTEST_LINKAGE ListAdder -{ -public: - ListAdder(TestList& list, Test* test); -}; + class UNITTEST_LINKAGE ListAdder + { + public: + ListAdder(TestList& list, Test* test); + }; } diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index facc94e..738c56b 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -10,106 +10,106 @@ #include "MemoryOutStream.h" #ifndef UNITTEST_POSIX - #define UNITTEST_THROW_SIGNALS_POSIX_ONLY +#define UNITTEST_THROW_SIGNALS_POSIX_ONLY #else - #include "Posix/SignalTranslator.h" +#include "Posix/SignalTranslator.h" #endif #ifdef TEST - #error UnitTest++ redefines TEST +#error UnitTest++ redefines TEST #endif #ifdef TEST_EX - #error UnitTest++ redefines TEST_EX +#error UnitTest++ redefines TEST_EX #endif #ifdef TEST_FIXTURE_EX - #error UnitTest++ redefines 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 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_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 \ - { \ - volatile bool ctorOk = false; \ - UT_TRY \ - ({ \ - Fixture##Name##Helper fixtureHelper(m_details); \ - ctorOk = true; \ - UnitTest::ExecuteTest(fixtureHelper, m_details, false); \ - }) \ - UT_CATCH (UnitTest::AssertException, e, \ - { \ - (void)e; \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream stream; \ - stream << "Unhandled exception: " << e.what(); \ - UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - 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_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 \ + { \ + volatile bool ctorOk = false; \ + UT_TRY \ + ({ \ + Fixture ## Name ## Helper fixtureHelper(m_details); \ + ctorOk = true; \ + UnitTest::ExecuteTest(fixtureHelper, m_details, false); \ + }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + (void)e; \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream stream; \ + stream << "Unhandled exception: " << e.what(); \ + UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + 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()) diff --git a/UnitTest++/TestReporter.cpp b/UnitTest++/TestReporter.cpp index acfca3e..362da93 100644 --- a/UnitTest++/TestReporter.cpp +++ b/UnitTest++/TestReporter.cpp @@ -2,8 +2,7 @@ namespace UnitTest { -TestReporter::~TestReporter() -{ -} + TestReporter::~TestReporter() + {} } diff --git a/UnitTest++/TestReporter.h b/UnitTest++/TestReporter.h index 2100524..f296a59 100644 --- a/UnitTest++/TestReporter.h +++ b/UnitTest++/TestReporter.h @@ -5,18 +5,18 @@ namespace UnitTest { -class TestDetails; + class TestDetails; -class UNITTEST_LINKAGE TestReporter -{ -public: - virtual ~TestReporter(); + class UNITTEST_LINKAGE 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; -}; + 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/UnitTest++/TestReporterStdout.cpp b/UnitTest++/TestReporterStdout.cpp index 7d08903..1bf671c 100644 --- a/UnitTest++/TestReporterStdout.cpp +++ b/UnitTest++/TestReporterStdout.cpp @@ -5,42 +5,40 @@ // cstdio doesn't pull in namespace std on VC6, so we do it here. #if defined(UNITTEST_WIN32) && (_MSC_VER == 1200) - namespace std {} +namespace std {} #endif namespace UnitTest { -void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure) -{ - using namespace std; -#if defined(__APPLE__) || defined(__GNUG__) - char const* const errorFormat = "%s:%d:%d: error: Failure in %s: %s\n"; - fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure); -#else - char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n"; - fprintf(stderr, errorFormat, details.filename, details.lineNumber, details.testName, failure); -#endif -} - -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 const 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); -} + void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure) + { + using namespace std; + #if defined(__APPLE__) || defined(__GNUG__) + char const* const errorFormat = "%s:%d:%d: error: Failure in %s: %s\n"; + fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure); + #else + char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n"; + fprintf(stderr, errorFormat, details.filename, details.lineNumber, details.testName, failure); + #endif + } + + 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 const 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/UnitTest++/TestReporterStdout.h b/UnitTest++/TestReporterStdout.h index e8d7bbf..6cedfc5 100644 --- a/UnitTest++/TestReporterStdout.h +++ b/UnitTest++/TestReporterStdout.h @@ -5,15 +5,15 @@ namespace UnitTest { -class UNITTEST_LINKAGE 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); -}; + class UNITTEST_LINKAGE 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 +#endif diff --git a/UnitTest++/TestResults.cpp b/UnitTest++/TestResults.cpp index b3b67c0..e40ea70 100644 --- a/UnitTest++/TestResults.cpp +++ b/UnitTest++/TestResults.cpp @@ -5,56 +5,55 @@ 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; -} + 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/UnitTest++/TestResults.h b/UnitTest++/TestResults.h index a24aaf5..c56a632 100644 --- a/UnitTest++/TestResults.h +++ b/UnitTest++/TestResults.h @@ -5,33 +5,33 @@ namespace UnitTest { -class TestReporter; -class TestDetails; + class TestReporter; + class TestDetails; -class UNITTEST_LINKAGE TestResults -{ -public: - explicit TestResults(TestReporter* reporter = 0); + class UNITTEST_LINKAGE 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); + 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; + int GetTotalTestCount() const; + int GetFailedTestCount() const; + int GetFailureCount() const; -private: - TestReporter* m_testReporter; - int m_totalTestCount; - int m_failedTestCount; - int m_failureCount; + private: + TestReporter* m_testReporter; + int m_totalTestCount; + int m_failedTestCount; + int m_failureCount; - bool m_currentTestFailed; + bool m_currentTestFailed; - TestResults(TestResults const&); - TestResults& operator =(TestResults const&); -}; + TestResults(TestResults const&); + TestResults& operator =(TestResults const&); + }; } diff --git a/UnitTest++/TestRunner.cpp b/UnitTest++/TestRunner.cpp index a8151e6..8e0581d 100644 --- a/UnitTest++/TestRunner.cpp +++ b/UnitTest++/TestRunner.cpp @@ -10,73 +10,73 @@ 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; -} - -TestResults* TestRunner::GetTestResults() -{ - return m_result; -} - -int TestRunner::Finish() const -{ - float const secondsElapsed = static_cast(m_timer->GetTimeInMs() / 1000.0); - 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 -{ - if (curTest->m_isMockTest == false) - CurrentTest::Results() = result; - - Timer testTimer; - testTimer.Start(); - - result->OnTestStart(curTest->m_details); - - curTest->Run(); - - double const testTimeInMs = testTimer.GetTimeInMs(); - if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_details.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, static_cast< float >(testTimeInMs / 1000.0)); -} + 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; + } + + TestResults* TestRunner::GetTestResults() + { + return m_result; + } + + int TestRunner::Finish() const + { + float const secondsElapsed = static_cast(m_timer->GetTimeInMs() / 1000.0); + 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 + { + if (curTest->m_isMockTest == false) + CurrentTest::Results() = result; + + Timer testTimer; + testTimer.Start(); + + result->OnTestStart(curTest->m_details); + + curTest->Run(); + + double const testTimeInMs = testTimer.GetTimeInMs(); + if (maxTestTimeInMs > 0 && testTimeInMs > maxTestTimeInMs && !curTest->m_details.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, static_cast< float >(testTimeInMs / 1000.0)); + } } diff --git a/UnitTest++/TestRunner.h b/UnitTest++/TestRunner.h index f88b9cc..914249a 100644 --- a/UnitTest++/TestRunner.h +++ b/UnitTest++/TestRunner.h @@ -7,54 +7,54 @@ namespace UnitTest { -class TestReporter; -class TestResults; -class Timer; - -UNITTEST_LINKAGE int RunAllTests(); - -struct True -{ - bool operator()(const Test* const) const - { - return true; - } -}; - -class UNITTEST_LINKAGE 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->m_nextTest; - } - - return Finish(); - } - - TestResults* GetTestResults(); - -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; -}; + class TestReporter; + class TestResults; + class Timer; + + UNITTEST_LINKAGE int RunAllTests(); + + struct True + { + bool operator()(const Test* const) const + { + return true; + } + }; + + class UNITTEST_LINKAGE 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->m_nextTest; + } + + return Finish(); + } + + TestResults* GetTestResults(); + + 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; + }; } diff --git a/UnitTest++/TestSuite.h b/UnitTest++/TestSuite.h index 2812d8c..7b70122 100644 --- a/UnitTest++/TestSuite.h +++ b/UnitTest++/TestSuite.h @@ -1,12 +1,12 @@ #ifndef UNITTEST_TESTSUITE_H #define UNITTEST_TESTSUITE_H -namespace UnitTestSuite +namespace UnitTestSuite { - inline char const* GetSuiteName () - { - return "DefaultSuite"; - } + inline char const* GetSuiteName () + { + return "DefaultSuite"; + } } #endif diff --git a/UnitTest++/TimeConstraint.cpp b/UnitTest++/TimeConstraint.cpp index f806aeb..e45dd97 100644 --- a/UnitTest++/TimeConstraint.cpp +++ b/UnitTest++/TimeConstraint.cpp @@ -6,24 +6,24 @@ namespace UnitTest { -TimeConstraint::TimeConstraint(int ms, TestDetails const& details, int lineNumber) - : m_details(details, lineNumber) - , m_maxMs(ms) -{ - m_timer.Start(); -} + TimeConstraint::TimeConstraint(int ms, TestDetails const& details, int lineNumber) + : m_details(details, lineNumber) + , m_maxMs(ms) + { + m_timer.Start(); + } -TimeConstraint::~TimeConstraint() -{ - double 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."; + TimeConstraint::~TimeConstraint() + { + double 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."; - CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); - } -} + CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); + } + } } diff --git a/UnitTest++/TimeConstraint.h b/UnitTest++/TimeConstraint.h index cf6d68a..be9d255 100644 --- a/UnitTest++/TimeConstraint.h +++ b/UnitTest++/TimeConstraint.h @@ -7,30 +7,30 @@ namespace UnitTest { -class TestResults; - -class UNITTEST_LINKAGE TimeConstraint -{ -public: - TimeConstraint(int ms, TestDetails const& details, int lineNumber); - ~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, m_details, __LINE__) - -#define UNITTEST_TIME_CONSTRAINT_EXEMPT() \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - m_details.timeConstraintExempt = true; \ - UNITTEST_MULTILINE_MACRO_END + class TestResults; + + class UNITTEST_LINKAGE TimeConstraint + { + public: + TimeConstraint(int ms, TestDetails const& details, int lineNumber); + ~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, m_details, __LINE__) + + #define UNITTEST_TIME_CONSTRAINT_EXEMPT() \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + m_details.timeConstraintExempt = true; \ + UNITTEST_MULTILINE_MACRO_END } diff --git a/UnitTest++/TimeHelpers.h b/UnitTest++/TimeHelpers.h index f34ed00..1602d6e 100644 --- a/UnitTest++/TimeHelpers.h +++ b/UnitTest++/TimeHelpers.h @@ -1,7 +1,7 @@ #include "Config.h" #if defined UNITTEST_POSIX - #include "Posix/TimeHelpers.h" +#include "Posix/TimeHelpers.h" #else - #include "Win32/TimeHelpers.h" +#include "Win32/TimeHelpers.h" #endif diff --git a/UnitTest++/Win32/TimeHelpers.cpp b/UnitTest++/Win32/TimeHelpers.cpp index aa97b89..a46ca52 100644 --- a/UnitTest++/Win32/TimeHelpers.cpp +++ b/UnitTest++/Win32/TimeHelpers.cpp @@ -5,45 +5,45 @@ namespace UnitTest { -Timer::Timer() - : m_threadHandle(::GetCurrentThread()) - , m_startTime(0) -{ -#if defined(UNITTEST_WIN32) && (_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(); -} - -double Timer::GetTimeInMs() const -{ - __int64 const elapsedTime = GetTime() - m_startTime; - double const seconds = double(elapsedTime) / double(m_frequency); - return seconds * 1000.0; -} - -__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 ms) -{ - ::Sleep(ms); -} + Timer::Timer() + : m_threadHandle(::GetCurrentThread()) + , m_startTime(0) + { + #if defined(UNITTEST_WIN32) && (_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(); + } + + double Timer::GetTimeInMs() const + { + __int64 const elapsedTime = GetTime() - m_startTime; + double const seconds = double(elapsedTime) / double(m_frequency); + return seconds * 1000.0; + } + + __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 ms) + { + ::Sleep(ms); + } } diff --git a/UnitTest++/Win32/TimeHelpers.h b/UnitTest++/Win32/TimeHelpers.h index 2bbe75f..1498dea 100644 --- a/UnitTest++/Win32/TimeHelpers.h +++ b/UnitTest++/Win32/TimeHelpers.h @@ -5,40 +5,40 @@ #include "../HelperMacros.h" #ifdef UNITTEST_MINGW - #ifndef __int64 - #define __int64 long long - #endif +#ifndef __int64 +#define __int64 long long +#endif #endif namespace UnitTest { -class UNITTEST_LINKAGE Timer -{ -public: - Timer(); - void Start(); - double GetTimeInMs() const; + class UNITTEST_LINKAGE Timer + { + public: + Timer(); + void Start(); + double GetTimeInMs() const; -private: - __int64 GetTime() const; + private: + __int64 GetTime() const; - void* m_threadHandle; + void* m_threadHandle; -#if defined(_WIN64) - unsigned __int64 m_processAffinityMask; -#else - unsigned long m_processAffinityMask; -#endif + #if defined(_WIN64) + unsigned __int64 m_processAffinityMask; + #else + unsigned long m_processAffinityMask; + #endif - __int64 m_startTime; - __int64 m_frequency; -}; + __int64 m_startTime; + __int64 m_frequency; + }; -namespace TimeHelpers -{ - UNITTEST_LINKAGE void SleepMs(int ms); -} + namespace TimeHelpers + { + UNITTEST_LINKAGE void SleepMs(int ms); + } } diff --git a/UnitTest++/XmlTestReporter.cpp b/UnitTest++/XmlTestReporter.cpp index c3312ea..d44de05 100644 --- a/UnitTest++/XmlTestReporter.cpp +++ b/UnitTest++/XmlTestReporter.cpp @@ -13,118 +13,117 @@ 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, '&', "&"); - ReplaceChar(escaped, '<', "<"); - ReplaceChar(escaped, '>', ">"); - ReplaceChar(escaped, '\'', "'"); - ReplaceChar(escaped, '\"', """); - - return escaped; -} - -string BuildFailureMessage(string const& file, int line, string const& message) -{ - ostringstream failureMessage; - failureMessage << file << "(" << line << ") : " << message; - return failureMessage.str(); -} + 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, '&', "&"); + ReplaceChar(escaped, '<', "<"); + ReplaceChar(escaped, '>', ">"); + ReplaceChar(escaped, '\'', "'"); + ReplaceChar(escaped, '\"', """); + + 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) -{ -} + XmlTestReporter::XmlTestReporter(ostream& ostream) + : m_ostream(ostream) + {} -void XmlTestReporter::ReportSummary(int totalTestCount, int failedTestCount, - int failureCount, float secondsElapsed) -{ - AddXmlElement(m_ostream, NULL); + void XmlTestReporter::ReportSummary(int totalTestCount, int failedTestCount, + int failureCount, float secondsElapsed) + { + AddXmlElement(m_ostream, NULL); - BeginResults(m_ostream, totalTestCount, failedTestCount, failureCount, secondsElapsed); + 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); + DeferredTestResultList const& results = GetResults(); + for (DeferredTestResultList::const_iterator i = results.begin(); i != results.end(); ++i) + { + BeginTest(m_ostream, *i); - if (i->failed) + if (i->failed) AddFailure(m_ostream, *i); - EndTest(m_ostream, *i); - } - - EndResults(m_ostream); -} - -void XmlTestReporter::AddXmlElement(ostream& os, char const* encoding) -{ - os << ""; -} - -void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, - int failureCount, float secondsElapsed) -{ - os << ""; -} - -void XmlTestReporter::EndResults(std::ostream& os) -{ - os << ""; -} - -void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result) -{ - os << ""; - else - os << "/>"; -} - -void XmlTestReporter::AddFailure(std::ostream& os, DeferredTestResult const& result) -{ - os << ">"; // close element - - for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); - it != result.failures.end(); - ++it) - { - string const escapedMessage = XmlEscape(std::string(it->failureStr)); - string const message = BuildFailureMessage(result.failureFile, it->lineNumber, escapedMessage); - - os << ""; - } -} + EndTest(m_ostream, *i); + } + + EndResults(m_ostream); + } + + void XmlTestReporter::AddXmlElement(ostream& os, char const* encoding) + { + os << ""; + } + + void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, + int failureCount, float secondsElapsed) + { + os << ""; + } + + void XmlTestReporter::EndResults(std::ostream& os) + { + os << ""; + } + + void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result) + { + os << ""; + else + os << "/>"; + } + + void XmlTestReporter::AddFailure(std::ostream& os, DeferredTestResult const& result) + { + os << ">"; // close element + + for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); + it != result.failures.end(); + ++it) + { + string const escapedMessage = XmlEscape(std::string(it->failureStr)); + string const message = BuildFailureMessage(result.failureFile, it->lineNumber, escapedMessage); + + os << ""; + } + } } diff --git a/UnitTest++/XmlTestReporter.h b/UnitTest++/XmlTestReporter.h index 63d424e..9466903 100644 --- a/UnitTest++/XmlTestReporter.h +++ b/UnitTest++/XmlTestReporter.h @@ -11,26 +11,26 @@ namespace UnitTest { -class UNITTEST_LINKAGE 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; -}; + class UNITTEST_LINKAGE 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; + }; } diff --git a/tests/Main.cpp b/tests/Main.cpp index ae9cc54..4a0f402 100644 --- a/tests/Main.cpp +++ b/tests/Main.cpp @@ -2,5 +2,5 @@ int main(int, char const *[]) { - return UnitTest::RunAllTests(); + return UnitTest::RunAllTests(); } diff --git a/tests/RecordingReporter.h b/tests/RecordingReporter.h index ea899a2..a2e4839 100644 --- a/tests/RecordingReporter.h +++ b/tests/RecordingReporter.h @@ -9,89 +9,89 @@ struct RecordingReporter : public UnitTest::TestReporter { private: - enum { kMaxStringLength = 256 }; + 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; + 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; }; diff --git a/tests/ScopedCurrentTest.h b/tests/ScopedCurrentTest.h index 60b1a8e..7737da9 100644 --- a/tests/ScopedCurrentTest.h +++ b/tests/ScopedCurrentTest.h @@ -7,31 +7,30 @@ class ScopedCurrentTest { public: - ScopedCurrentTest() - : m_oldTestResults(UnitTest::CurrentTest::Results()) - , m_oldTestDetails(UnitTest::CurrentTest::Details()) - { - } + 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; + 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; - } + if (newDetails != NULL) + UnitTest::CurrentTest::Details() = newDetails; + } - ~ScopedCurrentTest() - { - UnitTest::CurrentTest::Results() = m_oldTestResults; - UnitTest::CurrentTest::Details() = m_oldTestDetails; - } + ~ScopedCurrentTest() + { + UnitTest::CurrentTest::Results() = m_oldTestResults; + UnitTest::CurrentTest::Details() = m_oldTestDetails; + } private: - UnitTest::TestResults* m_oldTestResults; - const UnitTest::TestDetails* m_oldTestDetails; + UnitTest::TestResults* m_oldTestResults; + const UnitTest::TestDetails* m_oldTestDetails; }; #endif diff --git a/tests/TestAssertHandler.cpp b/tests/TestAssertHandler.cpp index c9286f3..74a0f52 100644 --- a/tests/TestAssertHandler.cpp +++ b/tests/TestAssertHandler.cpp @@ -12,125 +12,122 @@ using namespace UnitTest; namespace { -TEST(CanSetAssertExpected) -{ - Detail::ExpectAssert(true); - CHECK(Detail::AssertExpected()); - - Detail::ExpectAssert(false); - CHECK(!Detail::AssertExpected()); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -TEST(ReportAssertThrowsAssertException) -{ - bool caught = false; - - try - { - TestResults testResults; - TestDetails testDetails("", "", "", 0); - Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); - } - catch(AssertException const&) - { - caught = true; - } - - CHECK(true == caught); -} - -TEST(ReportAssertClearsExpectAssertFlag) -{ - RecordingReporter reporter; - TestResults testResults(&reporter); - TestDetails testDetails("", "", "", 0); - - try - { - Detail::ExpectAssert(true); - Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); - } - catch(AssertException const&) - { - } - - CHECK(Detail::AssertExpected() == false); - CHECK_EQUAL(0, reporter.testFailedCount); -} - -TEST(ReportAssertWritesFailureToResultsAndDetailsWhenAssertIsNotExpected) -{ - const int lineNumber = 12345; - const char* description = "description"; - const char* filename = "filename"; - - RecordingReporter reporter; - TestResults testResults(&reporter); - TestDetails testDetails("", "", "", 0); - - try - { - Detail::ReportAssertEx(&testResults, &testDetails, description, filename, lineNumber); - } - catch(AssertException const&) - { - } - - CHECK_EQUAL(description, reporter.lastFailedMessage); - CHECK_EQUAL(filename, reporter.lastFailedFile); - CHECK_EQUAL(lineNumber, reporter.lastFailedLine); -} - -TEST(ReportAssertReportsNoErrorsWhenAssertIsExpected) -{ - Detail::ExpectAssert(true); - - RecordingReporter reporter; - TestResults testResults(&reporter); - TestDetails testDetails("", "", "", 0); - - try - { - Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); - } - catch(AssertException const&) - { - } - - CHECK_EQUAL(0, reporter.testFailedCount); -} - -TEST(CheckAssertMacroSetsAssertExpectationToFalseAfterRunning) -{ - Detail::ExpectAssert(true); - CHECK_ASSERT(ReportAssert("", "", 0)); - CHECK(!Detail::AssertExpected()); - Detail::ExpectAssert(false); -} - -#else - -TEST(SetAssertJumpTargetReturnsFalseWhenSettingJumpTarget) -{ - CHECK(UNITTEST_SET_ASSERT_JUMP_TARGET() == false); -} - -TEST(JumpToAssertJumpTarget_JumpsToSetPoint_ReturnsTrue) -{ - const volatile bool taken = !!UNITTEST_SET_ASSERT_JUMP_TARGET(); - - volatile bool set = false; - if (taken == false) - { - UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); - set = true; - } - - CHECK(set == false); -} - -#endif + TEST(CanSetAssertExpected) + { + Detail::ExpectAssert(true); + CHECK(Detail::AssertExpected()); + + Detail::ExpectAssert(false); + CHECK(!Detail::AssertExpected()); + } + + #ifndef UNITTEST_NO_EXCEPTIONS + + TEST(ReportAssertThrowsAssertException) + { + bool caught = false; + + try + { + TestResults testResults; + TestDetails testDetails("", "", "", 0); + Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); + } + catch(AssertException const&) + { + caught = true; + } + + CHECK(true == caught); + } + + TEST(ReportAssertClearsExpectAssertFlag) + { + RecordingReporter reporter; + TestResults testResults(&reporter); + TestDetails testDetails("", "", "", 0); + + try + { + Detail::ExpectAssert(true); + Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); + } + catch(AssertException const&) + {} + + CHECK(Detail::AssertExpected() == false); + CHECK_EQUAL(0, reporter.testFailedCount); + } + + TEST(ReportAssertWritesFailureToResultsAndDetailsWhenAssertIsNotExpected) + { + const int lineNumber = 12345; + const char* description = "description"; + const char* filename = "filename"; + + RecordingReporter reporter; + TestResults testResults(&reporter); + TestDetails testDetails("", "", "", 0); + + try + { + Detail::ReportAssertEx(&testResults, &testDetails, description, filename, lineNumber); + } + catch(AssertException const&) + {} + + CHECK_EQUAL(description, reporter.lastFailedMessage); + CHECK_EQUAL(filename, reporter.lastFailedFile); + CHECK_EQUAL(lineNumber, reporter.lastFailedLine); + } + + TEST(ReportAssertReportsNoErrorsWhenAssertIsExpected) + { + Detail::ExpectAssert(true); + + RecordingReporter reporter; + TestResults testResults(&reporter); + TestDetails testDetails("", "", "", 0); + + try + { + Detail::ReportAssertEx(&testResults, &testDetails, "", "", 0); + } + catch(AssertException const&) + {} + + CHECK_EQUAL(0, reporter.testFailedCount); + } + + TEST(CheckAssertMacroSetsAssertExpectationToFalseAfterRunning) + { + Detail::ExpectAssert(true); + CHECK_ASSERT(ReportAssert("", "", 0)); + CHECK(!Detail::AssertExpected()); + Detail::ExpectAssert(false); + } + + #else + + TEST(SetAssertJumpTargetReturnsFalseWhenSettingJumpTarget) + { + CHECK(UNITTEST_SET_ASSERT_JUMP_TARGET() == false); + } + + TEST(JumpToAssertJumpTarget_JumpsToSetPoint_ReturnsTrue) + { + const volatile bool taken = !!UNITTEST_SET_ASSERT_JUMP_TARGET(); + + volatile bool set = false; + if (taken == false) + { + UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); + set = true; + } + + CHECK(set == false); + } + + #endif } diff --git a/tests/TestCheckMacros.cpp b/tests/TestCheckMacros.cpp index 45ea0e9..f9c46c4 100644 --- a/tests/TestCheckMacros.cpp +++ b/tests/TestCheckMacros.cpp @@ -7,512 +7,512 @@ 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")); -} - -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(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); -} - -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(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(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); -} - -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(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(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); -} - -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); -} - -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(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")); -} - -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); -} + 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")); + } + + 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(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); + } + + 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(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(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); + } + + 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(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(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); + } + + 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); + } + + 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(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")); + } + + 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/tests/TestChecks.cpp b/tests/TestChecks.cpp index 9554b31..1ec64ee 100644 --- a/tests/TestChecks.cpp +++ b/tests/TestChecks.cpp @@ -9,310 +9,310 @@ 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(CheckEqualsWithStringsWorksOnNullExpected) -{ - char const* const expected = "hi"; - char const* const actual = NULL; - TestResults results; - CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); - CHECK_EQUAL (1, results.GetFailureCount()); -} - -TEST(CheckEqualsWithStringsWorksOnNullActual) -{ - char const* const expected = NULL; - char const* const actual = "hi"; - TestResults results; - CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); - CHECK_EQUAL (1, results.GetFailureCount()); -} - -TEST(CheckEqualsWithStringsWorksOnNullExpectedAndActual) -{ - char const* const expected = NULL; - char const* const actual = NULL; - TestResults results; - CheckEqual(results, expected, actual, 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) -{ - const unsigned int bitpattern = 0xFFFFFFFF; - float nan; - UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern)); - - TestResults results; - CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0)); - CHECK_EQUAL(1, results.GetFailureCount()); -} - -TEST(CheckCloseWithNaNAgainstItselfFails) -{ - const unsigned int bitpattern = 0xFFFFFFFF; - float nan; - UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern)); - - 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); -} + 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(CheckEqualsWithStringsWorksOnNullExpected) + { + char const* const expected = "hi"; + char const* const actual = NULL; + TestResults results; + CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); + CHECK_EQUAL (1, results.GetFailureCount()); + } + + TEST(CheckEqualsWithStringsWorksOnNullActual) + { + char const* const expected = NULL; + char const* const actual = "hi"; + TestResults results; + CheckEqual(results, expected, actual, TestDetails("", "", "", 0)); + CHECK_EQUAL (1, results.GetFailureCount()); + } + + TEST(CheckEqualsWithStringsWorksOnNullExpectedAndActual) + { + char const* const expected = NULL; + char const* const actual = NULL; + TestResults results; + CheckEqual(results, expected, actual, 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) + { + const unsigned int bitpattern = 0xFFFFFFFF; + float nan; + UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern)); + + TestResults results; + CheckClose(results, 3.0f, nan, 0.1f, TestDetails("", "", "", 0)); + CHECK_EQUAL(1, results.GetFailureCount()); + } + + TEST(CheckCloseWithNaNAgainstItselfFails) + { + const unsigned int bitpattern = 0xFFFFFFFF; + float nan; + UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern)); + + 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/tests/TestCompositeTestReporter.cpp b/tests/TestCompositeTestReporter.cpp index 9440a9e..d2be918 100644 --- a/tests/TestCompositeTestReporter.cpp +++ b/tests/TestCompositeTestReporter.cpp @@ -5,172 +5,171 @@ using namespace UnitTest; namespace { -TEST(ZeroReportersByDefault) -{ - CHECK_EQUAL(0, CompositeTestReporter().GetReporterCount()); -} - -struct MockReporter : TestReporter -{ - MockReporter() - : testStartCalled(false) - , testStartDetails(NULL) - , failureCalled(false) - , failureDetails(NULL) - , failureStr(NULL) - , testFinishCalled(false) - , testFinishDetails(NULL) - , testFinishSecondsElapsed(-1.0f) - , summaryCalled(false) - , summaryTotalTestCount(-1) - , summaryFailureCount(-1) - , summarySecondsElapsed(-1.0f) - { - } - - virtual void ReportTestStart(TestDetails const& test) - { - testStartCalled = true; - testStartDetails = &test; - } - - virtual void ReportFailure(TestDetails const& test, char const* failure) - { - failureCalled = true; - failureDetails = &test; - failureStr = failure; - } - - virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed) - { - testFinishCalled = true; - testFinishDetails = &test; - testFinishSecondsElapsed = secondsElapsed; - } - - virtual void ReportSummary(int totalTestCount, - int failedTestCount, - int failureCount, - float secondsElapsed) - { - summaryCalled = true; - summaryTotalTestCount = totalTestCount; - summaryFailedTestCount = failedTestCount; - summaryFailureCount = failureCount; - summarySecondsElapsed = secondsElapsed; - } - - bool testStartCalled; - TestDetails const* testStartDetails; - - bool failureCalled; - TestDetails const* failureDetails; - const char* failureStr; - - bool testFinishCalled; - TestDetails const* testFinishDetails; - float testFinishSecondsElapsed; - - bool summaryCalled; - int summaryTotalTestCount; - int summaryFailedTestCount; - int summaryFailureCount; - float summarySecondsElapsed; -}; - -TEST(AddReporter) -{ - MockReporter r; - CompositeTestReporter c; - - CHECK(c.AddReporter(&r)); - CHECK_EQUAL(1, c.GetReporterCount()); -} - -TEST(RemoveReporter) -{ - MockReporter r; - CompositeTestReporter c; - - c.AddReporter(&r); - CHECK(c.RemoveReporter(&r)); - CHECK_EQUAL(0, c.GetReporterCount()); -} - -struct Fixture -{ - Fixture() - { - c.AddReporter(&r0); - c.AddReporter(&r1); - } - - MockReporter r0, r1; - CompositeTestReporter c; -}; - -TEST_FIXTURE(Fixture, ReportTestStartCallsReportTestStartOnAllAggregates) -{ - TestDetails t("", "", "", 0); - c.ReportTestStart(t); - - CHECK(r0.testStartCalled); - CHECK_EQUAL(&t, r0.testStartDetails); - CHECK(r1.testStartCalled); - CHECK_EQUAL(&t, r1.testStartDetails); -} - -TEST_FIXTURE(Fixture, ReportFailureCallsReportFailureOnAllAggregates) -{ - TestDetails t("", "", "", 0); - const char* failStr = "fail"; - c.ReportFailure(t, failStr); - - CHECK(r0.failureCalled); - CHECK_EQUAL(&t, r0.failureDetails); - CHECK_EQUAL(failStr, r0.failureStr); - - CHECK(r1.failureCalled); - CHECK_EQUAL(&t, r1.failureDetails); - CHECK_EQUAL(failStr, r1.failureStr); -} - -TEST_FIXTURE(Fixture, ReportTestFinishCallsReportTestFinishOnAllAggregates) -{ - TestDetails t("", "", "", 0); - const float s = 1.2345f; - c.ReportTestFinish(t, s); - - CHECK(r0.testFinishCalled); - CHECK_EQUAL(&t, r0.testFinishDetails); - CHECK_CLOSE(s, r0.testFinishSecondsElapsed, 0.00001f); - - CHECK(r1.testFinishCalled); - CHECK_EQUAL(&t, r1.testFinishDetails); - CHECK_CLOSE(s, r1.testFinishSecondsElapsed, 0.00001f); -} - -TEST_FIXTURE(Fixture, ReportSummaryCallsReportSummaryOnAllAggregates) -{ - TestDetails t("", "", "", 0); - const int testCount = 3; - const int failedTestCount = 4; - const int failureCount = 5; - const float secondsElapsed = 3.14159f; - - c.ReportSummary(testCount, failedTestCount, failureCount, secondsElapsed); - - CHECK(r0.summaryCalled); - CHECK_EQUAL(testCount, r0.summaryTotalTestCount); - CHECK_EQUAL(failedTestCount, r0.summaryFailedTestCount); - CHECK_EQUAL(failureCount, r0.summaryFailureCount); - CHECK_CLOSE(secondsElapsed, r0.summarySecondsElapsed, 0.00001f); - - CHECK(r1.summaryCalled); - CHECK_EQUAL(testCount, r1.summaryTotalTestCount); - CHECK_EQUAL(failedTestCount, r1.summaryFailedTestCount); - CHECK_EQUAL(failureCount, r1.summaryFailureCount); - CHECK_CLOSE(secondsElapsed, r1.summarySecondsElapsed, 0.00001f); -} + TEST(ZeroReportersByDefault) + { + CHECK_EQUAL(0, CompositeTestReporter().GetReporterCount()); + } + + struct MockReporter : TestReporter + { + MockReporter() + : testStartCalled(false) + , testStartDetails(NULL) + , failureCalled(false) + , failureDetails(NULL) + , failureStr(NULL) + , testFinishCalled(false) + , testFinishDetails(NULL) + , testFinishSecondsElapsed(-1.0f) + , summaryCalled(false) + , summaryTotalTestCount(-1) + , summaryFailureCount(-1) + , summarySecondsElapsed(-1.0f) + {} + + virtual void ReportTestStart(TestDetails const& test) + { + testStartCalled = true; + testStartDetails = &test; + } + + virtual void ReportFailure(TestDetails const& test, char const* failure) + { + failureCalled = true; + failureDetails = &test; + failureStr = failure; + } + + virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed) + { + testFinishCalled = true; + testFinishDetails = &test; + testFinishSecondsElapsed = secondsElapsed; + } + + virtual void ReportSummary(int totalTestCount, + int failedTestCount, + int failureCount, + float secondsElapsed) + { + summaryCalled = true; + summaryTotalTestCount = totalTestCount; + summaryFailedTestCount = failedTestCount; + summaryFailureCount = failureCount; + summarySecondsElapsed = secondsElapsed; + } + + bool testStartCalled; + TestDetails const* testStartDetails; + + bool failureCalled; + TestDetails const* failureDetails; + const char* failureStr; + + bool testFinishCalled; + TestDetails const* testFinishDetails; + float testFinishSecondsElapsed; + + bool summaryCalled; + int summaryTotalTestCount; + int summaryFailedTestCount; + int summaryFailureCount; + float summarySecondsElapsed; + }; + + TEST(AddReporter) + { + MockReporter r; + CompositeTestReporter c; + + CHECK(c.AddReporter(&r)); + CHECK_EQUAL(1, c.GetReporterCount()); + } + + TEST(RemoveReporter) + { + MockReporter r; + CompositeTestReporter c; + + c.AddReporter(&r); + CHECK(c.RemoveReporter(&r)); + CHECK_EQUAL(0, c.GetReporterCount()); + } + + struct Fixture + { + Fixture() + { + c.AddReporter(&r0); + c.AddReporter(&r1); + } + + MockReporter r0, r1; + CompositeTestReporter c; + }; + + TEST_FIXTURE(Fixture, ReportTestStartCallsReportTestStartOnAllAggregates) + { + TestDetails t("", "", "", 0); + c.ReportTestStart(t); + + CHECK(r0.testStartCalled); + CHECK_EQUAL(&t, r0.testStartDetails); + CHECK(r1.testStartCalled); + CHECK_EQUAL(&t, r1.testStartDetails); + } + + TEST_FIXTURE(Fixture, ReportFailureCallsReportFailureOnAllAggregates) + { + TestDetails t("", "", "", 0); + const char* failStr = "fail"; + c.ReportFailure(t, failStr); + + CHECK(r0.failureCalled); + CHECK_EQUAL(&t, r0.failureDetails); + CHECK_EQUAL(failStr, r0.failureStr); + + CHECK(r1.failureCalled); + CHECK_EQUAL(&t, r1.failureDetails); + CHECK_EQUAL(failStr, r1.failureStr); + } + + TEST_FIXTURE(Fixture, ReportTestFinishCallsReportTestFinishOnAllAggregates) + { + TestDetails t("", "", "", 0); + const float s = 1.2345f; + c.ReportTestFinish(t, s); + + CHECK(r0.testFinishCalled); + CHECK_EQUAL(&t, r0.testFinishDetails); + CHECK_CLOSE(s, r0.testFinishSecondsElapsed, 0.00001f); + + CHECK(r1.testFinishCalled); + CHECK_EQUAL(&t, r1.testFinishDetails); + CHECK_CLOSE(s, r1.testFinishSecondsElapsed, 0.00001f); + } + + TEST_FIXTURE(Fixture, ReportSummaryCallsReportSummaryOnAllAggregates) + { + TestDetails t("", "", "", 0); + const int testCount = 3; + const int failedTestCount = 4; + const int failureCount = 5; + const float secondsElapsed = 3.14159f; + + c.ReportSummary(testCount, failedTestCount, failureCount, secondsElapsed); + + CHECK(r0.summaryCalled); + CHECK_EQUAL(testCount, r0.summaryTotalTestCount); + CHECK_EQUAL(failedTestCount, r0.summaryFailedTestCount); + CHECK_EQUAL(failureCount, r0.summaryFailureCount); + CHECK_CLOSE(secondsElapsed, r0.summarySecondsElapsed, 0.00001f); + + CHECK(r1.summaryCalled); + CHECK_EQUAL(testCount, r1.summaryTotalTestCount); + CHECK_EQUAL(failedTestCount, r1.summaryFailedTestCount); + CHECK_EQUAL(failureCount, r1.summaryFailureCount); + CHECK_CLOSE(secondsElapsed, r1.summarySecondsElapsed, 0.00001f); + } } diff --git a/tests/TestCurrentTest.cpp b/tests/TestCurrentTest.cpp index 7de1a72..6cfb99d 100644 --- a/tests/TestCurrentTest.cpp +++ b/tests/TestCurrentTest.cpp @@ -2,37 +2,37 @@ #include "UnitTest++/CurrentTest.h" #include "ScopedCurrentTest.h" -namespace +namespace { -TEST(CanSetandGetDetails) -{ - bool ok = false; - { - ScopedCurrentTest scopedTest; + TEST(CanSetandGetDetails) + { + bool ok = false; + { + ScopedCurrentTest scopedTest; - const UnitTest::TestDetails* details = reinterpret_cast< const UnitTest::TestDetails* >(12345); - UnitTest::CurrentTest::Details() = details; + const UnitTest::TestDetails* details = reinterpret_cast< const UnitTest::TestDetails* >(12345); + UnitTest::CurrentTest::Details() = details; - ok = (UnitTest::CurrentTest::Details() == details); - } + ok = (UnitTest::CurrentTest::Details() == details); + } - CHECK(ok); -} + CHECK(ok); + } -TEST(CanSetAndGetResults) -{ - bool ok = false; - { - ScopedCurrentTest scopedTest; + TEST(CanSetAndGetResults) + { + bool ok = false; + { + ScopedCurrentTest scopedTest; - UnitTest::TestResults results; - UnitTest::CurrentTest::Results() = &results; + UnitTest::TestResults results; + UnitTest::CurrentTest::Results() = &results; - ok = (UnitTest::CurrentTest::Results() == &results); - } + ok = (UnitTest::CurrentTest::Results() == &results); + } - CHECK(ok); -} + CHECK(ok); + } } diff --git a/tests/TestDeferredTestReporter.cpp b/tests/TestDeferredTestReporter.cpp index 60c347c..de57387 100644 --- a/tests/TestDeferredTestReporter.cpp +++ b/tests/TestDeferredTestReporter.cpp @@ -9,114 +9,113 @@ namespace UnitTest { -namespace -{ - -#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - 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()); + namespace + { + + #ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + 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.c_str()); + CHECK_EQUAL(testSuite.c_str(), result.suiteName.c_str()); + } + + 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.c_str()); + } + + 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].failureStr); + CHECK_EQUAL(failure2, result.failures[1].failureStr); + } + + 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); + DeferredTestFailure const& failure = result.failures.at(0); + CHECK_EQUAL(goodStr, failure.failureStr); + } + + } } -TEST_FIXTURE(DeferredTestReporterFixture, ReportTestStartCapturesTestNameAndSuite) -{ - reporter.ReportTestStart(details); - - DeferredTestResult const& result = reporter.GetResults().at(0); - CHECK_EQUAL(testName.c_str(), result.testName.c_str()); - CHECK_EQUAL(testSuite.c_str(), result.suiteName.c_str()); -} - -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.c_str()); -} - -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].failureStr); - CHECK_EQUAL(failure2, result.failures[1].failureStr); -} - -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); - DeferredTestFailure const& failure = result.failures.at(0); - CHECK_EQUAL(goodStr, failure.failureStr); -} - -}} - #endif diff --git a/tests/TestExceptions.cpp b/tests/TestExceptions.cpp index 1a0ab04..972e64d 100644 --- a/tests/TestExceptions.cpp +++ b/tests/TestExceptions.cpp @@ -12,552 +12,546 @@ using namespace std; namespace { -int ThrowingFunction() -{ - throw "Doh"; -} - -int ThrowingStdExceptionFunction() -{ - throw std::logic_error("Doh"); -} - -SUITE(CheckExceptionTests) -{ - struct CheckFixture - { - CheckFixture() - : reporter() - , testResults(&reporter) - { - } - - void PerformCheckWithNonStdThrow() - { + int ThrowingFunction() + { + throw "Doh"; + } + + int ThrowingStdExceptionFunction() + { + throw std::logic_error("Doh"); + } + + SUITE(CheckExceptionTests) + { + struct CheckFixture + { + CheckFixture() + : reporter() + , testResults(&reporter) + {} + + void PerformCheckWithNonStdThrow() + { ScopedCurrentTest scopedResults(testResults); CHECK(ThrowingFunction() == 1); - } + } - void PerformCheckWithStdThrow() - { + void PerformCheckWithStdThrow() + { ScopedCurrentTest scopedResults(testResults); CHECK(ThrowingStdExceptionFunction() == 1); - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - }; - - TEST_FIXTURE(CheckFixture, CheckFailsOnException) - { - PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckFixture, CheckFailsOnStdException) - { - PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents) - { - PerformCheckWithNonStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); - } - - TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents) - { - PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1")); - } - - TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) - { - PerformCheckWithStdThrow(); - CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); - } -} - -SUITE(CheckEqualExceptionTests) -{ - struct CheckEqualFixture - { - CheckEqualFixture() - : reporter() - , testResults(&reporter) - , line(-1) - { - } - - void PerformCheckWithNonStdThrow() - { + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + }; + + TEST_FIXTURE(CheckFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction() == 1")); + } + + TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction() == 1")); + } + + TEST_FIXTURE(CheckFixture, CheckFailureBecauseOfStandardExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + } + } + + SUITE(CheckEqualExceptionTests) + { + struct CheckEqualFixture + { + CheckEqualFixture() + : reporter() + , testResults(&reporter) + , line(-1) + {} + + void PerformCheckWithNonStdThrow() + { UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); CHECK_EQUAL(ThrowingFunction(), 123); line = __LINE__; - } + } - void PerformCheckWithStdThrow() - { + void PerformCheckWithStdThrow() + { UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); CHECK_EQUAL(ThrowingStdExceptionFunction(), 123); line = __LINE__; - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; - }; - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnException) - { - PerformCheckWithNonStdThrow(); - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnStdException) - { - PerformCheckWithStdThrow(); - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) - { - PerformCheckWithNonStdThrow(); - - CHECK_EQUAL("testName", reporter.lastFailedTest); - CHECK_EQUAL("suiteName", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionContainsCorrectDetails) - { - PerformCheckWithStdThrow(); - - CHECK_EQUAL("testName", reporter.lastFailedTest); - CHECK_EQUAL("suiteName", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionIncludesCheckContents) - { - PerformCheckWithNonStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()")); - CHECK(strstr(reporter.lastFailedMessage, "123")); - } - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionIncludesCheckContents) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction()")); - CHECK(strstr(reporter.lastFailedMessage, "123")); - } - - TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); - } -} - -SUITE(CheckCloseExceptionTests) -{ - struct CheckCloseFixture - { - CheckCloseFixture() - : reporter() - , testResults(&reporter) - , line(-1) - { - } - - void PerformCheckWithNonStdThrow() - { + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnException) + { + PerformCheckWithNonStdThrow(); + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailsOnStdException) + { + PerformCheckWithStdThrow(); + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); + + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); + + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "ThrowingFunction()")); + CHECK(strstr(reporter.lastFailedMessage, "123")); + } + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "ThrowingStdExceptionFunction()")); + CHECK(strstr(reporter.lastFailedMessage, "123")); + } + + TEST_FIXTURE(CheckEqualFixture, CheckEqualFailureBecauseOfStandardExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + } + } + + SUITE(CheckCloseExceptionTests) + { + struct CheckCloseFixture + { + CheckCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + {} + + void PerformCheckWithNonStdThrow() + { UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); CHECK_CLOSE(static_cast(ThrowingFunction()), 1.0001f, 0.1f); line = __LINE__; - } + } - void PerformCheckWithStdThrow() - { + void PerformCheckWithStdThrow() + { UnitTest::TestDetails const testDetails("closeTest", "closeSuite", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); CHECK_CLOSE(static_cast(ThrowingStdExceptionFunction()), 1.0001f, 0.1f); line = __LINE__; - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; - }; - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnException) - { - PerformCheckWithNonStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnStdException) - { - PerformCheckWithStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionContainsCorrectDetails) - { - PerformCheckWithNonStdThrow(); - - CHECK_EQUAL("closeTest", reporter.lastFailedTest); - CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionContainsCorrectDetails) - { - PerformCheckWithStdThrow(); - - CHECK_EQUAL("closeTest", reporter.lastFailedTest); - CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionIncludesCheckContents) - { - PerformCheckWithNonStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingFunction())")); - CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); - } - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionIncludesCheckContents) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingStdExceptionFunction())")); - CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); - } - - TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); - } -} - -class ThrowingObject -{ -public: - float operator[](int) const - { - throw "Test throw"; - } -}; - -class StdThrowingObject -{ -public: - float operator[](int) const - { - throw std::runtime_error("Test throw"); - } -}; - -SUITE(CheckArrayCloseExceptionTests) -{ - struct CheckArrayCloseFixture - { - CheckArrayCloseFixture() - : reporter() - , testResults(&reporter) - , line(-1) - { - } - - void PerformCheckWithNonStdThrow() - { + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnException) + { + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailsOnStdException) + { + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); + + CHECK_EQUAL("closeTest", reporter.lastFailedTest); + CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); + + CHECK_EQUAL("closeTest", reporter.lastFailedTest); + CHECK_EQUAL("closeSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingFunction())")); + CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); + } + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "static_cast(ThrowingStdExceptionFunction())")); + CHECK(strstr(reporter.lastFailedMessage, "1.0001f")); + } + + TEST_FIXTURE(CheckCloseFixture, CheckCloseFailureBecauseOfStandardExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Doh)")); + } + } + + class ThrowingObject + { + public: + float operator[](int) const + { + throw "Test throw"; + } + }; + + class StdThrowingObject + { + public: + float operator[](int) const + { + throw std::runtime_error("Test throw"); + } + }; + + SUITE(CheckArrayCloseExceptionTests) + { + struct CheckArrayCloseFixture + { + CheckArrayCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + {} + + void PerformCheckWithNonStdThrow() + { UnitTest::TestDetails const 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__; - } + } - void PerformCheckWithStdThrow() - { + void PerformCheckWithStdThrow() + { UnitTest::TestDetails const testDetails("arrayCloseTest", "arrayCloseSuite", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); int const data[4] = { 0, 1, 2, 3 }; CHECK_ARRAY_CLOSE(data, StdThrowingObject(), 4, 0.01f); line = __LINE__; - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; - }; - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) - { - PerformCheckWithNonStdThrow(); - - CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) - { - PerformCheckWithStdThrow(); - - CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnException) - { - PerformCheckWithNonStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnStdException) - { - PerformCheckWithStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnExceptionIncludesCheckContents) - { - PerformCheckWithNonStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); - } - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); - } - - TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesWhat) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); - } -} - -SUITE(CheckArrayEqualExceptionTests) -{ - struct CheckArrayEqualFixture - { - CheckArrayEqualFixture() - : reporter() - , testResults(&reporter) - , line(-1) - { - } - - void PerformCheckWithNonStdThrow() - { + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); + + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); + + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); + } + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); + } + + TEST_FIXTURE(CheckArrayCloseFixture, CheckFailureOnStdExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); + } + } + + SUITE(CheckArrayEqualExceptionTests) + { + struct CheckArrayEqualFixture + { + CheckArrayEqualFixture() + : reporter() + , testResults(&reporter) + , line(-1) + {} + + void PerformCheckWithNonStdThrow() + { UnitTest::TestDetails const testDetails("arrayEqualTest", "arrayEqualSuite", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); int const data[4] = { 0, 1, 2, 3 }; CHECK_ARRAY_EQUAL(data, ThrowingObject(), 4); line = __LINE__; - } + } - void PerformCheckWithStdThrow() - { + void PerformCheckWithStdThrow() + { UnitTest::TestDetails const testDetails("arrayEqualTest", "arrayEqualSuite", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); int const data[4] = { 0, 1, 2, 3 }; CHECK_ARRAY_EQUAL(data, StdThrowingObject(), 4); line = __LINE__; - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; - }; - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) - { - PerformCheckWithNonStdThrow(); - - CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) - { - PerformCheckWithStdThrow(); - - CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnException) - { - PerformCheckWithNonStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnStdException) - { - PerformCheckWithStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnExceptionIncludesCheckContents) - { - PerformCheckWithNonStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); - } - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesCheckContents) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); - } - - TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesWhat) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); - } -} - -SUITE(CheckArray2DExceptionTests) -{ - class ThrowingObject2D - { - public: - float* operator[](int) const - { + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); + + CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); + + CHECK_EQUAL("arrayEqualTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayEqualSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject()")); + } + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject()")); + } + + TEST_FIXTURE(CheckArrayEqualFixture, CheckFailureOnStdExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); + } + } + + SUITE(CheckArray2DExceptionTests) + { + class ThrowingObject2D + { + public: + float* operator[](int) const + { throw "Test throw"; - } - }; - - class StdThrowingObject2D - { - public: - float* operator[](int) const - { + } + }; + + class StdThrowingObject2D + { + public: + float* operator[](int) const + { throw std::runtime_error("Test throw"); - } - }; - - struct CheckArray2DCloseFixture - { - CheckArray2DCloseFixture() - : reporter() - , testResults(&reporter) - , line(-1) - { - } - - void PerformCheckWithNonStdThrow() - { + } + }; + + struct CheckArray2DCloseFixture + { + CheckArray2DCloseFixture() + : reporter() + , testResults(&reporter) + , line(-1) + {} + + void PerformCheckWithNonStdThrow() + { UnitTest::TestDetails const 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__; - } + } - void PerformCheckWithStdThrow() - { + void PerformCheckWithStdThrow() + { UnitTest::TestDetails const testDetails("array2DCloseTest", "array2DCloseSuite", "filename", -1); ScopedCurrentTest scopedResults(testResults, &testDetails); const float data[2][2] = { {0, 1}, {2, 3} }; CHECK_ARRAY2D_CLOSE(data, StdThrowingObject2D(), 2, 2, 0.01f); line = __LINE__; - } - - RecordingReporter reporter; - UnitTest::TestResults testResults; - int line; - }; - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) - { - PerformCheckWithNonStdThrow(); - - CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) - { - PerformCheckWithStdThrow(); - - CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); - } - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnException) - { - PerformCheckWithNonStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnStdException) - { - PerformCheckWithStdThrow(); - - CHECK(testResults.GetFailureCount() > 0); - } - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnExceptionIncludesCheckContents) - { - PerformCheckWithNonStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject2D()")); - } - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "data")); - CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject2D()")); - } - - TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesWhat) - { - PerformCheckWithStdThrow(); - - CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); - } -} + } + + RecordingReporter reporter; + UnitTest::TestResults testResults; + int line; + }; + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfExceptionContainsCorrectDetails) + { + PerformCheckWithNonStdThrow(); + + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureBecauseOfStdExceptionContainsCorrectDetails) + { + PerformCheckWithStdThrow(); + + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnException) + { + PerformCheckWithNonStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailsOnStdException) + { + PerformCheckWithStdThrow(); + + CHECK(testResults.GetFailureCount() > 0); + } + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnExceptionIncludesCheckContents) + { + PerformCheckWithNonStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "ThrowingObject2D()")); + } + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesCheckContents) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "data")); + CHECK(strstr(reporter.lastFailedMessage, "StdThrowingObject2D()")); + } + + TEST_FIXTURE(CheckArray2DCloseFixture, CheckFailureOnStdExceptionIncludesWhat) + { + PerformCheckWithStdThrow(); + + CHECK(strstr(reporter.lastFailedMessage, "exception (Test throw)")); + } + } } #endif diff --git a/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp index ff1e920..447aac1 100644 --- a/tests/TestMemoryOutStream.cpp +++ b/tests/TestMemoryOutStream.cpp @@ -11,326 +11,326 @@ using namespace std; namespace { -const char* const maxSignedIntegralStr(size_t nBytes) -{ - switch(nBytes) - { - case 8: - return "9223372036854775807"; - case 4: - return "2147483647"; - case 2: - return "32767"; - case 1: - return "127"; - default: - return "Unsupported signed integral size"; - } -} - -const char* const minSignedIntegralStr(size_t nBytes) -{ - switch(nBytes) - { - case 8: - return "-9223372036854775808"; - case 4: - return "-2147483648"; - case 2: - return "-32768"; - case 1: - return "-128"; - default: - return "Unsupported signed integral size"; - } -} - -const char* const maxUnsignedIntegralStr(size_t nBytes) -{ - switch(nBytes) - { - case 8: - return "18446744073709551615"; - case 4: - return "4294967295"; - case 2: - return "65535"; - case 1: - return "255"; - default: - return "Unsupported signed integral size"; - } -} - -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(StreaminMaxIntWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << INT_MAX; - CHECK_EQUAL(maxSignedIntegralStr(sizeof(int)), stream.GetText()); -} - -TEST(StreamingMinIntWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << INT_MIN; - CHECK_EQUAL(minSignedIntegralStr(sizeof(int)), stream.GetText()); -} - -TEST(StreamingUnsignedIntWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned int)123; - CHECK_EQUAL("123", stream.GetText()); -} - -TEST(StreamingMaxUnsignedIntWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned int)UINT_MAX; - CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned int)), stream.GetText()); -} - -TEST(StreamingMinUnsignedIntWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned int)0; - CHECK_EQUAL("0", stream.GetText()); -} - -TEST(StreamingLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (long)(-123); - CHECK_EQUAL("-123", stream.GetText()); -} - -TEST(StreamingMaxLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (long)(LONG_MAX); - CHECK_EQUAL(maxSignedIntegralStr(sizeof(long)), stream.GetText()); -} - -TEST(StreamingMinLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (long)(LONG_MIN); - CHECK_EQUAL(minSignedIntegralStr(sizeof(long)), stream.GetText()); -} - -TEST(StreamingUnsignedLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned long)123; - CHECK_EQUAL("123", stream.GetText()); -} - -TEST(StreamingMaxUnsignedLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned long)ULONG_MAX; - CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long)), stream.GetText()); -} - -TEST(StreamingMinUnsignedLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned long)0ul; - CHECK_EQUAL("0", stream.GetText()); -} - -TEST(StreamingLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; -#ifdef UNITTEST_COMPILER_IS_MSVC6 - stream << (__int64)-12345i64; -#else - stream << (long long)-12345ll; -#endif - CHECK_EQUAL("-12345", stream.GetText()); -} - -#ifdef LLONG_MAX -TEST(StreamingMaxLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (long long)LLONG_MAX; - CHECK_EQUAL(maxSignedIntegralStr(sizeof(long long)), stream.GetText()); -} -#endif - -#ifdef LLONG_MIN -TEST(StreamingMinLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (long long)LLONG_MIN; - CHECK_EQUAL(minSignedIntegralStr(sizeof(long long)), stream.GetText()); -} -#endif - -TEST(StreamingUnsignedLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; -#ifdef UNITTEST_COMPILER_IS_MSVC6 - stream << (unsigned __int64)85899ui64; -#else - stream << (unsigned long long)85899ull; -#endif - CHECK_EQUAL("85899", stream.GetText()); -} - -#ifdef ULLONG_MAX -TEST(StreamingMaxUnsignedLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; - stream << (unsigned long long)ULLONG_MAX; - CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long long)), stream.GetText()); -} -#endif - -TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) -{ - MemoryOutStream stream; -#ifdef UNITTEST_COMPILER_IS_MSVC6 - stream << (unsigned __int64)0ui64; -#else - stream << (unsigned long long)0ull; -#endif - CHECK_EQUAL("0", 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()); -} - -TEST(ClearEmptiesMemoryOutStreamContents) -{ - MemoryOutStream stream; - stream << "Hello world"; - stream.Clear(); - CHECK_EQUAL("", stream.GetText()); -} - -#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM - -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.000000", stream.GetText()); -} - -TEST(WritingSizeTLongerThanCapacityFitsInNewBuffer) -{ - MemoryOutStream stream(8); - stream << "aaaa" << size_t(32145); - CHECK_EQUAL("aaaa32145", stream.GetText()); -} - -TEST(VerifyLargeDoubleCanBeStreamedWithoutCrashing) -{ - MemoryOutStream stream(8); - stream << DBL_MAX; - CHECK(true); -} - -#endif + const char* const maxSignedIntegralStr(size_t nBytes) + { + switch(nBytes) + { + case 8: + return "9223372036854775807"; + case 4: + return "2147483647"; + case 2: + return "32767"; + case 1: + return "127"; + default: + return "Unsupported signed integral size"; + } + } + + const char* const minSignedIntegralStr(size_t nBytes) + { + switch(nBytes) + { + case 8: + return "-9223372036854775808"; + case 4: + return "-2147483648"; + case 2: + return "-32768"; + case 1: + return "-128"; + default: + return "Unsupported signed integral size"; + } + } + + const char* const maxUnsignedIntegralStr(size_t nBytes) + { + switch(nBytes) + { + case 8: + return "18446744073709551615"; + case 4: + return "4294967295"; + case 2: + return "65535"; + case 1: + return "255"; + default: + return "Unsupported signed integral size"; + } + } + + 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(StreaminMaxIntWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << INT_MAX; + CHECK_EQUAL(maxSignedIntegralStr(sizeof(int)), stream.GetText()); + } + + TEST(StreamingMinIntWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << INT_MIN; + CHECK_EQUAL(minSignedIntegralStr(sizeof(int)), stream.GetText()); + } + + TEST(StreamingUnsignedIntWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned int)123; + CHECK_EQUAL("123", stream.GetText()); + } + + TEST(StreamingMaxUnsignedIntWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned int)UINT_MAX; + CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned int)), stream.GetText()); + } + + TEST(StreamingMinUnsignedIntWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned int)0; + CHECK_EQUAL("0", stream.GetText()); + } + + TEST(StreamingLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (long)(-123); + CHECK_EQUAL("-123", stream.GetText()); + } + + TEST(StreamingMaxLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (long)(LONG_MAX); + CHECK_EQUAL(maxSignedIntegralStr(sizeof(long)), stream.GetText()); + } + + TEST(StreamingMinLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (long)(LONG_MIN); + CHECK_EQUAL(minSignedIntegralStr(sizeof(long)), stream.GetText()); + } + + TEST(StreamingUnsignedLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned long)123; + CHECK_EQUAL("123", stream.GetText()); + } + + TEST(StreamingMaxUnsignedLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned long)ULONG_MAX; + CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long)), stream.GetText()); + } + + TEST(StreamingMinUnsignedLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned long)0ul; + CHECK_EQUAL("0", stream.GetText()); + } + + TEST(StreamingLongLongWritesCorrectCharacters) + { + MemoryOutStream stream; + #ifdef UNITTEST_COMPILER_IS_MSVC6 + stream << (__int64)-12345i64; + #else + stream << (long long)-12345ll; + #endif + CHECK_EQUAL("-12345", stream.GetText()); + } + + #ifdef LLONG_MAX + TEST(StreamingMaxLongLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (long long)LLONG_MAX; + CHECK_EQUAL(maxSignedIntegralStr(sizeof(long long)), stream.GetText()); + } + #endif + + #ifdef LLONG_MIN + TEST(StreamingMinLongLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (long long)LLONG_MIN; + CHECK_EQUAL(minSignedIntegralStr(sizeof(long long)), stream.GetText()); + } + #endif + + TEST(StreamingUnsignedLongLongWritesCorrectCharacters) + { + MemoryOutStream stream; + #ifdef UNITTEST_COMPILER_IS_MSVC6 + stream << (unsigned __int64)85899ui64; + #else + stream << (unsigned long long)85899ull; + #endif + CHECK_EQUAL("85899", stream.GetText()); + } + + #ifdef ULLONG_MAX + TEST(StreamingMaxUnsignedLongLongWritesCorrectCharacters) + { + MemoryOutStream stream; + stream << (unsigned long long)ULLONG_MAX; + CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long long)), stream.GetText()); + } + #endif + + TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) + { + MemoryOutStream stream; + #ifdef UNITTEST_COMPILER_IS_MSVC6 + stream << (unsigned __int64)0ui64; + #else + stream << (unsigned long long)0ull; + #endif + CHECK_EQUAL("0", 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()); + } + + TEST(ClearEmptiesMemoryOutStreamContents) + { + MemoryOutStream stream; + stream << "Hello world"; + stream.Clear(); + CHECK_EQUAL("", stream.GetText()); + } + + #ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + + 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.000000", stream.GetText()); + } + + TEST(WritingSizeTLongerThanCapacityFitsInNewBuffer) + { + MemoryOutStream stream(8); + stream << "aaaa" << size_t(32145); + CHECK_EQUAL("aaaa32145", stream.GetText()); + } + + TEST(VerifyLargeDoubleCanBeStreamedWithoutCrashing) + { + MemoryOutStream stream(8); + stream << DBL_MAX; + CHECK(true); + } + + #endif } diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 49529eb..2d1aec8 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -7,127 +7,127 @@ using namespace UnitTest; namespace { -TEST(PassingTestHasNoFailures) -{ - class PassingTest : public Test - { - public: - PassingTest() : Test("passing") {} - virtual void RunImpl() const - { + 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 - { + } + }; + + 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(); - } + } + }; + + TestResults results; + { + ScopedCurrentTest scopedResults(results); + FailingTest().Run(); + } + + CHECK_EQUAL(1, results.GetFailureCount()); + } + + #ifndef UNITTEST_NO_EXCEPTIONS + TEST(ThrowingTestsAreReportedAsFailures) + { + class CrashingTest : public Test + { + public: + CrashingTest() : Test("throwing") {} + virtual void RunImpl() const + { + throw "Blah"; + } + }; - CHECK_EQUAL(1, results.GetFailureCount()); -} + TestResults results; + { + ScopedCurrentTest scopedResult(results); + CrashingTest().Run(); + } -#ifndef UNITTEST_NO_EXCEPTIONS -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()); -} + CHECK_EQUAL(1, results.GetFailureCount()); + } -#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) + #if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) // Skip this test in debug because some debuggers don't like it. -#if defined(NDEBUG) -TEST(CrashingTestsAreReportedAsFailures) -{ - class CrashingTest : public Test - { - public: - CrashingTest() : Test("crashing") {} - virtual void RunImpl() const - { + #if defined(NDEBUG) + 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 -#endif -#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()); -} + } + }; + + TestResults results; + { + ScopedCurrentTest scopedResult(results); + CrashingTest().Run(); + } + + CHECK_EQUAL(1, results.GetFailureCount()); + } + #endif + #endif + #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/tests/TestTestList.cpp b/tests/TestTestList.cpp index 73732c5..4a0bdcb 100644 --- a/tests/TestTestList.cpp +++ b/tests/TestTestList.cpp @@ -6,45 +6,45 @@ 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.m_nextTest == 0); -} - -TEST(AddingSecondTestAddsItToEndOfList) -{ - Test test1("test1"); - Test test2("test2"); - - TestList list; - list.Add(&test1); - list.Add(&test2); - - CHECK(list.GetHead() == &test1); - CHECK(test1.m_nextTest == &test2); - CHECK(test2.m_nextTest == 0); -} - -TEST(ListAdderAddsTestToList) -{ - TestList list; - - Test test(""); - ListAdder adder(list, &test); - - CHECK(list.GetHead() == &test); - CHECK(test.m_nextTest == 0); -} + TEST(TestListIsEmptyByDefault) + { + TestList list; + CHECK(list.GetHead() == 0); + } + + TEST(AddingTestSetsHeadToTest) + { + Test test("test"); + TestList list; + list.Add(&test); + + CHECK(list.GetHead() == &test); + CHECK(test.m_nextTest == 0); + } + + TEST(AddingSecondTestAddsItToEndOfList) + { + Test test1("test1"); + Test test2("test2"); + + TestList list; + list.Add(&test1); + list.Add(&test2); + + CHECK(list.GetHead() == &test1); + CHECK(test1.m_nextTest == &test2); + CHECK(test2.m_nextTest == 0); + } + + TEST(ListAdderAddsTestToList) + { + TestList list; + + Test test(""); + ListAdder adder(list, &test); + + CHECK(list.GetHead() == &test); + CHECK(test.m_nextTest == 0); + } } diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index 9bf7b91..a54485e 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -13,219 +13,212 @@ using namespace std; /* test for c++11 support */ #ifndef _MSC_VER - /* Test for clang >= 3.3 */ - #ifdef __clang__ - #if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 ))) - #define _NOEXCEPT_OP(x) noexcept(x) - #else - #define _NOEXCEPT_OP(x) - #endif - #endif - - #ifndef __clang__ - /* Test for GCC >= 4.8.0 */ - #ifdef __GNUC__ - #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 )) - #define _NOEXCEPT_OP(x) noexcept(x) - #else - #define _NOEXCEPT_OP(x) - #endif - #endif - #endif +/* Test for clang >= 3.3 */ +#ifdef __clang__ +#if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 ))) +#define _NOEXCEPT_OP(x) noexcept(x) +#else +#define _NOEXCEPT_OP(x) +#endif +#endif + +#ifndef __clang__ +/* Test for GCC >= 4.8.0 */ +#ifdef __GNUC__ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 )) +#define _NOEXCEPT_OP(x) noexcept(x) +#else +#define _NOEXCEPT_OP(x) +#endif +#endif +#endif #elif _MSC_VER - #if (_MSC_VER > 1800) - #define _NOEXCEPT_OP(x) noexcept(x) - #else - #define _NOEXCEPT_OP(x) - #endif +#if (_MSC_VER > 1800) +#define _NOEXCEPT_OP(x) noexcept(x) +#else +#define _NOEXCEPT_OP(x) +#endif #endif namespace { -TestList list1; -TEST_EX(DummyTest, list1) -{ -} + TestList list1; + TEST_EX(DummyTest, list1) + {} -TEST (TestsAreAddedToTheListThroughMacro) -{ - CHECK(list1.GetHead() != 0); - CHECK(list1.GetHead()->m_nextTest == 0); -} + TEST (TestsAreAddedToTheListThroughMacro) + { + CHECK(list1.GetHead() != 0); + CHECK(list1.GetHead()->m_nextTest == 0); + } -#ifndef UNITTEST_NO_EXCEPTIONS + #ifndef UNITTEST_NO_EXCEPTIONS -struct ThrowingThingie -{ - ThrowingThingie() : dummy(false) - { - if (!dummy) + struct ThrowingThingie + { + ThrowingThingie() : dummy(false) + { + if (!dummy) throw "Oops"; - } + } - bool dummy; -}; + bool dummy; + }; -TestList list2; -TEST_FIXTURE_EX(ThrowingThingie, DummyTestName, list2) -{ -} + 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")); -} + TEST (ExceptionsInFixtureAreReportedAsHappeningInTheFixture) + { + RecordingReporter reporter; + TestResults result(&reporter); + { + ScopedCurrentTest scopedResults(result); + list2.GetHead()->Run(); + } -#endif + 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) - { - } + #endif - TEST_FIXTURE(DummyFixture,SimilarlyNamedFixtureTestsInDifferentSuitesWork) - { - } -} - -TestList macroTestList1; -TEST_EX(MacroTestHelper1, macroTestList1) -{ -} + struct DummyFixture + { + int x; + }; -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); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -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() _NOEXCEPT_OP(false) { 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")); -} - -#endif +// 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); + } + + #ifndef UNITTEST_NO_EXCEPTIONS + + 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() _NOEXCEPT_OP(false) { + 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")); + } + + #endif } @@ -234,9 +227,8 @@ TEST(CorrectlyReportsFixturesWithCtorsThatAssert) // Note: we are outside of the anonymous namespace SUITE(SameTestSuite) { - TEST(DummyTest1) - { - } + TEST(DummyTest1) + {} } #define CUR_TEST_NAME CurrentTestDetailsContainCurrentTestInfo @@ -245,8 +237,8 @@ SUITE(SameTestSuite) TEST(CUR_TEST_NAME) { - const UnitTest::TestDetails* details = CurrentTest::Details(); - CHECK_EQUAL(STRINGIFY(CUR_TEST_NAME), details->testName); + const UnitTest::TestDetails* details = CurrentTest::Details(); + CHECK_EQUAL(STRINGIFY(CUR_TEST_NAME), details->testName); } #undef CUR_TEST_NAME diff --git a/tests/TestTestResults.cpp b/tests/TestTestResults.cpp index a115687..1f66744 100644 --- a/tests/TestTestResults.cpp +++ b/tests/TestTestResults.cpp @@ -6,106 +6,106 @@ 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); -} + 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/tests/TestTestRunner.cpp b/tests/TestTestRunner.cpp index d4982a4..86c672d 100644 --- a/tests/TestTestRunner.cpp +++ b/tests/TestTestRunner.cpp @@ -10,328 +10,324 @@ 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() const - { - TestResults& testResults_ = *CurrentTest::Results(); - - for (int i=0; i < count; ++i) + + 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() const + { + TestResults& testResults_ = *CurrentTest::Results(); + + for (int i=0; i < count; ++i) + { + if (asserted) { - if (asserted) - { - ReportAssert("desc", "file", 0); - } - else if (!success) - { - testResults_.OnTestFailure(m_details, "message"); - } + ReportAssert("desc", "file", 0); } - } - - bool const success; - bool const asserted; - int const count; - }; - - struct FixtureBase - { - FixtureBase() - : runner(reporter) - { - } - - template - int RunTestsIf(TestList const& list, char const* suiteName, - const Predicate& predicate, int maxTestTimeInMs) - { - TestResults* oldResults = CurrentTest::Results(); - const TestDetails* oldDetails = CurrentTest::Details(); - int result = runner.RunTestsIf(list, suiteName, predicate, maxTestTimeInMs); - CurrentTest::Results() = oldResults; - CurrentTest::Details() = oldDetails; - return result; - } - - TestRunner runner; - RecordingReporter reporter; - }; - - struct TestRunnerFixture : public FixtureBase - { - TestList list; - }; - - TEST_FIXTURE(TestRunnerFixture, TestStartIsReportedCorrectly) - { - MockTest test("goodtest", true, false); - list.Add(&test); - - 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); - - 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() const - { - TimeHelpers::SleepMs(20); - } - }; - - TEST_FIXTURE(TestRunnerFixture, TestFinishIsCalledWithCorrectTime) - { - SlowTest test; - list.Add(&test); - - // Using UnitTest::Timer here is arguably a bit hokey and self-referential, but - // it should guarantee that the test time recorded is less than that plus the - // overhead of RunTestsIf -- the only thing we can reliably assert without - // reworking the test to not use sleeps at all - Timer actual; - actual.Start(); - RunTestsIf(list, NULL, True(), 0); - - CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= actual.GetTimeInMs()); - } - - TEST_FIXTURE(TestRunnerFixture, FailureCountIsZeroWhenNoTestsAreRun) - { - CHECK_EQUAL(0, 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, RunTestsIf(list, NULL, True(), 0)); - CHECK_EQUAL(2, reporter.testFailedCount); - } - - TEST_FIXTURE(TestRunnerFixture, TestsThatAssertAreReportedAsFailing) - { - MockTest test("test", true, true); - list.Add(&test); - - 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); - - 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); - - 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); - - RunTestsIf(list, NULL, True(), 0); - CHECK_EQUAL(5, reporter.summaryFailureCount); - } - - TEST_FIXTURE(TestRunnerFixture, SlowTestPassesForHighTimeThreshold) - { - SlowTest test; - list.Add(&test); - - RunTestsIf(list, NULL, True(), 0); - CHECK_EQUAL(0, reporter.testFailedCount); - } - - TEST_FIXTURE(TestRunnerFixture, SlowTestFailsForLowTimeThreshold) - { - SlowTest test; - list.Add(&test); - - RunTestsIf(list, NULL, True(), 3); - CHECK_EQUAL(1, reporter.testFailedCount); - } - - TEST_FIXTURE(TestRunnerFixture, SlowTestHasCorrectFailureInformation) - { - SlowTest test; - list.Add(&test); - - 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() const + else if (!success) { - UNITTEST_TIME_CONSTRAINT_EXEMPT(); - TimeHelpers::SleepMs(20); + testResults_.OnTestFailure(m_details, "message"); } - }; - - SlowExemptedTest test; - list.Add(&test); - - RunTestsIf(list, NULL, True(), 3); - CHECK_EQUAL(0, reporter.testFailedCount); - } - - struct TestSuiteFixture : FixtureBase - { - TestSuiteFixture() - : test1("TestInDefaultSuite") - , test2("TestInOtherSuite", "OtherSuite") - , test3("SecondTestInDefaultSuite") - { - list.Add(&test1); - list.Add(&test2); - } - - Test test1; - Test test2; - Test test3; - TestList list; - }; - - TEST_FIXTURE(TestSuiteFixture, TestRunnerRunsAllSuitesIfNullSuiteIsPassed) - { - RunTestsIf(list, NULL, True(), 0); - CHECK_EQUAL(2, reporter.summaryTotalTestCount); - } - - TEST_FIXTURE(TestSuiteFixture,TestRunnerRunsOnlySpecifiedSuite) - { - 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); - - 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); - - RunTestsIf(list, "suite", RunTestIfNameIs("goodtest"), 0); - - CHECK_EQUAL(1, reporter.testRunCount); - CHECK_EQUAL("goodtest", reporter.lastStartedTest); - CHECK_EQUAL("suite", reporter.lastStartedSuite); - } - + } + } + + bool const success; + bool const asserted; + int const count; + }; + + struct FixtureBase + { + FixtureBase() + : runner(reporter) + {} + + template + int RunTestsIf(TestList const& list, char const* suiteName, + const Predicate& predicate, int maxTestTimeInMs) + { + TestResults* oldResults = CurrentTest::Results(); + const TestDetails* oldDetails = CurrentTest::Details(); + int result = runner.RunTestsIf(list, suiteName, predicate, maxTestTimeInMs); + CurrentTest::Results() = oldResults; + CurrentTest::Details() = oldDetails; + return result; + } + + TestRunner runner; + RecordingReporter reporter; + }; + + struct TestRunnerFixture : public FixtureBase + { + TestList list; + }; + + TEST_FIXTURE(TestRunnerFixture, TestStartIsReportedCorrectly) + { + MockTest test("goodtest", true, false); + list.Add(&test); + + 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); + + 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() const + { + TimeHelpers::SleepMs(20); + } + }; + + TEST_FIXTURE(TestRunnerFixture, TestFinishIsCalledWithCorrectTime) + { + SlowTest test; + list.Add(&test); + + // Using UnitTest::Timer here is arguably a bit hokey and self-referential, but + // it should guarantee that the test time recorded is less than that plus the + // overhead of RunTestsIf -- the only thing we can reliably assert without + // reworking the test to not use sleeps at all + Timer actual; + actual.Start(); + RunTestsIf(list, NULL, True(), 0); + + CHECK(reporter.lastFinishedTestTime >= 0.005f && reporter.lastFinishedTestTime <= actual.GetTimeInMs()); + } + + TEST_FIXTURE(TestRunnerFixture, FailureCountIsZeroWhenNoTestsAreRun) + { + CHECK_EQUAL(0, 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, RunTestsIf(list, NULL, True(), 0)); + CHECK_EQUAL(2, reporter.testFailedCount); + } + + TEST_FIXTURE(TestRunnerFixture, TestsThatAssertAreReportedAsFailing) + { + MockTest test("test", true, true); + list.Add(&test); + + 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); + + 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); + + 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); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(5, reporter.summaryFailureCount); + } + + TEST_FIXTURE(TestRunnerFixture, SlowTestPassesForHighTimeThreshold) + { + SlowTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(0, reporter.testFailedCount); + } + + TEST_FIXTURE(TestRunnerFixture, SlowTestFailsForLowTimeThreshold) + { + SlowTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 3); + CHECK_EQUAL(1, reporter.testFailedCount); + } + + TEST_FIXTURE(TestRunnerFixture, SlowTestHasCorrectFailureInformation) + { + SlowTest test; + list.Add(&test); + + 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() const + { + UNITTEST_TIME_CONSTRAINT_EXEMPT(); + TimeHelpers::SleepMs(20); + } + }; + + SlowExemptedTest test; + list.Add(&test); + + RunTestsIf(list, NULL, True(), 3); + CHECK_EQUAL(0, reporter.testFailedCount); + } + + struct TestSuiteFixture : FixtureBase + { + TestSuiteFixture() + : test1("TestInDefaultSuite") + , test2("TestInOtherSuite", "OtherSuite") + , test3("SecondTestInDefaultSuite") + { + list.Add(&test1); + list.Add(&test2); + } + + Test test1; + Test test2; + Test test3; + TestList list; + }; + + TEST_FIXTURE(TestSuiteFixture, TestRunnerRunsAllSuitesIfNullSuiteIsPassed) + { + RunTestsIf(list, NULL, True(), 0); + CHECK_EQUAL(2, reporter.summaryTotalTestCount); + } + + TEST_FIXTURE(TestSuiteFixture,TestRunnerRunsOnlySpecifiedSuite) + { + 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); + + 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); + + RunTestsIf(list, "suite", RunTestIfNameIs("goodtest"), 0); + + CHECK_EQUAL(1, reporter.testRunCount); + CHECK_EQUAL("goodtest", reporter.lastStartedTest); + CHECK_EQUAL("suite", reporter.lastStartedSuite); + } + } diff --git a/tests/TestTestSuite.cpp b/tests/TestTestSuite.cpp index ff56089..e0bbacf 100644 --- a/tests/TestTestSuite.cpp +++ b/tests/TestTestSuite.cpp @@ -5,8 +5,7 @@ // Note: we are outside of the anonymous namespace SUITE(SameTestSuite) { - TEST(DummyTest2) - { - } + TEST(DummyTest2) + {} } diff --git a/tests/TestTimeConstraint.cpp b/tests/TestTimeConstraint.cpp index ab93a05..976b8ce 100644 --- a/tests/TestTimeConstraint.cpp +++ b/tests/TestTimeConstraint.cpp @@ -9,61 +9,61 @@ using namespace UnitTest; namespace { -TEST(TimeConstraintSucceedsWithFastTest) -{ - TestResults result; - { - ScopedCurrentTest scopedResult(result); - TimeConstraint t(200, TestDetails("", "", "", 0), 0); - TimeHelpers::SleepMs(5); - } - CHECK_EQUAL(0, result.GetFailureCount()); -} + TEST(TimeConstraintSucceedsWithFastTest) + { + TestResults result; + { + ScopedCurrentTest scopedResult(result); + TimeConstraint t(200, TestDetails("", "", "", 0), 0); + TimeHelpers::SleepMs(5); + } + CHECK_EQUAL(0, result.GetFailureCount()); + } -TEST(TimeConstraintFailsWithSlowTest) -{ - TestResults result; - { - ScopedCurrentTest scopedResult(result); - TimeConstraint t(10, TestDetails("", "", "", 0),0); - TimeHelpers::SleepMs(20); - } - CHECK_EQUAL(1, result.GetFailureCount()); -} + TEST(TimeConstraintFailsWithSlowTest) + { + TestResults result; + { + ScopedCurrentTest scopedResult(result); + TimeConstraint t(10, TestDetails("", "", "", 0),0); + TimeHelpers::SleepMs(20); + } + CHECK_EQUAL(1, result.GetFailureCount()); + } -TEST(TimeConstraintFailureIncludesCorrectData) -{ - RecordingReporter reporter; - TestResults result(&reporter); - { - ScopedCurrentTest scopedResult(result); + TEST(TimeConstraintFailureIncludesCorrectData) + { + RecordingReporter reporter; + TestResults result(&reporter); + { + ScopedCurrentTest scopedResult(result); - TestDetails const details("testname", "suitename", "filename", 10); - TimeConstraint t(10, details,10); - TimeHelpers::SleepMs(20); - } + TestDetails const details("testname", "suitename", "filename", 10); + TimeConstraint t(10, details,10); + TimeHelpers::SleepMs(20); + } - using namespace std; + using namespace std; - CHECK(strstr(reporter.lastFailedFile, "filename")); - CHECK_EQUAL(10, reporter.lastFailedLine); - CHECK(strstr(reporter.lastFailedTest, "testname")); -} + 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),0); - TimeHelpers::SleepMs(20); - } + TEST(TimeConstraintFailureIncludesTimeoutInformation) + { + RecordingReporter reporter; + TestResults result(&reporter); + { + ScopedCurrentTest scopedResult(result); + TimeConstraint t(10, TestDetails("", "", "", 0),0); + TimeHelpers::SleepMs(20); + } - using namespace std; + using namespace std; - CHECK(strstr(reporter.lastFailedMessage, "ime constraint")); - CHECK(strstr(reporter.lastFailedMessage, "under 10ms")); -} + CHECK(strstr(reporter.lastFailedMessage, "ime constraint")); + CHECK(strstr(reporter.lastFailedMessage, "under 10ms")); + } } diff --git a/tests/TestTimeConstraintMacro.cpp b/tests/TestTimeConstraintMacro.cpp index 3caf15d..a8d0c79 100644 --- a/tests/TestTimeConstraintMacro.cpp +++ b/tests/TestTimeConstraintMacro.cpp @@ -6,83 +6,83 @@ 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")); -} - -TEST(TimeConstraintMacroComparesAgainstPreciseActual) -{ - int testLine = 0; - RecordingReporter reporter; - - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - UNITTEST_TIME_CONSTRAINT(1); testLine = __LINE__; - - // start a new timer and run until we're as little over the 1 msec - // threshold as we can achieve; this should guarantee that the "test" - // runs in some very small amount of time > 1 msec - UnitTest::Timer myTimer; - myTimer.Start(); - - while (myTimer.GetTimeInMs() < 1.001) - UnitTest::TimeHelpers::SleepMs(0); - } - - using namespace std; - - CHECK_EQUAL(1, reporter.testFailedCount); - CHECK(strstr(reporter.lastFailedFile, __FILE__)); - CHECK_EQUAL(testLine, reporter.lastFailedLine); - CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroComparesAgainstPreciseActual")); -} - -struct EmptyFixture {}; - -TEST_FIXTURE(EmptyFixture, TimeConstraintMacroWorksInFixtures) -{ - 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, "TimeConstraintMacroWorksInFixtures")); -} + 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")); + } + + TEST(TimeConstraintMacroComparesAgainstPreciseActual) + { + int testLine = 0; + RecordingReporter reporter; + + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + UNITTEST_TIME_CONSTRAINT(1); testLine = __LINE__; + + // start a new timer and run until we're as little over the 1 msec + // threshold as we can achieve; this should guarantee that the "test" + // runs in some very small amount of time > 1 msec + UnitTest::Timer myTimer; + myTimer.Start(); + + while (myTimer.GetTimeInMs() < 1.001) + UnitTest::TimeHelpers::SleepMs(0); + } + + using namespace std; + + CHECK_EQUAL(1, reporter.testFailedCount); + CHECK(strstr(reporter.lastFailedFile, __FILE__)); + CHECK_EQUAL(testLine, reporter.lastFailedLine); + CHECK(strstr(reporter.lastFailedTest, "TimeConstraintMacroComparesAgainstPreciseActual")); + } + + struct EmptyFixture {}; + + TEST_FIXTURE(EmptyFixture, TimeConstraintMacroWorksInFixtures) + { + 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, "TimeConstraintMacroWorksInFixtures")); + } } diff --git a/tests/TestUnitTestPP.cpp b/tests/TestUnitTestPP.cpp index 3bd6ab7..8130ef7 100644 --- a/tests/TestUnitTestPP.cpp +++ b/tests/TestUnitTestPP.cpp @@ -5,144 +5,143 @@ 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); -} - -#ifndef UNITTEST_NO_EXCEPTIONS - -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 - { + 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); + } + + #ifndef UNITTEST_NO_EXCEPTIONS + + 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 - { + } + }; + + 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()); -} - -#endif - -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); -} + } + }; + + UnitTest::TestResults results; + { + ScopedCurrentTest scopedResults(results); + + WrongThrowTest test; + test.Run(); + } + + CHECK_EQUAL(1, results.GetFailureCount()); + } + + #endif + + 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/tests/TestXmlTestReporter.cpp b/tests/TestXmlTestReporter.cpp index 154ada8..410766d 100644 --- a/tests/TestXmlTestReporter.cpp +++ b/tests/TestXmlTestReporter.cpp @@ -12,176 +12,175 @@ using std::ostringstream; namespace { -#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + #ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM // 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 = - "" - "" - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_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 = - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_str()); -} - -TEST_FIXTURE(XmlTestReporterFixture, SingleSuccessfulTestReportSummaryFormat) -{ - TestDetails const details("TestName", "DefaultSuite", "", 0); - - reporter.ReportTestStart(details); - reporter.ReportSummary(1, 0, 0, 0.1f); - - const char *expected = - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_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 = - "" - "" - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_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 = - "" - "" - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_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 = - "" - "" - "" - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_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 = - "" - "" - "" - "" - "" - "" - ""; - - CHECK_EQUAL(expected, output.str().c_str()); -} + 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 = + "" + "" + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_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 = + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_str()); + } + + TEST_FIXTURE(XmlTestReporterFixture, SingleSuccessfulTestReportSummaryFormat) + { + TestDetails const details("TestName", "DefaultSuite", "", 0); + + reporter.ReportTestStart(details); + reporter.ReportSummary(1, 0, 0, 0.1f); + + const char *expected = + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_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 = + "" + "" + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_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 = + "" + "" + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_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 = + "" + "" + "" + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_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 = + "" + "" + "" + "" + "" + "" + ""; + + CHECK_EQUAL(expected, output.str().c_str()); + } } From f82c403768ff2d4de6366e7c223102883a2e1b2a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 22:22:37 -0600 Subject: [PATCH 102/184] Change preprocessor indent rules. --- .uncrustify | 6 ++-- UnitTest++/CheckMacros.h | 54 ++++++++++++++--------------- UnitTest++/ExecuteTest.h | 14 ++++---- UnitTest++/MemoryOutStream.cpp | 28 +++++++-------- UnitTest++/MemoryOutStream.h | 10 +++--- UnitTest++/Posix/SignalTranslator.h | 6 ++-- UnitTest++/ReportAssert.cpp | 10 +++--- UnitTest++/ReportAssertImpl.h | 10 +++--- UnitTest++/TestReporterStdout.cpp | 6 ++-- UnitTest++/Win32/TimeHelpers.cpp | 4 +-- UnitTest++/Win32/TimeHelpers.h | 6 ++-- tests/ScopedCurrentTest.h | 2 ++ tests/TestAssertHandler.cpp | 6 ++-- tests/TestDeferredTestReporter.cpp | 4 +-- tests/TestMemoryOutStream.cpp | 34 +++++++++--------- tests/TestTest.cpp | 12 +++---- tests/TestTestMacros.cpp | 8 ++--- tests/TestUnitTestPP.cpp | 4 +-- tests/TestXmlTestReporter.cpp | 4 +-- 19 files changed, 115 insertions(+), 113 deletions(-) diff --git a/.uncrustify b/.uncrustify index 1d7e5d6..c14672f 100644 --- a/.uncrustify +++ b/.uncrustify @@ -476,9 +476,9 @@ cmt_insert_func_header = "" cmt_insert_class_header = "" cmt_insert_oc_msg_header = "" cmt_insert_before_preproc = false -pp_indent = add -pp_indent_at_level = true -pp_indent_count = 0 +pp_indent = remove +pp_indent_at_level = false +pp_indent_count = 3 pp_space = ignore pp_space_count = 0 pp_indent_region = 0 diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index b2a0654..db424bd 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -34,25 +34,25 @@ #error UnitTest++ redefines CHECK_ARRAY2D_CLOSE #endif -#define CHECK(value) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ - ({ \ - if (!UnitTest::Check(value)) \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ - }) \ - UT_CATCH (std::exception, e, \ - { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ - }) \ - UT_CATCH_ALL \ - ({ \ - UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - "Unhandled exception in CHECK(" #value ")"); \ - }) \ +#define CHECK(value) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + UT_TRY \ + ({ \ + if (!UnitTest::Check(value)) \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ + }) \ + UT_CATCH (std::exception, e, \ + { \ + UnitTest::MemoryOutStream message; \ + message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + message.GetText()); \ + }) \ + UT_CATCH_ALL \ + ({ \ + UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ + "Unhandled exception in CHECK(" #value ")"); \ + }) \ UNITTEST_MULTILINE_MACRO_END #define CHECK_EQUAL(expected, actual) \ @@ -158,14 +158,14 @@ // CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h) #ifndef UNITTEST_NO_EXCEPTIONS -#define CHECK_THROW(expression, ExpectedExceptionType) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - 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"); \ +#define CHECK_THROW(expression, ExpectedExceptionType) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + 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"); \ UNITTEST_MULTILINE_MACRO_END diff --git a/UnitTest++/ExecuteTest.h b/UnitTest++/ExecuteTest.h index 7bfb99d..c6917fc 100644 --- a/UnitTest++/ExecuteTest.h +++ b/UnitTest++/ExecuteTest.h @@ -25,19 +25,19 @@ namespace UnitTest { if (isMockTest == false) CurrentTest::Details() = &details; - #ifdef UNITTEST_NO_EXCEPTIONS +#ifdef UNITTEST_NO_EXCEPTIONS if (UNITTEST_SET_ASSERT_JUMP_TARGET() == 0) { - #endif - #ifndef UNITTEST_POSIX +#endif +#ifndef UNITTEST_POSIX UT_TRY({ testObject.RunImpl(); }) - #else +#else UT_TRY ({ UNITTEST_THROW_SIGNALS_POSIX_ONLY testObject.RunImpl(); }) - #endif +#endif UT_CATCH(AssertException, e, { (void)e; }) UT_CATCH(std::exception, e, { @@ -49,9 +49,9 @@ namespace UnitTest { ({ CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed"); }) - #ifdef UNITTEST_NO_EXCEPTIONS +#ifdef UNITTEST_NO_EXCEPTIONS } - #endif +#endif } } diff --git a/UnitTest++/MemoryOutStream.cpp b/UnitTest++/MemoryOutStream.cpp index 787351c..98e52e6 100644 --- a/UnitTest++/MemoryOutStream.cpp +++ b/UnitTest++/MemoryOutStream.cpp @@ -16,7 +16,7 @@ namespace UnitTest { m_text = this->str(); } - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 #define snprintf _snprintf @@ -41,7 +41,7 @@ namespace UnitTest { return FormatToStream(stream, "%I64u", n); } - #endif +#endif } @@ -135,32 +135,32 @@ namespace UnitTest { return *this; } - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 MemoryOutStream& MemoryOutStream::operator <<(__int64 const n) - #else +#else MemoryOutStream& MemoryOutStream::operator <<(long long const n) - #endif +#endif { - #ifdef UNITTEST_WIN32 +#ifdef UNITTEST_WIN32 FormatToStream(*this, "%I64d", n); - #else +#else FormatToStream(*this, "%lld", n); - #endif +#endif return *this; } - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 MemoryOutStream& MemoryOutStream::operator <<(unsigned __int64 const n) - #else +#else MemoryOutStream& MemoryOutStream::operator <<(unsigned long long const n) - #endif +#endif { - #ifdef UNITTEST_WIN32 +#ifdef UNITTEST_WIN32 FormatToStream(*this, "%I64u", n); - #else +#else FormatToStream(*this, "%llu", n); - #endif +#endif return *this; } diff --git a/UnitTest++/MemoryOutStream.h b/UnitTest++/MemoryOutStream.h index 893a829..8a18721 100644 --- a/UnitTest++/MemoryOutStream.h +++ b/UnitTest++/MemoryOutStream.h @@ -26,10 +26,10 @@ namespace UnitTest mutable std::string m_text; }; - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 std::ostream& operator<<(std::ostream& stream, __int64 const n); std::ostream& operator<<(std::ostream& stream, unsigned __int64 const n); - #endif +#endif } @@ -57,13 +57,13 @@ namespace UnitTest MemoryOutStream& operator <<(int n); MemoryOutStream& operator <<(long n); MemoryOutStream& operator <<(unsigned long n); - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 MemoryOutStream& operator <<(__int64 n); MemoryOutStream& operator <<(unsigned __int64 n); - #else +#else MemoryOutStream& operator <<(long long n); MemoryOutStream& operator <<(unsigned long long n); - #endif +#endif MemoryOutStream& operator <<(float f); MemoryOutStream& operator <<(double d); MemoryOutStream& operator <<(void const* p); diff --git a/UnitTest++/Posix/SignalTranslator.h b/UnitTest++/Posix/SignalTranslator.h index 107f362..efb3618 100644 --- a/UnitTest++/Posix/SignalTranslator.h +++ b/UnitTest++/Posix/SignalTranslator.h @@ -26,11 +26,11 @@ namespace UnitTest { struct sigaction m_old_SIGALRM_action; }; - #if !defined (__GNUC__) +#if !defined (__GNUC__) #define UNITTEST_EXTENSION - #else +#else #define UNITTEST_EXTENSION __extension__ - #endif +#endif #define UNITTEST_THROW_SIGNALS_POSIX_ONLY \ UnitTest::SignalTranslator sig; \ diff --git a/UnitTest++/ReportAssert.cpp b/UnitTest++/ReportAssert.cpp index 1e07160..79e6d0e 100644 --- a/UnitTest++/ReportAssert.cpp +++ b/UnitTest++/ReportAssert.cpp @@ -28,13 +28,13 @@ namespace UnitTest { namespace Detail { - #ifdef UNITTEST_NO_EXCEPTIONS +#ifdef UNITTEST_NO_EXCEPTIONS UNITTEST_JMPBUF* GetAssertJmpBuf() { static UNITTEST_JMPBUF s_jmpBuf; return &s_jmpBuf; } - #endif +#endif UNITTEST_LINKAGE void ReportAssertEx(TestResults* testResults, const TestDetails* testDetails, @@ -50,11 +50,11 @@ namespace UnitTest { ExpectAssert(false); - #ifndef UNITTEST_NO_EXCEPTIONS +#ifndef UNITTEST_NO_EXCEPTIONS throw AssertException(); - #else +#else UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET(); - #endif +#endif } UNITTEST_LINKAGE void ExpectAssert(bool expected) diff --git a/UnitTest++/ReportAssertImpl.h b/UnitTest++/ReportAssertImpl.h index e8ecc29..711f1da 100644 --- a/UnitTest++/ReportAssertImpl.h +++ b/UnitTest++/ReportAssertImpl.h @@ -25,20 +25,20 @@ namespace UnitTest { UNITTEST_LINKAGE bool AssertExpected(); - #ifdef UNITTEST_NO_EXCEPTIONS +#ifdef UNITTEST_NO_EXCEPTIONS UNITTEST_LINKAGE UNITTEST_JMPBUF* GetAssertJmpBuf(); - #ifdef UNITTEST_WIN32 +#ifdef UNITTEST_WIN32 #define UNITTEST_SET_ASSERT_JUMP_TARGET() \ __pragma(warning(push)) __pragma(warning(disable: 4611)) \ UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) \ __pragma(warning(pop)) - #else +#else #define UNITTEST_SET_ASSERT_JUMP_TARGET() UNITTEST_SETJMP(*UnitTest::Detail::GetAssertJmpBuf()) - #endif +#endif #define UNITTEST_JUMP_TO_ASSERT_JUMP_TARGET() UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), 1) - #endif +#endif } } diff --git a/UnitTest++/TestReporterStdout.cpp b/UnitTest++/TestReporterStdout.cpp index 1bf671c..97b0f14 100644 --- a/UnitTest++/TestReporterStdout.cpp +++ b/UnitTest++/TestReporterStdout.cpp @@ -13,13 +13,13 @@ namespace UnitTest { void TestReporterStdout::ReportFailure(TestDetails const& details, char const* failure) { using namespace std; - #if defined(__APPLE__) || defined(__GNUG__) +#if defined(__APPLE__) || defined(__GNUG__) char const* const errorFormat = "%s:%d:%d: error: Failure in %s: %s\n"; fprintf(stderr, errorFormat, details.filename, details.lineNumber, 1, details.testName, failure); - #else +#else char const* const errorFormat = "%s(%d): error: Failure in %s: %s\n"; fprintf(stderr, errorFormat, details.filename, details.lineNumber, details.testName, failure); - #endif +#endif } void TestReporterStdout::ReportTestStart(TestDetails const& /*test*/) diff --git a/UnitTest++/Win32/TimeHelpers.cpp b/UnitTest++/Win32/TimeHelpers.cpp index a46ca52..684ffdf 100644 --- a/UnitTest++/Win32/TimeHelpers.cpp +++ b/UnitTest++/Win32/TimeHelpers.cpp @@ -9,9 +9,9 @@ namespace UnitTest { : m_threadHandle(::GetCurrentThread()) , m_startTime(0) { - #if defined(UNITTEST_WIN32) && (_MSC_VER == 1200) // VC6 doesn't have DWORD_PTR +#if defined(UNITTEST_WIN32) && (_MSC_VER == 1200) // VC6 doesn't have DWORD_PTR typedef unsigned long DWORD_PTR; - #endif +#endif DWORD_PTR systemMask; ::GetProcessAffinityMask(GetCurrentProcess(), &m_processAffinityMask, &systemMask); diff --git a/UnitTest++/Win32/TimeHelpers.h b/UnitTest++/Win32/TimeHelpers.h index 1498dea..11d4352 100644 --- a/UnitTest++/Win32/TimeHelpers.h +++ b/UnitTest++/Win32/TimeHelpers.h @@ -24,11 +24,11 @@ namespace UnitTest { void* m_threadHandle; - #if defined(_WIN64) +#if defined(_WIN64) unsigned __int64 m_processAffinityMask; - #else +#else unsigned long m_processAffinityMask; - #endif +#endif __int64 m_startTime; __int64 m_frequency; diff --git a/tests/ScopedCurrentTest.h b/tests/ScopedCurrentTest.h index 7737da9..4070252 100644 --- a/tests/ScopedCurrentTest.h +++ b/tests/ScopedCurrentTest.h @@ -19,7 +19,9 @@ class ScopedCurrentTest UnitTest::CurrentTest::Results() = &newResults; if (newDetails != NULL) + { UnitTest::CurrentTest::Details() = newDetails; + } } ~ScopedCurrentTest() diff --git a/tests/TestAssertHandler.cpp b/tests/TestAssertHandler.cpp index 74a0f52..4c7f2b5 100644 --- a/tests/TestAssertHandler.cpp +++ b/tests/TestAssertHandler.cpp @@ -21,7 +21,7 @@ namespace { CHECK(!Detail::AssertExpected()); } - #ifndef UNITTEST_NO_EXCEPTIONS +#ifndef UNITTEST_NO_EXCEPTIONS TEST(ReportAssertThrowsAssertException) { @@ -107,7 +107,7 @@ namespace { Detail::ExpectAssert(false); } - #else +#else TEST(SetAssertJumpTargetReturnsFalseWhenSettingJumpTarget) { @@ -128,6 +128,6 @@ namespace { CHECK(set == false); } - #endif +#endif } diff --git a/tests/TestDeferredTestReporter.cpp b/tests/TestDeferredTestReporter.cpp index de57387..46b4d63 100644 --- a/tests/TestDeferredTestReporter.cpp +++ b/tests/TestDeferredTestReporter.cpp @@ -12,13 +12,13 @@ namespace UnitTest namespace { - #ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM +#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM MemoryOutStream& operator <<(MemoryOutStream& lhs, const std::string& rhs) { lhs << rhs.c_str(); return lhs; } - #endif +#endif struct MockDeferredTestReporter : public DeferredTestReporter { diff --git a/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp index 447aac1..7c1ffbc 100644 --- a/tests/TestMemoryOutStream.cpp +++ b/tests/TestMemoryOutStream.cpp @@ -170,60 +170,60 @@ namespace { TEST(StreamingLongLongWritesCorrectCharacters) { MemoryOutStream stream; - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 stream << (__int64)-12345i64; - #else +#else stream << (long long)-12345ll; - #endif +#endif CHECK_EQUAL("-12345", stream.GetText()); } - #ifdef LLONG_MAX +#ifdef LLONG_MAX TEST(StreamingMaxLongLongWritesCorrectCharacters) { MemoryOutStream stream; stream << (long long)LLONG_MAX; CHECK_EQUAL(maxSignedIntegralStr(sizeof(long long)), stream.GetText()); } - #endif +#endif - #ifdef LLONG_MIN +#ifdef LLONG_MIN TEST(StreamingMinLongLongWritesCorrectCharacters) { MemoryOutStream stream; stream << (long long)LLONG_MIN; CHECK_EQUAL(minSignedIntegralStr(sizeof(long long)), stream.GetText()); } - #endif +#endif TEST(StreamingUnsignedLongLongWritesCorrectCharacters) { MemoryOutStream stream; - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 stream << (unsigned __int64)85899ui64; - #else +#else stream << (unsigned long long)85899ull; - #endif +#endif CHECK_EQUAL("85899", stream.GetText()); } - #ifdef ULLONG_MAX +#ifdef ULLONG_MAX TEST(StreamingMaxUnsignedLongLongWritesCorrectCharacters) { MemoryOutStream stream; stream << (unsigned long long)ULLONG_MAX; CHECK_EQUAL(maxUnsignedIntegralStr(sizeof(unsigned long long)), stream.GetText()); } - #endif +#endif TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) { MemoryOutStream stream; - #ifdef UNITTEST_COMPILER_IS_MSVC6 +#ifdef UNITTEST_COMPILER_IS_MSVC6 stream << (unsigned __int64)0ui64; - #else +#else stream << (unsigned long long)0ull; - #endif +#endif CHECK_EQUAL("0", stream.GetText()); } @@ -265,7 +265,7 @@ namespace { CHECK_EQUAL("", stream.GetText()); } - #ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM +#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM TEST(StreamInitialCapacityIsCorrect) { @@ -331,6 +331,6 @@ namespace { CHECK(true); } - #endif +#endif } diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 2d1aec8..5a4e1ca 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -50,7 +50,7 @@ namespace { CHECK_EQUAL(1, results.GetFailureCount()); } - #ifndef UNITTEST_NO_EXCEPTIONS +#ifndef UNITTEST_NO_EXCEPTIONS TEST(ThrowingTestsAreReportedAsFailures) { class CrashingTest : public Test @@ -72,9 +72,9 @@ namespace { CHECK_EQUAL(1, results.GetFailureCount()); } - #if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) +#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) // Skip this test in debug because some debuggers don't like it. - #if defined(NDEBUG) +#if defined(NDEBUG) TEST(CrashingTestsAreReportedAsFailures) { class CrashingTest : public Test @@ -96,9 +96,9 @@ namespace { CHECK_EQUAL(1, results.GetFailureCount()); } - #endif - #endif - #endif +#endif +#endif +#endif TEST(TestWithUnspecifiedSuiteGetsDefaultSuite) { diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index a54485e..86504d2 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -55,7 +55,7 @@ namespace { CHECK(list1.GetHead()->m_nextTest == 0); } - #ifndef UNITTEST_NO_EXCEPTIONS +#ifndef UNITTEST_NO_EXCEPTIONS struct ThrowingThingie { @@ -86,7 +86,7 @@ namespace { CHECK(strstr(reporter.lastFailedMessage, "ThrowingThingie")); } - #endif +#endif struct DummyFixture { @@ -134,7 +134,7 @@ namespace { CHECK_EQUAL ("DefaultSuite", macroTestList2.GetHead()->m_details.suiteName); } - #ifndef UNITTEST_NO_EXCEPTIONS +#ifndef UNITTEST_NO_EXCEPTIONS struct FixtureCtorThrows { @@ -218,7 +218,7 @@ namespace { CHECK(strstr(reporter.lastFailedMessage, "assert failure")); } - #endif +#endif } diff --git a/tests/TestUnitTestPP.cpp b/tests/TestUnitTestPP.cpp index 8130ef7..831b360 100644 --- a/tests/TestUnitTestPP.cpp +++ b/tests/TestUnitTestPP.cpp @@ -44,7 +44,7 @@ namespace { CHECK_ARRAY_CLOSE(a1, a2, 3, 0.1f); } - #ifndef UNITTEST_NO_EXCEPTIONS +#ifndef UNITTEST_NO_EXCEPTIONS TEST(CheckThrowMacroSucceedsOnCorrectException) { @@ -106,7 +106,7 @@ namespace { CHECK_EQUAL(1, results.GetFailureCount()); } - #endif +#endif struct SimpleFixture { diff --git a/tests/TestXmlTestReporter.cpp b/tests/TestXmlTestReporter.cpp index 410766d..a3edde2 100644 --- a/tests/TestXmlTestReporter.cpp +++ b/tests/TestXmlTestReporter.cpp @@ -12,7 +12,7 @@ using std::ostringstream; namespace { - #ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM +#ifndef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM // Overload to let MemoryOutStream accept std::string MemoryOutStream& operator<<(MemoryOutStream& s, const std::string& value) @@ -21,7 +21,7 @@ namespace return s; } - #endif +#endif struct XmlTestReporterFixture { From bb7555c718bd2e54178bb0610b80570ce2190f9f Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 22:48:36 -0600 Subject: [PATCH 103/184] Tweak preprocessor blocks. --- .uncrustify | 2 +- UnitTest++/CheckMacros.h | 14 ++++---- UnitTest++/Config.h | 37 +++++++++++---------- UnitTest++/ExceptionMacros.h | 16 ++++----- UnitTest++/HelperMacros.h | 62 +++++++++++++++++------------------ UnitTest++/ReportAssert.cpp | 2 +- UnitTest++/ReportAssertImpl.h | 2 +- UnitTest++/TimeHelpers.h | 4 +-- tests/TestTestMacros.cpp | 48 +++++++++++++-------------- 9 files changed, 95 insertions(+), 92 deletions(-) diff --git a/.uncrustify b/.uncrustify index c14672f..ea1187b 100644 --- a/.uncrustify +++ b/.uncrustify @@ -476,7 +476,7 @@ cmt_insert_func_header = "" cmt_insert_class_header = "" cmt_insert_oc_msg_header = "" cmt_insert_before_preproc = false -pp_indent = remove +pp_indent = ignore pp_indent_at_level = false pp_indent_count = 3 pp_space = ignore diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index db424bd..d79d503 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -11,27 +11,27 @@ #include "ReportAssertImpl.h" #ifdef CHECK -#error UnitTest++ redefines CHECK + #error UnitTest++ redefines CHECK #endif #ifdef CHECK_EQUAL -#error UnitTest++ redefines CHECK_EQUAL + #error UnitTest++ redefines CHECK_EQUAL #endif #ifdef CHECK_CLOSE -#error UnitTest++ redefines CHECK_CLOSE + #error UnitTest++ redefines CHECK_CLOSE #endif #ifdef CHECK_ARRAY_EQUAL -#error UnitTest++ redefines CHECK_ARRAY_EQUAL + #error UnitTest++ redefines CHECK_ARRAY_EQUAL #endif #ifdef CHECK_ARRAY_CLOSE -#error UnitTest++ redefines CHECK_ARRAY_CLOSE + #error UnitTest++ redefines CHECK_ARRAY_CLOSE #endif #ifdef CHECK_ARRAY2D_CLOSE -#error UnitTest++ redefines CHECK_ARRAY2D_CLOSE + #error UnitTest++ redefines CHECK_ARRAY2D_CLOSE #endif #define CHECK(value) \ @@ -158,6 +158,7 @@ // CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h) #ifndef UNITTEST_NO_EXCEPTIONS + #define CHECK_THROW(expression, ExpectedExceptionType) \ UNITTEST_MULTILINE_MACRO_BEGIN \ bool caught_ = false; \ @@ -176,4 +177,5 @@ UnitTest::Detail::ExpectAssert(false); \ UNITTEST_MULTILINE_MACRO_END #endif + #endif diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index f6757c3..ff62b4e 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -4,28 +4,29 @@ // Standard defines documented here: http://predef.sourceforge.net #if defined(_MSC_VER) -#pragma warning(disable:4702)// unreachable code -#pragma warning(disable:4722)// destructor never returns, potential memory leak - -#if (_MSC_VER == 1200) // VC6 -#define UNITTEST_COMPILER_IS_MSVC6 -#pragma warning(disable:4786) -#pragma warning(disable:4290) -#endif - -#ifdef _USRDLL -#define UNITTEST_WIN32_DLL -#endif -#define UNITTEST_WIN32 + #pragma warning(disable:4702)// unreachable code + #pragma warning(disable:4722)// destructor never returns, potential memory leak + + #if (_MSC_VER == 1200) // VC6 + #define UNITTEST_COMPILER_IS_MSVC6 + #pragma warning(disable:4786) + #pragma warning(disable:4290) + #endif + + #ifdef _USRDLL + #define UNITTEST_WIN32_DLL + #endif + + #define UNITTEST_WIN32 #endif #if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \ defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) -#define UNITTEST_POSIX + #define UNITTEST_POSIX #endif #if defined(__MINGW32__) -#define UNITTEST_MINGW + #define UNITTEST_MINGW #endif @@ -43,7 +44,7 @@ // well as Google Code HEAD users that may have used or defined // UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file. #ifndef UNITTEST_USE_CUSTOM_STREAMS -#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM + #define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM #endif // DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like @@ -65,9 +66,9 @@ // std namespace qualification: used for functions like strcpy that // may live in std:: namespace (cstring header). #if defined( UNITTEST_COMPILER_IS_MSVC6 ) -#define UNIITEST_NS_QUAL_STD(x) x + #define UNIITEST_NS_QUAL_STD(x) x #else -#define UNIITEST_NS_QUAL_STD(x) ::std::x + #define UNIITEST_NS_QUAL_STD(x) ::std::x #endif #endif diff --git a/UnitTest++/ExceptionMacros.h b/UnitTest++/ExceptionMacros.h index 0cc5a1c..ca8757e 100644 --- a/UnitTest++/ExceptionMacros.h +++ b/UnitTest++/ExceptionMacros.h @@ -4,15 +4,15 @@ #include "Config.h" #ifndef UNITTEST_NO_EXCEPTIONS -#define UT_TRY(x) try x -#define UT_THROW(x) throw x -#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody -#define UT_CATCH_ALL(CatchBody) catch(...) CatchBody + #define UT_TRY(x) try x + #define UT_THROW(x) throw x + #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody + #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody #else -#define UT_TRY(x) x -#define UT_THROW(x) -#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) -#define UT_CATCH_ALL(CatchBody) + #define UT_TRY(x) x + #define UT_THROW(x) + #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) + #define UT_CATCH_ALL(CatchBody) #endif #endif diff --git a/UnitTest++/HelperMacros.h b/UnitTest++/HelperMacros.h index c94abce..6d72f22 100644 --- a/UnitTest++/HelperMacros.h +++ b/UnitTest++/HelperMacros.h @@ -6,47 +6,47 @@ #define UNITTEST_MULTILINE_MACRO_BEGIN do { #if defined(UNITTEST_WIN32) && !defined(UNITTEST_COMPILER_IS_MSVC6) -#define UNITTEST_MULTILINE_MACRO_END \ - } __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop)) + #define UNITTEST_MULTILINE_MACRO_END \ + } __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop)) #else -#define UNITTEST_MULTILINE_MACRO_END } while(0) + #define UNITTEST_MULTILINE_MACRO_END } while(0) #endif #ifdef UNITTEST_WIN32_DLL -#define UNITTEST_IMPORT __declspec(dllimport) -#define UNITTEST_EXPORT __declspec(dllexport) - -#ifdef UNITTEST_DLL_EXPORT -#define UNITTEST_LINKAGE UNITTEST_EXPORT -#define UNITTEST_IMPEXP_TEMPLATE -#else -#define UNITTEST_LINKAGE UNITTEST_IMPORT -#define UNITTEST_IMPEXP_TEMPLATE extern -#endif - -#define UNITTEST_STDVECTOR_LINKAGE(T) \ - __pragma(warning(push)) \ - __pragma(warning(disable: 4231)) \ - UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ - UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ - __pragma(warning(pop)) + #define UNITTEST_IMPORT __declspec(dllimport) + #define UNITTEST_EXPORT __declspec(dllexport) + + #ifdef UNITTEST_DLL_EXPORT + #define UNITTEST_LINKAGE UNITTEST_EXPORT + #define UNITTEST_IMPEXP_TEMPLATE + #else + #define UNITTEST_LINKAGE UNITTEST_IMPORT + #define UNITTEST_IMPEXP_TEMPLATE extern + #endif + + #define UNITTEST_STDVECTOR_LINKAGE(T) \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4231)) \ + UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ + UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ + __pragma(warning(pop)) #else -#define UNITTEST_IMPORT -#define UNITTEST_EXPORT -#define UNITTEST_LINKAGE -#define UNITTEST_IMPEXP_TEMPLATE -#define UNITTEST_STDVECTOR_LINKAGE(T) + #define UNITTEST_IMPORT + #define UNITTEST_EXPORT + #define UNITTEST_LINKAGE + #define UNITTEST_IMPEXP_TEMPLATE + #define UNITTEST_STDVECTOR_LINKAGE(T) #endif #ifdef UNITTEST_WIN32 -#define UNITTEST_JMPBUF jmp_buf -#define UNITTEST_SETJMP setjmp -#define UNITTEST_LONGJMP longjmp + #define UNITTEST_JMPBUF jmp_buf + #define UNITTEST_SETJMP setjmp + #define UNITTEST_LONGJMP longjmp #elif defined UNITTEST_POSIX -#define UNITTEST_JMPBUF std::jmp_buf -#define UNITTEST_SETJMP setjmp -#define UNITTEST_LONGJMP std::longjmp + #define UNITTEST_JMPBUF std::jmp_buf + #define UNITTEST_SETJMP setjmp + #define UNITTEST_LONGJMP std::longjmp #endif #endif diff --git a/UnitTest++/ReportAssert.cpp b/UnitTest++/ReportAssert.cpp index 79e6d0e..47d0c5f 100644 --- a/UnitTest++/ReportAssert.cpp +++ b/UnitTest++/ReportAssert.cpp @@ -6,7 +6,7 @@ #include "TestDetails.h" #ifdef UNITTEST_NO_EXCEPTIONS -#include "ReportAssertImpl.h" + #include "ReportAssertImpl.h" #endif namespace UnitTest { diff --git a/UnitTest++/ReportAssertImpl.h b/UnitTest++/ReportAssertImpl.h index 711f1da..865292f 100644 --- a/UnitTest++/ReportAssertImpl.h +++ b/UnitTest++/ReportAssertImpl.h @@ -5,7 +5,7 @@ #include "HelperMacros.h" #ifdef UNITTEST_NO_EXCEPTIONS -#include + #include #endif namespace UnitTest { diff --git a/UnitTest++/TimeHelpers.h b/UnitTest++/TimeHelpers.h index 1602d6e..2f186ff 100644 --- a/UnitTest++/TimeHelpers.h +++ b/UnitTest++/TimeHelpers.h @@ -1,7 +1,7 @@ #include "Config.h" #if defined UNITTEST_POSIX -#include "Posix/TimeHelpers.h" + #include "Posix/TimeHelpers.h" #else -#include "Win32/TimeHelpers.h" + #include "Win32/TimeHelpers.h" #endif diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index 86504d2..4a13316 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -13,33 +13,33 @@ using namespace std; /* test for c++11 support */ #ifndef _MSC_VER -/* Test for clang >= 3.3 */ -#ifdef __clang__ -#if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 ))) -#define _NOEXCEPT_OP(x) noexcept(x) -#else -#define _NOEXCEPT_OP(x) -#endif -#endif - -#ifndef __clang__ -/* Test for GCC >= 4.8.0 */ -#ifdef __GNUC__ -#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 )) -#define _NOEXCEPT_OP(x) noexcept(x) -#else -#define _NOEXCEPT_OP(x) -#endif -#endif -#endif + /* Test for clang >= 3.3 */ + #ifdef __clang__ + #if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 ))) + #define _NOEXCEPT_OP(x) noexcept(x) + #else + #define _NOEXCEPT_OP(x) + #endif + #endif + + #ifndef __clang__ + /* Test for GCC >= 4.8.0 */ + #ifdef __GNUC__ + #if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 )) + #define _NOEXCEPT_OP(x) noexcept(x) + #else + #define _NOEXCEPT_OP(x) + #endif + #endif + #endif #elif _MSC_VER -#if (_MSC_VER > 1800) -#define _NOEXCEPT_OP(x) noexcept(x) -#else -#define _NOEXCEPT_OP(x) -#endif + #if (_MSC_VER > 1800) + #define _NOEXCEPT_OP(x) noexcept(x) + #else + #define _NOEXCEPT_OP(x) + #endif #endif From 353d3989d30a5fc23ac892776552b9213e9a2f0a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 23:10:38 -0600 Subject: [PATCH 104/184] Delete straggling .vcproj files. --- UnitTest++/unittestpp_vs2005.vcproj | 614 ---------------------------- UnitTest++/unittestpp_vs2008.vcproj | 607 --------------------------- 2 files changed, 1221 deletions(-) delete mode 100644 UnitTest++/unittestpp_vs2005.vcproj delete mode 100644 UnitTest++/unittestpp_vs2008.vcproj diff --git a/UnitTest++/unittestpp_vs2005.vcproj b/UnitTest++/unittestpp_vs2005.vcproj deleted file mode 100644 index 0c1f6ae..0000000 --- a/UnitTest++/unittestpp_vs2005.vcproj +++ /dev/null @@ -1,614 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/UnitTest++/unittestpp_vs2008.vcproj b/UnitTest++/unittestpp_vs2008.vcproj deleted file mode 100644 index 68a2ea3..0000000 --- a/UnitTest++/unittestpp_vs2008.vcproj +++ /dev/null @@ -1,607 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 5b34768df0c4552aeac1ef980b683b15a3b473f2 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 29 Jan 2016 23:24:21 -0600 Subject: [PATCH 105/184] Prepare v1.5.1 tag --- README.md | 11 ++++++++--- configure.ac | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5ec57bc..be3573f 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,17 @@ Via svn: svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp -### Latest release (v1.5.0) ### +### Latest release (v1.5.1) ### Via git: git clone https://github.com/unittest-cpp/unittest-cpp cd unittest-cpp - git checkout v1.5.0 + git checkout v1.5.1 Via svn: - svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.5.0 unittest-cpp + svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.5.1 unittest-cpp License --------- @@ -77,6 +77,11 @@ Contributors Historic release notes ---------------------- +### Version 1.5.1 (2016-01-30) ### +- pkg-config support +- Fix for Visual Studio 2010 compilation issue in 1.5.0 +- [Full List](https://github.com/unittest-cpp/unittest-cpp/issues?q=milestone%3A1.5.1+) + ### Version 1.5 (2015-11-04) ### - Visual Studio 2015 support - CMake-based build management diff --git a/configure.ac b/configure.ac index 9e2ef7b..7b77b73 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([UnitTest++], [1.5.0], [pjohnmeyer@gmail.com]) +AC_INIT([UnitTest++], [1.5.1], [pjohnmeyer@gmail.com]) AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -13,7 +13,7 @@ AM_CONDITIONAL([WINDOWS], [test "${host#*mingw}" != "${host}" -o "${host#*msvc}" != "${host}"]) LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [1:5:0]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [1:5:1]) # Checks for programs. AC_PROG_CXX From e7b56d4e3cff2154df3c613e7dfb3ad709a050ec Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Fri, 17 Oct 2014 17:12:55 -0500 Subject: [PATCH 106/184] Introducing additional functionality to allow client code to stop a unit test when an assert fails. The following macro has been added: REQUIRE An example of when these type of checks are useful: std::vector v = foo(); REQUIRE(CHECK_EQUAL(3, v.size())); // test stops here on a fail // so we don't segfault looking at // v[0] below. CHECK_EQUAL(1, v[0]); CHECK_EQUAL(2, v[1]); CHECK_EQUAL(3, v[2]); Multiple checks are supported as follows: REQUIRE({ CHECK_EQUAL(1, 2); CHECK(true); }; In the multiple check scenario, all the checks in the REQUIRE block will be run. After which, if any failures were reported, the TEST case will be stopped. When UNITTEST_NO_EXCEPTIONS is defined, REQUIRE is a noop. --- UnitTest++/RequireMacros.h | 28 ++ UnitTest++/UnitTestPP.h | 1 + tests/TestRequireMacros.cpp | 842 ++++++++++++++++++++++++++++++++++++ 3 files changed, 871 insertions(+) create mode 100644 UnitTest++/RequireMacros.h create mode 100644 tests/TestRequireMacros.cpp diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h new file mode 100644 index 0000000..65817d9 --- /dev/null +++ b/UnitTest++/RequireMacros.h @@ -0,0 +1,28 @@ +#ifndef UNITTEST_REQUIREMACROS_H +#define UNITTEST_REQUIREMACROS_H + +#include "HelperMacros.h" +#include "ExceptionMacros.h" +#include "CurrentTest.h" + +#ifdef REQUIRE + #error UnitTest++ redefines REQUIRE +#endif + +#ifndef UNITTEST_NO_EXCEPTIONS + #define REQUIRE(test) \ + UNITTEST_MULTILINE_MACRO_BEGIN \ + int const failuresBeforeTest = UnitTest::CurrentTest::Results()->GetFailureCount(); \ + test; \ + int const failuresAfterTest = UnitTest::CurrentTest::Results()->GetFailureCount(); \ + if(failuresAfterTest > failuresBeforeTest) \ + { \ + UT_THROW(UnitTest::AssertException()); \ + } \ + UNITTEST_MULTILINE_MACRO_END + #endif +#endif + +#ifdef UNITTEST_NO_EXCEPTIONS + #define REQUIRE(test) test; +#endif diff --git a/UnitTest++/UnitTestPP.h b/UnitTest++/UnitTestPP.h index c9bbc0c..3e02d31 100644 --- a/UnitTest++/UnitTestPP.h +++ b/UnitTest++/UnitTestPP.h @@ -4,6 +4,7 @@ #include "Config.h" #include "TestMacros.h" #include "CheckMacros.h" +#include "RequireMacros.h" #include "TestRunner.h" #include "TimeConstraint.h" #include "ReportAssert.h" diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacros.cpp new file mode 100644 index 0000000..3025a34 --- /dev/null +++ b/tests/TestRequireMacros.cpp @@ -0,0 +1,842 @@ +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/CurrentTest.h" +#include "RecordingReporter.h" +#include "ScopedCurrentTest.h" + +using namespace std; + +#ifndef UNITTEST_NO_EXCEPTIONS + +namespace { + +TEST(RequireCheckSucceedsOnTrue) +{ + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK(true)); + } + catch(const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + +TEST(RequiredCheckFailsOnFalse) +{ + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK(false)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + + +TEST(RequireMacroSupportsMultipleChecks) +{ + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try{ + REQUIRE({ + CHECK(true); + CHECK_EQUAL(1,1); + }); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + + +TEST(RequireMacroSupportsMultipleChecksWithFailingChecks) +{ + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try{ + REQUIRE({ + CHECK(true); + CHECK_EQUAL(1,2); + }); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + +TEST(FailureReportsCorrectTestName) +{ + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK(false)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL(m_details.testName, reporter.lastFailedTest); +} + +TEST(RequiredCheckFailureIncludesCheckContents) +{ + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + const bool yaddayadda = false; + + try + { + REQUIRE(CHECK(yaddayadda)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK(strstr(reporter.lastFailedMessage, "yaddayadda")); +} + +TEST(RequiredCheckEqualSucceedsOnEqual) +{ + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_EQUAL(1,1)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + +TEST(RequiredCheckEqualFailsOnNotEqual) +{ + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_EQUAL(1, 2)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + +TEST(RequiredCheckEqualFailureContainsCorrectDetails) +{ + int line = 0; + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + + try + { + line = __LINE__; REQUIRE(CHECK_EQUAL(1, 123)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +int g_sideEffect = 0; +int FunctionWithSideEffects() +{ + ++g_sideEffect; + return 1; +} + +TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenPassing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_EQUAL(1, FunctionWithSideEffects())); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + +TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenFailing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_EQUAL(2, FunctionWithSideEffects())); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + + +TEST(RequiredCheckCloseSucceedsOnEqual) +{ + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_CLOSE(1.0f, 1.001f, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + +TEST(RequiredCheckCloseFailsOnNotEqual) +{ + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_CLOSE (1.0f, 1.1f, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + +TEST(RequiredCheckCloseFailureContainsCorrectDetails) +{ + int line = 0; + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + UnitTest::TestDetails testDetails("test", "suite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + + try + { + line = __LINE__; REQUIRE(CHECK_CLOSE(1.0f, 1.1f, 0.01f)); + CHECK(false); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL("test", reporter.lastFailedTest); + CHECK_EQUAL("suite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenPassing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f)); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + +TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenFailing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { + REQUIRE(CHECK_CLOSE(2, FunctionWithSideEffects(), 0.1f)); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + +TEST(RequiredCheckArrayCloseSucceedsOnEqual) +{ + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + const float data[4] = { 0, 1, 2, 3 }; + + try + { + REQUIRE(CHECK_ARRAY_CLOSE (data, data, 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + +TEST(RequiredCheckArrayCloseFailsOnNotEqual) +{ + bool failure = false; + bool exception = 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 }; + + try + { + REQUIRE(CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + +TEST(RequiredCheckArrayCloseFailureIncludesCheckExpectedAndActual) +{ + 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 }; + + try + { + REQUIRE(CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); +} + +TEST(RequiredCheckArrayCloseFailureContainsCorrectDetails) +{ + 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 }; + + try + { + line = __LINE__; REQUIRE(CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +TEST(RequiredCheckArrayCloseFailureIncludesTolerance) +{ + 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 }; + + try + { + REQUIRE(CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK(strstr(reporter.lastFailedMessage, "0.01")); +} + +TEST(RequiredCheckArrayEqualSuceedsOnEqual) +{ + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + const float data[4] = { 0, 1, 2, 3 }; + + try + { + REQUIRE(CHECK_ARRAY_EQUAL (data, data, 4)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + +TEST(RequiredCheckArrayEqualFailsOnNotEqual) +{ + bool failure = false; + bool exception = 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 }; + + try + { + REQUIRE(CHECK_ARRAY_EQUAL (data1, data2, 4)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + +TEST(RequiredCheckArrayEqualFailureIncludesCheckExpectedAndActual) +{ + 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 }; + + try + { + REQUIRE(CHECK_ARRAY_EQUAL (data1, data2, 4)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); +} + +TEST(RequiredCheckArrayEqualFailureContainsCorrectInfo) +{ + 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 }; + + try + { + line = __LINE__; REQUIRE(CHECK_ARRAY_EQUAL (data1, data2, 4)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL("RequiredCheckArrayEqualFailureContainsCorrectInfo", reporter.lastFailedTest); + CHECK_EQUAL(__FILE__, reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +float const* FunctionWithSideEffects2() +{ + ++g_sideEffect; + static float const data[] = {1,2,3,4}; + return data; +} + +TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[] = { 0, 1, 2, 3 }; + + try + { + REQUIRE(CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + +TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenFailing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[] = { 0, 1, 3, 3 }; + + try + { + REQUIRE(CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL(1, g_sideEffect); +} + +TEST(RequiredCheckArray2DCloseSucceedsOnEqual) +{ + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {2, 3} }; + + try + { + REQUIRE(CHECK_ARRAY2D_CLOSE(data, data, 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); +} + +TEST(RequiredCheckArray2DCloseFailsOnNotEqual) +{ + bool failure = false; + bool exception = 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} }; + + try + { + REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); +} + +TEST(RequiredCheckArray2DCloseFailureIncludesCheckExpectedAndActual) +{ + 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} }; + + try + { + REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ [ 0 1 ] [ 2 3 ] ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ [ 0 1 ] [ 3 3 ] ]")); +} + +TEST(RequiredCheckArray2DCloseFailureContainsCorrectDetails) +{ + 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} }; + + try + { + line = __LINE__; REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); +} + +TEST(RequiredCheckArray2DCloseFailureIncludesTolerance) +{ + 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} }; + + try + { + REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + + CHECK(strstr(reporter.lastFailedMessage, "0.01")); +} + +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(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenPassing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {2, 3} }; + + try + { + REQUIRE(CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + +TEST(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenFailing) +{ + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {3, 3} }; + + try + { + REQUIRE(CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f)); + } + catch (const UnitTest::AssertException&) + { + } + } + CHECK_EQUAL(1, g_sideEffect); +} + +} + +#endif From 06308ee8023de4a0070e45cbdeb52e45ea002b9a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 4 Nov 2014 23:41:05 -0600 Subject: [PATCH 107/184] Use for loop to achieve REQUIRE with no parens I changed the definition of the REQUIRE macro to use for loops and some comma operator shenanigans to allow things like: REQUIRE { CHECK(...); CHECK_EQUAL(..., ...); } or REQUIRE CHECK(...); I updated the tests and they all passed on my machine. My only concern is that some compilers might complain about the unreachable code in the (throw UnitTest::AssertException(), true) expression. --- UnitTest++/RequireMacros.h | 19 ++++------ tests/TestRequireMacros.cpp | 74 +++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index 65817d9..747bda7 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -10,19 +10,14 @@ #endif #ifndef UNITTEST_NO_EXCEPTIONS - #define REQUIRE(test) \ - UNITTEST_MULTILINE_MACRO_BEGIN \ - int const failuresBeforeTest = UnitTest::CurrentTest::Results()->GetFailureCount(); \ - test; \ - int const failuresAfterTest = UnitTest::CurrentTest::Results()->GetFailureCount(); \ - if(failuresAfterTest > failuresBeforeTest) \ - { \ - UT_THROW(UnitTest::AssertException()); \ - } \ - UNITTEST_MULTILINE_MACRO_END - #endif + #define REQUIRE \ + for (int failuresBeforeTest = UnitTest::CurrentTest::Results()->GetFailureCount(), newFailures = 0, run = 0; \ + (run == 0) || ((newFailures != 0) && (throw UnitTest::AssertException(), true)); \ + newFailures = UnitTest::CurrentTest::Results()->GetFailureCount() - failuresBeforeTest, run = 1) #endif #ifdef UNITTEST_NO_EXCEPTIONS - #define REQUIRE(test) test; + #define REQUIRE #endif + +#endif \ No newline at end of file diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacros.cpp index 3025a34..869de32 100644 --- a/tests/TestRequireMacros.cpp +++ b/tests/TestRequireMacros.cpp @@ -21,7 +21,7 @@ TEST(RequireCheckSucceedsOnTrue) try { - REQUIRE(CHECK(true)); + REQUIRE CHECK(true); } catch(const UnitTest::AssertException&) { @@ -46,7 +46,7 @@ TEST(RequiredCheckFailsOnFalse) try { - REQUIRE(CHECK(false)); + REQUIRE CHECK(false); } catch (const UnitTest::AssertException&) { @@ -71,10 +71,11 @@ TEST(RequireMacroSupportsMultipleChecks) ScopedCurrentTest scopedResults(testResults); try{ - REQUIRE({ + REQUIRE + { CHECK(true); CHECK_EQUAL(1,1); - }); + } } catch (const UnitTest::AssertException&) { @@ -99,10 +100,11 @@ TEST(RequireMacroSupportsMultipleChecksWithFailingChecks) ScopedCurrentTest scopedResults(testResults); try{ - REQUIRE({ + REQUIRE + { CHECK(true); CHECK_EQUAL(1,2); - }); + } } catch (const UnitTest::AssertException&) { @@ -125,7 +127,7 @@ TEST(FailureReportsCorrectTestName) try { - REQUIRE(CHECK(false)); + REQUIRE CHECK(false); } catch (const UnitTest::AssertException&) { @@ -145,7 +147,7 @@ TEST(RequiredCheckFailureIncludesCheckContents) try { - REQUIRE(CHECK(yaddayadda)); + REQUIRE CHECK(yaddayadda); } catch (const UnitTest::AssertException&) { @@ -166,7 +168,7 @@ TEST(RequiredCheckEqualSucceedsOnEqual) try { - REQUIRE(CHECK_EQUAL(1,1)); + REQUIRE CHECK_EQUAL(1,1); } catch (const UnitTest::AssertException&) { @@ -191,7 +193,7 @@ TEST(RequiredCheckEqualFailsOnNotEqual) try { - REQUIRE(CHECK_EQUAL(1, 2)); + REQUIRE CHECK_EQUAL(1, 2); } catch (const UnitTest::AssertException&) { @@ -216,7 +218,7 @@ TEST(RequiredCheckEqualFailureContainsCorrectDetails) try { - line = __LINE__; REQUIRE(CHECK_EQUAL(1, 123)); + line = __LINE__; REQUIRE CHECK_EQUAL(1, 123); } catch (const UnitTest::AssertException&) { @@ -245,7 +247,7 @@ TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenPassing) try { - REQUIRE(CHECK_EQUAL(1, FunctionWithSideEffects())); + REQUIRE CHECK_EQUAL(1, FunctionWithSideEffects()); } catch (const UnitTest::AssertException&) { @@ -263,7 +265,7 @@ TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenFailing) try { - REQUIRE(CHECK_EQUAL(2, FunctionWithSideEffects())); + REQUIRE CHECK_EQUAL(2, FunctionWithSideEffects()); } catch (const UnitTest::AssertException&) { @@ -284,7 +286,7 @@ TEST(RequiredCheckCloseSucceedsOnEqual) try { - REQUIRE(CHECK_CLOSE(1.0f, 1.001f, 0.01f)); + REQUIRE CHECK_CLOSE(1.0f, 1.001f, 0.01f); } catch (const UnitTest::AssertException&) { @@ -309,7 +311,7 @@ TEST(RequiredCheckCloseFailsOnNotEqual) try { - REQUIRE(CHECK_CLOSE (1.0f, 1.1f, 0.01f)); + REQUIRE CHECK_CLOSE (1.0f, 1.1f, 0.01f); } catch (const UnitTest::AssertException&) { @@ -334,7 +336,7 @@ TEST(RequiredCheckCloseFailureContainsCorrectDetails) try { - line = __LINE__; REQUIRE(CHECK_CLOSE(1.0f, 1.1f, 0.01f)); + line = __LINE__; REQUIRE CHECK_CLOSE(1.0f, 1.1f, 0.01f); CHECK(false); } catch (const UnitTest::AssertException&) @@ -357,7 +359,7 @@ TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenPassing) try { - REQUIRE(CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f)); + REQUIRE CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f); } catch (const UnitTest::AssertException&) { @@ -375,7 +377,7 @@ TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenFailing) try { - REQUIRE(CHECK_CLOSE(2, FunctionWithSideEffects(), 0.1f)); + REQUIRE CHECK_CLOSE(2, FunctionWithSideEffects(), 0.1f); } catch (const UnitTest::AssertException&) { @@ -396,7 +398,7 @@ TEST(RequiredCheckArrayCloseSucceedsOnEqual) try { - REQUIRE(CHECK_ARRAY_CLOSE (data, data, 4, 0.01f)); + REQUIRE CHECK_ARRAY_CLOSE (data, data, 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -424,7 +426,7 @@ TEST(RequiredCheckArrayCloseFailsOnNotEqual) try { - REQUIRE(CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f)); + REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -450,7 +452,7 @@ TEST(RequiredCheckArrayCloseFailureIncludesCheckExpectedAndActual) try { - REQUIRE(CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f)); + REQUIRE CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -475,7 +477,7 @@ TEST(RequiredCheckArrayCloseFailureContainsCorrectDetails) try { - line = __LINE__; REQUIRE(CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f)); + line = __LINE__; REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -500,7 +502,7 @@ TEST(RequiredCheckArrayCloseFailureIncludesTolerance) try { - REQUIRE(CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f)); + REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -523,7 +525,7 @@ TEST(RequiredCheckArrayEqualSuceedsOnEqual) try { - REQUIRE(CHECK_ARRAY_EQUAL (data, data, 4)); + REQUIRE CHECK_ARRAY_EQUAL (data, data, 4); } catch (const UnitTest::AssertException&) { @@ -551,7 +553,7 @@ TEST(RequiredCheckArrayEqualFailsOnNotEqual) try { - REQUIRE(CHECK_ARRAY_EQUAL (data1, data2, 4)); + REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); } catch (const UnitTest::AssertException&) { @@ -577,7 +579,7 @@ TEST(RequiredCheckArrayEqualFailureIncludesCheckExpectedAndActual) try { - REQUIRE(CHECK_ARRAY_EQUAL (data1, data2, 4)); + REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); } catch (const UnitTest::AssertException&) { @@ -601,7 +603,7 @@ TEST(RequiredCheckArrayEqualFailureContainsCorrectInfo) try { - line = __LINE__; REQUIRE(CHECK_ARRAY_EQUAL (data1, data2, 4)); + line = __LINE__; REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); } catch (const UnitTest::AssertException&) { @@ -631,7 +633,7 @@ TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing) try { - REQUIRE(CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f)); + REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -651,7 +653,7 @@ TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenFailing) try { - REQUIRE(CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f)); + REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); } catch (const UnitTest::AssertException&) { @@ -674,7 +676,7 @@ TEST(RequiredCheckArray2DCloseSucceedsOnEqual) try { - REQUIRE(CHECK_ARRAY2D_CLOSE(data, data, 2, 2, 0.01f)); + REQUIRE CHECK_ARRAY2D_CLOSE(data, data, 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { @@ -702,7 +704,7 @@ TEST(RequiredCheckArray2DCloseFailsOnNotEqual) try { - REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { @@ -728,7 +730,7 @@ TEST(RequiredCheckArray2DCloseFailureIncludesCheckExpectedAndActual) try { - REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { @@ -753,7 +755,7 @@ TEST(RequiredCheckArray2DCloseFailureContainsCorrectDetails) try { - line = __LINE__; REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + line = __LINE__; REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { @@ -778,7 +780,7 @@ TEST(RequiredCheckArray2DCloseFailureIncludesTolerance) try { - REQUIRE(CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f)); + REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { @@ -808,7 +810,7 @@ TEST(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenPassing) try { - REQUIRE(CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f)); + REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { @@ -828,7 +830,7 @@ TEST(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenFailing) try { - REQUIRE(CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f)); + REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); } catch (const UnitTest::AssertException&) { From a9161c1ba6f62584c435f56323e5a21891ecdffc Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Sat, 6 Dec 2014 22:59:28 -0600 Subject: [PATCH 108/184] This commit addresses two issues: (1) unreachable code in for loop shenanigans is eliminated. (2) code after a failing REQUIRE check no longer executes. Used a decorating TestReporter to achive this. --- UnitTest++/CheckMacros.h | 30 ++++++++++++-- UnitTest++/RequireMacros.h | 9 +---- UnitTest++/RequiredCheckTestReporter.cpp | 29 ++++++++++++++ UnitTest++/RequiredCheckTestReporter.h | 29 ++++++++++++++ UnitTest++/TestResults.h | 4 ++ UnitTest++/ThrowingTestReporter.cpp | 51 ++++++++++++++++++++++++ UnitTest++/ThrowingTestReporter.h | 29 ++++++++++++++ tests/TestRequireMacros.cpp | 30 ++++++++++++++ 8 files changed, 201 insertions(+), 10 deletions(-) create mode 100644 UnitTest++/RequiredCheckTestReporter.cpp create mode 100644 UnitTest++/RequiredCheckTestReporter.h create mode 100644 UnitTest++/ThrowingTestReporter.cpp create mode 100644 UnitTest++/ThrowingTestReporter.h diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index d79d503..bc9fbcf 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -41,6 +41,10 @@ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -60,7 +64,11 @@ UT_TRY \ ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ + }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -81,6 +89,10 @@ ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -100,7 +112,11 @@ UT_TRY \ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ + }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -121,6 +137,10 @@ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -140,7 +160,11 @@ UT_TRY \ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ + }) \ + UT_CATCH (UnitTest::AssertException, e, \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index 747bda7..9fee8eb 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -1,19 +1,14 @@ #ifndef UNITTEST_REQUIREMACROS_H #define UNITTEST_REQUIREMACROS_H -#include "HelperMacros.h" -#include "ExceptionMacros.h" -#include "CurrentTest.h" +#include "RequiredCheckTestReporter.h" #ifdef REQUIRE #error UnitTest++ redefines REQUIRE #endif #ifndef UNITTEST_NO_EXCEPTIONS - #define REQUIRE \ - for (int failuresBeforeTest = UnitTest::CurrentTest::Results()->GetFailureCount(), newFailures = 0, run = 0; \ - (run == 0) || ((newFailures != 0) && (throw UnitTest::AssertException(), true)); \ - newFailures = UnitTest::CurrentTest::Results()->GetFailureCount() - failuresBeforeTest, run = 1) + #define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.next(); ) #endif #ifdef UNITTEST_NO_EXCEPTIONS diff --git a/UnitTest++/RequiredCheckTestReporter.cpp b/UnitTest++/RequiredCheckTestReporter.cpp new file mode 100644 index 0000000..cae20db --- /dev/null +++ b/UnitTest++/RequiredCheckTestReporter.cpp @@ -0,0 +1,29 @@ +#include "RequiredCheckTestReporter.h" + +#include "CurrentTest.h" +#include "TestResults.h" + +namespace UnitTest { + + RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults* results) + : m_results(results) + , m_throwingReporter(0) + , m_continue(0) + { + if(m_results) + { + m_throwingReporter.setDecorated(m_results->m_testReporter); + m_results->m_testReporter = &m_throwingReporter; + } + } + + RequiredCheckTestReporter::~RequiredCheckTestReporter() + { + if(m_results) m_results->m_testReporter = m_throwingReporter.getDecorated(); + } + + bool RequiredCheckTestReporter::next() + { + return m_continue++ == 0; + } +} \ No newline at end of file diff --git a/UnitTest++/RequiredCheckTestReporter.h b/UnitTest++/RequiredCheckTestReporter.h new file mode 100644 index 0000000..22613e9 --- /dev/null +++ b/UnitTest++/RequiredCheckTestReporter.h @@ -0,0 +1,29 @@ +#ifndef UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H +#define UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H + +#include "HelperMacros.h" +#include "ThrowingTestReporter.h" + +namespace UnitTest { + + class TestResults; + + // This RAII class decorates the current TestReporter with + // a version that throws after reporting a failure. + class UNITTEST_LINKAGE RequiredCheckTestReporter + { + public: + explicit RequiredCheckTestReporter(TestResults* results); + ~RequiredCheckTestReporter(); + + bool next(); + + private: + TestResults* m_results; + ThrowingTestReporter m_throwingReporter; + int m_continue; + }; +} + +#endif + diff --git a/UnitTest++/TestResults.h b/UnitTest++/TestResults.h index c56a632..024ace3 100644 --- a/UnitTest++/TestResults.h +++ b/UnitTest++/TestResults.h @@ -5,6 +5,7 @@ namespace UnitTest { +class RequiredCheckTestReporter; class TestReporter; class TestDetails; @@ -22,6 +23,9 @@ namespace UnitTest { int GetFailureCount() const; private: + friend class RequiredCheckTestReporter; + +private: TestReporter* m_testReporter; int m_totalTestCount; int m_failedTestCount; diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp new file mode 100644 index 0000000..45ccade --- /dev/null +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -0,0 +1,51 @@ +#include "ThrowingTestReporter.h" +#include "AssertException.h" + +namespace UnitTest { + + ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter) + : m_decoratedReporter(decoratedReporter) + { + } + + //virtual + ThrowingTestReporter::~ThrowingTestReporter() + { + } + + //virtual + void ThrowingTestReporter::ReportTestStart(TestDetails const& test) + { + if(m_decoratedReporter) m_decoratedReporter->ReportTestStart(test); + } + + //virtual + void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure) + { + if(m_decoratedReporter) m_decoratedReporter->ReportFailure(test, failure); + throw AssertException(); + } + + //virtual + void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) + { + if(m_decoratedReporter) m_decoratedReporter->ReportTestFinish(test, secondsElapsed); + } + + //virtual + void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) + { + if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); + } + + TestReporter* ThrowingTestReporter::getDecorated() const + { + return m_decoratedReporter; + } + + void ThrowingTestReporter::setDecorated(TestReporter* reporter) + { + m_decoratedReporter = reporter; + } + +} diff --git a/UnitTest++/ThrowingTestReporter.h b/UnitTest++/ThrowingTestReporter.h new file mode 100644 index 0000000..0a02a51 --- /dev/null +++ b/UnitTest++/ThrowingTestReporter.h @@ -0,0 +1,29 @@ +#ifndef UNITTEST_THROWINGTESTREPORTER_H +#define UNITTEST_THROWINGTESTREPORTER_H + +#include "TestReporter.h" + +namespace UnitTest { + + // A TestReporter that throws when ReportFailure is called. Otherwise it + // forwards the calls to a decorated TestReporter + class ThrowingTestReporter : public TestReporter + { + public: + explicit ThrowingTestReporter(TestReporter* reporter); + + virtual ~ThrowingTestReporter(); + 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); + + TestReporter* getDecorated() const; + void setDecorated(TestReporter* reporter); + + private: + TestReporter* m_decoratedReporter; + }; +} + +#endif diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacros.cpp index 869de32..46732a2 100644 --- a/tests/TestRequireMacros.cpp +++ b/tests/TestRequireMacros.cpp @@ -117,7 +117,37 @@ TEST(RequireMacroSupportsMultipleChecksWithFailingChecks) CHECK(failure); CHECK(exception); } + +TEST(RequireMacroDoesntExecuteCodeAfterAFailingCheck) +{ + bool failure = false; + bool exception = false; + bool run = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try{ + REQUIRE + { + CHECK(false); + run = true; // this shouldn't get executed. + } + } + catch (const UnitTest::AssertException&) + { + exception = true; + } + + failure = (testResults.GetFailureCount() > 0); + } + CHECK(failure); + CHECK(exception); + CHECK(!run); +} + TEST(FailureReportsCorrectTestName) { RecordingReporter reporter; From 89ff2596ee12aeea98975f17ced70184ab5a0322 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Sun, 17 May 2015 21:21:10 -0500 Subject: [PATCH 109/184] Eliminating 'unused exception variable' warnings. --- UnitTest++/CheckMacros.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index bc9fbcf..96b98ba 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -41,7 +41,7 @@ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UT_CATCH (UnitTest::AssertException, , \ { \ UT_THROW(); \ }) \ @@ -65,7 +65,7 @@ ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UT_CATCH (UnitTest::AssertException, , \ { \ UT_THROW(); \ }) \ @@ -89,7 +89,7 @@ ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UT_CATCH (UnitTest::AssertException, , \ { \ UT_THROW(); \ }) \ @@ -113,7 +113,7 @@ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UT_CATCH (UnitTest::AssertException, , \ { \ UT_THROW(); \ }) \ @@ -137,7 +137,7 @@ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UT_CATCH (UnitTest::AssertException, , \ { \ UT_THROW(); \ }) \ @@ -161,7 +161,7 @@ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UT_CATCH (UnitTest::AssertException, , \ { \ UT_THROW(); \ }) \ From 74ca0c301f84abd7833dc9c927261e05ee04b276 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 4 Feb 2016 21:16:45 -0600 Subject: [PATCH 110/184] Merge and uncrustify. --- UnitTest++/CheckMacros.h | 54 +- UnitTest++/RequireMacros.h | 4 +- UnitTest++/RequiredCheckTestReporter.cpp | 38 +- UnitTest++/RequiredCheckTestReporter.h | 34 +- UnitTest++/TestResults.h | 6 +- UnitTest++/ThrowingTestReporter.cpp | 86 +- UnitTest++/ThrowingTestReporter.h | 32 +- tests/TestRequireMacros.cpp | 1538 +++++++++++----------- 8 files changed, 885 insertions(+), 907 deletions(-) diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index 96b98ba..82a4042 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -41,10 +41,10 @@ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ - { \ - UT_THROW(); \ - }) \ + UT_CATCH (UnitTest::AssertException, , \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -64,11 +64,11 @@ UT_TRY \ ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (UnitTest::AssertException, , \ - { \ - UT_THROW(); \ - }) \ + }) \ + UT_CATCH (UnitTest::AssertException, , \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -89,10 +89,10 @@ ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ - { \ - UT_THROW(); \ - }) \ + UT_CATCH (UnitTest::AssertException, , \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -112,11 +112,11 @@ UT_TRY \ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (UnitTest::AssertException, , \ - { \ - UT_THROW(); \ - }) \ + }) \ + UT_CATCH (UnitTest::AssertException, , \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -137,10 +137,10 @@ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ - { \ - UT_THROW(); \ - }) \ + UT_CATCH (UnitTest::AssertException, , \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -160,11 +160,11 @@ UT_TRY \ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ - }) \ - UT_CATCH (UnitTest::AssertException, , \ - { \ - UT_THROW(); \ - }) \ + }) \ + UT_CATCH (UnitTest::AssertException, , \ + { \ + UT_THROW(); \ + }) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index 9fee8eb..4a107d4 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -8,11 +8,11 @@ #endif #ifndef UNITTEST_NO_EXCEPTIONS - #define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.next(); ) +#define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.next(); ) #endif #ifdef UNITTEST_NO_EXCEPTIONS - #define REQUIRE +#define REQUIRE #endif #endif \ No newline at end of file diff --git a/UnitTest++/RequiredCheckTestReporter.cpp b/UnitTest++/RequiredCheckTestReporter.cpp index cae20db..1fd2ec7 100644 --- a/UnitTest++/RequiredCheckTestReporter.cpp +++ b/UnitTest++/RequiredCheckTestReporter.cpp @@ -5,25 +5,25 @@ namespace UnitTest { - RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults* results) - : m_results(results) - , m_throwingReporter(0) - , m_continue(0) - { - if(m_results) - { - m_throwingReporter.setDecorated(m_results->m_testReporter); - m_results->m_testReporter = &m_throwingReporter; - } - } + RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults* results) + : m_results(results) + , m_throwingReporter(0) + , m_continue(0) + { + if(m_results) + { + m_throwingReporter.setDecorated(m_results->m_testReporter); + m_results->m_testReporter = &m_throwingReporter; + } + } - RequiredCheckTestReporter::~RequiredCheckTestReporter() - { - if(m_results) m_results->m_testReporter = m_throwingReporter.getDecorated(); - } + RequiredCheckTestReporter::~RequiredCheckTestReporter() + { + if(m_results) m_results->m_testReporter = m_throwingReporter.getDecorated(); + } - bool RequiredCheckTestReporter::next() - { - return m_continue++ == 0; - } + bool RequiredCheckTestReporter::next() + { + return m_continue++ == 0; + } } \ No newline at end of file diff --git a/UnitTest++/RequiredCheckTestReporter.h b/UnitTest++/RequiredCheckTestReporter.h index 22613e9..a8c635e 100644 --- a/UnitTest++/RequiredCheckTestReporter.h +++ b/UnitTest++/RequiredCheckTestReporter.h @@ -6,23 +6,23 @@ namespace UnitTest { - class TestResults; - - // This RAII class decorates the current TestReporter with - // a version that throws after reporting a failure. - class UNITTEST_LINKAGE RequiredCheckTestReporter - { - public: - explicit RequiredCheckTestReporter(TestResults* results); - ~RequiredCheckTestReporter(); - - bool next(); - - private: - TestResults* m_results; - ThrowingTestReporter m_throwingReporter; - int m_continue; - }; + class TestResults; + + // This RAII class decorates the current TestReporter with + // a version that throws after reporting a failure. + class UNITTEST_LINKAGE RequiredCheckTestReporter + { + public: + explicit RequiredCheckTestReporter(TestResults* results); + ~RequiredCheckTestReporter(); + + bool next(); + + private: + TestResults* m_results; + ThrowingTestReporter m_throwingReporter; + int m_continue; + }; } #endif diff --git a/UnitTest++/TestResults.h b/UnitTest++/TestResults.h index 024ace3..b23418c 100644 --- a/UnitTest++/TestResults.h +++ b/UnitTest++/TestResults.h @@ -5,7 +5,7 @@ namespace UnitTest { -class RequiredCheckTestReporter; + class RequiredCheckTestReporter; class TestReporter; class TestDetails; @@ -23,9 +23,9 @@ class RequiredCheckTestReporter; int GetFailureCount() const; private: - friend class RequiredCheckTestReporter; + friend class RequiredCheckTestReporter; -private: + private: TestReporter* m_testReporter; int m_totalTestCount; int m_failedTestCount; diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp index 45ccade..367a8b3 100644 --- a/UnitTest++/ThrowingTestReporter.cpp +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -3,49 +3,47 @@ namespace UnitTest { - ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter) - : m_decoratedReporter(decoratedReporter) - { - } - - //virtual - ThrowingTestReporter::~ThrowingTestReporter() - { - } - - //virtual - void ThrowingTestReporter::ReportTestStart(TestDetails const& test) - { - if(m_decoratedReporter) m_decoratedReporter->ReportTestStart(test); - } - - //virtual - void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure) - { - if(m_decoratedReporter) m_decoratedReporter->ReportFailure(test, failure); - throw AssertException(); - } - - //virtual - void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) - { - if(m_decoratedReporter) m_decoratedReporter->ReportTestFinish(test, secondsElapsed); - } - - //virtual - void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) - { - if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); - } - - TestReporter* ThrowingTestReporter::getDecorated() const - { - return m_decoratedReporter; - } - - void ThrowingTestReporter::setDecorated(TestReporter* reporter) - { - m_decoratedReporter = reporter; - } + ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter) + : m_decoratedReporter(decoratedReporter) + {} + + //virtual + ThrowingTestReporter::~ThrowingTestReporter() + {} + + //virtual + void ThrowingTestReporter::ReportTestStart(TestDetails const& test) + { + if(m_decoratedReporter) m_decoratedReporter->ReportTestStart(test); + } + + //virtual + void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure) + { + if(m_decoratedReporter) m_decoratedReporter->ReportFailure(test, failure); + throw AssertException(); + } + + //virtual + void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) + { + if(m_decoratedReporter) m_decoratedReporter->ReportTestFinish(test, secondsElapsed); + } + + //virtual + void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) + { + if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); + } + + TestReporter* ThrowingTestReporter::getDecorated() const + { + return m_decoratedReporter; + } + + void ThrowingTestReporter::setDecorated(TestReporter* reporter) + { + m_decoratedReporter = reporter; + } } diff --git a/UnitTest++/ThrowingTestReporter.h b/UnitTest++/ThrowingTestReporter.h index 0a02a51..8ed91da 100644 --- a/UnitTest++/ThrowingTestReporter.h +++ b/UnitTest++/ThrowingTestReporter.h @@ -5,25 +5,25 @@ namespace UnitTest { - // A TestReporter that throws when ReportFailure is called. Otherwise it - // forwards the calls to a decorated TestReporter - class ThrowingTestReporter : public TestReporter - { - public: - explicit ThrowingTestReporter(TestReporter* reporter); + // A TestReporter that throws when ReportFailure is called. Otherwise it + // forwards the calls to a decorated TestReporter + class ThrowingTestReporter : public TestReporter + { + public: + explicit ThrowingTestReporter(TestReporter* reporter); - virtual ~ThrowingTestReporter(); - 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); + virtual ~ThrowingTestReporter(); + 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); - TestReporter* getDecorated() const; - void setDecorated(TestReporter* reporter); + TestReporter* getDecorated() const; + void setDecorated(TestReporter* reporter); - private: - TestReporter* m_decoratedReporter; - }; + private: + TestReporter* m_decoratedReporter; + }; } #endif diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacros.cpp index 46732a2..88cb128 100644 --- a/tests/TestRequireMacros.cpp +++ b/tests/TestRequireMacros.cpp @@ -9,865 +9,845 @@ using namespace std; namespace { -TEST(RequireCheckSucceedsOnTrue) -{ - bool failure = true; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - - ScopedCurrentTest scopedResults(testResults); - - try - { + TEST(RequireCheckSucceedsOnTrue) + { + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK(true); - } - catch(const UnitTest::AssertException&) - { + } + catch(const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(!failure); - CHECK(!exception); -} - -TEST(RequiredCheckFailsOnFalse) -{ - bool failure = false; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try - { + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } + + TEST(RequiredCheckFailsOnFalse) + { + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK(false); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } + } - CHECK(failure); - CHECK(exception); -} + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); + } + + + TEST(RequireMacroSupportsMultipleChecks) + { + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); - -TEST(RequireMacroSupportsMultipleChecks) -{ - bool failure = false; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try{ + try{ REQUIRE { - CHECK(true); - CHECK_EQUAL(1,1); + CHECK(true); + CHECK_EQUAL(1,1); } - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(!failure); - CHECK(!exception); -} + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } -TEST(RequireMacroSupportsMultipleChecksWithFailingChecks) -{ - bool failure = false; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try{ + TEST(RequireMacroSupportsMultipleChecksWithFailingChecks) + { + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try{ REQUIRE { - CHECK(true); - CHECK_EQUAL(1,2); + CHECK(true); + CHECK_EQUAL(1,2); } - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(failure); - CHECK(exception); -} - -TEST(RequireMacroDoesntExecuteCodeAfterAFailingCheck) -{ - bool failure = false; - bool exception = false; - bool run = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try{ + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); + } + + TEST(RequireMacroDoesntExecuteCodeAfterAFailingCheck) + { + bool failure = false; + bool exception = false; + bool run = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try{ REQUIRE { - CHECK(false); - run = true; // this shouldn't get executed. + CHECK(false); + run = true; // this shouldn't get executed. } - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(failure); - CHECK(exception); - CHECK(!run); -} + } -TEST(FailureReportsCorrectTestName) -{ - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try - { - REQUIRE CHECK(false); - } - catch (const UnitTest::AssertException&) - { - } - } + failure = (testResults.GetFailureCount() > 0); + } - CHECK_EQUAL(m_details.testName, reporter.lastFailedTest); -} + CHECK(failure); + CHECK(exception); + CHECK(!run); + } -TEST(RequiredCheckFailureIncludesCheckContents) -{ - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - const bool yaddayadda = false; - - try - { - REQUIRE CHECK(yaddayadda); - } - catch (const UnitTest::AssertException&) - { - } - } + TEST(FailureReportsCorrectTestName) + { + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); - CHECK(strstr(reporter.lastFailedMessage, "yaddayadda")); -} - -TEST(RequiredCheckEqualSucceedsOnEqual) -{ - bool failure = true; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try - { + try + { + REQUIRE CHECK(false); + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL(m_details.testName, reporter.lastFailedTest); + } + + TEST(RequiredCheckFailureIncludesCheckContents) + { + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + const bool yaddayadda = false; + + try + { + REQUIRE CHECK(yaddayadda); + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK(strstr(reporter.lastFailedMessage, "yaddayadda")); + } + + TEST(RequiredCheckEqualSucceedsOnEqual) + { + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_EQUAL(1,1); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(!failure); - CHECK(!exception); -} - -TEST(RequiredCheckEqualFailsOnNotEqual) -{ - bool failure = false; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try - { + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } + + TEST(RequiredCheckEqualFailsOnNotEqual) + { + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_EQUAL(1, 2); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(failure); - CHECK(exception); -} - -TEST(RequiredCheckEqualFailureContainsCorrectDetails) -{ - int line = 0; - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - - try - { + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); + } + + TEST(RequiredCheckEqualFailureContainsCorrectDetails) + { + int line = 0; + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + + try + { line = __LINE__; REQUIRE CHECK_EQUAL(1, 123); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK_EQUAL("testName", reporter.lastFailedTest); - CHECK_EQUAL("suiteName", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} - -int g_sideEffect = 0; -int FunctionWithSideEffects() -{ - ++g_sideEffect; - return 1; -} - -TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenPassing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + int g_sideEffect = 0; + int FunctionWithSideEffects() + { + ++g_sideEffect; + return 1; + } + + TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_EQUAL(1, FunctionWithSideEffects()); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} - -TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenFailing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_EQUAL(2, FunctionWithSideEffects()); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} - - -TEST(RequiredCheckCloseSucceedsOnEqual) -{ - bool failure = true; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } + + + TEST(RequiredCheckCloseSucceedsOnEqual) + { + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_CLOSE(1.0f, 1.001f, 0.01f); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(!failure); - CHECK(!exception); -} - -TEST(RequiredCheckCloseFailsOnNotEqual) -{ - bool failure = false; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - try - { + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } + + TEST(RequiredCheckCloseFailsOnNotEqual) + { + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_CLOSE (1.0f, 1.1f, 0.01f); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } - - CHECK(failure); - CHECK(exception); -} - -TEST(RequiredCheckCloseFailureContainsCorrectDetails) -{ - int line = 0; - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - UnitTest::TestDetails testDetails("test", "suite", "filename", -1); - ScopedCurrentTest scopedResults(testResults, &testDetails); - - try - { + } + + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(failure); + CHECK(exception); + } + + TEST(RequiredCheckCloseFailureContainsCorrectDetails) + { + int line = 0; + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + UnitTest::TestDetails testDetails("test", "suite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + + try + { line = __LINE__; REQUIRE CHECK_CLOSE(1.0f, 1.1f, 0.01f); CHECK(false); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK_EQUAL("test", reporter.lastFailedTest); - CHECK_EQUAL("suite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} - -TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenPassing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL("test", reporter.lastFailedTest); + CHECK_EQUAL("suite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} - -TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenFailing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + try + { REQUIRE CHECK_CLOSE(2, FunctionWithSideEffects(), 0.1f); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} - -TEST(RequiredCheckArrayCloseSucceedsOnEqual) -{ - bool failure = true; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - const float data[4] = { 0, 1, 2, 3 }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckArrayCloseSucceedsOnEqual) + { + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + const float data[4] = { 0, 1, 2, 3 }; + + try + { REQUIRE CHECK_ARRAY_CLOSE (data, data, 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } + } - CHECK(!failure); - CHECK(!exception); -} + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } -TEST(RequiredCheckArrayCloseFailsOnNotEqual) -{ - bool failure = false; - bool exception = 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 }; - - try - { + TEST(RequiredCheckArrayCloseFailsOnNotEqual) + { + bool failure = false; + bool exception = 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 }; + + try + { REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } + } - failure = (testResults.GetFailureCount() > 0); - } + failure = (testResults.GetFailureCount() > 0); + } - CHECK(failure); - CHECK(exception); -} + CHECK(failure); + CHECK(exception); + } -TEST(RequiredCheckArrayCloseFailureIncludesCheckExpectedAndActual) -{ - 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 }; - - try - { - REQUIRE CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); - CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); -} + TEST(RequiredCheckArrayCloseFailureIncludesCheckExpectedAndActual) + { + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); -TEST(RequiredCheckArrayCloseFailureContainsCorrectDetails) -{ - 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 }; - - try - { - line = __LINE__; REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; -TEST(RequiredCheckArrayCloseFailureIncludesTolerance) -{ - 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 }; - - try - { + try + { + REQUIRE CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f); + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); + } + + TEST(RequiredCheckArrayCloseFailureContainsCorrectDetails) + { + 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 }; + + try + { + line = __LINE__; REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST(RequiredCheckArrayCloseFailureIncludesTolerance) + { + 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 }; + + try + { REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK(strstr(reporter.lastFailedMessage, "0.01")); -} - -TEST(RequiredCheckArrayEqualSuceedsOnEqual) -{ - bool failure = true; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - const float data[4] = { 0, 1, 2, 3 }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK(strstr(reporter.lastFailedMessage, "0.01")); + } + + TEST(RequiredCheckArrayEqualSuceedsOnEqual) + { + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + const float data[4] = { 0, 1, 2, 3 }; + + try + { REQUIRE CHECK_ARRAY_EQUAL (data, data, 4); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } + } - CHECK(!failure); - CHECK(!exception); -} + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } + + TEST(RequiredCheckArrayEqualFailsOnNotEqual) + { + bool failure = false; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); -TEST(RequiredCheckArrayEqualFailsOnNotEqual) -{ - bool failure = false; - bool exception = 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 }; - - try - { + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; + + try + { REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } + } - CHECK(failure); - CHECK(exception); -} + failure = (testResults.GetFailureCount() > 0); + } -TEST(RequiredCheckArrayEqualFailureIncludesCheckExpectedAndActual) -{ - 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 }; - - try - { - REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); - CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); -} + CHECK(failure); + CHECK(exception); + } -TEST(RequiredCheckArrayEqualFailureContainsCorrectInfo) -{ - 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 }; - - try - { - line = __LINE__; REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK_EQUAL("RequiredCheckArrayEqualFailureContainsCorrectInfo", reporter.lastFailedTest); - CHECK_EQUAL(__FILE__, reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} + TEST(RequiredCheckArrayEqualFailureIncludesCheckExpectedAndActual) + { + RecordingReporter reporter; + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); -float const* FunctionWithSideEffects2() -{ - ++g_sideEffect; - static float const data[] = {1,2,3,4}; - return data; -} + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; -TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - const float data[] = { 0, 1, 2, 3 }; - - try - { + try + { + REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); + } + + TEST(RequiredCheckArrayEqualFailureContainsCorrectInfo) + { + 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 }; + + try + { + line = __LINE__; REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL("RequiredCheckArrayEqualFailureContainsCorrectInfo", reporter.lastFailedTest); + CHECK_EQUAL(__FILE__, reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + float const* FunctionWithSideEffects2() + { + ++g_sideEffect; + static float const data[] = {1,2,3,4}; + return data; + } + + TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[] = { 0, 1, 2, 3 }; + + try + { REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} - -TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenFailing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - const float data[] = { 0, 1, 3, 3 }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[] = { 0, 1, 3, 3 }; + + try + { REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK_EQUAL(1, g_sideEffect); -} - -TEST(RequiredCheckArray2DCloseSucceedsOnEqual) -{ - bool failure = true; - bool exception = false; - { - RecordingReporter reporter; - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); - - const float data[2][2] = { {0, 1}, {2, 3} }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckArray2DCloseSucceedsOnEqual) + { + bool failure = true; + bool exception = false; + { + RecordingReporter reporter; + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {2, 3} }; + + try + { REQUIRE CHECK_ARRAY2D_CLOSE(data, data, 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } - - failure = (testResults.GetFailureCount() > 0); - } + } - CHECK(!failure); - CHECK(!exception); -} + failure = (testResults.GetFailureCount() > 0); + } + + CHECK(!failure); + CHECK(!exception); + } -TEST(RequiredCheckArray2DCloseFailsOnNotEqual) -{ - bool failure = false; - bool exception = 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} }; - - try - { + TEST(RequiredCheckArray2DCloseFailsOnNotEqual) + { + bool failure = false; + bool exception = 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} }; + + try + { REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { + } + catch (const UnitTest::AssertException&) + { exception = true; - } + } - failure = (testResults.GetFailureCount() > 0); - } + failure = (testResults.GetFailureCount() > 0); + } - CHECK(failure); - CHECK(exception); -} + CHECK(failure); + CHECK(exception); + } -TEST(RequiredCheckArray2DCloseFailureIncludesCheckExpectedAndActual) -{ - RecordingReporter reporter; - { - UnitTest::TestResults testResults(&reporter); - ScopedCurrentTest scopedResults(testResults); + TEST(RequiredCheckArray2DCloseFailureIncludesCheckExpectedAndActual) + { + 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} }; + int const data1[2][2] = { {0, 1}, {2, 3} }; + int const data2[2][2] = { {0, 1}, {3, 3} }; - try - { + try + { REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK(strstr(reporter.lastFailedMessage, "xpected [ [ 0 1 ] [ 2 3 ] ]")); - CHECK(strstr(reporter.lastFailedMessage, "was [ [ 0 1 ] [ 3 3 ] ]")); -} - -TEST(RequiredCheckArray2DCloseFailureContainsCorrectDetails) -{ - 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} }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ [ 0 1 ] [ 2 3 ] ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ [ 0 1 ] [ 3 3 ] ]")); + } + + TEST(RequiredCheckArray2DCloseFailureContainsCorrectDetails) + { + 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} }; + + try + { line = __LINE__; REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); - CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); - CHECK_EQUAL("filename", reporter.lastFailedFile); - CHECK_EQUAL(line, reporter.lastFailedLine); -} - -TEST(RequiredCheckArray2DCloseFailureIncludesTolerance) -{ - 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} }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST(RequiredCheckArray2DCloseFailureIncludesTolerance) + { + 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} }; + + try + { REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - - CHECK(strstr(reporter.lastFailedMessage, "0.01")); -} - -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(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenPassing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - const float data[2][2] = { {0, 1}, {2, 3} }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + + CHECK(strstr(reporter.lastFailedMessage, "0.01")); + } + + 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(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {2, 3} }; + + try + { REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} - -TEST(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenFailing) -{ - g_sideEffect = 0; - { - UnitTest::TestResults testResults; - ScopedCurrentTest scopedResults(testResults); - - const float data[2][2] = { {0, 1}, {3, 3} }; - - try - { + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {3, 3} }; + + try + { REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); - } - catch (const UnitTest::AssertException&) - { - } - } - CHECK_EQUAL(1, g_sideEffect); -} + } + catch (const UnitTest::AssertException&) + {} + } + CHECK_EQUAL(1, g_sideEffect); + } } From 40b8f0b17b0a9db2af01529e8e9a6db56830a471 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 4 Feb 2016 22:33:37 -0600 Subject: [PATCH 111/184] Use new RequiredCheckException for REQUIRE Rather than re-using AssertException, it felt more correct to create a new special-purpose exception. --- UnitTest++/CheckMacros.h | 13 ++--- UnitTest++/RequiredCheckException.cpp | 17 +++++++ UnitTest++/RequiredCheckException.h | 23 +++++++++ UnitTest++/ThrowingTestReporter.cpp | 4 +- tests/TestRequireMacros.cpp | 70 +++++++++++++-------------- 5 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 UnitTest++/RequiredCheckException.cpp create mode 100644 UnitTest++/RequiredCheckException.h diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index 82a4042..9547c32 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -5,6 +5,7 @@ #include "ExceptionMacros.h" #include "Checks.h" #include "AssertException.h" +#include "RequiredCheckException.h" #include "MemoryOutStream.h" #include "TestDetails.h" #include "CurrentTest.h" @@ -41,7 +42,7 @@ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ + UT_CATCH (UnitTest::RequiredCheckException, , \ { \ UT_THROW(); \ }) \ @@ -65,7 +66,7 @@ ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ + UT_CATCH (UnitTest::RequiredCheckException, , \ { \ UT_THROW(); \ }) \ @@ -89,7 +90,7 @@ ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ + UT_CATCH (UnitTest::RequiredCheckException, , \ { \ UT_THROW(); \ }) \ @@ -113,7 +114,7 @@ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ + UT_CATCH (UnitTest::RequiredCheckException, , \ { \ UT_THROW(); \ }) \ @@ -137,7 +138,7 @@ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ + UT_CATCH (UnitTest::RequiredCheckException, , \ { \ UT_THROW(); \ }) \ @@ -161,7 +162,7 @@ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::AssertException, , \ + UT_CATCH (UnitTest::RequiredCheckException, , \ { \ UT_THROW(); \ }) \ diff --git a/UnitTest++/RequiredCheckException.cpp b/UnitTest++/RequiredCheckException.cpp new file mode 100644 index 0000000..874370e --- /dev/null +++ b/UnitTest++/RequiredCheckException.cpp @@ -0,0 +1,17 @@ +#include "RequiredCheckException.h" + +#ifndef UNITTEST_NO_EXCEPTIONS + +namespace UnitTest { + + RequiredCheckException::RequiredCheckException() + { + } + + RequiredCheckException::~RequiredCheckException() throw() + { + } + +} + +#endif diff --git a/UnitTest++/RequiredCheckException.h b/UnitTest++/RequiredCheckException.h new file mode 100644 index 0000000..c9a36da --- /dev/null +++ b/UnitTest++/RequiredCheckException.h @@ -0,0 +1,23 @@ +#ifndef UNITTEST_REQUIREDCHECKEXCEPTION_H +#define UNITTEST_REQUIREDCHECKEXCEPTION_H + +#include "Config.h" +#ifndef UNITTEST_NO_EXCEPTIONS + +#include "HelperMacros.h" +#include + +namespace UnitTest { + + class UNITTEST_LINKAGE RequiredCheckException : public std::exception + { + public: + RequiredCheckException(); + virtual ~RequiredCheckException() throw(); + }; + +} + +#endif + +#endif diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp index 367a8b3..f48e308 100644 --- a/UnitTest++/ThrowingTestReporter.cpp +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -1,5 +1,5 @@ #include "ThrowingTestReporter.h" -#include "AssertException.h" +#include "RequiredCheckException.h" namespace UnitTest { @@ -21,7 +21,7 @@ namespace UnitTest { void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure) { if(m_decoratedReporter) m_decoratedReporter->ReportFailure(test, failure); - throw AssertException(); + throw RequiredCheckException(); } //virtual diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacros.cpp index 88cb128..6b76004 100644 --- a/tests/TestRequireMacros.cpp +++ b/tests/TestRequireMacros.cpp @@ -23,7 +23,7 @@ namespace { { REQUIRE CHECK(true); } - catch(const UnitTest::AssertException&) + catch(const UnitTest::RequiredCheckException&) { exception = true; } @@ -48,7 +48,7 @@ namespace { { REQUIRE CHECK(false); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -77,7 +77,7 @@ namespace { CHECK_EQUAL(1,1); } } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -106,7 +106,7 @@ namespace { CHECK_EQUAL(1,2); } } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -135,7 +135,7 @@ namespace { run = true; // this shouldn't get executed. } } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -159,7 +159,7 @@ namespace { { REQUIRE CHECK(false); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -178,7 +178,7 @@ namespace { { REQUIRE CHECK(yaddayadda); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -198,7 +198,7 @@ namespace { { REQUIRE CHECK_EQUAL(1,1); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -223,7 +223,7 @@ namespace { { REQUIRE CHECK_EQUAL(1, 2); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -248,7 +248,7 @@ namespace { { line = __LINE__; REQUIRE CHECK_EQUAL(1, 123); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -276,7 +276,7 @@ namespace { { REQUIRE CHECK_EQUAL(1, FunctionWithSideEffects()); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); @@ -293,7 +293,7 @@ namespace { { REQUIRE CHECK_EQUAL(2, FunctionWithSideEffects()); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); @@ -313,7 +313,7 @@ namespace { { REQUIRE CHECK_CLOSE(1.0f, 1.001f, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -338,7 +338,7 @@ namespace { { REQUIRE CHECK_CLOSE (1.0f, 1.1f, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -364,7 +364,7 @@ namespace { line = __LINE__; REQUIRE CHECK_CLOSE(1.0f, 1.1f, 0.01f); CHECK(false); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -385,7 +385,7 @@ namespace { { REQUIRE CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); @@ -402,7 +402,7 @@ namespace { { REQUIRE CHECK_CLOSE(2, FunctionWithSideEffects(), 0.1f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); @@ -422,7 +422,7 @@ namespace { { REQUIRE CHECK_ARRAY_CLOSE (data, data, 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -450,7 +450,7 @@ namespace { { REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -476,7 +476,7 @@ namespace { { REQUIRE CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -500,7 +500,7 @@ namespace { { line = __LINE__; REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -524,7 +524,7 @@ namespace { { REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -546,7 +546,7 @@ namespace { { REQUIRE CHECK_ARRAY_EQUAL (data, data, 4); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -574,7 +574,7 @@ namespace { { REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -600,7 +600,7 @@ namespace { { REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -623,7 +623,7 @@ namespace { { line = __LINE__; REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -652,7 +652,7 @@ namespace { { REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); @@ -671,7 +671,7 @@ namespace { { REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -693,7 +693,7 @@ namespace { { REQUIRE CHECK_ARRAY2D_CLOSE(data, data, 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -721,7 +721,7 @@ namespace { { REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) { exception = true; } @@ -747,7 +747,7 @@ namespace { { REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -771,7 +771,7 @@ namespace { { line = __LINE__; REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -795,7 +795,7 @@ namespace { { REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } @@ -824,7 +824,7 @@ namespace { { REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); @@ -843,7 +843,7 @@ namespace { { REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); } - catch (const UnitTest::AssertException&) + catch (const UnitTest::RequiredCheckException&) {} } CHECK_EQUAL(1, g_sideEffect); From 57fc32c1143a5e94da910ed6b6b345d2d278a3b1 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 4 Feb 2016 22:45:36 -0600 Subject: [PATCH 112/184] Change camelCase methods to PascalCase --- UnitTest++/RequireMacros.h | 4 ++-- UnitTest++/RequiredCheckTestReporter.cpp | 6 +++--- UnitTest++/RequiredCheckTestReporter.h | 2 +- UnitTest++/TestResults.h | 1 - UnitTest++/ThrowingTestReporter.cpp | 4 ++-- UnitTest++/ThrowingTestReporter.h | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index 4a107d4..f20353a 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -8,11 +8,11 @@ #endif #ifndef UNITTEST_NO_EXCEPTIONS -#define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.next(); ) + #define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) #endif #ifdef UNITTEST_NO_EXCEPTIONS -#define REQUIRE + #define REQUIRE #endif #endif \ No newline at end of file diff --git a/UnitTest++/RequiredCheckTestReporter.cpp b/UnitTest++/RequiredCheckTestReporter.cpp index 1fd2ec7..689827a 100644 --- a/UnitTest++/RequiredCheckTestReporter.cpp +++ b/UnitTest++/RequiredCheckTestReporter.cpp @@ -12,17 +12,17 @@ namespace UnitTest { { if(m_results) { - m_throwingReporter.setDecorated(m_results->m_testReporter); + m_throwingReporter.SetDecorated(m_results->m_testReporter); m_results->m_testReporter = &m_throwingReporter; } } RequiredCheckTestReporter::~RequiredCheckTestReporter() { - if(m_results) m_results->m_testReporter = m_throwingReporter.getDecorated(); + if(m_results) m_results->m_testReporter = m_throwingReporter.GetDecorated(); } - bool RequiredCheckTestReporter::next() + bool RequiredCheckTestReporter::Next() { return m_continue++ == 0; } diff --git a/UnitTest++/RequiredCheckTestReporter.h b/UnitTest++/RequiredCheckTestReporter.h index a8c635e..220ae9b 100644 --- a/UnitTest++/RequiredCheckTestReporter.h +++ b/UnitTest++/RequiredCheckTestReporter.h @@ -16,7 +16,7 @@ namespace UnitTest { explicit RequiredCheckTestReporter(TestResults* results); ~RequiredCheckTestReporter(); - bool next(); + bool Next(); private: TestResults* m_results; diff --git a/UnitTest++/TestResults.h b/UnitTest++/TestResults.h index b23418c..a4d8e60 100644 --- a/UnitTest++/TestResults.h +++ b/UnitTest++/TestResults.h @@ -25,7 +25,6 @@ namespace UnitTest { private: friend class RequiredCheckTestReporter; - private: TestReporter* m_testReporter; int m_totalTestCount; int m_failedTestCount; diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp index f48e308..acdc38c 100644 --- a/UnitTest++/ThrowingTestReporter.cpp +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -36,12 +36,12 @@ namespace UnitTest { if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); } - TestReporter* ThrowingTestReporter::getDecorated() const + TestReporter* ThrowingTestReporter::GetDecorated() const { return m_decoratedReporter; } - void ThrowingTestReporter::setDecorated(TestReporter* reporter) + void ThrowingTestReporter::SetDecorated(TestReporter* reporter) { m_decoratedReporter = reporter; } diff --git a/UnitTest++/ThrowingTestReporter.h b/UnitTest++/ThrowingTestReporter.h index 8ed91da..15766b8 100644 --- a/UnitTest++/ThrowingTestReporter.h +++ b/UnitTest++/ThrowingTestReporter.h @@ -18,8 +18,8 @@ namespace UnitTest { virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed); virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed); - TestReporter* getDecorated() const; - void setDecorated(TestReporter* reporter); + TestReporter* GetDecorated() const; + void SetDecorated(TestReporter* reporter); private: TestReporter* m_decoratedReporter; From 5eec0a255f366b58df25e7626a3a65fedfdeba41 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 4 Feb 2016 23:00:52 -0600 Subject: [PATCH 113/184] Simplify required check reporter interactions Was able to remove ThrowingTestReporter::SetDecorated and ::GetDecorated by changing RequiredCheckTestReporter to accept its TestResults by reference. This simple change removed several if-checks and some functions. --- UnitTest++/RequireMacros.h | 2 +- UnitTest++/RequiredCheckTestReporter.cpp | 13 +++++-------- UnitTest++/RequiredCheckTestReporter.h | 5 +++-- UnitTest++/ThrowingTestReporter.cpp | 10 ---------- UnitTest++/ThrowingTestReporter.h | 3 --- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index f20353a..ea1f6b9 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -8,7 +8,7 @@ #endif #ifndef UNITTEST_NO_EXCEPTIONS - #define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) + #define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(*UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) #endif #ifdef UNITTEST_NO_EXCEPTIONS diff --git a/UnitTest++/RequiredCheckTestReporter.cpp b/UnitTest++/RequiredCheckTestReporter.cpp index 689827a..7c21d20 100644 --- a/UnitTest++/RequiredCheckTestReporter.cpp +++ b/UnitTest++/RequiredCheckTestReporter.cpp @@ -5,21 +5,18 @@ namespace UnitTest { - RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults* results) + RequiredCheckTestReporter::RequiredCheckTestReporter(TestResults& results) : m_results(results) - , m_throwingReporter(0) + , m_originalTestReporter(results.m_testReporter) + , m_throwingReporter(results.m_testReporter) , m_continue(0) { - if(m_results) - { - m_throwingReporter.SetDecorated(m_results->m_testReporter); - m_results->m_testReporter = &m_throwingReporter; - } + m_results.m_testReporter = &m_throwingReporter; } RequiredCheckTestReporter::~RequiredCheckTestReporter() { - if(m_results) m_results->m_testReporter = m_throwingReporter.GetDecorated(); + m_results.m_testReporter = m_originalTestReporter; } bool RequiredCheckTestReporter::Next() diff --git a/UnitTest++/RequiredCheckTestReporter.h b/UnitTest++/RequiredCheckTestReporter.h index 220ae9b..117ae01 100644 --- a/UnitTest++/RequiredCheckTestReporter.h +++ b/UnitTest++/RequiredCheckTestReporter.h @@ -13,13 +13,14 @@ namespace UnitTest { class UNITTEST_LINKAGE RequiredCheckTestReporter { public: - explicit RequiredCheckTestReporter(TestResults* results); + explicit RequiredCheckTestReporter(TestResults& results); ~RequiredCheckTestReporter(); bool Next(); private: - TestResults* m_results; + TestResults& m_results; + TestReporter* m_originalTestReporter; ThrowingTestReporter m_throwingReporter; int m_continue; }; diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp index acdc38c..7fb670b 100644 --- a/UnitTest++/ThrowingTestReporter.cpp +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -36,14 +36,4 @@ namespace UnitTest { if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); } - TestReporter* ThrowingTestReporter::GetDecorated() const - { - return m_decoratedReporter; - } - - void ThrowingTestReporter::SetDecorated(TestReporter* reporter) - { - m_decoratedReporter = reporter; - } - } diff --git a/UnitTest++/ThrowingTestReporter.h b/UnitTest++/ThrowingTestReporter.h index 15766b8..34e105e 100644 --- a/UnitTest++/ThrowingTestReporter.h +++ b/UnitTest++/ThrowingTestReporter.h @@ -18,9 +18,6 @@ namespace UnitTest { virtual void ReportTestFinish(TestDetails const& test, float secondsElapsed); virtual void ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed); - TestReporter* GetDecorated() const; - void SetDecorated(TestReporter* reporter); - private: TestReporter* m_decoratedReporter; }; From 3f5095ba13dda9aea740e6085fc8fe37b8ecf81a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 4 Feb 2016 23:14:42 -0600 Subject: [PATCH 114/184] Eliminate some single-line if statements. --- UnitTest++/ThrowingTestReporter.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp index 7fb670b..672f042 100644 --- a/UnitTest++/ThrowingTestReporter.cpp +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -14,26 +14,38 @@ namespace UnitTest { //virtual void ThrowingTestReporter::ReportTestStart(TestDetails const& test) { - if(m_decoratedReporter) m_decoratedReporter->ReportTestStart(test); + if(m_decoratedReporter) + { + m_decoratedReporter->ReportTestStart(test); + } } //virtual void ThrowingTestReporter::ReportFailure(TestDetails const& test, char const* failure) { - if(m_decoratedReporter) m_decoratedReporter->ReportFailure(test, failure); + if(m_decoratedReporter) + { + m_decoratedReporter->ReportFailure(test, failure); + } throw RequiredCheckException(); } //virtual void ThrowingTestReporter::ReportTestFinish(TestDetails const& test, float secondsElapsed) { - if(m_decoratedReporter) m_decoratedReporter->ReportTestFinish(test, secondsElapsed); + if(m_decoratedReporter) + { + m_decoratedReporter->ReportTestFinish(test, secondsElapsed); + } } //virtual void ThrowingTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) { - if(m_decoratedReporter) m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); + if(m_decoratedReporter) + { + m_decoratedReporter->ReportSummary(totalTestCount, failedTestCount, failureCount, secondsElapsed); + } } } From 6bb9541ae2d82c04018eb4f1152f99b59db23dff Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 6 Feb 2016 22:04:52 -0600 Subject: [PATCH 115/184] Fix warnings, errors, 2x error reporting in MSVC Visual Studio 2015 complained about calling UT_THROW with zero arguments. Visual Studio 6 complained about calling UT_CATCH with an empty second argument. For these cases, I added UT_RETHROW(ExceptionName). I also added a catch of RequiredCheckException to ExecuteTest to avoid two error messages on each failed REQUIRE check. --- UnitTest++/CheckMacros.h | 40 ++++++++++-------------------------- UnitTest++/ExceptionMacros.h | 2 ++ UnitTest++/ExecuteTest.h | 2 ++ 3 files changed, 15 insertions(+), 29 deletions(-) diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index 9547c32..e9dae64 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -38,14 +38,11 @@ #define CHECK(value) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ - ({ \ + ({ \ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ - UT_CATCH (UnitTest::RequiredCheckException, , \ - { \ - UT_THROW(); \ - }) \ + UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -63,13 +60,10 @@ #define CHECK_EQUAL(expected, actual) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ - ({ \ + ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::RequiredCheckException, , \ - { \ - UT_THROW(); \ - }) \ + UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -78,7 +72,7 @@ message.GetText()); \ }) \ UT_CATCH_ALL \ - ({ \ + ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \ }) \ @@ -87,13 +81,10 @@ #define CHECK_CLOSE(expected, actual, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ - ({ \ + ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::RequiredCheckException, , \ - { \ - UT_THROW(); \ - }) \ + UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -102,7 +93,7 @@ message.GetText()); \ }) \ UT_CATCH_ALL \ - ({ \ + ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \ }) \ @@ -114,10 +105,7 @@ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::RequiredCheckException, , \ - { \ - UT_THROW(); \ - }) \ + UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -138,10 +126,7 @@ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::RequiredCheckException, , \ - { \ - UT_THROW(); \ - }) \ + UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ @@ -162,10 +147,7 @@ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_CATCH (UnitTest::RequiredCheckException, , \ - { \ - UT_THROW(); \ - }) \ + UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ diff --git a/UnitTest++/ExceptionMacros.h b/UnitTest++/ExceptionMacros.h index ca8757e..027a5da 100644 --- a/UnitTest++/ExceptionMacros.h +++ b/UnitTest++/ExceptionMacros.h @@ -6,11 +6,13 @@ #ifndef UNITTEST_NO_EXCEPTIONS #define UT_TRY(x) try x #define UT_THROW(x) throw x + #define UT_RETHROW(ExceptionType) catch(ExceptionType&) { throw; } #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody #else #define UT_TRY(x) x #define UT_THROW(x) + #define UT_RETHROW() #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) #define UT_CATCH_ALL(CatchBody) #endif diff --git a/UnitTest++/ExecuteTest.h b/UnitTest++/ExecuteTest.h index c6917fc..8e516db 100644 --- a/UnitTest++/ExecuteTest.h +++ b/UnitTest++/ExecuteTest.h @@ -7,6 +7,7 @@ #include "TestResults.h" #include "MemoryOutStream.h" #include "AssertException.h" +#include "RequiredCheckException.h" #include "CurrentTest.h" #ifdef UNITTEST_NO_EXCEPTIONS @@ -38,6 +39,7 @@ namespace UnitTest { testObject.RunImpl(); }) #endif + UT_CATCH(RequiredCheckException, e, { (void)e; }) UT_CATCH(AssertException, e, { (void)e; }) UT_CATCH(std::exception, e, { From 7a68264b0fe7a8da3569a31b8815b4a78b710155 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Mon, 8 Feb 2016 19:11:05 -0600 Subject: [PATCH 116/184] Renaming tests/TestRequireMacros.cpp -> tests/TestRequireMacrosWithExceptionsOn.cpp, testing REQUIRE with exceptions turned off will require a significantly different approach. --- ...estRequireMacros.cpp => TestRequireMacrosWithExceptionsOn.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{TestRequireMacros.cpp => TestRequireMacrosWithExceptionsOn.cpp} (100%) diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacrosWithExceptionsOn.cpp similarity index 100% rename from tests/TestRequireMacros.cpp rename to tests/TestRequireMacrosWithExceptionsOn.cpp From 4b0ac3f34a598fbd6ad7e0158e9663f0481ab965 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Mon, 8 Feb 2016 21:36:05 -0600 Subject: [PATCH 117/184] UT_RETHROW needed to take an argument when UNITTEST_NO_EXCEPTIONS=1. --- UnitTest++/ExceptionMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest++/ExceptionMacros.h b/UnitTest++/ExceptionMacros.h index 027a5da..c3b1e30 100644 --- a/UnitTest++/ExceptionMacros.h +++ b/UnitTest++/ExceptionMacros.h @@ -12,7 +12,7 @@ #else #define UT_TRY(x) x #define UT_THROW(x) - #define UT_RETHROW() + #define UT_RETHROW(ExceptionType) #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) #define UT_CATCH_ALL(CatchBody) #endif From 2e53a17d7e85d11efeef3ca88d852d2c80b2e5b1 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Mon, 8 Feb 2016 21:38:56 -0600 Subject: [PATCH 118/184] With code proposed in Pull Request #95, when UNITTEST_NO_EXCEPTIONS is defined, the definition for REQUIRE macro is empty. This commit adds functionality for stopping unit tests early when UNITTEST_NO_EXCEPTIONS is defined via std::longjmp. --- UnitTest++/RequireMacros.h | 8 +- UnitTest++/ThrowingTestReporter.cpp | 12 +- tests/TestRequireMacrosWithExceptionsOff.cpp | 738 +++++++++++++++++++ 3 files changed, 750 insertions(+), 8 deletions(-) create mode 100644 tests/TestRequireMacrosWithExceptionsOff.cpp diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index ea1f6b9..0830e99 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -7,12 +7,6 @@ #error UnitTest++ redefines REQUIRE #endif -#ifndef UNITTEST_NO_EXCEPTIONS - #define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(*UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) -#endif +#define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(*UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) -#ifdef UNITTEST_NO_EXCEPTIONS - #define REQUIRE #endif - -#endif \ No newline at end of file diff --git a/UnitTest++/ThrowingTestReporter.cpp b/UnitTest++/ThrowingTestReporter.cpp index 672f042..4e56149 100644 --- a/UnitTest++/ThrowingTestReporter.cpp +++ b/UnitTest++/ThrowingTestReporter.cpp @@ -1,6 +1,10 @@ #include "ThrowingTestReporter.h" #include "RequiredCheckException.h" +#ifdef UNITTEST_NO_EXCEPTIONS +#include "ReportAssertImpl.h" +#endif + namespace UnitTest { ThrowingTestReporter::ThrowingTestReporter(TestReporter* decoratedReporter) @@ -27,7 +31,13 @@ namespace UnitTest { { m_decoratedReporter->ReportFailure(test, failure); } - throw RequiredCheckException(); + + #ifndef UNITTEST_NO_EXCEPTIONS + throw RequiredCheckException(); + #else + static const int stopTest = 1; + UNITTEST_LONGJMP(*UnitTest::Detail::GetAssertJmpBuf(), stopTest); + #endif } //virtual diff --git a/tests/TestRequireMacrosWithExceptionsOff.cpp b/tests/TestRequireMacrosWithExceptionsOff.cpp new file mode 100644 index 0000000..d43fbc1 --- /dev/null +++ b/tests/TestRequireMacrosWithExceptionsOff.cpp @@ -0,0 +1,738 @@ +#include "UnitTest++/UnitTestPP.h" +#include "UnitTest++/CurrentTest.h" +#include "RecordingReporter.h" +#include "ScopedCurrentTest.h" + +#include + +using namespace std; + +#ifdef UNITTEST_NO_EXCEPTIONS + +// NOTE: unit tests here use a work around for std::longjmp +// taking us out of the current running unit test. We use a +// follow on test to check the previous test exhibited correct +// behavior. + +namespace { + + static RecordingReporter reporter; + static std::string testName; + static bool next = false; + static int line = 0; + + // Use destructor to reset our globals + struct DoValidationOn + { + ~DoValidationOn() + { + testName = ""; + next = false; + line = 0; + + reporter.lastFailedLine = 0; + memset(reporter.lastFailedTest, 0, sizeof(reporter.lastFailedTest)); + memset(reporter.lastFailedSuite, 0, sizeof(reporter.lastFailedSuite)); + memset(reporter.lastFailedFile, 0, sizeof(reporter.lastFailedFile)); + } + }; + + TEST(RequireCheckSucceedsOnTrue) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK(true); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequireCheckSucceedsOnTrue_FollowOn) + { + CHECK(next); + } + + TEST(RequiredCheckFailsOnFalse) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK(false); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckFailsOnFalse_FollowOn) + { + CHECK(!next); + } + + TEST(RequireMacroSupportsMultipleChecks) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE + { + CHECK(true); + CHECK_EQUAL(1,1); + } + + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequireMacroSupportsMultipleChecks_FollowOn) + { + CHECK(next); + } + + TEST(RequireMacroSupportsMultipleChecksWithFailingChecks) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE + { + CHECK(true); + CHECK_EQUAL(1,2); + } + + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequireMacroSupportsMultipleChecksWithFailingChecks_FollowOn) + { + CHECK(!next); + } + + TEST(RequireMacroDoesntExecuteCodeAfterAFailingCheck) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE + { + CHECK(false); + next = true; + } + } + } + + TEST_FIXTURE(DoValidationOn, RequireMacroDoesntExecuteCodeAfterAFailingCheck_FollowOn) + { + CHECK(!next); + } + + TEST(FailureReportsCorrectTestName) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + testName = m_details.testName; + REQUIRE CHECK(false); + } + } + + TEST_FIXTURE(DoValidationOn, FailureReportsCorrectTestName_FollowOn) + { + CHECK_EQUAL(testName, reporter.lastFailedTest); + } + + TEST(RequiredCheckFailureIncludesCheckContents) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + testName = m_details.testName; + const bool yaddayadda = false; + + REQUIRE CHECK(yaddayadda); + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckFailureIncludesCheckContents_FollowOn) + { + CHECK(strstr(reporter.lastFailedMessage, "yaddayadda")); + } + + TEST(RequiredCheckEqualSucceedsOnEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_EQUAL(1,1); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckEqualSucceedsOnEqual_FollowOn) + { + CHECK(next); + } + + TEST(RequiredCheckEqualFailsOnNotEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_EQUAL(1, 2); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckEqualFailsOnNotEqual_FollowOn) + { +// TODO: check reporter last test name + CHECK(!next); + } + + TEST(RequiredCheckEqualFailureContainsCorrectDetails) + { + { + UnitTest::TestResults testResults(&reporter); + UnitTest::TestDetails const testDetails("testName", "suiteName", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + + line = __LINE__; REQUIRE CHECK_EQUAL(1, 123); + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckEqualFailureContainsCorrectDetails_FollowOn) + { + CHECK_EQUAL("testName", reporter.lastFailedTest); + CHECK_EQUAL("suiteName", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + int g_sideEffect = 0; + int FunctionWithSideEffects() + { + ++g_sideEffect; + return 1; + } + + TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_EQUAL(1, FunctionWithSideEffects()); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckEqualDoesNotHaveSideEffectsWhenPassing_FollowOn) + { + CHECK_EQUAL(1, g_sideEffect); + CHECK(next); + } + + TEST(RequiredCheckEqualDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_EQUAL(2, FunctionWithSideEffects()); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckEqualDoesNotHaveSideEffectsWhenFailing_FollowOn) + { + CHECK_EQUAL(1, g_sideEffect); + CHECK(!next); + } + + TEST(RequiredCheckCloseSucceedsOnEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_CLOSE(1.0f, 1.001f, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckCloseSucceedsOnEqual_FollowOn) + { + CHECK(next); + } + + TEST(RequiredCheckCloseFailsOnNotEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_CLOSE (1.0f, 1.1f, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckCloseFailsOnNotEqual_FollowOn) + { + CHECK(!next); + } + + TEST(RequiredCheckCloseFailureContainsCorrectDetails) + { + { + UnitTest::TestResults testResults(&reporter); + UnitTest::TestDetails testDetails("test", "suite", "filename", -1); + ScopedCurrentTest scopedResults(testResults, &testDetails); + + line = __LINE__; REQUIRE CHECK_CLOSE(1.0f, 1.1f, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckCloseFailureContainsCorrectDetails_FollowOn) + { + CHECK_EQUAL("test", reporter.lastFailedTest); + CHECK_EQUAL("suite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + + CHECK(!next); + } + + TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_CLOSE (1, FunctionWithSideEffects(), 0.1f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckCloseDoesNotHaveSideEffectsWhenPassing_FollowOn) + { + CHECK_EQUAL(1, g_sideEffect); + CHECK(next); + } + + TEST(RequiredCheckCloseDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + REQUIRE CHECK_CLOSE(2, FunctionWithSideEffects(), 0.1f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckCloseDoesNotHaveSideEffectsWhenFailingOn) + { + CHECK_EQUAL(1, g_sideEffect); + CHECK(!next); + } + + TEST(RequiredCheckArrayCloseSucceedsOnEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + const float data[4] = { 0, 1, 2, 3 }; + + REQUIRE CHECK_ARRAY_CLOSE (data, data, 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseSucceedsOnEqual_FollowOn) + { + CHECK(next); + } + + TEST(RequiredCheckArrayCloseFailsOnNotEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; + + REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseFailsOnNotEqual_FollowOn) + { + CHECK(!next); + } + + TEST(RequiredCheckArrayCloseFailureIncludesCheckExpectedAndActual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; + + REQUIRE CHECK_ARRAY_CLOSE(data1, data2, 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseFailureIncludesCheckExpectedAndActual_FollowOn) + { + CHECK(!next); + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); + } + + TEST(RequiredCheckArrayCloseFailureContainsCorrectDetails) + { + { + 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 }; + + line = __LINE__; REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseFailureContainsCorrectDetails_FollowOn) + { + CHECK(!next); + + CHECK_EQUAL("arrayCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("arrayCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST(RequiredCheckArrayCloseFailureIncludesTolerance) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + float const data1[4] = { 0, 1, 2, 3 }; + float const data2[4] = { 0, 1, 3, 3 }; + + REQUIRE CHECK_ARRAY_CLOSE (data1, data2, 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseFailureIncludesTolerance_FollowOn) + { + CHECK(!next); + CHECK(strstr(reporter.lastFailedMessage, "0.01")); + } + + TEST(RequiredCheckArrayEqualSuceedsOnEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + const float data[4] = { 0, 1, 2, 3 }; + + REQUIRE CHECK_ARRAY_EQUAL (data, data, 4); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayEqualSuceedsOnEqual_FollowOn) + { + CHECK(next); + } + + TEST(RequiredCheckArrayEqualFailsOnNotEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; + + REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayEqualFailsOnNotEqual) + { + CHECK(!next); + } + + TEST(RequiredCheckArrayEqualFailureIncludesCheckExpectedAndActual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; + + REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayEqualFailureIncludesCheckExpectedAndActual_FollowOn) + { + CHECK(!next); + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ 0 1 2 3 ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ 0 1 3 3 ]")); + } + + TEST(RequiredCheckArrayEqualFailureContainsCorrectInfo) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + int const data1[4] = { 0, 1, 2, 3 }; + int const data2[4] = { 0, 1, 3, 3 }; + + line = __LINE__; REQUIRE CHECK_ARRAY_EQUAL (data1, data2, 4); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayEqualFailureContainsCorrectInfo_FollowOn) + { + CHECK(!next); + + CHECK_EQUAL("RequiredCheckArrayEqualFailureContainsCorrectInfo", reporter.lastFailedTest); + CHECK_EQUAL(__FILE__, reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + float const* FunctionWithSideEffects2() + { + ++g_sideEffect; + static float const data[] = { 0, 1, 2, 3}; + return data; + } + + TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[] = { 0, 1, 2, 3 }; + + REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing_FollowOn) + { + CHECK_EQUAL(1, g_sideEffect); + CHECK(next); + } + + TEST(RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[] = { 0, 1, 3, 3 }; + + REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenFailing_FollowOn) + { + CHECK_EQUAL(1, g_sideEffect); + CHECK(!next); + } + + TEST(RequiredCheckArray2DCloseSucceedsOnEqual) + { + { + UnitTest::TestResults testResults(&reporter); + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {2, 3} }; + + REQUIRE CHECK_ARRAY2D_CLOSE(data, data, 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseSucceedsOnEqual_FollowOn) + { + CHECK(next); + } + + TEST(RequiredCheckArray2DCloseFailsOnNotEqual) + { + { + 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} }; + + REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseFailsOnNotEqual_FollowOn) + { + CHECK(!next); + } + + TEST(RequiredCheckArray2DCloseFailureIncludesCheckExpectedAndActual) + { + { + 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} }; + + REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseFailureIncludesCheckExpectedAndActual_FollowOn) + { + CHECK(!next); + + CHECK(strstr(reporter.lastFailedMessage, "xpected [ [ 0 1 ] [ 2 3 ] ]")); + CHECK(strstr(reporter.lastFailedMessage, "was [ [ 0 1 ] [ 3 3 ] ]")); + } + + TEST(RequiredCheckArray2DCloseFailureContainsCorrectDetails) + { + { + 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} }; + + line = __LINE__; REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseFailureContainsCorrectDetails_FollowOn) + { + CHECK(!next); + + CHECK_EQUAL("array2DCloseTest", reporter.lastFailedTest); + CHECK_EQUAL("array2DCloseSuite", reporter.lastFailedSuite); + CHECK_EQUAL("filename", reporter.lastFailedFile); + CHECK_EQUAL(line, reporter.lastFailedLine); + } + + TEST(RequiredCheckArray2DCloseFailureIncludesTolerance) + { + { + 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} }; + + REQUIRE CHECK_ARRAY2D_CLOSE (data1, data2, 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseFailureIncludesTolerance_FollowOn) + { + CHECK(!next); + CHECK(strstr(reporter.lastFailedMessage, "0.01")); + } + + 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(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenPassing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {2, 3} }; + + REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenPassing_FollowOn) + { + CHECK(next); + CHECK_EQUAL(1, g_sideEffect); + } + + TEST(RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenFailing) + { + g_sideEffect = 0; + { + UnitTest::TestResults testResults; + ScopedCurrentTest scopedResults(testResults); + + const float data[2][2] = { {0, 1}, {3, 3} }; + + REQUIRE CHECK_ARRAY2D_CLOSE (data, FunctionWithSideEffects3(), 2, 2, 0.01f); + next = true; + } + } + + TEST_FIXTURE(DoValidationOn, RequiredCheckArray2DCloseDoesNotHaveSideEffectsWhenFailing_FollowOn) + { + CHECK(!next); + CHECK_EQUAL(1, g_sideEffect); + } +} + +#endif From 1c30bcd16b1c69eb7cde4894bc446d47d4268c92 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Mon, 8 Feb 2016 21:54:58 -0600 Subject: [PATCH 119/184] Correcting RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing to exercise the passing case (per the UT name). --- tests/TestRequireMacros.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/TestRequireMacros.cpp b/tests/TestRequireMacros.cpp index 6b76004..f904708 100644 --- a/tests/TestRequireMacros.cpp +++ b/tests/TestRequireMacros.cpp @@ -646,14 +646,9 @@ namespace { UnitTest::TestResults testResults; ScopedCurrentTest scopedResults(testResults); - const float data[] = { 0, 1, 2, 3 }; + const float data[] = { 1, 2, 3, 4 }; - try - { - REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); - } - catch (const UnitTest::RequiredCheckException&) - {} + REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); } CHECK_EQUAL(1, g_sideEffect); } From adebd8376a1e16d7661405e6ff214b2b617163da Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 21:11:19 -0600 Subject: [PATCH 120/184] Update autotools for new source files. --- UnitTest++/Makefile.am | 4 ++-- tests/Makefile.am | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index 32f6477..a512fca 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,7 +1,7 @@ lib_LTLIBRARIES = UnitTest++/libUnitTest++.la pkgincludedir = $(includedir)/UnitTest++/ -nobase_pkginclude_HEADERS = UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/Config.h UnitTest++/HelperMacros.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestSuite.h UnitTest++/TestResults.h UnitTest++/TestMacros.h UnitTest++/CheckMacros.h UnitTest++/TestRunner.h UnitTest++/TimeConstraint.h UnitTest++/ExecuteTest.h UnitTest++/AssertException.h UnitTest++/MemoryOutStream.h UnitTest++/CurrentTest.h UnitTest++/Checks.h UnitTest++/TimeHelpers.h UnitTest++/ExceptionMacros.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/CompositeTestReporter.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h -UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Test.cpp UnitTest++/Checks.cpp UnitTest++/TestRunner.cpp UnitTest++/TestResults.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/ReportAssert.cpp UnitTest++/TestList.cpp UnitTest++/TimeConstraint.cpp UnitTest++/TestDetails.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/XmlTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/CompositeTestReporter.cpp +nobase_pkginclude_HEADERS = UnitTest++/AssertException.h UnitTest++/CheckMacros.h UnitTest++/Checks.h UnitTest++/CompositeTestReporter.h UnitTest++/Config.h UnitTest++/CurrentTest.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h UnitTest++/ExceptionMacros.h UnitTest++/ExecuteTest.h UnitTest++/HelperMacros.h UnitTest++/MemoryOutStream.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/RequireMacros.h UnitTest++/RequiredCheckException.h UnitTest++/RequiredCheckTestReporter.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestMacros.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/TestResults.h UnitTest++/TestRunner.h UnitTest++/TestSuite.h UnitTest++/ThrowingTestReporter.h UnitTest++/TimeConstraint.h UnitTest++/TimeHelpers.h UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/XmlTestReporter.h +UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Checks.cpp UnitTest++/CompositeTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/ReportAssert.cpp UnitTest++/RequiredCheckException.cpp UnitTest++/RequiredCheckTestReporter.cpp UnitTest++/Test.cpp UnitTest++/TestDetails.cpp UnitTest++/TestList.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/TestResults.cpp UnitTest++/TestRunner.cpp UnitTest++/ThrowingTestReporter.cpp UnitTest++/TimeConstraint.cpp UnitTest++/XmlTestReporter.cpp if WINDOWS nobase_pkginclude_HEADERS += UnitTest++/Win32/TimeHelpers.h diff --git a/tests/Makefile.am b/tests/Makefile.am index 5306292..fe7cffd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ check_PROGRAMS = UnitTest++/TestUnitTest++ -UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp +UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestRequireMacros.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp UnitTest___TestUnitTest___LDADD = UnitTest++/libUnitTest++.la TESTS = UnitTest++/TestUnitTest++ From 073a1ea0e1a484128bf4efa1d803e009c2356e2f Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 21:44:25 -0600 Subject: [PATCH 121/184] Enable C++11 support in autoconf --- configure.ac | 2 + m4/ax_cxx_compile_stdcxx.m4 | 558 +++++++++++++++++++++++++++++++++ m4/ax_cxx_compile_stdcxx_11.m4 | 39 +++ 3 files changed, 599 insertions(+) create mode 100644 m4/ax_cxx_compile_stdcxx.m4 create mode 100644 m4/ax_cxx_compile_stdcxx_11.m4 diff --git a/configure.ac b/configure.ac index 7b77b73..46e3be6 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,8 @@ AC_SUBST([LIBUNITTEST_SO_VERSION], [1:5:1]) AC_PROG_CXX AC_PROG_CC +AX_CXX_COMPILE_STDCXX_11(noext, optional) + # Checks for libraries. # Checks for header files. diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 0000000..66d41f5 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,558 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXXFLAGS to +# enable support. VERSION may be '11' (for the C++11 standard) or '14' +# (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [], + [$1], [14], [], + [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++$1 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + else + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + + AC_SUBST(HAVE_CXX$1) + fi +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_seperators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) \ No newline at end of file diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4 new file mode 100644 index 0000000..09db383 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx_11.m4 @@ -0,0 +1,39 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXXFLAGS to enable support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++11. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 14 + +include([ax_cxx_compile_stdcxx.m4]) + +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) From 0a99a9a5c9d1bd48f4efc0f31ac0c82eaffa6651 Mon Sep 17 00:00:00 2001 From: Austin Gilbert Date: Mon, 8 Feb 2016 21:54:58 -0600 Subject: [PATCH 122/184] Correcting RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing to exercise the passing case (per the UT name). --- tests/TestRequireMacrosWithExceptionsOn.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/TestRequireMacrosWithExceptionsOn.cpp b/tests/TestRequireMacrosWithExceptionsOn.cpp index 6b76004..f904708 100644 --- a/tests/TestRequireMacrosWithExceptionsOn.cpp +++ b/tests/TestRequireMacrosWithExceptionsOn.cpp @@ -646,14 +646,9 @@ namespace { UnitTest::TestResults testResults; ScopedCurrentTest scopedResults(testResults); - const float data[] = { 0, 1, 2, 3 }; + const float data[] = { 1, 2, 3, 4 }; - try - { - REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); - } - catch (const UnitTest::RequiredCheckException&) - {} + REQUIRE CHECK_ARRAY_CLOSE (data, FunctionWithSideEffects2(), 4, 0.01f); } CHECK_EQUAL(1, g_sideEffect); } From 962387ce5d275f1d7dc920796239ae07e7b2a441 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 21:11:19 -0600 Subject: [PATCH 123/184] Update autotools for new source files. --- UnitTest++/Makefile.am | 4 ++-- tests/Makefile.am | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index 32f6477..a512fca 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,7 +1,7 @@ lib_LTLIBRARIES = UnitTest++/libUnitTest++.la pkgincludedir = $(includedir)/UnitTest++/ -nobase_pkginclude_HEADERS = UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/Config.h UnitTest++/HelperMacros.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestSuite.h UnitTest++/TestResults.h UnitTest++/TestMacros.h UnitTest++/CheckMacros.h UnitTest++/TestRunner.h UnitTest++/TimeConstraint.h UnitTest++/ExecuteTest.h UnitTest++/AssertException.h UnitTest++/MemoryOutStream.h UnitTest++/CurrentTest.h UnitTest++/Checks.h UnitTest++/TimeHelpers.h UnitTest++/ExceptionMacros.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/CompositeTestReporter.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h -UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Test.cpp UnitTest++/Checks.cpp UnitTest++/TestRunner.cpp UnitTest++/TestResults.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/ReportAssert.cpp UnitTest++/TestList.cpp UnitTest++/TimeConstraint.cpp UnitTest++/TestDetails.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/XmlTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/CompositeTestReporter.cpp +nobase_pkginclude_HEADERS = UnitTest++/AssertException.h UnitTest++/CheckMacros.h UnitTest++/Checks.h UnitTest++/CompositeTestReporter.h UnitTest++/Config.h UnitTest++/CurrentTest.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h UnitTest++/ExceptionMacros.h UnitTest++/ExecuteTest.h UnitTest++/HelperMacros.h UnitTest++/MemoryOutStream.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/RequireMacros.h UnitTest++/RequiredCheckException.h UnitTest++/RequiredCheckTestReporter.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestMacros.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/TestResults.h UnitTest++/TestRunner.h UnitTest++/TestSuite.h UnitTest++/ThrowingTestReporter.h UnitTest++/TimeConstraint.h UnitTest++/TimeHelpers.h UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/XmlTestReporter.h +UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Checks.cpp UnitTest++/CompositeTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/ReportAssert.cpp UnitTest++/RequiredCheckException.cpp UnitTest++/RequiredCheckTestReporter.cpp UnitTest++/Test.cpp UnitTest++/TestDetails.cpp UnitTest++/TestList.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/TestResults.cpp UnitTest++/TestRunner.cpp UnitTest++/ThrowingTestReporter.cpp UnitTest++/TimeConstraint.cpp UnitTest++/XmlTestReporter.cpp if WINDOWS nobase_pkginclude_HEADERS += UnitTest++/Win32/TimeHelpers.h diff --git a/tests/Makefile.am b/tests/Makefile.am index 5306292..fe7cffd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ check_PROGRAMS = UnitTest++/TestUnitTest++ -UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp +UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestRequireMacros.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp UnitTest___TestUnitTest___LDADD = UnitTest++/libUnitTest++.la TESTS = UnitTest++/TestUnitTest++ From 898f18d799ecb2cf335c6070183e72f3ee59d79b Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 21:44:25 -0600 Subject: [PATCH 124/184] Enable C++11 support in autoconf --- configure.ac | 2 + m4/ax_cxx_compile_stdcxx.m4 | 558 +++++++++++++++++++++++++++++++++ m4/ax_cxx_compile_stdcxx_11.m4 | 39 +++ 3 files changed, 599 insertions(+) create mode 100644 m4/ax_cxx_compile_stdcxx.m4 create mode 100644 m4/ax_cxx_compile_stdcxx_11.m4 diff --git a/configure.ac b/configure.ac index 7b77b73..46e3be6 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,8 @@ AC_SUBST([LIBUNITTEST_SO_VERSION], [1:5:1]) AC_PROG_CXX AC_PROG_CC +AX_CXX_COMPILE_STDCXX_11(noext, optional) + # Checks for libraries. # Checks for header files. diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 0000000..66d41f5 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,558 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXXFLAGS to +# enable support. VERSION may be '11' (for the C++11 standard) or '14' +# (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [], + [$1], [14], [], + [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++$1 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXXFLAGS="$ac_save_CXXFLAGS"]) + if eval test x\$$cachevar = xyes; then + CXXFLAGS="$CXXFLAGS $switch" + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + else + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + + AC_SUBST(HAVE_CXX$1) + fi +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_seperators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) \ No newline at end of file diff --git a/m4/ax_cxx_compile_stdcxx_11.m4 b/m4/ax_cxx_compile_stdcxx_11.m4 new file mode 100644 index 0000000..09db383 --- /dev/null +++ b/m4/ax_cxx_compile_stdcxx_11.m4 @@ -0,0 +1,39 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXXFLAGS to enable support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++11. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 14 + +include([ax_cxx_compile_stdcxx.m4]) + +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) From 5ad8cd86c9cd4b30fb7dc1f926a8861bf34d5659 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 23:12:40 -0600 Subject: [PATCH 125/184] Add new tests to Makefile.am --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index fe7cffd..647476e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ check_PROGRAMS = UnitTest++/TestUnitTest++ -UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestRequireMacros.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp +UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestRequireMacrosWithExceptionsOff.cpp tests/TestRequireMacrosWithExceptionsOn.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp UnitTest___TestUnitTest___LDADD = UnitTest++/libUnitTest++.la TESTS = UnitTest++/TestUnitTest++ From 6c78c6ea2b1f4d9c9e7b0addcb3672b27d57bc67 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 23:45:52 -0600 Subject: [PATCH 126/184] Add more compilers to appveyor config --- appveyor.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c36218a..e7b1cfb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,26 @@ +version: 1.6.0.{build} + os: - Windows Server 2012 R2 -install: +environment: + matrix: + + - CMAKE_GENERATOR: Visual Studio 9 + BUILD_FOLDER: 'vs2008' + - CMAKE_GENERATOR: Visual Studio 10 + BUILD_FOLDER: 'vs2010' + - CMAKE_GENERATOR: Visual Studio 11 + BUILD_FOLDER: 'vs2012' + - CMAKE_GENERATOR: Visual Studio 12 + BUILD_FOLDER: 'vs2013' + - CMAKE_GENERATOR: Visual Studio 14 + BUILD_FOLDER: 'vs2015' + +before_build: # Generate solution files using cmake, in 'builds' directory. # No need to create it because it's part of the repo. - - cd builds && cmake -G "Visual Studio 12" ../ && cd .. + - mkdir builds\%BUILD_FOLDER% && cd builds\%BUILD_FOLDER% && cmake -G %CMAKE_GENERATOR% ..\..\ && cd ..\.. configuration: - Debug From 5908e00efbc1d6879eea56f17f298e0caee862d1 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 23:49:15 -0600 Subject: [PATCH 127/184] Add forgotten quotes around CMAKE_GENERATOR --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e7b1cfb..5ed1f2b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ environment: before_build: # Generate solution files using cmake, in 'builds' directory. # No need to create it because it's part of the repo. - - mkdir builds\%BUILD_FOLDER% && cd builds\%BUILD_FOLDER% && cmake -G %CMAKE_GENERATOR% ..\..\ && cd ..\.. + - mkdir builds\%BUILD_FOLDER% && cd builds\%BUILD_FOLDER% && cmake -G "%CMAKE_GENERATOR%" ..\..\ && cd ..\.. configuration: - Debug From 8080a0c798512f398bbca85cb66ff9de9af93f6c Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 23:54:50 -0600 Subject: [PATCH 128/184] Fix CMAKE_GENERATOR values --- appveyor.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5ed1f2b..a34d3b0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,21 +6,16 @@ os: environment: matrix: - - CMAKE_GENERATOR: Visual Studio 9 - BUILD_FOLDER: 'vs2008' - - CMAKE_GENERATOR: Visual Studio 10 - BUILD_FOLDER: 'vs2010' - - CMAKE_GENERATOR: Visual Studio 11 - BUILD_FOLDER: 'vs2012' - - CMAKE_GENERATOR: Visual Studio 12 - BUILD_FOLDER: 'vs2013' - - CMAKE_GENERATOR: Visual Studio 14 - BUILD_FOLDER: 'vs2015' + - CMAKE_GENERATOR: Visual Studio 9 2008 + - CMAKE_GENERATOR: Visual Studio 10 2010 + - CMAKE_GENERATOR: Visual Studio 11 2012 + - CMAKE_GENERATOR: Visual Studio 12 2013 + - CMAKE_GENERATOR: Visual Studio 14 2015 before_build: # Generate solution files using cmake, in 'builds' directory. # No need to create it because it's part of the repo. - - mkdir builds\%BUILD_FOLDER% && cd builds\%BUILD_FOLDER% && cmake -G "%CMAKE_GENERATOR%" ..\..\ && cd ..\.. + - pushd builds && cmake -G "%CMAKE_GENERATOR%" ..\ && popd configuration: - Debug @@ -28,3 +23,8 @@ configuration: build: project: builds/UnitTest++.sln + +matrix: + fast_finish: true + + From 6ce4bbe8d916d55e5fd57f69bf08b34693834072 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Tue, 23 Feb 2016 23:59:31 -0600 Subject: [PATCH 129/184] Use build_script instead of build for appveyor Using build_script to run cmake --build fixes issues with msbuild not always finding the correct file formats, etc. --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index a34d3b0..28dc4fc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,8 +21,8 @@ configuration: - Debug - Release -build: - project: builds/UnitTest++.sln +build_script: + - pushd builds && cmake --build . && popd matrix: fast_finish: true From b69b63ac2bf4a967b35e853026abb68b3f8442ad Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Mon, 29 Feb 2016 22:32:58 -0600 Subject: [PATCH 130/184] Update docs, versions for 1.6.0. --- .gitmodules | 1 + README.md | 14 +++++++++----- configure.ac | 4 ++-- docs | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitmodules b/.gitmodules index d3c2970..58e923a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "docs"] path = docs url = https://github.com/unittest-cpp/unittest-cpp.wiki.git + ignore = dirty \ No newline at end of file diff --git a/README.md b/README.md index be3573f..cf88fea 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ UnitTest++ =========== -UnitTest++ is a lightweight unit testing framework for C++. It was designed to do test-driven development on a wide variety of platforms. Simplicity, portability, speed, and small footprint are all very important aspects of UnitTest++. UnitTest++ is ANSI portable C++ and makes minimal use of advanced library and languages features, which means it should be easily portable to just about any platform. Out of the box, the following platforms are supported: +UnitTest++ is a lightweight unit testing framework for C++. It was designed to do test-driven development on a wide variety of platforms. Simplicity, portability, speed, and small footprint are all very important aspects of UnitTest++. UnitTest++ is mostly standard C++ and makes minimal use of advanced library and language features, which means it should be easily portable to just about any platform. Out of the box, the following platforms are supported: * Windows * Linux @@ -16,7 +16,7 @@ The full documentation for building and using UnitTest++ can be found on the [Gi Pre-requisites --------------- -While there are currently some bundled makefiles and projects, UnitTest++ is primarily built and supported using [CMake](http://cmake.org). +While there are currently some bundled automake files, UnitTest++ is primarily built and supported using [CMake](http://cmake.org). Downloading ------------ @@ -30,17 +30,17 @@ Via svn: svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp -### Latest release (v1.5.1) ### +### Latest release (v1.6.0) ### Via git: git clone https://github.com/unittest-cpp/unittest-cpp cd unittest-cpp - git checkout v1.5.1 + git checkout v1.6.0 Via svn: - svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.5.1 unittest-cpp + svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.6.0 unittest-cpp License --------- @@ -77,6 +77,10 @@ Contributors Historic release notes ---------------------- +### Version 1.6.0 (2016-02-29) ### +- Add REQUIRE macro to end tests early when selected checks fail +- [Full List](https://github.com/unittest-cpp/unittest-cpp/issues?q=milestone%3A1.6.0+) + ### Version 1.5.1 (2016-01-30) ### - pkg-config support - Fix for Visual Studio 2010 compilation issue in 1.5.0 diff --git a/configure.ac b/configure.ac index 46e3be6..001ced8 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([UnitTest++], [1.5.1], [pjohnmeyer@gmail.com]) +AC_INIT([UnitTest++], [1.6.0], [pjohnmeyer@gmail.com]) AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) @@ -13,7 +13,7 @@ AM_CONDITIONAL([WINDOWS], [test "${host#*mingw}" != "${host}" -o "${host#*msvc}" != "${host}"]) LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [1:5:1]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [1:6:0]) # Checks for programs. AC_PROG_CXX diff --git a/docs b/docs index 8d4ad23..14495a3 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 8d4ad2348f13d35ed7af7c11d6dad2f5ed67f6b4 +Subproject commit 14495a3a81568e9ce187231b629e4eb7bc7e0350 From e88121f69e1b4bf36e9d72b129f27ee7b1ed6fdb Mon Sep 17 00:00:00 2001 From: Jason Horsburgh Date: Tue, 15 Mar 2016 12:14:19 +0000 Subject: [PATCH 131/184] Add support for CMake find_package() Added export configuration for UnitTest++ target and installed the export and config file in libs/cmake/UnitTest++. Added basic UnitTest++Config.cmake file which includes exported targets file and sets UTPP_INCLUDE_DIRS to the install location of the includes directory, this allows UnitTest++ to be used as a normal target in your own CMakeLists.txt file. e.g.: find_package(UnitTest++ REQUIRED NO_MODULE) add_executable(foo ...) include_directories(${UTPP_INCLUDE_DIRS}) target_link_libraries(foo UnitTest++) which will ensure the library and installed headers paths are set up correctly for your own target. --- CMakeLists.txt | 9 +++++++-- cmake/UnitTest++Config.cmake | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 cmake/UnitTest++Config.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index c573ef9..ea7cf24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,6 +69,11 @@ else() set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") endif() -install(TARGETS UnitTest++ DESTINATION lib) +set(config_install_dir_ lib/cmake/${PROJECT_NAME}) +set(targets_export_name_ "${PROJECT_NAME}Targets") + +install(TARGETS UnitTest++ EXPORT "${targets_export_name_}" DESTINATION lib) install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) -install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) \ No newline at end of file +install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) +install(FILES cmake/UnitTest++Config.cmake DESTINATION "${config_install_dir_}") +install(EXPORT "${targets_export_name_}" DESTINATION "${config_install_dir_}") diff --git a/cmake/UnitTest++Config.cmake b/cmake/UnitTest++Config.cmake new file mode 100644 index 0000000..afe165c --- /dev/null +++ b/cmake/UnitTest++Config.cmake @@ -0,0 +1,2 @@ +include("${CMAKE_CURRENT_LIST_DIR}/UnitTest++Targets.cmake") +get_filename_component(UTPP_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../../include/" ABSOLUTE) From 8544b5b6bee4c80000b400642d6527c84fba2011 Mon Sep 17 00:00:00 2001 From: Saul Beniquez Date: Thu, 7 Apr 2016 14:55:53 -0400 Subject: [PATCH 132/184] Fix for #105 - Automake improvements: fixing pkgincludedir. --- UnitTest++/Makefile.am | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/UnitTest++/Makefile.am b/UnitTest++/Makefile.am index a512fca..62e246f 100644 --- a/UnitTest++/Makefile.am +++ b/UnitTest++/Makefile.am @@ -1,12 +1,13 @@ lib_LTLIBRARIES = UnitTest++/libUnitTest++.la -pkgincludedir = $(includedir)/UnitTest++/ +pkgincludedir = $(includedir) + nobase_pkginclude_HEADERS = UnitTest++/AssertException.h UnitTest++/CheckMacros.h UnitTest++/Checks.h UnitTest++/CompositeTestReporter.h UnitTest++/Config.h UnitTest++/CurrentTest.h UnitTest++/DeferredTestReporter.h UnitTest++/DeferredTestResult.h UnitTest++/ExceptionMacros.h UnitTest++/ExecuteTest.h UnitTest++/HelperMacros.h UnitTest++/MemoryOutStream.h UnitTest++/ReportAssert.h UnitTest++/ReportAssertImpl.h UnitTest++/RequireMacros.h UnitTest++/RequiredCheckException.h UnitTest++/RequiredCheckTestReporter.h UnitTest++/Test.h UnitTest++/TestDetails.h UnitTest++/TestList.h UnitTest++/TestMacros.h UnitTest++/TestReporter.h UnitTest++/TestReporterStdout.h UnitTest++/TestResults.h UnitTest++/TestRunner.h UnitTest++/TestSuite.h UnitTest++/ThrowingTestReporter.h UnitTest++/TimeConstraint.h UnitTest++/TimeHelpers.h UnitTest++/UnitTest++.h UnitTest++/UnitTestPP.h UnitTest++/XmlTestReporter.h UnitTest___libUnitTest___la_SOURCES = UnitTest++/AssertException.cpp UnitTest++/Checks.cpp UnitTest++/CompositeTestReporter.cpp UnitTest++/CurrentTest.cpp UnitTest++/DeferredTestReporter.cpp UnitTest++/DeferredTestResult.cpp UnitTest++/MemoryOutStream.cpp UnitTest++/ReportAssert.cpp UnitTest++/RequiredCheckException.cpp UnitTest++/RequiredCheckTestReporter.cpp UnitTest++/Test.cpp UnitTest++/TestDetails.cpp UnitTest++/TestList.cpp UnitTest++/TestReporter.cpp UnitTest++/TestReporterStdout.cpp UnitTest++/TestResults.cpp UnitTest++/TestRunner.cpp UnitTest++/ThrowingTestReporter.cpp UnitTest++/TimeConstraint.cpp UnitTest++/XmlTestReporter.cpp -if WINDOWS +if WINDOWS nobase_pkginclude_HEADERS += UnitTest++/Win32/TimeHelpers.h UnitTest___libUnitTest___la_SOURCES += UnitTest++/Win32/TimeHelpers.cpp -else +else nobase_pkginclude_HEADERS += UnitTest++/Posix/SignalTranslator.h UnitTest++/Posix/TimeHelpers.h UnitTest___libUnitTest___la_SOURCES += UnitTest++/Posix/SignalTranslator.cpp UnitTest++/Posix/TimeHelpers.cpp endif From 80d6bf7568beb707861f6e1929399a1b57ca4d11 Mon Sep 17 00:00:00 2001 From: Saul Beniquez Date: Thu, 7 Apr 2016 14:56:31 -0400 Subject: [PATCH 133/184] Better native OS detection using AC_CANONICAL_HOST. More information here: https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Canonicalizing.html --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 001ced8..df63ac9 100644 --- a/configure.ac +++ b/configure.ac @@ -9,8 +9,14 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([UnitTest++.pc]) AM_INIT_AUTOMAKE([foreign subdir-objects]) + +AC_CANONICAL_HOST + +dnl Detect OS and set automake variables +dnl Always the red-headed stepchild... AM_CONDITIONAL([WINDOWS], - [test "${host#*mingw}" != "${host}" -o "${host#*msvc}" != "${host}"]) + [test "${host//mingw/}" != "${host}" -o "${host//msvc/}" != "${host}"]) + LT_INIT() AC_SUBST([LIBUNITTEST_SO_VERSION], [1:6:0]) From 2a806451b1fb99cecff55e48d90a8b80185345ad Mon Sep 17 00:00:00 2001 From: bittwiddler1 Date: Thu, 7 Apr 2016 15:03:34 -0400 Subject: [PATCH 134/184] Comment changes Making the comments more explicative and less opinionated. :) --- configure.ac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index df63ac9..d833196 100644 --- a/configure.ac +++ b/configure.ac @@ -12,8 +12,7 @@ AM_INIT_AUTOMAKE([foreign subdir-objects]) AC_CANONICAL_HOST -dnl Detect OS and set automake variables -dnl Always the red-headed stepchild... +dnl Detect Windows, as it doesn't implement UNIX signals and requires special code AM_CONDITIONAL([WINDOWS], [test "${host//mingw/}" != "${host}" -o "${host//msvc/}" != "${host}"]) From 451ba1e2bc4715aa93d15d502d6bd11f116e7381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kilian=20K=C3=B6ppchen?= Date: Thu, 14 Apr 2016 15:23:10 +0200 Subject: [PATCH 135/184] Fix spelling of UTPP_USE_PLUS_SIGN option comment. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c573ef9..3f49660 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.8.1) project(UnitTest++) -option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON) +option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" ON) if(MSVC14 OR MSVC12) # has the support we need @@ -71,4 +71,4 @@ endif() install(TARGETS UnitTest++ DESTINATION lib) install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) -install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) \ No newline at end of file +install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) From 791c37a9f1b6b51c8bf7448f93e6a20cedf1c861 Mon Sep 17 00:00:00 2001 From: bittwiddler1 Date: Sat, 16 Apr 2016 19:12:21 -0400 Subject: [PATCH 136/184] Enabling silent build rules for automake --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index d833196..fbf92c8 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,7 @@ AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([UnitTest++.pc]) AM_INIT_AUTOMAKE([foreign subdir-objects]) +AM_SILENT_RULES([yes]) AC_CANONICAL_HOST From b7e0d70a63a0b862ec4bce37c14ae11446fc5e42 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Mon, 25 Apr 2016 13:37:31 -0500 Subject: [PATCH 137/184] Fix failures in `make distcheck` --- tests/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 647476e..06cc26c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,5 @@ check_PROGRAMS = UnitTest++/TestUnitTest++ -UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestRequireMacrosWithExceptionsOff.cpp tests/TestRequireMacrosWithExceptionsOn.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp + +UnitTest___TestUnitTest___SOURCES = tests/Main.cpp tests/TestAssertHandler.cpp tests/TestCheckMacros.cpp tests/TestChecks.cpp tests/TestCompositeTestReporter.cpp tests/TestCurrentTest.cpp tests/TestDeferredTestReporter.cpp tests/TestExceptions.cpp tests/TestMemoryOutStream.cpp tests/TestRequireMacrosWithExceptionsOff.cpp tests/TestRequireMacrosWithExceptionsOn.cpp tests/TestTest.cpp tests/TestTestList.cpp tests/TestTestMacros.cpp tests/TestTestResults.cpp tests/TestTestRunner.cpp tests/TestTestSuite.cpp tests/TestTimeConstraint.cpp tests/TestTimeConstraintMacro.cpp tests/TestUnitTestPP.cpp tests/TestXmlTestReporter.cpp tests/RecordingReporter.h tests/ScopedCurrentTest.h UnitTest___TestUnitTest___LDADD = UnitTest++/libUnitTest++.la TESTS = UnitTest++/TestUnitTest++ From 1a62540b790345001fe584b8be05b076a46da403 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 4 May 2016 21:30:44 -0500 Subject: [PATCH 138/184] Determine autoconf package version from git tags --- configure.ac | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fbf92c8..6b81131 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,11 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([UnitTest++], [1.6.0], [pjohnmeyer@gmail.com]) +AC_INIT([UnitTest++], + m4_esyscmd_s([git describe --tags | cut -c2-]), + [pjohnmeyer@gmail.com], + [unittest-cpp]) + AC_CONFIG_SRCDIR([UnitTest++/TestDetails.cpp]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) From 782e620fbb6e03bb479eeae012b68b86c06f650f Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Wed, 4 May 2016 21:36:40 -0500 Subject: [PATCH 139/184] Update versions to 1.6.1 --- README.md | 10 +++++----- appveyor.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cf88fea..8a49c3d 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,17 @@ Via svn: svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp -### Latest release (v1.6.0) ### +### Latest release (v1.6.1) ### Via git: git clone https://github.com/unittest-cpp/unittest-cpp cd unittest-cpp - git checkout v1.6.0 + git checkout v1.6.1 Via svn: - svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.6.0 unittest-cpp + svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.6.1 unittest-cpp License --------- @@ -58,7 +58,7 @@ Contributors * Charles Nicholson (charles.nicholson@gmail.com) @charlesnicholson ### Original Authors: ### -* Noel Llopis (llopis@convexhull.com) +* Noel Llopis (llopis@convexhull.com) * Charles Nicholson (charles.nicholson@gmail.com) ### Contributors not included in github history ### @@ -114,7 +114,7 @@ Historic release notes - Standard streams can be optionally compiled off by defining UNITTEST_USE_CUSTOM_STREAMS in Config.h - Added named test suites -- Added CHECK_ARRAY2D_CLOSE +- Added CHECK_ARRAY2D_CLOSE - Posix library name is libUnitTest++.a now - Floating point numbers are postfixed with 'f' in the failure reports diff --git a/appveyor.yml b/appveyor.yml index 28dc4fc..71e4398 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.6.0.{build} +version: 1.6.1.{build} os: - Windows Server 2012 R2 From 185b3d5086d4e369bdb7da23abfda23bd248866f Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 6 May 2016 23:44:02 -0500 Subject: [PATCH 140/184] Add UNITTEST_ versions of all CHECK macros UNITTEST_ now prefixes the implementation of all CHECK macros. Additionally, the build option UNITTEST_ENABLE_SHORT_MACROS can be shut off, disabling the creation of the existing short forms. This is helpful for users who may have conflicts with their projects or other libs. --- UnitTest++/CheckMacros.h | 92 ++++++++++++++++++++++++++-------------- UnitTest++/Config.h | 8 +++- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index e9dae64..b5c6858 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -11,31 +11,7 @@ #include "CurrentTest.h" #include "ReportAssertImpl.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) \ +#define UNITTEST_CHECK(value) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ ({ \ @@ -57,7 +33,7 @@ }) \ UNITTEST_MULTILINE_MACRO_END -#define CHECK_EQUAL(expected, actual) \ +#define UNITTEST_CHECK_EQUAL(expected, actual) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ ({ \ @@ -78,7 +54,7 @@ }) \ UNITTEST_MULTILINE_MACRO_END -#define CHECK_CLOSE(expected, actual, tolerance) \ +#define UNITTEST_CHECK_CLOSE(expected, actual, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ ({ \ @@ -99,7 +75,7 @@ }) \ UNITTEST_MULTILINE_MACRO_END -#define CHECK_ARRAY_EQUAL(expected, actual, count) \ +#define UNITTEST_CHECK_ARRAY_EQUAL(expected, actual, count) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ ({ \ @@ -120,7 +96,7 @@ }) \ UNITTEST_MULTILINE_MACRO_END -#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ +#define UNITTEST_CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ ({ \ @@ -141,7 +117,7 @@ }) \ UNITTEST_MULTILINE_MACRO_END -#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ +#define UNITTEST_CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UT_TRY \ ({ \ @@ -162,11 +138,48 @@ }) \ UNITTEST_MULTILINE_MACRO_END +#if UNITTEST_ENABLE_SHORT_MACROS + #ifdef CHECK + #error CHECK already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK instead + #else + #define CHECK UNITTEST_CHECK + #endif + + #ifdef CHECK_EQUAL + #error CHECK_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_EQUAL instead + #else + #define CHECK_EQUAL UNITTEST_CHECK_EQUAL + #endif + + #ifdef CHECK_CLOSE + #error CHECK_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_CLOSE instead + #else + #define CHECK_CLOSE UNITTEST_CHECK_CLOSE + #endif + + #ifdef CHECK_ARRAY_EQUAL + #error CHECK_ARRAY_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY_EQUAL instead + #else + #define CHECK_ARRAY_EQUAL UNITTEST_CHECK_ARRAY_EQUAL + #endif + + #ifdef CHECK_ARRAY_CLOSE + #error CHECK_ARRAY_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY_CLOSE instead + #else + #define CHECK_ARRAY_CLOSE UNITTEST_CHECK_ARRAY_CLOSE + #endif + + #ifdef CHECK_ARRAY2D_CLOSE + #error CHECK_ARRAY2D_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY2D_CLOSE instead + #else + #define CHECK_ARRAY2D_CLOSE UNITTEST_CHECK_ARRAY2D_CLOSE + #endif +#endif // CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h) #ifndef UNITTEST_NO_EXCEPTIONS -#define CHECK_THROW(expression, ExpectedExceptionType) \ +#define UNITTEST_CHECK_THROW(expression, ExpectedExceptionType) \ UNITTEST_MULTILINE_MACRO_BEGIN \ bool caught_ = false; \ try { expression; } \ @@ -177,7 +190,7 @@ UNITTEST_MULTILINE_MACRO_END -#define CHECK_ASSERT(expression) \ +#define UNITTEST_CHECK_ASSERT(expression) \ UNITTEST_MULTILINE_MACRO_BEGIN \ UnitTest::Detail::ExpectAssert(true); \ CHECK_THROW(expression, UnitTest::AssertException); \ @@ -185,4 +198,19 @@ UNITTEST_MULTILINE_MACRO_END #endif +#if UNITTEST_ENABLE_SHORT_MACROS + #ifdef CHECK_THROW + #error CHECK_THROW already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_THROW instead + #else + #define CHECK_THROW UNITTEST_CHECK_THROW + #endif + + #ifdef CHECK_ASSERT + #error CHECK_ASSERT already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ASSERT instead + #else + #define CHECK_ASSERT UNITTEST_CHECK_ASSERT + #endif +#endif + #endif + diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index ff62b4e..f0e23d3 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -16,7 +16,7 @@ #ifdef _USRDLL #define UNITTEST_WIN32_DLL #endif - + #define UNITTEST_WIN32 #endif @@ -71,4 +71,10 @@ #define UNIITEST_NS_QUAL_STD(x) ::std::x #endif +// By default, UnitTest++ will attempt to define "short" macro names like CHECK, CHECK_EQUAL, +// etc. Setting UNITTEST_ENABLE_SHORT_MACROS to 0 will disable this behavior, leaving +// only the longer macros "namespaced" with the UNITTEST_ prefix. + +#define UNITTEST_ENABLE_SHORT_MACROS 1 + #endif From c96bf526136997ff97ef81e8d74b59cc502c6b20 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 6 May 2016 23:57:59 -0500 Subject: [PATCH 141/184] Replace UT_ macro prefix with UNITTEST_IMPL_ The UT_ prefix was primarily for "internal" macros. This commit seeks to more consistently "namespace" UnitTest++ macros with the UNITTEST_ prefix, while also marking these particular macros as "private" implementation details with the IMPL_ wart. --- UnitTest++/CheckMacros.h | 48 ++++++++++++++++++------------------ UnitTest++/Config.h | 8 +++--- UnitTest++/ExceptionMacros.h | 20 +++++++-------- UnitTest++/ExecuteTest.h | 12 ++++----- UnitTest++/TestMacros.h | 8 +++--- 5 files changed, 48 insertions(+), 48 deletions(-) diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index b5c6858..bb45964 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -13,20 +13,20 @@ #define UNITTEST_CHECK(value) \ UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ if (!UnitTest::Check(value)) \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), #value); \ }) \ - UT_RETHROW (UnitTest::RequiredCheckException) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ message.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK(" #value ")"); \ @@ -35,19 +35,19 @@ #define UNITTEST_CHECK_EQUAL(expected, actual) \ UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ UnitTest::CheckEqual(*UnitTest::CurrentTest::Results(), expected, actual, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_RETHROW (UnitTest::RequiredCheckException) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ message.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_EQUAL(" #expected ", " #actual ")"); \ @@ -56,19 +56,19 @@ #define UNITTEST_CHECK_CLOSE(expected, actual, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ UnitTest::CheckClose(*UnitTest::CurrentTest::Results(), expected, actual, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_RETHROW (UnitTest::RequiredCheckException) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ message.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_CLOSE(" #expected ", " #actual ")"); \ @@ -77,19 +77,19 @@ #define UNITTEST_CHECK_ARRAY_EQUAL(expected, actual, count) \ UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ UnitTest::CheckArrayEqual(*UnitTest::CurrentTest::Results(), expected, actual, count, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_RETHROW (UnitTest::RequiredCheckException) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ message.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"); \ @@ -98,19 +98,19 @@ #define UNITTEST_CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ UnitTest::CheckArrayClose(*UnitTest::CurrentTest::Results(), expected, actual, count, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_RETHROW (UnitTest::RequiredCheckException) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ message.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"); \ @@ -119,19 +119,19 @@ #define UNITTEST_CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ UNITTEST_MULTILINE_MACRO_BEGIN \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ UnitTest::CheckArray2DClose(*UnitTest::CurrentTest::Results(), expected, actual, rows, columns, tolerance, UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__)); \ }) \ - UT_RETHROW (UnitTest::RequiredCheckException) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_RETHROW (UnitTest::RequiredCheckException) \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream message; \ message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ message.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ "Unhandled exception in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"); \ diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index f0e23d3..364fe8d 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -71,10 +71,10 @@ #define UNIITEST_NS_QUAL_STD(x) ::std::x #endif -// By default, UnitTest++ will attempt to define "short" macro names like CHECK, CHECK_EQUAL, -// etc. Setting UNITTEST_ENABLE_SHORT_MACROS to 0 will disable this behavior, leaving -// only the longer macros "namespaced" with the UNITTEST_ prefix. - +// By default, UnitTest++ will attempt to define "short" macro names like CHECK and CHECK_EQUAL +// for "public" interface macros etc. Setting UNITTEST_ENABLE_SHORT_MACROS to 0 will disable +// this behavior, leaving only the longer macros "namespaced" with the UNITTEST_ prefix. +// "Internal" utility macros will only have the UNITTEST_IMPL_ prefix. #define UNITTEST_ENABLE_SHORT_MACROS 1 #endif diff --git a/UnitTest++/ExceptionMacros.h b/UnitTest++/ExceptionMacros.h index c3b1e30..9b2bad4 100644 --- a/UnitTest++/ExceptionMacros.h +++ b/UnitTest++/ExceptionMacros.h @@ -4,17 +4,17 @@ #include "Config.h" #ifndef UNITTEST_NO_EXCEPTIONS - #define UT_TRY(x) try x - #define UT_THROW(x) throw x - #define UT_RETHROW(ExceptionType) catch(ExceptionType&) { throw; } - #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody - #define UT_CATCH_ALL(CatchBody) catch(...) CatchBody + #define UNITTEST_IMPL_TRY(x) try x + #define UNITTEST_IMPL_THROW(x) throw x + #define UNITTEST_IMPL_RETHROW(ExceptionType) catch(ExceptionType&) { throw; } + #define UNITTEST_IMPL_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody + #define UNITTEST_IMPL_CATCH_ALL(CatchBody) catch(...) CatchBody #else - #define UT_TRY(x) x - #define UT_THROW(x) - #define UT_RETHROW(ExceptionType) - #define UT_CATCH(ExceptionType, ExceptionName, CatchBody) - #define UT_CATCH_ALL(CatchBody) + #define UNITTEST_IMPL_TRY(x) x + #define UNITTEST_IMPL_THROW(x) + #define UNITTEST_IMPL_RETHROW(ExceptionType) + #define UNITTEST_IMPL_CATCH(ExceptionType, ExceptionName, CatchBody) + #define UNITTEST_IMPL_CATCH_ALL(CatchBody) #endif #endif diff --git a/UnitTest++/ExecuteTest.h b/UnitTest++/ExecuteTest.h index 8e516db..2759aad 100644 --- a/UnitTest++/ExecuteTest.h +++ b/UnitTest++/ExecuteTest.h @@ -31,23 +31,23 @@ namespace UnitTest { { #endif #ifndef UNITTEST_POSIX - UT_TRY({ testObject.RunImpl(); }) + UNITTEST_IMPL_TRY({ testObject.RunImpl(); }) #else - UT_TRY + UNITTEST_IMPL_TRY ({ UNITTEST_THROW_SIGNALS_POSIX_ONLY testObject.RunImpl(); }) #endif - UT_CATCH(RequiredCheckException, e, { (void)e; }) - UT_CATCH(AssertException, e, { (void)e; }) - UT_CATCH(std::exception, e, + UNITTEST_IMPL_CATCH(RequiredCheckException, e, { (void)e; }) + UNITTEST_IMPL_CATCH(AssertException, e, { (void)e; }) + UNITTEST_IMPL_CATCH(std::exception, e, { MemoryOutStream stream; stream << "Unhandled exception: " << e.what(); CurrentTest::Results()->OnTestFailure(details, stream.GetText()); }) - UT_CATCH_ALL + UNITTEST_IMPL_CATCH_ALL ({ CurrentTest::Results()->OnTestFailure(details, "Unhandled exception: test crashed"); }) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index 738c56b..efe455e 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -79,23 +79,23 @@ void Test ## Fixture ## Name::RunImpl() const \ { \ volatile bool ctorOk = false; \ - UT_TRY \ + UNITTEST_IMPL_TRY \ ({ \ Fixture ## Name ## Helper fixtureHelper(m_details); \ ctorOk = true; \ UnitTest::ExecuteTest(fixtureHelper, m_details, false); \ }) \ - UT_CATCH (UnitTest::AssertException, e, \ + UNITTEST_IMPL_CATCH (UnitTest::AssertException, e, \ { \ (void)e; \ }) \ - UT_CATCH (std::exception, e, \ + UNITTEST_IMPL_CATCH (std::exception, e, \ { \ UnitTest::MemoryOutStream stream; \ stream << "Unhandled exception: " << e.what(); \ UnitTest::CurrentTest::Results()->OnTestFailure(m_details, stream.GetText()); \ }) \ - UT_CATCH_ALL \ + UNITTEST_IMPL_CATCH_ALL \ ({ \ if (ctorOk) \ { \ From df386f189f3b5c60ffa15a195194edbb011857da Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 7 May 2016 00:12:09 -0500 Subject: [PATCH 142/184] Add UNITTEST_ prefixes to remaining macros TEST, SUITE, and REQUIRE macros now have UNITTEST_ and UNITTEST_IMPL_ prefixes like the others, completing the set. --- UnitTest++/RequireMacros.h | 12 +++++++---- UnitTest++/TestMacros.h | 41 ++++++++++++++++++++++---------------- tests/TestTestMacros.cpp | 14 ++++++------- 3 files changed, 39 insertions(+), 28 deletions(-) diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index 0830e99..f25899b 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -3,10 +3,14 @@ #include "RequiredCheckTestReporter.h" -#ifdef REQUIRE - #error UnitTest++ redefines REQUIRE -#endif +#define UNITTEST_REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(*UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) -#define REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(*UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) +#if UNITTEST_ENABLE_SHORT_MACROS + #ifdef REQUIRE + #error REQUIRE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_REQUIRE instead + #else + #define REQUIRE UNITTEST_REQUIRE + #endif +#endif #endif diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index efe455e..03cf3bb 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -15,19 +15,7 @@ #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) \ +#define UNITTEST_SUITE(Name) \ namespace Suite ## Name { \ namespace UnitTestSuite { \ inline char const* GetSuiteName () { \ @@ -37,7 +25,7 @@ } \ namespace Suite ## Name -#define TEST_EX(Name, List) \ +#define UNITTEST_IMPL_TEST(Name, List) \ class Test ## Name : public UnitTest::Test \ { \ public: \ @@ -51,10 +39,10 @@ void Test ## Name::RunImpl() const -#define TEST(Name) TEST_EX(Name, UnitTest::Test::GetTestList()) +#define UNITTEST_TEST(Name) UNITTEST_IMPL_TEST(Name, UnitTest::Test::GetTestList()) -#define TEST_FIXTURE_EX(Fixture, Name, List) \ +#define UNITTEST_IMPL_TEST_FIXTURE(Fixture, Name, List) \ class Fixture ## Name ## Helper : public Fixture \ { \ public: \ @@ -111,7 +99,26 @@ } \ void Fixture ## Name ## Helper::RunImpl() -#define TEST_FIXTURE(Fixture,Name) TEST_FIXTURE_EX(Fixture, Name, UnitTest::Test::GetTestList()) +#define UNITTEST_TEST_FIXTURE(Fixture,Name) UNITTEST_IMPL_TEST_FIXTURE(Fixture, Name, UnitTest::Test::GetTestList()) + +#if UNITTEST_ENABLE_SHORT_MACROS + #ifdef SUITE + #error SUITE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_SUITE instead + #else + #define SUITE UNITTEST_SUITE + #endif + #ifdef TEST + #error TEST already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_TEST instead + #else + #define TEST UNITTEST_TEST + #endif + + #ifdef TEST_FIXTURE + #error TEST_FIXTURE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_TEST_FIXTURE instead + #else + #define TEST_FIXTURE UNITTEST_TEST_FIXTURE + #endif +#endif #endif diff --git a/tests/TestTestMacros.cpp b/tests/TestTestMacros.cpp index 4a13316..e66bfb6 100644 --- a/tests/TestTestMacros.cpp +++ b/tests/TestTestMacros.cpp @@ -46,7 +46,7 @@ using namespace std; namespace { TestList list1; - TEST_EX(DummyTest, list1) + UNITTEST_IMPL_TEST(DummyTest, list1) {} TEST (TestsAreAddedToTheListThroughMacro) @@ -69,7 +69,7 @@ namespace { }; TestList list2; - TEST_FIXTURE_EX(ThrowingThingie, DummyTestName, list2) + UNITTEST_IMPL_TEST_FIXTURE(ThrowingThingie, DummyTestName, list2) {} TEST (ExceptionsInFixtureAreReportedAsHappeningInTheFixture) @@ -113,7 +113,7 @@ namespace { } TestList macroTestList1; - TEST_EX(MacroTestHelper1, macroTestList1) + UNITTEST_IMPL_TEST(MacroTestHelper1, macroTestList1) {} TEST(TestAddedWithTEST_EXMacroGetsDefaultSuite) @@ -124,7 +124,7 @@ namespace { } TestList macroTestList2; - TEST_FIXTURE_EX(DummyFixture, MacroTestHelper2, macroTestList2) + UNITTEST_IMPL_TEST_FIXTURE(DummyFixture, MacroTestHelper2, macroTestList2) {} TEST(TestAddedWithTEST_FIXTURE_EXMacroGetsDefaultSuite) @@ -144,7 +144,7 @@ namespace { }; TestList throwingFixtureTestList1; - TEST_FIXTURE_EX(FixtureCtorThrows, FixtureCtorThrowsTestName, throwingFixtureTestList1) + UNITTEST_IMPL_TEST_FIXTURE(FixtureCtorThrows, FixtureCtorThrowsTestName, throwingFixtureTestList1) {} TEST(FixturesWithThrowingCtorsAreFailures) @@ -170,7 +170,7 @@ namespace { }; TestList throwingFixtureTestList2; - TEST_FIXTURE_EX(FixtureDtorThrows, FixtureDtorThrowsTestName, throwingFixtureTestList2) + UNITTEST_IMPL_TEST_FIXTURE(FixtureDtorThrows, FixtureDtorThrowsTestName, throwingFixtureTestList2) {} TEST(FixturesWithThrowingDtorsAreFailures) @@ -200,7 +200,7 @@ namespace { }; TestList ctorAssertFixtureTestList; - TEST_FIXTURE_EX(FixtureCtorAsserts, CorrectlyReportsAssertFailureInCtor, ctorAssertFixtureTestList) + UNITTEST_IMPL_TEST_FIXTURE(FixtureCtorAsserts, CorrectlyReportsAssertFailureInCtor, ctorAssertFixtureTestList) {} TEST(CorrectlyReportsFixturesWithCtorsThatAssert) From 910381fadc6674089c3eb9e9be5911464273b7bc Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 7 May 2016 01:02:20 -0500 Subject: [PATCH 143/184] Change UNITTEST_ENABLE_SHORT_MACROS to DISABLE Also add a test file. --- UnitTest++/CheckMacros.h | 4 ++-- UnitTest++/Config.h | 9 +++++--- UnitTest++/RequireMacros.h | 2 +- UnitTest++/TestMacros.h | 2 +- tests/TestLongMacros.cpp | 45 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 tests/TestLongMacros.cpp diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index bb45964..261afbb 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -138,7 +138,7 @@ }) \ UNITTEST_MULTILINE_MACRO_END -#if UNITTEST_ENABLE_SHORT_MACROS +#ifndef UNITTEST_DISABLE_SHORT_MACROS #ifdef CHECK #error CHECK already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK instead #else @@ -198,7 +198,7 @@ UNITTEST_MULTILINE_MACRO_END #endif -#if UNITTEST_ENABLE_SHORT_MACROS +#ifndef UNITTEST_DISABLE_SHORT_MACROS #ifdef CHECK_THROW #error CHECK_THROW already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_THROW instead #else diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index 364fe8d..a653e45 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -72,9 +72,12 @@ #endif // By default, UnitTest++ will attempt to define "short" macro names like CHECK and CHECK_EQUAL -// for "public" interface macros etc. Setting UNITTEST_ENABLE_SHORT_MACROS to 0 will disable -// this behavior, leaving only the longer macros "namespaced" with the UNITTEST_ prefix. +// for "public" interface macros etc. Defining UNITTEST_DISABLE_SHORT_MACROS in your project +// will disable this behavior, leaving only the longer macros "namespaced" with the UNITTEST_ +// prefix. +// // "Internal" utility macros will only have the UNITTEST_IMPL_ prefix. -#define UNITTEST_ENABLE_SHORT_MACROS 1 + +// #define UNITTEST_DISABLE_SHORT_MACROS #endif diff --git a/UnitTest++/RequireMacros.h b/UnitTest++/RequireMacros.h index f25899b..7fe793b 100644 --- a/UnitTest++/RequireMacros.h +++ b/UnitTest++/RequireMacros.h @@ -5,7 +5,7 @@ #define UNITTEST_REQUIRE for(UnitTest::RequiredCheckTestReporter decoratedReporter(*UnitTest::CurrentTest::Results()); decoratedReporter.Next(); ) -#if UNITTEST_ENABLE_SHORT_MACROS +#ifndef UNITTEST_DISABLE_SHORT_MACROS #ifdef REQUIRE #error REQUIRE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_REQUIRE instead #else diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index 03cf3bb..d6bc204 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -101,7 +101,7 @@ #define UNITTEST_TEST_FIXTURE(Fixture,Name) UNITTEST_IMPL_TEST_FIXTURE(Fixture, Name, UnitTest::Test::GetTestList()) -#if UNITTEST_ENABLE_SHORT_MACROS +#ifndef UNITTEST_DISABLE_SHORT_MACROS #ifdef SUITE #error SUITE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_SUITE instead #else diff --git a/tests/TestLongMacros.cpp b/tests/TestLongMacros.cpp new file mode 100644 index 0000000..6720a97 --- /dev/null +++ b/tests/TestLongMacros.cpp @@ -0,0 +1,45 @@ +#define UNITTEST_DISABLE_SHORT_MACROS + +#include "UnitTest++/UnitTestPP.h" + +// This file is not intended to test every little thing, just a few basics to hopefully ensure +// the macros are working and the short macros are not defined. +UNITTEST_SUITE(LongMacros) +{ + UNITTEST_TEST(LongCheckMacroWorks) + { + UNITTEST_CHECK(true); + } + + class Fixture + { + public: + Fixture() : sanity_(true) {} + protected: + bool sanity_; + }; + + UNITTEST_TEST_FIXTURE(Fixture, LongFixtureMacroWorks) + { + UNITTEST_REQUIRE UNITTEST_CHECK(sanity_); + } + + UNITTEST_TEST(ShortMacrosAreNotDefined) + { +#if defined(CHECK) || \ + defined(CHECK_EQUAL) || \ + defined(CHECK_CLOSE) || \ + defined(CHECK_ARRAY_EQUAL) || \ + defined(CHECK_ARRAY_CLOSE) || \ + defined(CHECK_ARRAY2D_CLOSE) || \ + defined(CHECK_THROW) || \ + defined(CHECK_ASSERT) || \ + defined(SUITE) || \ + defined(TEST) || \ + defined(TEST_FIXTURE) || \ + defined(REQUIRE) + + UNITTEST_CHECK(false); +#endif + } +} From 27317ec0773157ba1d479d0f78fc402ada323336 Mon Sep 17 00:00:00 2001 From: JonChesterfield Date: Mon, 16 May 2016 11:13:51 +0100 Subject: [PATCH 144/184] Prefix local variable message in CHECK macros with UnitTest_ to reduce the risk of name collisions with application code --- UnitTest++/CheckMacros.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/UnitTest++/CheckMacros.h b/UnitTest++/CheckMacros.h index e9dae64..3bfbaf8 100644 --- a/UnitTest++/CheckMacros.h +++ b/UnitTest++/CheckMacros.h @@ -45,10 +45,10 @@ UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ + UnitTest::MemoryOutStream UnitTest_message; \ + UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK(" #value ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ + UnitTest_message.GetText()); \ }) \ UT_CATCH_ALL \ ({ \ @@ -66,10 +66,10 @@ UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \ + UnitTest::MemoryOutStream UnitTest_message; \ + UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_EQUAL(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ + UnitTest_message.GetText()); \ }) \ UT_CATCH_ALL \ ({ \ @@ -87,10 +87,10 @@ UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::MemoryOutStream UnitTest_message; \ + UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_CLOSE(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ + UnitTest_message.GetText()); \ }) \ UT_CATCH_ALL \ ({ \ @@ -108,10 +108,10 @@ UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \ + UnitTest::MemoryOutStream UnitTest_message; \ + UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_EQUAL(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ + UnitTest_message.GetText()); \ }) \ UT_CATCH_ALL \ ({ \ @@ -129,10 +129,10 @@ UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::MemoryOutStream UnitTest_message; \ + UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY_CLOSE(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ + UnitTest_message.GetText()); \ }) \ UT_CATCH_ALL \ ({ \ @@ -150,10 +150,10 @@ UT_RETHROW (UnitTest::RequiredCheckException) \ UT_CATCH (std::exception, e, \ { \ - UnitTest::MemoryOutStream message; \ - message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \ + UnitTest::MemoryOutStream UnitTest_message; \ + UnitTest_message << "Unhandled exception (" << e.what() << ") in CHECK_ARRAY2D_CLOSE(" #expected ", " #actual ")"; \ UnitTest::CurrentTest::Results()->OnTestFailure(UnitTest::TestDetails(*UnitTest::CurrentTest::Details(), __LINE__), \ - message.GetText()); \ + UnitTest_message.GetText()); \ }) \ UT_CATCH_ALL \ ({ \ From 053bcfc9c7760fbaecaa9c882a6f0bcf11c318fd Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 2 Jun 2016 19:49:48 +0200 Subject: [PATCH 145/184] Add support for Haiku. --- UnitTest++/Config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index ff62b4e..4bd31fe 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -21,7 +21,8 @@ #endif #if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \ - defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) + defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) \ + || defined (__HAIKU__) #define UNITTEST_POSIX #endif From 21589e561214664249d2872c13642ced555cd23a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 15 Jul 2016 23:23:45 -0500 Subject: [PATCH 146/184] Take UnitTest::Check parameter by const reference Fixes #119 and #7 --- UnitTest++/Checks.h | 2 +- tests/TestChecks.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/UnitTest++/Checks.h b/UnitTest++/Checks.h index 5b09768..70bd51b 100644 --- a/UnitTest++/Checks.h +++ b/UnitTest++/Checks.h @@ -9,7 +9,7 @@ namespace UnitTest { template< typename Value > - bool Check(Value const value) + bool Check(Value const& value) { return !!value; // doing double negative to avoid silly VS warnings } diff --git a/tests/TestChecks.cpp b/tests/TestChecks.cpp index 1ec64ee..233b8a8 100644 --- a/tests/TestChecks.cpp +++ b/tests/TestChecks.cpp @@ -315,4 +315,32 @@ namespace { CHECK_EQUAL(1234, reporter.lastFailedLine); } + TEST(CheckProperlyDealsWithOperatorBoolOverrides) + { + class TruthyUnlessCopied + { + public: + TruthyUnlessCopied() + : truthy_(true) + { + } + + TruthyUnlessCopied(const TruthyUnlessCopied& orig) + : truthy_(false) + { + } + + operator bool() const + { + return truthy_; + } + + private: + bool truthy_; + }; + + TruthyUnlessCopied objectThatShouldBeTruthy; + CHECK(objectThatShouldBeTruthy); + } + } From bec6ba56ec0988815034656cfb8a7957e728d6d6 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 15 Jul 2016 23:54:59 -0500 Subject: [PATCH 147/184] Attempted fix for Travis build. --- tests/TestChecks.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/TestChecks.cpp b/tests/TestChecks.cpp index 233b8a8..645c3d9 100644 --- a/tests/TestChecks.cpp +++ b/tests/TestChecks.cpp @@ -315,30 +315,30 @@ namespace { CHECK_EQUAL(1234, reporter.lastFailedLine); } - TEST(CheckProperlyDealsWithOperatorBoolOverrides) + class TruthyUnlessCopied { - class TruthyUnlessCopied + public: + TruthyUnlessCopied() + : truthy_(true) + { + } + + TruthyUnlessCopied(const TruthyUnlessCopied& orig) + : truthy_(false) + { + } + + operator bool() const { - public: - TruthyUnlessCopied() - : truthy_(true) - { - } - - TruthyUnlessCopied(const TruthyUnlessCopied& orig) - : truthy_(false) - { - } - - operator bool() const - { - return truthy_; - } - - private: - bool truthy_; - }; + return truthy_; + } + + private: + bool truthy_; + }; + TEST(CheckProperlyDealsWithOperatorBoolOverrides) + { TruthyUnlessCopied objectThatShouldBeTruthy; CHECK(objectThatShouldBeTruthy); } From de915185f6f40a3c25bef51eecddab22c40d045d Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 15 Jul 2016 23:58:48 -0500 Subject: [PATCH 148/184] Remove unused variable from test copy constructor --- tests/TestChecks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestChecks.cpp b/tests/TestChecks.cpp index 645c3d9..2c0ac04 100644 --- a/tests/TestChecks.cpp +++ b/tests/TestChecks.cpp @@ -323,7 +323,7 @@ namespace { { } - TruthyUnlessCopied(const TruthyUnlessCopied& orig) + TruthyUnlessCopied(const TruthyUnlessCopied&) : truthy_(false) { } From fa971526199acfa5a36ae7e85fcd668a1685d582 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 7 May 2016 02:19:02 -0500 Subject: [PATCH 149/184] Add UTPP_SKIP_TESTS_AS_BUILD_STEP CMake option Helps address #104. --- CMakeLists.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5aa7e..03f3063 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 2.8.1) project(UnitTest++) -option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" ON) +option(UTPP_USE_PLUS_SIGN + "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" + ON) +option(UTPP_SKIP_TESTS_AS_BUILD_STEP + "Set this to ON if you do not wish unit tests to run as part of cmake --build" + OFF) if(MSVC14 OR MSVC12) # has the support we need @@ -55,10 +60,15 @@ endif() target_link_libraries(TestUnitTest++ UnitTest++) -# run unit tests as post build step -add_custom_command(TARGET TestUnitTest++ - POST_BUILD COMMAND TestUnitTest++ - COMMENT "Running unit tests") +if(${UTPP_SKIP_TESTS_AS_BUILD_STEP}) + add_custom_command(TARGET TestUnitTest++ + POST_BUILD COMMAND echo "TestUnitTest++ was not run as a build step because UTPP_SKIP_TESTS_AS_BUILD_STEP is ON") +else() + # run unit tests as post build step + add_custom_command(TARGET TestUnitTest++ + POST_BUILD COMMAND TestUnitTest++ + COMMENT "Running unit tests") +endif() # add install targets # need a custom install path? From 14f317c40c98835d10b0b6072e667dc1911c3b93 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 7 May 2016 02:29:16 -0500 Subject: [PATCH 150/184] Eliminate double-negative in option name / value UTPP_SKIP_TESTS_AS_BUILD_STEP with a default value of OFF was an unfortunate choice, so this changes it to UTPP_RUN_TESTS_AS_BUILD_STEP with a default value of ON. --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03f3063..447f4ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,9 +4,9 @@ project(UnitTest++) option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" ON) -option(UTPP_SKIP_TESTS_AS_BUILD_STEP - "Set this to ON if you do not wish unit tests to run as part of cmake --build" - OFF) +option(UTPP_RUN_TESTS_AS_BUILD_STEP + "Set this to OFF if you do not wish unit tests to run as part of cmake --build" + ON) if(MSVC14 OR MSVC12) # has the support we need @@ -60,14 +60,14 @@ endif() target_link_libraries(TestUnitTest++ UnitTest++) -if(${UTPP_SKIP_TESTS_AS_BUILD_STEP}) +if(${UTPP_RUN_TESTS_AS_BUILD_STEP}) + # run unit tests as post build step add_custom_command(TARGET TestUnitTest++ - POST_BUILD COMMAND echo "TestUnitTest++ was not run as a build step because UTPP_SKIP_TESTS_AS_BUILD_STEP is ON") + POST_BUILD COMMAND TestUnitTest++ + COMMENT "Running unit tests") else() - # run unit tests as post build step add_custom_command(TARGET TestUnitTest++ - POST_BUILD COMMAND TestUnitTest++ - COMMENT "Running unit tests") + POST_BUILD COMMAND echo "TestUnitTest++ was not run as a build step because UTPP_RUN_TESTS_AS_BUILD_STEP is OFF") endif() # add install targets From 6b69ed78bae727246a6f2e1308feabaf28ded093 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Mon, 18 Jul 2016 21:13:03 -0500 Subject: [PATCH 151/184] Skip test build with same option as run As part of this, changed the option name to `UTPP_INCLUDE_TESTS_IN_BUILD`. The test target is still added to the build and can be built/run separately using the CMake --target option. --- CMakeLists.txt | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 447f4ce..e99ee13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,8 +4,8 @@ project(UnitTest++) option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" ON) -option(UTPP_RUN_TESTS_AS_BUILD_STEP - "Set this to OFF if you do not wish unit tests to run as part of cmake --build" +option(UTPP_INCLUDE_TESTS_IN_BUILD + "Set this to OFF if you do not wish to automatically build or run unit tests as part of the default cmake --build" ON) if(MSVC14 OR MSVC12) @@ -60,14 +60,13 @@ endif() target_link_libraries(TestUnitTest++ UnitTest++) -if(${UTPP_RUN_TESTS_AS_BUILD_STEP}) - # run unit tests as post build step - add_custom_command(TARGET TestUnitTest++ - POST_BUILD COMMAND TestUnitTest++ - COMMENT "Running unit tests") -else() - add_custom_command(TARGET TestUnitTest++ - POST_BUILD COMMAND echo "TestUnitTest++ was not run as a build step because UTPP_RUN_TESTS_AS_BUILD_STEP is OFF") +# run unit tests as post build step +add_custom_command(TARGET TestUnitTest++ + POST_BUILD COMMAND TestUnitTest++ + COMMENT "Running unit tests") + +if(NOT ${UTPP_INCLUDE_TESTS_IN_BUILD}) + set_target_properties(TestUnitTest++ PROPERTIES EXCLUDE_FROM_ALL 1) endif() # add install targets From 7c159427516124ba8c01262b15f492b6b6789dce Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 27 Aug 2016 08:26:05 -0500 Subject: [PATCH 152/184] Up warning level to /W4 /WX for MSVC-like compilers Also adds a CMake option, UTPP_AMPLIFY_WARNINGS, that can be turned OFF to disable the new behavior. --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e99ee13..89e61f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ option(UTPP_USE_PLUS_SIGN option(UTPP_INCLUDE_TESTS_IN_BUILD "Set this to OFF if you do not wish to automatically build or run unit tests as part of the default cmake --build" ON) +option(UTPP_AMPLIFY_WARNINGS + "Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler" + ON) if(MSVC14 OR MSVC12) # has the support we need @@ -23,6 +26,15 @@ else() endif() endif() +# up warning level for project +if (${UTPP_AMPLIFY_WARNINGS}) + # instead of getting compiler specific, we're going to try making an assumption that an existing /W# means + # we are dealing with an MSVC or MSVC-like compiler (e.g. Intel on Windows) + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + endif() +endif() + # get the main sources file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.h) file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.cpp) From 7e4fff3bb420820b67562ccd1d706e17d795cf8d Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 27 Aug 2016 08:27:15 -0500 Subject: [PATCH 153/184] Fix "assignment operator could not be generated" warning This shows up with /W4 on MSVC. Fixes #107. --- UnitTest++/RequiredCheckTestReporter.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UnitTest++/RequiredCheckTestReporter.h b/UnitTest++/RequiredCheckTestReporter.h index 117ae01..99d9cdd 100644 --- a/UnitTest++/RequiredCheckTestReporter.h +++ b/UnitTest++/RequiredCheckTestReporter.h @@ -19,6 +19,9 @@ namespace UnitTest { bool Next(); private: + RequiredCheckTestReporter(RequiredCheckTestReporter const&); + RequiredCheckTestReporter& operator =(RequiredCheckTestReporter const&); + TestResults& m_results; TestReporter* m_originalTestReporter; ThrowingTestReporter m_throwingReporter; From f0044e919dcae4a171d2db45f2aea92850df2b0c Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 27 Aug 2016 09:54:32 -0500 Subject: [PATCH 154/184] Up warning level to -Wall/extra/error for non-MSVC UTPP_AMPLIFY_WARNINGS can be turned OFF to disable the new behavior. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 89e61f5..76c8665 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ if (${UTPP_AMPLIFY_WARNINGS}) # we are dealing with an MSVC or MSVC-like compiler (e.g. Intel on Windows) if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + else() + string(CONCAT CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" " -Wall -Wextra -Werror -Wno-ignored-qualifiers") endif() endif() From 2e2475fa5401c4ef123b3ca26f7a8e60ee5eb425 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 27 Aug 2016 09:55:37 -0500 Subject: [PATCH 155/184] Fix unused variable warnings --- UnitTest++/Posix/SignalTranslator.cpp | 4 ++-- UnitTest++/Posix/SignalTranslator.h | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/UnitTest++/Posix/SignalTranslator.cpp b/UnitTest++/Posix/SignalTranslator.cpp index 4039896..69cc194 100644 --- a/UnitTest++/Posix/SignalTranslator.cpp +++ b/UnitTest++/Posix/SignalTranslator.cpp @@ -28,12 +28,12 @@ namespace UnitTest { 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 ); + sigaction( SIGILL, &action, &m_old_SIGILL_action ); } SignalTranslator::~SignalTranslator() { - sigaction( SIGILL, &m_old_SIGBUS_action, 0 ); + sigaction( SIGILL, &m_old_SIGILL_action, 0 ); sigaction( SIGBUS, &m_old_SIGBUS_action, 0 ); sigaction( SIGTRAP, &m_old_SIGTRAP_action, 0 ); sigaction( SIGFPE, &m_old_SIGFPE_action, 0 ); diff --git a/UnitTest++/Posix/SignalTranslator.h b/UnitTest++/Posix/SignalTranslator.h index efb3618..66d388d 100644 --- a/UnitTest++/Posix/SignalTranslator.h +++ b/UnitTest++/Posix/SignalTranslator.h @@ -22,8 +22,7 @@ namespace UnitTest { 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; + struct sigaction m_old_SIGILL_action; }; #if !defined (__GNUC__) From e161d44077646e63e8956ce0c70002cecda3d2be Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 27 Aug 2016 10:04:54 -0500 Subject: [PATCH 156/184] Use CMake SET instead of string CONCAT string(CONCAT...) was not available in older versions of CMake targeted by this project. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76c8665..32023b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ if (${UTPP_AMPLIFY_WARNINGS}) if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") else() - string(CONCAT CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" " -Wall -Wextra -Werror -Wno-ignored-qualifiers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-ignored-qualifiers") endif() endif() From 7d7ba0aba44d5a9d76442e5e8286686e01eaf222 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Sat, 27 Aug 2016 20:41:41 -0500 Subject: [PATCH 157/184] Re-enable ignored-qualifiers warning and fix --- CMakeLists.txt | 2 +- tests/TestMemoryOutStream.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32023b9..a7411bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ if (${UTPP_AMPLIFY_WARNINGS}) if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-ignored-qualifiers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") endif() endif() diff --git a/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp index 7c1ffbc..854277e 100644 --- a/tests/TestMemoryOutStream.cpp +++ b/tests/TestMemoryOutStream.cpp @@ -11,7 +11,7 @@ using namespace std; namespace { - const char* const maxSignedIntegralStr(size_t nBytes) + const char* maxSignedIntegralStr(size_t nBytes) { switch(nBytes) { @@ -28,7 +28,7 @@ namespace { } } - const char* const minSignedIntegralStr(size_t nBytes) + const char* minSignedIntegralStr(size_t nBytes) { switch(nBytes) { @@ -45,7 +45,7 @@ namespace { } } - const char* const maxUnsignedIntegralStr(size_t nBytes) + const char* maxUnsignedIntegralStr(size_t nBytes) { switch(nBytes) { From eca039304b7e93ee40e3d733a0c051af7e7943e2 Mon Sep 17 00:00:00 2001 From: Gabriel Schlozer Date: Mon, 29 Aug 2016 22:36:31 +0200 Subject: [PATCH 158/184] Used size_t for CHECK macros --- UnitTest++/Checks.h | 30 +++++++++++++++--------------- tests/TestExceptions.cpp | 8 ++++---- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/UnitTest++/Checks.h b/UnitTest++/Checks.h index 70bd51b..7c37691 100644 --- a/UnitTest++/Checks.h +++ b/UnitTest++/Checks.h @@ -57,10 +57,10 @@ namespace UnitTest { template< typename Expected, typename Actual > void CheckArrayEqual(TestResults& results, Expected const& expected, Actual const& actual, - int const count, TestDetails const& details) + size_t const count, TestDetails const& details) { bool equal = true; - for (int i = 0; i < count; ++i) + for (size_t i = 0; i < count; ++i) equal &= (expected[i] == actual[i]); if (!equal) @@ -69,12 +69,12 @@ namespace UnitTest { stream << "Expected [ "; - for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex) + for (size_t expectedIndex = 0; expectedIndex < count; ++expectedIndex) stream << expected[expectedIndex] << " "; stream << "] but was [ "; - for (int actualIndex = 0; actualIndex < count; ++actualIndex) + for (size_t actualIndex = 0; actualIndex < count; ++actualIndex) stream << actual[actualIndex] << " "; stream << "]"; @@ -84,17 +84,17 @@ namespace UnitTest { } template< typename Expected, typename Actual, typename Tolerance > - bool ArrayAreClose(Expected const& expected, Actual const& actual, int const count, Tolerance const& tolerance) + bool ArrayAreClose(Expected const& expected, Actual const& actual, size_t const count, Tolerance const& tolerance) { bool equal = true; - for (int i = 0; i < count; ++i) + for (size_t 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) + size_t const count, Tolerance const& tolerance, TestDetails const& details) { bool equal = ArrayAreClose(expected, actual, count, tolerance); @@ -103,11 +103,11 @@ namespace UnitTest { UnitTest::MemoryOutStream stream; stream << "Expected [ "; - for (int expectedIndex = 0; expectedIndex < count; ++expectedIndex) + for (size_t expectedIndex = 0; expectedIndex < count; ++expectedIndex) stream << expected[expectedIndex] << " "; stream << "] +/- " << tolerance << " but was [ "; - for (int actualIndex = 0; actualIndex < count; ++actualIndex) + for (size_t actualIndex = 0; actualIndex < count; ++actualIndex) stream << actual[actualIndex] << " "; stream << "]"; @@ -117,10 +117,10 @@ namespace UnitTest { 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) + size_t const rows, size_t const columns, Tolerance const& tolerance, TestDetails const& details) { bool equal = true; - for (int i = 0; i < rows; ++i) + for (size_t i = 0; i < rows; ++i) equal &= ArrayAreClose(expected[i], actual[i], columns, tolerance); if (!equal) @@ -129,20 +129,20 @@ namespace UnitTest { stream << "Expected [ "; - for (int expectedRow = 0; expectedRow < rows; ++expectedRow) + for (size_t expectedRow = 0; expectedRow < rows; ++expectedRow) { stream << "[ "; - for (int expectedColumn = 0; expectedColumn < columns; ++expectedColumn) + for (size_t expectedColumn = 0; expectedColumn < columns; ++expectedColumn) stream << expected[expectedRow][expectedColumn] << " "; stream << "] "; } stream << "] +/- " << tolerance << " but was [ "; - for (int actualRow = 0; actualRow < rows; ++actualRow) + for (size_t actualRow = 0; actualRow < rows; ++actualRow) { stream << "[ "; - for (int actualColumn = 0; actualColumn < columns; ++actualColumn) + for (size_t actualColumn = 0; actualColumn < columns; ++actualColumn) stream << actual[actualRow][actualColumn] << " "; stream << "] "; } diff --git a/tests/TestExceptions.cpp b/tests/TestExceptions.cpp index 972e64d..08f6547 100644 --- a/tests/TestExceptions.cpp +++ b/tests/TestExceptions.cpp @@ -253,7 +253,7 @@ namespace { class ThrowingObject { public: - float operator[](int) const + float operator[](size_t) const { throw "Test throw"; } @@ -262,7 +262,7 @@ namespace { class StdThrowingObject { public: - float operator[](int) const + float operator[](size_t) const { throw std::runtime_error("Test throw"); } @@ -451,7 +451,7 @@ namespace { class ThrowingObject2D { public: - float* operator[](int) const + float* operator[](size_t) const { throw "Test throw"; } @@ -460,7 +460,7 @@ namespace { class StdThrowingObject2D { public: - float* operator[](int) const + float* operator[](size_t) const { throw std::runtime_error("Test throw"); } From 0d77b1ae10622d39450d905b8aec23267a1085c3 Mon Sep 17 00:00:00 2001 From: Julien Monat Rodier Date: Tue, 11 Oct 2016 13:00:40 -0700 Subject: [PATCH 159/184] Update docs reference to avoid bad path names on windows --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index 14495a3..a6963b7 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 14495a3a81568e9ce187231b629e4eb7bc7e0350 +Subproject commit a6963b798400df760e148a6e15e9c13db965a3ec From 40f90dc601eb2107c3e4786a3ebe16e7fd273075 Mon Sep 17 00:00:00 2001 From: Evan Danaher Date: Thu, 1 Dec 2016 12:22:54 -0500 Subject: [PATCH 160/184] Build pkgconfig file with CMake, not just with autoconf. --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7411bc..fb10f47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,3 +100,11 @@ install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) install(FILES cmake/UnitTest++Config.cmake DESTINATION "${config_install_dir_}") install(EXPORT "${targets_export_name_}" DESTINATION "${config_install_dir_}") + +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(includedir ${CMAKE_INSTALL_PREFIX}/include/UnitTest++) +configure_file("UnitTest++.pc.in" "UnitTest++.pc" @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/UnitTest++.pc" + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") From 9eba823269fffa8f1a5c780c937c202672b636fe Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Wed, 14 Dec 2016 23:11:20 -0800 Subject: [PATCH 161/184] Demonstrate that compiler is identified as MSVC when VS2014 Clang extension is used --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7411bc..2d6c28c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,19 @@ option(UTPP_AMPLIFY_WARNINGS "Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler" ON) +message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") if(MSVC14 OR MSVC12) + message(STATUS "Using MSVC compiler") # has the support we need else() include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) if(COMPILER_SUPPORTS_CXX14) + message(STATUS "Specify C++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") elseif(COMPILER_SUPPORTS_CXX11) + message(STATUS "Specify C++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") From 8f7a2634462011b9b366704e480d25fe7fc2f626 Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Thu, 15 Dec 2016 00:31:56 -0800 Subject: [PATCH 162/184] Increase CMake version to resolve developer warnings regarding implicit quoted dereference in STREQUAL comparison --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d6c28c..4f8c8db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.1) +cmake_minimum_required(VERSION 3.1.0) project(UnitTest++) option(UTPP_USE_PLUS_SIGN From c4ab9d31ed98da89bf1f07738129139eb0034dd8 Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Thu, 15 Dec 2016 00:40:03 -0800 Subject: [PATCH 163/184] Identify Clang compiler when used as an MSVC extension --- CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f8c8db..000fd6b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,22 +11,24 @@ option(UTPP_AMPLIFY_WARNINGS "Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler" ON) -message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") -if(MSVC14 OR MSVC12) - message(STATUS "Using MSVC compiler") - # has the support we need +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + # CHECK_CXX_COMPILER_FLAG could be used + # but MSVC version is preferred for feature requirements + if (MSVC14 OR MSVC12) + # has the support we need + else() + message(WARNING "The MSVC compiler version does not support required C++11 features. Please use a different C++ compiler.") + endif() else() include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) if(COMPILER_SUPPORTS_CXX14) - message(STATUS "Specify C++14") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") elseif(COMPILER_SUPPORTS_CXX11) - message(STATUS "Specify C++11") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() - message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + message(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() endif() From bb495391070e2a87503f9d3dba723b62a90a5032 Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Thu, 15 Dec 2016 02:46:13 -0800 Subject: [PATCH 164/184] Revert "Increase CMake version to resolve developer warnings regarding implicit quoted dereference in STREQUAL comparison" This reverts commit 8f7a2634462011b9b366704e480d25fe7fc2f626. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 000fd6b..f075074 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 2.8.1) project(UnitTest++) option(UTPP_USE_PLUS_SIGN From a2fe23887a793c42b35c7be54bd9e06023bc36b7 Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Thu, 15 Dec 2016 02:50:09 -0800 Subject: [PATCH 165/184] =?UTF-8?q?Use=20=E2=80=9CMATCHES=E2=80=9D=20inste?= =?UTF-8?q?ad=20of=20=E2=80=9CSTREQUAL=E2=80=9D=20to=20avoid=20ambiguous?= =?UTF-8?q?=20comparison.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NOTE: Unlike STREQUAL this comparison is supported pre and post CMake v3.1.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f075074..4c39baf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ option(UTPP_AMPLIFY_WARNINGS "Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler" ON) -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +if(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") # CHECK_CXX_COMPILER_FLAG could be used # but MSVC version is preferred for feature requirements if (MSVC14 OR MSVC12) From 8d70dff05bbf19bd72ab198e3d4d14a244891123 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 13 Jan 2017 14:35:21 -0600 Subject: [PATCH 166/184] Delete unused ChangeLog file Closes #138 --- ChangeLog | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 ChangeLog diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index e69de29..0000000 From 8e5968bb05b03e024c4d783e703e1f416762177d Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 13 Jan 2017 14:36:38 -0600 Subject: [PATCH 167/184] Roll version number to 2.0.0 --- README.md | 12 +++++++++--- appveyor.yml | 2 +- configure.ac | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8a49c3d..7c138a8 100644 --- a/README.md +++ b/README.md @@ -30,17 +30,17 @@ Via svn: svn checkout https://github.com/unittest-cpp/unittest-cpp/trunk unittest-cpp -### Latest release (v1.6.1) ### +### Latest release (v2.0.0) ### Via git: git clone https://github.com/unittest-cpp/unittest-cpp cd unittest-cpp - git checkout v1.6.1 + git checkout v2.0.0 Via svn: - svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v1.6.1 unittest-cpp + svn checkout https://github.com/unittest-cpp/unittest-cpp/tags/v2.0.0 unittest-cpp License --------- @@ -77,6 +77,12 @@ Contributors Historic release notes ---------------------- +### Version 2.0.0 (2017-01-13) ### +- Change Check method supporting CHECK macro to accept argument by reference +- Introduce long macro forms (e.g. UNITTEST_CHECK); make short forms optional +- Improved Visual Studio 2015 support +- [Full List](https://github.com/unittest-cpp/unittest-cpp/issues?q=milestone%3A2.0.0+) + ### Version 1.6.0 (2016-02-29) ### - Add REQUIRE macro to end tests early when selected checks fail - [Full List](https://github.com/unittest-cpp/unittest-cpp/issues?q=milestone%3A1.6.0+) diff --git a/appveyor.yml b/appveyor.yml index 71e4398..bebe4f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.6.1.{build} +version: 2.0.0.{build} os: - Windows Server 2012 R2 diff --git a/configure.ac b/configure.ac index 6b81131..56300a6 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AM_CONDITIONAL([WINDOWS], LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [1:6:0]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [2:0:0]) # Checks for programs. AC_PROG_CXX From 615b6cdd0fa614ab4276c2382889355dd698b556 Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Fri, 13 Jan 2017 14:51:19 -0600 Subject: [PATCH 168/184] Add note re: autotools to INSTALL file --- INSTALL | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/INSTALL b/INSTALL index 6e90e07..6c99c94 100644 --- a/INSTALL +++ b/INSTALL @@ -1,3 +1,9 @@ + +Preamble: If you are installing UnitTest++ from source, or from a +release prior to 1.6.1, you will need to have autotools installed and +run `autoreconf -i; autoconf` prior to following the standard +instructions below. + Installation Instructions ************************* From 85bade33f596a4dab33eb6d44f662d64fc20f510 Mon Sep 17 00:00:00 2001 From: Iblis Lin Date: Sat, 14 Jan 2017 23:00:24 +0800 Subject: [PATCH 169/184] cmake: fix pkgconfig dir path on FreeBSD --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb10f47..a0f5511 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,5 +106,10 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(includedir ${CMAKE_INSTALL_PREFIX}/include/UnitTest++) configure_file("UnitTest++.pc.in" "UnitTest++.pc" @ONLY) +if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig) +else() + set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) +endif() install(FILES "${CMAKE_CURRENT_BINARY_DIR}/UnitTest++.pc" - DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") + DESTINATION "${pkgconfdir}") From 0757ba8f903fc94ac852c8ba394cd96358b0e2c7 Mon Sep 17 00:00:00 2001 From: Christoph Willing Date: Mon, 23 Jan 2017 17:49:12 +1000 Subject: [PATCH 170/184] Add support for LIB_SUFFIX Signed-off-by: Christoph Willing --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0f5511..6b490ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ option(UTPP_AMPLIFY_WARNINGS "Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler" ON) +set(LIB_SUFFIX "" CACHE STRING "Identifier to add to end of lib directory name e.g. 64 for lib64") + if(MSVC14 OR MSVC12) # has the support we need else() @@ -92,10 +94,10 @@ else() set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") endif() -set(config_install_dir_ lib/cmake/${PROJECT_NAME}) +set(config_install_dir_ lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}) set(targets_export_name_ "${PROJECT_NAME}Targets") -install(TARGETS UnitTest++ EXPORT "${targets_export_name_}" DESTINATION lib) +install(TARGETS UnitTest++ EXPORT "${targets_export_name_}" DESTINATION lib${LIB_SUFFIX}) install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) install(FILES cmake/UnitTest++Config.cmake DESTINATION "${config_install_dir_}") @@ -103,13 +105,13 @@ install(EXPORT "${targets_export_name_}" DESTINATION "${config_install_dir_}") set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) -set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(libdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) set(includedir ${CMAKE_INSTALL_PREFIX}/include/UnitTest++) configure_file("UnitTest++.pc.in" "UnitTest++.pc" @ONLY) if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig) else() - set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) + set(pkgconfdir ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig) endif() install(FILES "${CMAKE_CURRENT_BINARY_DIR}/UnitTest++.pc" DESTINATION "${pkgconfdir}") From d7bd757862916cca0c4888070c9c929a8a9bd089 Mon Sep 17 00:00:00 2001 From: timdave13 Date: Thu, 2 Feb 2017 17:14:27 -0500 Subject: [PATCH 171/184] fix clang warning fix clang warning: 'X' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Wweak-vtables] --- UnitTest++/TestMacros.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index d6bc204..8ff87f8 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -49,10 +49,12 @@ explicit Fixture ## Name ## Helper(UnitTest::TestDetails const& details) : m_details(details) {} \ void RunImpl(); \ UnitTest::TestDetails const& m_details; \ + virtual ~Fixture ## Name ## Helper(); \ private: \ Fixture ## Name ## Helper(Fixture ## Name ## Helper const&); \ Fixture ## Name ## Helper& operator =(Fixture ## Name ## Helper const&); \ }; \ + Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){}; \ \ class Test ## Fixture ## Name : public UnitTest::Test \ { \ @@ -60,9 +62,9 @@ Test ## Fixture ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } test ## Fixture ## Name ## Instance; \ + } static test ## Fixture ## Name ## Instance; \ \ - UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ + static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ \ void Test ## Fixture ## Name::RunImpl() const \ { \ From 0a6857e3883175a5682bc2a7df9e7b53f73f53a9 Mon Sep 17 00:00:00 2001 From: Tim Bochenek Date: Thu, 2 Feb 2017 18:03:59 -0500 Subject: [PATCH 172/184] fix clang warning fix clang warning 'extra ';' outside function is c++11 extension --- UnitTest++/TestMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index 8ff87f8..dbe3430 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -54,7 +54,7 @@ Fixture ## Name ## Helper(Fixture ## Name ## Helper const&); \ Fixture ## Name ## Helper& operator =(Fixture ## Name ## Helper const&); \ }; \ - Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){}; \ + Fixture ## Name ## Helper::~Fixture ## Name ## Helper(){} \ \ class Test ## Fixture ## Name : public UnitTest::Test \ { \ From 0b15459ee4fbee824c6a699d4c64fba8e49b8339 Mon Sep 17 00:00:00 2001 From: Gabriel Hare Date: Thu, 2 Feb 2017 21:56:48 -0800 Subject: [PATCH 173/184] Downgrade message to STATUS and do not declare C++11 as a requirement. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c39baf..2ed7b67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") if (MSVC14 OR MSVC12) # has the support we need else() - message(WARNING "The MSVC compiler version does not support required C++11 features. Please use a different C++ compiler.") + message(STATUS "The MSVC compiler version does not support UnitTest++ C++11 features.") endif() else() include(CheckCXXCompilerFlag) @@ -28,7 +28,7 @@ else() elseif(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") else() - message(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support.") endif() endif() From 07d4872076b3b7d824149186a230f54ef5cd04df Mon Sep 17 00:00:00 2001 From: Tim Bochenek Date: Fri, 3 Feb 2017 08:19:17 -0500 Subject: [PATCH 174/184] fix clang warnings fix clang warning warning: no previous extern declaration for non-static variable 'X' [-Wmissing-variable-declarations] --- UnitTest++/TestMacros.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/UnitTest++/TestMacros.h b/UnitTest++/TestMacros.h index dbe3430..0c8e903 100644 --- a/UnitTest++/TestMacros.h +++ b/UnitTest++/TestMacros.h @@ -25,16 +25,16 @@ } \ namespace Suite ## Name -#define UNITTEST_IMPL_TEST(Name, List) \ +#define UNITTEST_IMPL_TEST(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; \ + } static test ## Name ## Instance; \ \ - UnitTest::ListAdder adder ## Name (List, &test ## Name ## Instance); \ + static UnitTest::ListAdder adder ## Name (List, &test ## Name ## Instance); \ \ void Test ## Name::RunImpl() const @@ -62,9 +62,9 @@ Test ## Fixture ## Name() : Test(#Name, UnitTestSuite::GetSuiteName(), __FILE__, __LINE__) {} \ private: \ virtual void RunImpl() const; \ - } static test ## Fixture ## Name ## Instance; \ + } static test ## Fixture ## Name ## Instance; \ \ - static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ + static UnitTest::ListAdder adder ## Fixture ## Name (List, &test ## Fixture ## Name ## Instance); \ \ void Test ## Fixture ## Name::RunImpl() const \ { \ From 33e63147539750304216b22b01c8968432c959b8 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Mon, 22 May 2017 00:22:38 +0900 Subject: [PATCH 175/184] Added autogen.sh file to ease autotools installation --- autogen.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..347366d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +test -e ./.autotools_aux || mkdir .autotools_aux + +libtoolize -cq +aclocal -I m4 --install # Generate aclocal +autoconf # Generate configure script +autoheader # Generate config.h +automake --add-missing --copy # Generate Makefile.in and other scripts From a6fdaeef1269e50c8777989d4338cc39a5a0f6a3 Mon Sep 17 00:00:00 2001 From: Martin Moene Date: Sat, 8 Jul 2017 11:09:38 +0200 Subject: [PATCH 176/184] Use if (MSVC) as per issue #160 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e60f81b..a683ea1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ option(UTPP_AMPLIFY_WARNINGS set(LIB_SUFFIX "" CACHE STRING "Identifier to add to end of lib directory name e.g. 64 for lib64") -if(${CMAKE_CXX_COMPILER_ID} MATCHES "MSVC") +if (MSVC) # CHECK_CXX_COMPILER_FLAG could be used # but MSVC version is preferred for feature requirements if (MSVC14 OR MSVC12) From a7d506d7ebbea35cc089b319443cd899d440132c Mon Sep 17 00:00:00 2001 From: Flow86 Date: Wed, 20 Mar 2019 13:19:15 +0100 Subject: [PATCH 177/184] add support to build unittest cpp on AIX (IBM) --- UnitTest++/Config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UnitTest++/Config.h b/UnitTest++/Config.h index 4bebf1a..14429ee 100644 --- a/UnitTest++/Config.h +++ b/UnitTest++/Config.h @@ -22,7 +22,7 @@ #if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \ defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) \ - || defined (__HAIKU__) + || defined (__HAIKU__) || defined(_AIX) #define UNITTEST_POSIX #endif From bdef2bdd62598afc31e17b24349b47d3813eed57 Mon Sep 17 00:00:00 2001 From: Dan Huantes Date: Wed, 14 Aug 2019 11:32:00 -0500 Subject: [PATCH 178/184] UnitTest++ now correctly supports CMake's find_package config mode [CMakeLists.txt] - Bumped cmake minimum requirement to go to 3.0 as this appears to be earliest version that transitive usage requirements are supported. - Added version to project so that is evident when looking at CMakeLists.txt - Removed include_directories as that command affects more than just UnitTest++ in favor of target_include_directories. - The target_include_directories uses the generator expressions to do the same thing for the BUILD_INTERFACE condition but only affects UnitTest++. The INSTALL_INTERFACE ensures that when UnitTest++ is installed client applications calling find_package for UnitTest++ only have to add the UnitTest++ target to the target_link_libraries and will get the correct include path for UnitTest++ added to their include paths. - Added DEBUG_POSTFIX to both library and unit test to distinguish them from each other as they are installed into the same directory and would otherwise overwrite one another. - Added Versioning using write_basic_package_version_file to the install so that a client can call find_package(UnitTest++ 2.1 REQUIRED) and it will be able to confirm the version. If the version is updated you could theoretically ahve a version 2.2, 2.3 ,etc... and the find_package mechanism will find the correct one. the SameMajorVersion option in that call indicates that 2.3 is compatible with 2.1 or in other words if find_package(UnitTest++ 2.1 REQUIRED) is called and 2.3 is installed that satisfies the condition but if only 3.0 was installed it will fail because of 'SameMajorVersion'. - Also added installation for the Version file. --- CMakeLists.txt | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a683ea1..03a4f62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8.1) -project(UnitTest++) +cmake_minimum_required(VERSION 3.0) +project(UnitTest++ VERSION 2.1) option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" @@ -74,7 +74,7 @@ endif() file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h) source_group( "" FILES ${TEST_SRCS}) add_executable(TestUnitTest++ ${TEST_SRCS}) -include_directories(.) + if(${UTPP_USE_PLUS_SIGN}) set_target_properties(TestUnitTest++ PROPERTIES OUTPUT_NAME TestUnitTest++) @@ -100,13 +100,30 @@ else() set (UTPP_INSTALL_DESTINATION "include/UnitTestPP") endif() +target_include_directories( UnitTest++ + PUBLIC + $ + $ + ) +set_target_properties(UnitTest++ PROPERTIES DEBUG_POSTFIX "-d") +set_target_properties(TestUnitTest++ PROPERTIES DEBUG_POSTFIX "-d") + set(config_install_dir_ lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}) set(targets_export_name_ "${PROJECT_NAME}Targets") +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + cmake/UnitTest++ConfigVersion.cmake + VERSION ${UnitTest++_VERSION} + COMPATIBILITY SameMajorVersion + ) install(TARGETS UnitTest++ EXPORT "${targets_export_name_}" DESTINATION lib${LIB_SUFFIX}) install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION}) install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_}) -install(FILES cmake/UnitTest++Config.cmake DESTINATION "${config_install_dir_}") +install(FILES + cmake/UnitTest++Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/cmake/UnitTest++ConfigVersion.cmake + DESTINATION "${config_install_dir_}") install(EXPORT "${targets_export_name_}" DESTINATION "${config_install_dir_}") set(prefix ${CMAKE_INSTALL_PREFIX}) From 2423fcac7668aa9c331a2dcf024c3ca06742942d Mon Sep 17 00:00:00 2001 From: Dan Huantes Date: Thu, 15 Aug 2019 08:26:41 -0500 Subject: [PATCH 179/184] CrasingTestsAreReportedAsFailures no longer core dumps on Clang Release Found that Crashing tests at some point in Clang history were actually caught but testing on Clang 6.0 and Clang 7.0 this is not the case. So added Clang to the list of compilers that don't run this tests. Noted that several other Pull Requests were failing for the same reason. --- tests/TestTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/TestTest.cpp b/tests/TestTest.cpp index 5a4e1ca..0db0650 100644 --- a/tests/TestTest.cpp +++ b/tests/TestTest.cpp @@ -72,7 +72,7 @@ namespace { CHECK_EQUAL(1, results.GetFailureCount()); } -#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) +#if !defined(UNITTEST_MINGW) && !defined(UNITTEST_WIN32) && !defined(__clang__) // Skip this test in debug because some debuggers don't like it. #if defined(NDEBUG) TEST(CrashingTestsAreReportedAsFailures) From c26966668191029f50d3e9f7318e176e5bbd74fc Mon Sep 17 00:00:00 2001 From: Dan Huantes Date: Thu, 17 Oct 2019 08:23:46 -0500 Subject: [PATCH 180/184] Version made explicitly 3 parts - Updated to appveyor.yml and configure.ac to 2.1.0 to match CMake project version. --- CMakeLists.txt | 2 +- appveyor.yml | 2 +- configure.ac | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03a4f62..7a3fb55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.0) -project(UnitTest++ VERSION 2.1) +project(UnitTest++ VERSION 2.1.0) option(UTPP_USE_PLUS_SIGN "Set this to OFF if you wish to use '-cpp' instead of '++' in lib/include paths" diff --git a/appveyor.yml b/appveyor.yml index bebe4f5..3a4637d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 2.0.0.{build} +version: 2.1.0.{build} os: - Windows Server 2012 R2 diff --git a/configure.ac b/configure.ac index 56300a6..372f576 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AM_CONDITIONAL([WINDOWS], LT_INIT() -AC_SUBST([LIBUNITTEST_SO_VERSION], [2:0:0]) +AC_SUBST([LIBUNITTEST_SO_VERSION], [2:1:0]) # Checks for programs. AC_PROG_CXX From f871471d9020788eb0c05582f6430cca36397424 Mon Sep 17 00:00:00 2001 From: Dan Huantes Date: Tue, 7 Apr 2020 18:07:24 -0500 Subject: [PATCH 181/184] Added Namespace to Exported Target [CMakeLists.txt] - It is standard practice to have a namespace for an imported target. Added UnitTest++:: as the namespace argument so that find_package(UnitTest++) will result in UnitTest++::UnitTest++ target that will be used in target_link_libraries. - Updated target_link_libraries for TestUnitTest++ as an example --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a3fb55..b4c75c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,8 @@ source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_}) # create the lib add_library(UnitTest++ STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_}) +add_library(UnitTest++::UnitTest++ ALIAS UnitTest++) + if(${UTPP_USE_PLUS_SIGN}) set_target_properties(UnitTest++ PROPERTIES OUTPUT_NAME UnitTest++) @@ -80,7 +82,10 @@ if(${UTPP_USE_PLUS_SIGN}) set_target_properties(TestUnitTest++ PROPERTIES OUTPUT_NAME TestUnitTest++) endif() -target_link_libraries(TestUnitTest++ UnitTest++) +target_link_libraries(TestUnitTest++ + PUBLIC + UnitTest++::UnitTest++ + ) # run unit tests as post build step add_custom_command(TARGET TestUnitTest++ @@ -124,7 +129,7 @@ install(FILES cmake/UnitTest++Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmake/UnitTest++ConfigVersion.cmake DESTINATION "${config_install_dir_}") -install(EXPORT "${targets_export_name_}" DESTINATION "${config_install_dir_}") +install(EXPORT "${targets_export_name_}" NAMESPACE "UnitTest++::" DESTINATION "${config_install_dir_}") set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) From 37df68be21fd3bcadea0c54fe5e7d5176c1801ce Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Mon, 17 Aug 2020 19:53:58 -0500 Subject: [PATCH 182/184] Add hiatus note & link to issue --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7c138a8..e0b2978 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +> ### Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 1 October 2020. Subscribe to https://github.com/unittest-cpp/unittest-cpp/issues/180 for updates. + + [![Build Status](https://travis-ci.org/unittest-cpp/unittest-cpp.svg?branch=master)](https://travis-ci.org/unittest-cpp/unittest-cpp) [![Build status](https://ci.appveyor.com/api/projects/status/ffs2k8dddts5cyok/branch/master?svg=true)](https://ci.appveyor.com/project/pjohnmeyer/unittest-cpp/branch/master) From 854cae2518d280f732b593cbc9a1c305cb6a753a Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 1 Oct 2020 19:56:11 -0500 Subject: [PATCH 183/184] Extend hiatus to 15 October See #180 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e0b2978..8de8c90 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> ### Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 1 October 2020. Subscribe to https://github.com/unittest-cpp/unittest-cpp/issues/180 for updates. +> ### Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 15 October 2020. Subscribe to https://github.com/unittest-cpp/unittest-cpp/issues/180 for updates. [![Build Status](https://travis-ci.org/unittest-cpp/unittest-cpp.svg?branch=master)](https://travis-ci.org/unittest-cpp/unittest-cpp) From 10e50ad70c696002b1d5bbefd0ea04b3ea92a03b Mon Sep 17 00:00:00 2001 From: Patrick Johnmeyer Date: Thu, 12 Nov 2020 23:26:38 -0600 Subject: [PATCH 184/184] Extend hiatus to 26 November --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8de8c90..6ece10e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -> ### Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 15 October 2020. Subscribe to https://github.com/unittest-cpp/unittest-cpp/issues/180 for updates. +> ### Maintenance of UnitTest++, recently sporadic, is officially on hiatus until 26 November 2020. Subscribe to https://github.com/unittest-cpp/unittest-cpp/issues/180 for updates. [![Build Status](https://travis-ci.org/unittest-cpp/unittest-cpp.svg?branch=master)](https://travis-ci.org/unittest-cpp/unittest-cpp)