| 31 | #include "tests-common.h" |
| 32 | |
| 33 | static std::string tryReadFile(std::string const& filename) { |
| 34 | std::string s; |
| 35 | std::ifstream ifs(filename.c_str(), std::ifstream::in); |
| 36 | |
| 37 | if (!ifs.is_open()) { |
| 38 | throw "cannot open input file"; |
| 39 | } |
| 40 | |
| 41 | char buffer[4096]; |
| 42 | while (ifs.good()) { |
| 43 | ifs.read(&buffer[0], sizeof(buffer)); |
| 44 | s.append(buffer, ifs.gcount()); |
| 45 | } |
| 46 | ifs.close(); |
| 47 | |
| 48 | return s; |
| 49 | } |
| 50 | |
| 51 | static std::string readFile(std::string filename) { |
| 52 | #ifdef _WIN32 |