| 9800 | // elements, starting at address 'begin'. |
| 9801 | template <typename T> |
| 9802 | void UniversalPrintArray(const T* begin, size_t len, ::std::ostream* os) { |
| 9803 | if (len == 0) { |
| 9804 | *os << "{}"; |
| 9805 | } else { |
| 9806 | *os << "{ "; |
| 9807 | const size_t kThreshold = 18; |
| 9808 | const size_t kChunkSize = 8; |
| 9809 | // If the array has more than kThreshold elements, we'll have to |
| 9810 | // omit some details by printing only the first and the last |
| 9811 | // kChunkSize elements. |
| 9812 | // TODO(wan@google.com): let the user control the threshold using a flag. |
| 9813 | if (len <= kThreshold) { |
| 9814 | PrintRawArrayTo(begin, len, os); |
| 9815 | } else { |
| 9816 | PrintRawArrayTo(begin, kChunkSize, os); |
| 9817 | *os << ", ..., "; |
| 9818 | PrintRawArrayTo(begin + len - kChunkSize, kChunkSize, os); |
| 9819 | } |
| 9820 | *os << " }"; |
| 9821 | } |
| 9822 | } |
| 9823 | // This overload prints a (const) char array compactly. |
| 9824 | GTEST_API_ void UniversalPrintArray( |
| 9825 | const char* begin, size_t len, ::std::ostream* os); |
no test coverage detected