| 145 | } |
| 146 | |
| 147 | static std::string writestr(const std::string &str, bool gccStyle = false) |
| 148 | { |
| 149 | std::ostringstream ostr; |
| 150 | if (gccStyle) |
| 151 | ostr << '\"'; |
| 152 | for (auto i = str.cbegin(); i != str.cend(); ++i) { |
| 153 | if (*i == '\n') { |
| 154 | ostr << "\\n"; |
| 155 | if ((i+1) != str.end() && !gccStyle) |
| 156 | ostr << std::endl; |
| 157 | } else if (*i == '\t') |
| 158 | ostr << "\\t"; |
| 159 | else if (*i == '\"') |
| 160 | ostr << "\\\""; |
| 161 | else if (std::isprint(static_cast<unsigned char>(*i))) |
| 162 | ostr << *i; |
| 163 | else |
| 164 | ostr << "\\x" << std::hex << short{*i}; |
| 165 | } |
| 166 | if (!str.empty() && !gccStyle) |
| 167 | ostr << std::endl; |
| 168 | else if (gccStyle) |
| 169 | ostr << '\"'; |
| 170 | return ostr.str(); |
| 171 | } |
| 172 | |
| 173 | void TestFixture::assert_(const char * const filename, const unsigned int linenr, const bool condition, const std::string& msg) const |
| 174 | { |
no test coverage detected