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


C++ TestResult类代码示例

本文整理汇总了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;
	}
}
开发者ID:chaicko,项目名称:tdd_book_code,代码行数:10,代码来源:TestRegistry.cpp

示例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));
}
开发者ID:siredblood,项目名称:tree-bumpkin-project,代码行数:11,代码来源:ExceptionHandler.cpp

示例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);
  }
}
开发者ID:Christewart,项目名称:rapidcheck,代码行数:11,代码来源:ReproduceListener.cpp

示例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");
    }
开发者ID:robotology,项目名称:robot-testing,代码行数:20,代码来源:MultiTestCases.cpp

示例5: printCurrentTestEnded

void TestOutput::printCurrentTestEnded(const TestResult& res)
{
	if (verbose_) {
		print(" - ");
		print(res.getCurrentTestTotalExecutionTime());
		print(" ms\n");
	}
	else {
		printProgressIndicator();
	}
}
开发者ID:HackLinux,项目名称:KernelModuleTDDExperiment,代码行数:11,代码来源:TestOutput.cpp

示例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;
}
开发者ID:lmarent,项目名称:network_agents_ver2,代码行数:23,代码来源:test_runner.cpp

示例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";
 }
开发者ID:jeffamstutz,项目名称:ospDebugViewer,代码行数:12,代码来源:simple_outputter.hpp

示例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);
}
开发者ID:277631272,项目名称:jsoncpp,代码行数:21,代码来源:jsontest.cpp

示例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());
}
开发者ID:kaorun55,项目名称:CppUnitxHelper,代码行数:21,代码来源:TestSetupTest.cpp

示例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);
}
开发者ID:hipopotamo-hipotalamo,项目名称:appleseed,代码行数:21,代码来源:testrunnerthread.cpp

示例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();
}
开发者ID:getbraincloud,项目名称:braincloud-cpp,代码行数:21,代码来源:TestBCAsyncMatch.cpp

示例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;
   }
}
开发者ID:maheshmahajanplk,项目名称:Continuum,代码行数:40,代码来源:jsontest.cpp

示例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();
}
开发者ID:getbraincloud,项目名称:braincloud-cpp,代码行数:22,代码来源:TestBCGroup.cpp

示例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;
    });
}
开发者ID:suxinde2009,项目名称:magellan,代码行数:13,代码来源:TextResultPrinter.cpp

示例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);
    }
开发者ID:ixc-software,项目名称:lucksi,代码行数:13,代码来源:TestFwOutput.cpp


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