| 100 | namespace snappy { |
| 101 | |
| 102 | std::string ReadTestDataFile(const std::string& base, size_t size_limit) { |
| 103 | std::string contents; |
| 104 | const char* srcdir = getenv("srcdir"); // This is set by Automake. |
| 105 | std::string prefix; |
| 106 | if (srcdir) { |
| 107 | prefix = std::string(srcdir) + "/"; |
| 108 | } |
| 109 | file::GetContents(prefix + "testdata/" + base, &contents, file::Defaults() |
| 110 | ).ok(); |
| 111 | if (size_limit > 0) { |
| 112 | contents = contents.substr(0, size_limit); |
| 113 | } |
| 114 | return contents; |
| 115 | } |
| 116 | |
| 117 | std::string StrFormat(const char* format, ...) { |
| 118 | char buffer[4096]; |
no test coverage detected