| 89 | } |
| 90 | |
| 91 | void filesEqual(int line, const char* filename, const char* templatename, const char* filename_stringified, const char* templatename_stringified) |
| 92 | { |
| 93 | ++TEST::test_count; |
| 94 | TEST::test_line = line; |
| 95 | |
| 96 | TEST::equal_files = true; |
| 97 | TEST::infile.open(filename, std::ios::in); |
| 98 | TEST::templatefile.open(templatename, std::ios::in); |
| 99 | |
| 100 | if (TEST::infile.good() && TEST::templatefile.good()) |
| 101 | { |
| 102 | std::string TEST_FILE__template_line; |
| 103 | std::string TEST_FILE__line; |
| 104 | |
| 105 | while (TEST::infile.good() && TEST::templatefile.good()) |
| 106 | { |
| 107 | TEST::templatefile.getline(TEST::line_buffer, 65535); |
| 108 | TEST_FILE__template_line = TEST::line_buffer; |
| 109 | TEST::infile.getline(TEST::line_buffer, 65535); |
| 110 | TEST_FILE__line = TEST::line_buffer; |
| 111 | |
| 112 | TEST::equal_files &= (TEST_FILE__template_line == TEST_FILE__line); |
| 113 | if (TEST_FILE__template_line != TEST_FILE__line) |
| 114 | { |
| 115 | TEST::initialNewline(); |
| 116 | stdcout << " TEST_FILE_EQUAL: line mismatch:\n got: '" |
| 117 | << TEST_FILE__line << "'\n expected: '" |
| 118 | << TEST_FILE__template_line << "'\n"; |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | else |
| 123 | { |
| 124 | TEST::equal_files = false; |
| 125 | { |
| 126 | TEST::initialNewline(); |
| 127 | stdcout << " + line " |
| 128 | << line |
| 129 | << ": TEST_FILE_EQUAL(" |
| 130 | << filename_stringified |
| 131 | << ", " |
| 132 | << templatename_stringified; |
| 133 | stdcout << ") : " |
| 134 | << " cannot open file: \""; |
| 135 | if (!TEST::infile.good()) |
| 136 | { |
| 137 | stdcout << filename << "\" (input file) "; |
| 138 | } |
| 139 | if (!TEST::templatefile.good()) |
| 140 | { |
| 141 | stdcout << templatename << "\" (template file) "; |
| 142 | } |
| 143 | stdcout << "'\n"; |
| 144 | } |
| 145 | } |
| 146 | TEST::infile.close(); |
| 147 | TEST::templatefile.close(); |
| 148 | TEST::infile.clear(); |
nothing calls this directly
no test coverage detected