当前位置: 首页>>代码示例>>C++>>正文


C++ TestResult::addFailure方法代码示例

本文整理汇总了C++中TestResult::addFailure方法的典型用法代码示例。如果您正苦于以下问题:C++ TestResult::addFailure方法的具体用法?C++ TestResult::addFailure怎么用?C++ TestResult::addFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestResult的用法示例。


在下文中一共展示了TestResult::addFailure方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: run

void Test::run(TestResult &result) {
	try {
		runInternal();
	} catch (TestFailException *e) {
		result.addFailure(Failure(*e, name_));
	} catch (std::exception &e) {
		std::stringstream ss;
		ss << "unexpected exception " << e.what();
		result.addFailure(Failure(ss.str(), name_));
	} catch (...) {
		result.addFailure(Failure("unknown exception", name_));
	}
}
开发者ID:Adidasman1,项目名称:ReGameDLL_CS,代码行数:13,代码来源:Test.cpp

示例2: run

void Test::run (TestResult& result) 
{
  try {
    setup();
    runTest (result);
  } catch (std::exception e) {
    result.addFailure (Failure (e.what(), name, "", 0));	
  } catch (...) {
    result.addFailure (Failure ("Unhandled exception", name, "", 0));	
  }
  teardown();
  result.testWasRun();
}
开发者ID:pnrobinson,项目名称:rnx,代码行数:13,代码来源:unittest.cpp

示例3: printf

void 
Runner::runTestAt( unsigned int index, TestResult &result ) const
{
   TestCase *test = tests_[index]();
   result.setTestName( test->testName() );
   printf( "Testing %s: ", test->testName() );
   fflush( stdout );
#if JSON_USE_EXCEPTION
   try 
   {
#endif // if JSON_USE_EXCEPTION
      test->run( result );
#if JSON_USE_EXCEPTION
   } 
   catch ( const std::exception &e ) 
   {
      result.addFailure( __FILE__, __LINE__, 
         "Unexpected exception caugth:" ) << e.what();
   }
#endif // if JSON_USE_EXCEPTION
   delete test;
   const char *status = result.failed() ? "FAILED" 
                                        : "OK";
   printf( "%s\n", status );
   fflush( stdout );
}
开发者ID:maheshmahajanplk,项目名称:Continuum,代码行数:26,代码来源:jsontest.cpp

示例4: check_equal_compare

void check_equal_compare(const char* const expected, const char* const actual, TestResult& result, char* file, int line)
{
    if (strcmp((expected), (actual)) != 0) {
        std::ostringstream message;
        message << "expected '" << (expected) << "' but was '" << (actual) << "'";
        result.addFailure (Failure (message.str(), file, line));
        return;
    }
}
开发者ID:quasivivo,项目名称:charqueue,代码行数:9,代码来源:Test.cpp

示例5: failure

void IEEE754ExceptionsPlugin::ieee754Check(UtestShell& test, TestResult& result, int flag, const char* text)
{
    result.countCheck();
    if(inexactDisabled_) CHECK(!feclearexcept(FE_INEXACT));
    if(fetestexcept(flag)) {
        CHECK(!feclearexcept(FE_ALL_EXCEPT));
        CheckFailure failure(&test, __FILE__, __LINE__, "IEEE754_CHECK_CLEAR", text);
        result.addFailure(failure);
    }
}
开发者ID:FelixAdrianL,项目名称:cpputest,代码行数:10,代码来源:IEEE754ExceptionsPlugin.cpp

示例6: postTestAction

void MemoryLeakWarningPlugin::postTestAction(UtestShell& test, TestResult& result)
{
	memLeakDetector_->stopChecking();
	int leaks = memLeakDetector_->totalMemoryLeaks(mem_leak_period_checking);

	if (!ignoreAllWarnings_ && expectedLeaks_ != leaks && failureCount_ == result.getFailureCount()) {
		TestFailure f(&test, memLeakDetector_->report(mem_leak_period_checking));
		result.addFailure(f);
	}
	memLeakDetector_->markCheckingPeriodLeaksAsNonCheckingPeriod();
	ignoreAllWarnings_ = false;
	expectedLeaks_ = 0;
}
开发者ID:MoonE,项目名称:WCETExplorer,代码行数:13,代码来源:MemoryLeakWarningPlugin.cpp

示例7: check

bool Test::check(long expected, long actual, TestResult& result, const SimpleString& fileName, long lineNumber) {
	if (expected == actual)
		return true;
	result.addFailure (
		Failure (
			name_, 
			StringFrom (__FILE__), 
			__LINE__, 
			StringFrom (expected), 
			StringFrom (actual)));

	return false;

}
开发者ID:nagyist,项目名称:simple-photo,代码行数:14,代码来源:Test.cpp

示例8: check

bool Test::check(const std::string& expected, const std::string& actual, TestResult& result, const std::string& fileName, long lineNumber)
{
	if (expected == actual)
		return true;
	result.addFailure (
		Failure (
			name_, 
			boost::lexical_cast<std::string> (__FILE__),
			__LINE__, 
			expected, 
			actual));

	return false;

}
开发者ID:gburachas,项目名称:gtsam_pcl,代码行数:15,代码来源:Test.cpp

示例9: runPreviousTest

    void runPreviousTest()
    {
        if (currentTest_ == 0) return;

        if (firstTestInGroup_) {
            result_.currentGroupStarted(currentTest_);
            firstTestInGroup_ = false;
        }
        result_.currentTestStarted(currentTest_);

        millisTime += timeTheTestTakes_;

        if (testFailure_) {
            result_.addFailure(*testFailure_);
            delete testFailure_;
            testFailure_ = 0;
        }


        result_.currentTestEnded(currentTest_);
    }
开发者ID:BigShows,项目名称:cpputest,代码行数:21,代码来源:JUnitOutputTest.cpp

示例10: runPreviousTest

    void runPreviousTest()
    {
        if (currentTest_ == 0) return;

        if (firstTestInGroup_) {
            result_.currentGroupStarted(currentTest_);
            firstTestInGroup_ = false;
        }
        result_.currentTestStarted(currentTest_);

        millisTime += timeTheTestTakes_;
        for(unsigned int i = 0; i < numberOfChecksInTest_; i++) {
            result_.countCheck();
        }
        numberOfChecksInTest_ = 0;

        if (testFailure_) {
            result_.addFailure(*testFailure_);
            delete testFailure_;
            testFailure_ = 0;
        }

        result_.currentTestEnded(currentTest_);
    }
开发者ID:Andne,项目名称:cpputest,代码行数:24,代码来源:JUnitOutputTest.cpp


注:本文中的TestResult::addFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。