Compares the sidecars on disk with what the generator would write, touching nothing.
106{
107 std::vector<std::string> problems;
108 std::vector<std::filesystem::path> expected;
109
110 for (const auto& header : headers) {
111 const auto found = requests.find(header);
112 if (found == requests.end()) {
113 problems.push_back(header.string() + ": contains MF_DESCRIBE text but produced no request");
114 continue;
115 }
116
117 const std::filesystem::path sidecar =
sidecar_path(header);
118 expected.push_back(sidecar);
119 const std::string where = sidecar.string() + ": ";
121
123 for (auto at = have->find("\r\n"); at != std::string::npos; at = have->find("\r\n", at + 1)) {
124 have->erase(at, 1);
125 }
126 if (*have != want) {
127 const auto messages = drift(where, *have, want);
128 problems.insert(problems.end(), messages.begin(), messages.end());
129 }
130 } else {
131 problems.push_back(where + "missing, expected " + std::to_string(found->second.records.size()) + " record(s)");
132 }
133
135 problems.push_back(*problem);
136 }
137 }
138
139 for (const auto& sidecar : existing) {
140 if (std::ranges::find(expected, sidecar) == expected.end()) {
141 problems.push_back(sidecar.string() + ": orphaned, its header has no MF_DESCRIBE left");
142 }
143 }
144 return problems;
145}