本文整理汇总了C++中TestResult::get_assertion_failure_count方法的典型用法代码示例。如果您正苦于以下问题:C++ TestResult::get_assertion_failure_count方法的具体用法?C++ TestResult::get_assertion_failure_count怎么用?C++ TestResult::get_assertion_failure_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestResult
的用法示例。
在下文中一共展示了TestResult::get_assertion_failure_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_case
void TestSuite::run_case(
ITestCaseFactory& test_case_factory,
ITestListener& test_listener,
TestResult& test_case_result) const
{
test_case_result.signal_case_execution();
try
{
auto_ptr<ITestCase> test_case(test_case_factory.create());
test_case->run(test_listener, test_case_result);
if (test_case_result.get_assertion_failure_count() > 0)
test_case_result.signal_case_failure();
}
catch (const ExceptionAssertionFailure&)
{
test_case_result.signal_case_failure();
}
#ifdef NDEBUG
catch (const exception& e)
{
TestListenerHelper::write(
test_listener,
*this,
test_case_factory.get_name(),
__FILE__,
__LINE__,
TestMessage::TestCaseFailure,
"an unexpected exception was caught: %s.",
e.what());
test_case_result.signal_case_failure();
}
catch (...)
{
TestListenerHelper::write(
test_listener,
*this,
test_case_factory.get_name(),
__FILE__,
__LINE__,
TestMessage::TestCaseFailure,
"an unexpected exception was caught (no details available).");
test_case_result.signal_case_failure();
}
#endif
}
示例2: run_case
void TestSuite::run_case(
ITestCase& test_case,
ITestListener& test_listener,
TestResult& test_case_result) const
{
test_case_result.signal_case_execution();
try
{
// Run the test case.
test_case.run(test_listener, test_case_result);
// Report a test case failure if one or more assertions failed.
if (test_case_result.get_assertion_failure_count() > 0)
test_case_result.signal_case_failure();
}
catch (const ExceptionAssertionFailure&)
{
test_case_result.signal_case_failure();
}
#ifdef NDEBUG
catch (const exception& e)
{
TestListenerHelper::write(
test_listener,
*this,
test_case,
__FILE__,
__LINE__,
TestMessage::TestCaseFailure,
"An unexpected exception was caught: %s.",
e.what());
test_case_result.signal_case_failure();
}
catch (...)
{
TestListenerHelper::write(
test_listener,
*this,
test_case,
__FILE__,
__LINE__,
TestMessage::TestCaseFailure,
"An unexpected exception was caught (no details available).");
test_case_result.signal_case_failure();
}
#endif
}