コード例 #1
0
// Prints a TestPartResult to an std::string.
std::string PrintTestPartResultToString(const TestPartResult& test_part_result) {
	return (Message()
		<< internal::FormatFileLocation(test_part_result.file_name(),
		test_part_result.line_number())
		<< " " << TestPartResultTypeToString(test_part_result.type())
		<< test_part_result.message()).GetString();
}
コード例 #2
0
// Called after an assertion failure.
void SDKUnitTestListener::OnTestPartResult(const TestPartResult& result) {
	// If the test part succeeded, we don't need to do anything.
	if (result.type() == TestPartResult::kSuccess)
		return;

	// Print failure message from the assertion (e.g. expected this and got that).
	std::string res = PrintTestPartResultToString(result);
	PushResult( UTIL_VarArgs( "%s\n", res.c_str() ) );
}