summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/unittest-cpp/tests/TestAssertHandler.cpp
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2015-10-20 21:34:36 +0200
committer ImJezze <jezze@gmx.net>2015-10-20 21:34:36 +0200
commita7b8acbe3eebcf17367baa642375cfa47ae4ea85 (patch)
tree854b859d6176802c0278f4b00de3f7c774e02dda /3rdparty/unittest-cpp/tests/TestAssertHandler.cpp
parent4610935e796661874bb4ee7ec6536d9423aeb7be (diff)
parent74aae76c4e3e257f99d139c4febb5d86d1419e50 (diff)
Merge pull request #6 from mamedev/master
Sync to base master
Diffstat (limited to '3rdparty/unittest-cpp/tests/TestAssertHandler.cpp')
-rw-r--r--3rdparty/unittest-cpp/tests/TestAssertHandler.cpp136
1 files changed, 0 insertions, 136 deletions
diff --git a/3rdparty/unittest-cpp/tests/TestAssertHandler.cpp b/3rdparty/unittest-cpp/tests/TestAssertHandler.cpp
deleted file mode 100644
index c9286f38c03..00000000000
--- a/3rdparty/unittest-cpp/tests/TestAssertHandler.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-#include "UnitTest++/Config.h"
-#include "UnitTest++/UnitTestPP.h"
-
-#include "UnitTest++/ReportAssert.h"
-#include "UnitTest++/ReportAssertImpl.h"
-#include "UnitTest++/AssertException.h"
-
-#include "RecordingReporter.h"
-#include <csetjmp>
-
-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
-
-}