Commit graph

41 commits

Author SHA1 Message Date
Dan Huantes
2423fcac76 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.
2019-08-15 08:30:43 -05:00
Patrick Johnmeyer
d8e27e1825 Merge pull request #127 from pjohnmeyer/up_gcc_clang_warning_levels
Up non-MSVC warning levels
2016-08-30 20:45:40 -05:00
Gabriel Schlozer
eca039304b Used size_t for CHECK macros 2016-08-29 22:36:31 +02:00
Patrick Johnmeyer
7d7ba0aba4 Re-enable ignored-qualifiers warning and fix 2016-08-27 20:41:41 -05:00
Patrick Johnmeyer
097c71e6b8 Merge pull request #114 from unittest-cpp/long_and_short_macros
Long and short macros
2016-08-16 22:41:13 -05:00
Patrick Johnmeyer
de915185f6 Remove unused variable from test copy constructor 2016-07-15 23:58:48 -05:00
Patrick Johnmeyer
bec6ba56ec Attempted fix for Travis build. 2016-07-15 23:54:59 -05:00
Patrick Johnmeyer
21589e5612 Take UnitTest::Check parameter by const reference
Fixes #119 and #7
2016-07-15 23:23:45 -05:00
Patrick Johnmeyer
910381fadc Change UNITTEST_ENABLE_SHORT_MACROS to DISABLE
Also add a test file.
2016-05-07 01:02:20 -05:00
Patrick Johnmeyer
df386f189f Add UNITTEST_ prefixes to remaining macros
TEST, SUITE, and REQUIRE macros now have UNITTEST_ and UNITTEST_IMPL_
prefixes like the others, completing the set.
2016-05-07 00:12:09 -05:00
Patrick Johnmeyer
b7e0d70a63 Fix failures in make distcheck 2016-04-25 13:37:31 -05:00
Patrick Johnmeyer
5ad8cd86c9 Add new tests to Makefile.am 2016-02-23 23:12:40 -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
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
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
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
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
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
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
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
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
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
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
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
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
19fd65743b Remove lurking tests/*.vcproj files. 2014-11-08 00:24:51 -06:00
Patrick Johnmeyer
1fe3d72776 Reformatted code from #54. 2014-06-27 22:42:53 -05:00
Nathan Lapierre
6ea2db4cb1 keep absolute path 2014-06-05 02:07:49 -03:00
Nathan Lapierre
7b47f1c59a fix broken tests 2014-06-05 02:06:44 -03:00
Martin Moene
65d2e03ec9 Adapt MemoryOutStream for VC6 __int64 type 2013-05-10 11:32:15 +02:00
Martin Moene
23127fe5b9 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
2013-05-09 11:12:29 +02:00
Patrick Johnmeyer
ce196f218a Add support and project files for Visual Studio 2012 2013-03-24 01:13:10 -05:00
Patrick Johnmeyer
859e6250d2 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++.
2013-02-20 00:22:14 -06:00