本文整理汇总了C++中TestResult类的典型用法代码示例。如果您正苦于以下问题:C++ TestResult类的具体用法?C++ TestResult怎么用?C++ TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testShouldRun
bool TestRegistry::testShouldRun(Utest* test, TestResult& result)
{
if (groupFilter_ == 0) groupFilter_ = new SimpleString();
if (nameFilter_ == 0) nameFilter_ = new SimpleString();
if (test->shouldRun(*groupFilter_, *nameFilter_)) return true;
else {
result.countFilteredOut();
return false;
}
}
示例2: Handle
void Handle (TestResult& result, const char* condition,
const char* testname, const char* filename, int linenumber)
{
if (!g_bHandleExceptions)
throw;
const size_t size = 1024;
char msg[size] = "Unhandled exception ";
strncat( msg, condition, size );
result.AddFailure (Failure (msg, testname, filename, linenumber));
}
示例3: onTestFinished
void ReproduceListener::onTestFinished(const TestMetadata &metadata,
const TestResult &result) {
if (metadata.id.empty()) {
return;
}
FailureResult failure;
if (result.match(failure)) {
m_reproduceMap.emplace(metadata.id, failure.reproduce);
}
}
示例4: run
virtual void run() {
TestResultCollector collector;
// create a test result and add the listeners
TestResult result;
result.addListener(&collector);
// create a test runner
TestRunner runner;
MyTest test1;
MyTest2 test2;
runner.addTest(&test1);
runner.addTest(&test2);
runner.run(result);
//RTF_TEST_REPORT(Asserter::format("count: %d", collector.failedCount()));
RTF_TEST_CHECK(collector.testCount() == 2, "Checking tests count");
RTF_TEST_CHECK(collector.passedCount() == 1, "Checking passed count");
RTF_TEST_CHECK(collector.failedCount() == 1, "Checking failed count");
}
示例5: printCurrentTestEnded
void TestOutput::printCurrentTestEnded(const TestResult& res)
{
if (verbose_) {
print(" - ");
print(res.getCurrentTestTotalExecutionTime());
print(" ms\n");
}
else {
printProgressIndicator();
}
}
示例6: main
/*
* Run the test suite, return 0 on success, 1 on error.
*/
int main(void) {
TestResult controller;
TestResultCollector result;
controller.addListener(&result);
BriefTestProgressListener progress;
controller.addListener(&progress);
TestRunner runner;
runner.addTest( TestFactoryRegistry::getRegistry().makeTest() );
runner.run(controller);
CompilerOutputter outputter(&result, std::cerr);
outputter.write();
return result.wasSuccessful() ? 0 : 1;
}
示例7: EndTest
void EndTest(const std::string&,
const std::string&,
const TestParametersDescriptor&,
const TestResult& result) override
{
_stream << Console::TextBlue
<< Console::TextDefault
<< std::setprecision(5)
<< std::setw(9)
<< result.IterationsPerSecondAverage()
<< " fps";
}
示例8: runTestAt
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 caught:")
<< e.what();
}
#endif // if JSON_USE_EXCEPTION
delete test;
const char* status = result.failed() ? "FAILED" : "OK";
printf("%s\n", status);
fflush(stdout);
}
示例9: TestSuite
USING_NAMESPACE_CPPUNIT
void TestSetupTest::testTestSetup()
{
TestSuite* suite = new TestSuite("2Tests");
suite->addTest(new TestCaseTest::SuccessTestCase("SuccessTestCase"));
suite->addTest(new TestCaseTest::FailureTestCase("FailureTestCase"));
TestTestSetup test(suite);
TEST_ASSERT_EQUALS(2, test.countTestCases());
TEST_ASSERT_EQUALS("2Tests", test.getName());
TEST_ASSERT_EQUALS("suite 2Tests", test.toString());
TestResult result;
test.run(&result);
TEST_ASSERT(test.wasSetUp);
TEST_ASSERT(test.wasTornDown);
TEST_ASSERT_EQUALS(2, result.runCount());
TEST_ASSERT_EQUALS(1, result.failureCount());
TEST_ASSERT_EQUALS(0, result.errorCount());
TEST_ASSERT(!result.wasSuccessful());
}
示例10: listener
void TestRunnerThread::run()
{
QtTestListener listener(m_output_widget, m_result_widget);
TestResult result;
global_logger().set_enabled(false);
const filesystem::path old_current_path =
Application::change_current_directory_to_tests_root_path();
m_repository.run(listener, result);
filesystem::current_path(old_current_path);
global_logger().set_enabled(true);
const int failed_count = static_cast<int>(result.get_case_failure_count());
const int passed_count = static_cast<int>(result.get_case_execution_count()) - failed_count;
emit signal_finished(passed_count, failed_count);
}
示例11: TEST_F
TEST_F(TestBCAsyncMatch, SubmitTurn)
{
TestBCAsyncMatch::CreateMatch();
TestResult tr;
Json::Value matchState;
matchState["map"] = "level01";
Json::FastWriter fw;
m_bc->getAsyncMatchService()->submitTurn(GetUser(UserA)->m_profileId,
m_matchId.c_str(),
0,
fw.write(matchState).c_str(),
NULL,
GetUser(UserB)->m_profileId,
fw.write(matchState).c_str(),
fw.write(matchState).c_str(),
&tr);
tr.run(m_bc);
TestBCAsyncMatch::AbandonMatch();
}
示例12: testCount
bool
Runner::runAllTest( bool printSummary ) const
{
unsigned int count = testCount();
std::deque<TestResult> failures;
for ( unsigned int index = 0; index < count; ++index )
{
TestResult result;
runTestAt( index, result );
if ( result.failed() )
{
failures.push_back( result );
}
}
if ( failures.empty() )
{
if ( printSummary )
{
printf( "All %d tests passed\n", count );
}
return true;
}
else
{
for ( unsigned int index = 0; index < failures.size(); ++index )
{
TestResult &result = failures[index];
result.printFailure( count > 1 );
}
if ( printSummary )
{
unsigned int failedCount = static_cast<unsigned int>( failures.size() );
unsigned int passedCount = count - failedCount;
printf( "%d/%d tests passed (%d failure(s))\n", passedCount, count, failedCount );
}
return false;
}
}
示例13: TEST_F
TEST_F(TestBCGroup, CancelGroupInvitation)
{
Authenticate(UserA);
CreateGroup();
TestResult tr;
m_bc->getGroupService()->inviteGroupMember(
_groupId.c_str(),
GetUser(UserB)->m_profileId,
eGroupMember::ADMIN,
"",
&tr);
tr.run(m_bc);
m_bc->getGroupService()->cancelGroupInvitation(
_groupId.c_str(),
GetUser(UserB)->m_profileId,
&tr);
tr.run(m_bc);
DeleteGroup();
}
示例14: listFailures
void TextResultPrinter::listFailures(const TestResult& result) const
{
if (isAllPassed())
return;
out << RED << "[ FAILED ] "
<< WHITE << numOfTotalFail << " tests, listed below:\n";
result.listFailures([&](const TestFailure& failure){
out << RED << titleFor(failure)
<< WHITE << failure.getTestName() << std::endl;
});
}
示例15: TestCompleted
void StdOutput::TestCompleted(ISingleTest &test, const TestResult &result)
{
if (result.TestOK())
{
m_os << "." << std::flush;
m_okCount++;
return;
}
m_os << "[" << test.getTestNumber() << "=X]" << std::flush;
m_exceptionsCount++;
m_resultList.push_back(result);
}