Commit graph

34 commits

Author SHA1 Message Date
Patrick Johnmeyer
962387ce5d Update autotools for new source files. 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
4b0ac3f34a UT_RETHROW needed to take an argument when UNITTEST_NO_EXCEPTIONS=1. 2016-02-08 21:36:05 -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
353d3989d3 Delete straggling .vcproj files. 2016-01-29 23:10:38 -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
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
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
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
d310c03eea Add missing headers to Makefile.
Closes #42.
2015-04-03 23:27:32 -05:00
warmist
1fdc44246d Fix crash bug in msvc
fprintf had incorrect number of arguments.
2014-01-06 14:02:59 +02:00
Patrick Johnmeyer
04a6094d63 Merge pull request #48 from magicant/autotools
Fix autotools configuration
2013-07-22 07:13:26 -07:00
Patrick Johnmeyer
4661f377da Merge pull request #46 from lijoantony/master
Integrating test failures into QTCreator IDE build errors
2013-07-22 07:12:57 -07:00
WATANABE Yuki
cda955dee4 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.
2013-07-20 13:27:19 +09:00
Lijo Antony
bd1239bff7 Integrating test failure in to QtCreator IDE build errors 2013-06-09 23:48:16 +04: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
Victor Lavaud (qdii)
e90b9e5a63 Fixed autotools 2013-03-29 20:59:47 +01:00
Patrick Johnmeyer
90c1b7a3b7 Generate new Visual Studio 2005 projects. 2013-03-24 02:08:36 -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