Commit graph

233 commits

Author SHA1 Message Date
Austin Gilbert
4b0ac3f34a UT_RETHROW needed to take an argument when UNITTEST_NO_EXCEPTIONS=1. 2016-02-08 21:36:05 -06:00
Austin Gilbert
7a68264b0f Renaming tests/TestRequireMacros.cpp -> tests/TestRequireMacrosWithExceptionsOn.cpp, testing REQUIRE with exceptions turned off will require a significantly different approach. 2016-02-08 19:11:05 -06:00
Austin Gilbert
cd34fffa40 Merge remote-tracking branch 'pj/paxos1977-pjohnmeyer-RequiredMacro' into paxos1977-pjohnmeyer-RequiredMacro 2016-02-08 18:09:11 -06:00
Patrick Johnmeyer
6bb9541ae2 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.
2016-02-06 22:04:52 -06:00
Patrick Johnmeyer
3f5095ba13 Eliminate some single-line if statements. 2016-02-06 09:30:15 -06:00
Patrick Johnmeyer
5eec0a255f 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.
2016-02-06 09:30:15 -06:00
Patrick Johnmeyer
57fc32c114 Change camelCase methods to PascalCase 2016-02-06 09:30:15 -06:00
Patrick Johnmeyer
40b8f0b17b Use new RequiredCheckException for REQUIRE
Rather than re-using AssertException, it felt more correct to
create a new special-purpose exception.
2016-02-06 09:30:15 -06:00
Patrick Johnmeyer
74ca0c301f Merge and uncrustify. 2016-02-06 09:30:06 -06:00
Austin Gilbert
89ff2596ee Eliminating 'unused exception variable' warnings. 2016-02-06 09:30:05 -06:00
Austin Gilbert
a9161c1ba6 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.
2016-02-06 09:29:38 -06:00
Patrick Johnmeyer
06308ee802 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.
2016-02-06 09:28:48 -06:00
Austin Gilbert
e7b56d4e3c 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<int> 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.
2016-02-06 09:28:48 -06:00
Patrick Johnmeyer
5b34768df0 Prepare v1.5.1 tag 2016-01-29 23:24:21 -06:00
Patrick Johnmeyer
353d3989d3 Delete straggling .vcproj files. 2016-01-29 23:10:38 -06:00
Patrick Johnmeyer
6bfab53a64 Merge pull request #93 from unittest-cpp/uncrustify
Make formatting more consistent
2016-01-29 23:09:26 -06:00
Patrick Johnmeyer
bb7555c718 Tweak preprocessor blocks. 2016-01-29 22:48:36 -06:00
Patrick Johnmeyer
f82c403768 Change preprocessor indent rules. 2016-01-29 22:22:37 -06:00
Patrick Johnmeyer
b47b4f7e85 Add uncrustify config and run first pass. 2016-01-29 22:15:10 -06:00
Patrick Johnmeyer
6e1d0f48ab Fix comment in TestTestRunner.cpp
"Self-recursive" didn't make much sense.
2016-01-29 20:05:53 -06:00
Patrick Johnmeyer
7186084dd8 Merge pull request #92 from unittest-cpp/issue90
Reduce possible timing test failures
2016-01-29 20:03:48 -06:00
Patrick Johnmeyer
44aa33b02b 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
2016-01-29 19:50:23 -06:00
Patrick Johnmeyer
2fc284af64 Merge pull request #87 from rmpowell77/fix-sign-conversion
Adding an explicit cast for the conversion from int to useconds_t in TimeHelpers:::SleepMS.

Fixes #88
2016-01-29 19:32:41 -06:00
Richard Powell
014d6e48f8 adding an explicit cast for the conversion from int to useconds_t in TimeHelpers::SleepMS. 2015-12-16 06:53:06 -08:00
Patrick Johnmeyer
540f6615fb Merge pull request #85 from grahamreeds/master
Removed conditional compile around FixtureDtorThrows structure. Added…
2015-11-17 00:11:30 -06:00
grahamreeds
4fccb76875 Removed conditional compile around FixtureDtorThrows structure. Added a preprocessor block for _MSC_VER noexcept support. 2015-11-12 12:01:07 +00:00
Patrick Johnmeyer
24061e420c Merge pull request #71 from LocutusOfBorg/add-pkgconfig
Add pkg-config file
2015-11-04 20:18:44 -06:00
Patrick Johnmeyer
c5a3903bf9 Prepare v1.5.0 tag. 2015-11-04 12:04:13 -06:00
Patrick Johnmeyer
dc6b908380 Merge pull request #78 from Microsoft/vs2015Support
Vs2015 support
2015-10-15 22:20:22 -05:00
Anna Gringauze
0a14abb0a5 Added support for VS2015 2015-09-22 07:36:28 -07:00
Gianfranco Costamagna
5e52ae70dc
Add pkg config file (with help from Vicente Adolfo Bolea Sánchez) 2015-09-22 08:34:51 +02:00
Patrick Johnmeyer
dab64862c4 Merge pull request #77 from paxos1977/Issue76
Disable tests in TestTestMacros.cpp which throw exceptions from destructors
2015-09-21 22:54:39 -05:00
Patrick Johnmeyer
8741891f85 Merge pull request #69 from bittwiddler1/master
Adding conditional automake directives to allow Win32 compilation on win...
2015-09-21 22:19:05 -05:00
Austin Gilbert
c4e36176d9 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.
2015-09-17 17:28:44 -05:00
Patrick Johnmeyer
ae24d94242 Add travis and appveyor badges to README.md 2015-07-14 20:58:37 -05:00
Patrick Johnmeyer
67013d4b88 Add tiny comment change to trigger Travis. 2015-07-14 20:49:26 -05:00
Patrick Johnmeyer
ab716658dc Merge pull request #70 from hymerman/continuous-integration
Continuous integration
2015-07-14 20:43:29 -05:00
Ben Hymers
76e9982dd4 Add Travis CI configuration file, .travis.yml
Builds using CMAKE then GCC and Clang, in Debug and Release configurations
2015-04-27 09:09:35 +01:00
Ben Hymers
4b8d3a7418 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.
2015-04-27 08:52:29 +01:00
Patrick Johnmeyer
edf1e370ef Updating docs submodule reference. 2015-04-25 02:30:22 -05:00
Saul Beniquez
2d493d8020 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.
2015-04-19 18:48:56 -04:00
Saul Beniquez
c0e97bf082 [UnitTest++] Removing a spurrious UnitTest___libUnitTest___la_CPPFLAGS assignment 2015-04-07 12:48:47 -04:00
Saul Beniquez
9257dc7feb Removing duplicated UNITTEST_POSIX #define from cmdline -D flags 2015-04-07 09:34:52 -04:00
Saul Beniquez
7549615b31 Adding conditional automake directives to allow Win32 compilation on win32-mingw/cygwin-mingw systems. 2015-04-07 08:46:20 -04:00
Patrick Johnmeyer
53598bdeb6 Update wiki docs submodule. 2015-04-04 01:58:43 -05:00
Patrick Johnmeyer
2ee151af76 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.
2015-04-04 01:31:04 -05:00
Patrick Johnmeyer
bd11339b2d 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.
2015-04-04 00:56:40 -05:00
Patrick Johnmeyer
d310c03eea Add missing headers to Makefile.
Closes #42.
2015-04-03 23:27:32 -05:00
Patrick Johnmeyer
db377423a3 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.
2014-12-19 11:51:26 -06:00
Patrick Johnmeyer
59f2f901a3 Merge pull request #61 from pjohnmeyer/remove_project_files
Remove VS and XCode project files.

Resolves #47 and relates to #42.
2014-11-14 22:27:33 -06:00