Commit graph

246 commits

Author SHA1 Message Date
Patrick Johnmeyer
6c78c6ea2b Add more compilers to appveyor config 2016-02-23 23:45:52 -06:00
Patrick Johnmeyer
5ad8cd86c9 Add new tests to Makefile.am 2016-02-23 23:12:40 -06:00
Patrick Johnmeyer
240bf00f49 Merge branch 'paxos1977-paxos1977-pjohnmeyer-RequiredMacro' 2016-02-23 23:10:35 -06:00
Patrick Johnmeyer
898f18d799 Enable C++11 support in autoconf 2016-02-23 23:10:30 -06:00
Patrick Johnmeyer
962387ce5d Update autotools for new source files. 2016-02-23 23:10:29 -06:00
Austin Gilbert
0a99a9a5c9 Correcting RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing to exercise the passing case (per the UT name). 2016-02-23 23:10:29 -06:00
Patrick Johnmeyer
9fd7b2202e Merge pull request #98 from paxos1977/dev/FixingIncorrectUnitTest
Fixing a unit test that's exercising the wrong case
2016-02-23 22:45:42 -06:00
Patrick Johnmeyer
983a990484 Merge pull request #95 from pjohnmeyer/paxos1977-pjohnmeyer-RequiredMacro
Add REQUIRE macro for stopping tests early
2016-02-23 22:44:31 -06:00
Patrick Johnmeyer
073a1ea0e1 Enable C++11 support in autoconf 2016-02-23 21:44:25 -06:00
Patrick Johnmeyer
adebd8376a Update autotools for new source files. 2016-02-23 21:11:19 -06:00
Austin Gilbert
1c30bcd16b Correcting RequiredCheckArrayCloseDoesNotHaveSideEffectsWhenPassing to exercise the passing case (per the UT name). 2016-02-08 21:54:58 -06:00
Austin Gilbert
de385090d9 Merge branch 'dev/RequireMacroUsingLongjmp' into paxos1977-pjohnmeyer-RequiredMacro 2016-02-08 21:45:35 -06:00
Austin Gilbert
2e53a17d7e 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.
2016-02-08 21:38:56 -06:00
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