MCPcopy Create free account
hub / github.com/apache/singa / PrintOnOneLine

Function PrintOnOneLine

test/gtest/gtest-all.cc:5996–6012  ·  view source on GitHub ↗

Prints the given C-string on a single line by replacing all '\n' characters with string "\\n". If the output takes more than max_length characters, only prints the first max_length characters and "...".

Source from the content-addressed store, hash-verified

5994// max_length characters, only prints the first max_length characters
5995// and "...".
5996static void PrintOnOneLine(const char* str, int max_length) {
5997 if (str != NULL) {
5998 for (int i = 0; *str != '\0'; ++str) {
5999 if (i >= max_length) {
6000 printf("...");
6001 break;
6002 }
6003 if (*str == '\n') {
6004 printf("\\n");
6005 i += 2;
6006 } else {
6007 printf("%c", *str);
6008 ++i;
6009 }
6010 }
6011 }
6012}
6013
6014// Prints the names of the tests matching the user-specified filter flag.
6015void UnitTestImpl::ListTestsMatchingFilter() {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected