| 145 | } |
| 146 | |
| 147 | class SettingsBuilder |
| 148 | { |
| 149 | public: |
| 150 | explicit SettingsBuilder(const TestFixture &fixture) : fixture(fixture) {} |
| 151 | SettingsBuilder(const TestFixture &fixture, Settings settings) : fixture(fixture), settings(std::move(settings)) {} |
| 152 | |
| 153 | SettingsBuilder& severity(Severity sev, bool b = true) { |
| 154 | if (REDUNDANT_CHECK && settings.severity.isEnabled(sev) == b) |
| 155 | throw std::runtime_error("redundant setting: severity - " + severityToString(sev)); |
| 156 | settings.severity.setEnabled(sev, b); |
| 157 | return *this; |
| 158 | } |
| 159 | |
| 160 | SettingsBuilder& certainty(Certainty cert, bool b = true) { |
| 161 | if (REDUNDANT_CHECK && settings.certainty.isEnabled(cert) == b) |
| 162 | throw std::runtime_error("redundant setting: certainty"); |
| 163 | settings.certainty.setEnabled(cert, b); |
| 164 | return *this; |
| 165 | } |
| 166 | |
| 167 | SettingsBuilder& clang() { |
| 168 | if (REDUNDANT_CHECK && settings.clang) |
| 169 | throw std::runtime_error("redundant setting: clang"); |
| 170 | settings.clang = true; |
| 171 | return *this; |
| 172 | } |
| 173 | |
| 174 | SettingsBuilder& checkLibrary() { |
| 175 | if (REDUNDANT_CHECK && settings.checkLibrary) |
| 176 | throw std::runtime_error("redundant setting: checkLibrary"); |
| 177 | settings.checkLibrary = true; |
| 178 | return *this; |
| 179 | } |
| 180 | |
| 181 | SettingsBuilder& checkUnusedTemplates(bool b = true) { |
| 182 | if (REDUNDANT_CHECK && settings.checkUnusedTemplates == b) |
| 183 | throw std::runtime_error("redundant setting: checkUnusedTemplates"); |
| 184 | settings.checkUnusedTemplates = b; |
| 185 | return *this; |
| 186 | } |
| 187 | |
| 188 | SettingsBuilder& debugwarnings(bool b = true) { |
| 189 | if (REDUNDANT_CHECK && settings.debugwarnings == b) |
| 190 | throw std::runtime_error("redundant setting: debugwarnings"); |
| 191 | settings.debugwarnings = b; |
| 192 | return *this; |
| 193 | } |
| 194 | |
| 195 | SettingsBuilder& c(Standards::cstd_t std) { |
| 196 | // TODO: CLatest and C23 are the same - handle differently? |
| 197 | //if (REDUNDANT_CHECK && settings.standards.c == std) |
| 198 | // throw std::runtime_error("redundant setting: standards.c"); |
| 199 | settings.standards.c = std; |
| 200 | return *this; |
| 201 | } |
| 202 | |
| 203 | SettingsBuilder& cpp(Standards::cppstd_t std) { |
| 204 | // TODO: CPPLatest and CPP26 are the same - handle differently? |
no test coverage detected