| 66 | }; |
| 67 | |
| 68 | static int testBOM() |
| 69 | { |
| 70 | // test various encodings in binary mode |
| 71 | for (int i = 0; i < num_test_files; i++) { |
| 72 | { |
| 73 | kwsys::ofstream out("bom.txt", kwsys::ofstream::binary); |
| 74 | out.write(reinterpret_cast<char const*>(expected_bom_data[i] + 1), |
| 75 | *expected_bom_data[i]); |
| 76 | out.write(reinterpret_cast<char const*>(file_data[i] + 1), |
| 77 | file_data[i][0]); |
| 78 | } |
| 79 | |
| 80 | kwsys::ifstream in("bom.txt", kwsys::ofstream::binary); |
| 81 | kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); |
| 82 | if (bom != expected_bom[i]) { |
| 83 | std::cout << "Unexpected BOM " << i << std::endl; |
| 84 | return 1; |
| 85 | } |
| 86 | char data[max_test_file_size]; |
| 87 | in.read(data, file_data[i][0]); |
| 88 | if (!in.good()) { |
| 89 | std::cout << "Unable to read data " << i << std::endl; |
| 90 | return 1; |
| 91 | } |
| 92 | |
| 93 | if (memcmp(data, file_data[i] + 1, file_data[i][0]) != 0) { |
| 94 | std::cout << "Incorrect read data " << i << std::endl; |
| 95 | return 1; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | static int testBOMIO() |
| 103 | { |
no test coverage detected
searching dependent graphs…