Beispiel #1
0
// Called after the test ends.
// Print a summary only if the test failed.
void TersePrinter::OnTestEnd(const TestInfo& test_info)
{
	if (test_info.result()->Passed())
	{
		if (!useTerseOutput)
		{
			// print the message header
			test_header_printed_ = true;
			PrintTestHeader(COLOR_GREEN);
			// print the message trailer
			ColoredPrintf(COLOR_GREEN, "[       OK ] ");
			printf("%s.%s", test_case_name_.c_str(), test_info_name_.c_str());
			// print the test time
			if (GTEST_FLAG(print_time))
				printf(" (%s ms)\n", internal::StreamableToString(
				           test_info.result()->elapsed_time()).c_str());
			else
				printf("\n");
		}
	}
	else
	{
		ColoredPrintf(COLOR_RED, "%s", "[  FAILED  ] ");
		printf("%s.%s\n", test_case_name_.c_str(), test_info_name_.c_str());
	}
	fflush(stdout);
}
	void OnTestEnd(const TestInfo& test_info)
	{
		std::pair<gcString, bool> res = std::make_pair(m_szLastTest, test_info.result()->Passed());
		std::pair<gcString, uint64> end = std::make_pair(m_szLastTest, (uint64)test_info.result()->elapsed_time());

		onTestResultEvent(res);
		onTestEndEnd(end);
	}
void SDKUnitTestListener::OnTestEnd(const TestInfo& test_info) {
	if (test_info.result()->Passed()) {
		PushResult( "[       OK ] " );
	} else {
		PushResult( "[  FAILED  ] " );
	}

	PrintTestName(test_info.test_case_name(), test_info.name() );

	if (GTEST_FLAG(print_time)) {
		PushResult( UTIL_VarArgs(" (%s ms)\n", internal::StreamableToString(
			test_info.result()->elapsed_time()).c_str()) );
	} else {
		PushResult( "\n" );
	}
}
Beispiel #4
0
 virtual void OnTestEnd(const TestInfo& test_info) {
   if (test_info.result()->Passed())
   {
     _CrtMemState stateNow, stateDiff;
     _CrtMemCheckpoint(&stateNow);
     int diffResult = _CrtMemDifference(&stateDiff, &memState_, &stateNow);
     if (diffResult)
     {
       FAIL() << "Memory leak of " << stateDiff.lSizes[1] << " byte(s) detected.";
     }
   }
 }
void TestSuite::OnTestEnd(const TestInfo& test_info) {
    const TestResult *testResult = test_info.result();

    if (testResult->Passed()) {
        this->currentTestInfo->status = true;
        this->currentTestInfo->summary = "Test passed";
    }

    this->currentTestInfo->timeInMillis = testResult->elapsed_time();

    this->testsResults->addResult(this->currentTestInfo);

    delete this->currentTestInfo;
}