Count occurrences of @p needle in @p haystack. Used to tally how many `error(` lines the returned `.dem` text contains.
| 178 | // Count occurrences of @p needle in @p haystack. Used to tally how many |
| 179 | // `error(` lines the returned `.dem` text contains. |
| 180 | static std::size_t countOccurrences(const std::string &haystack, |
| 181 | const std::string &needle) { |
| 182 | std::size_t count = 0, pos = 0; |
| 183 | while ((pos = haystack.find(needle, pos)) != std::string::npos) { |
| 184 | ++count; |
| 185 | pos += needle.size(); |
| 186 | } |
| 187 | return count; |
| 188 | } |
| 189 | |
| 190 | // Detectors and observables appear in the `.dem` file as TARGETS in |
| 191 | // `error(...)` lines, not as standalone instructions. `D5` is a reference |
no test coverage detected