| 286 | #endif |
| 287 | |
| 288 | bool |
| 289 | BndSet::isConsistent(void) const { |
| 290 | #ifndef NDEBUG |
| 291 | if (fst()==nullptr) { |
| 292 | if (lst()!=nullptr || size()!=0) { |
| 293 | std::cerr<<"Strange empty set.\n"; |
| 294 | return false; |
| 295 | } else return true; |
| 296 | } |
| 297 | |
| 298 | if (fst()!=nullptr && lst()==nullptr) { |
| 299 | std::cerr<<"First is not null, last is.\n"; |
| 300 | return false; |
| 301 | } |
| 302 | |
| 303 | RangeList *p=nullptr; |
| 304 | RangeList *c=fst(); |
| 305 | |
| 306 | int min = c->min(); |
| 307 | int max = c->max(); |
| 308 | |
| 309 | if (max<min) { |
| 310 | std::cerr << "Single range list twisted: ("<<min<<","<<max<<")" ; |
| 311 | return false; |
| 312 | } |
| 313 | |
| 314 | RangeList *nc=c->next(); |
| 315 | p=c; c=nc; |
| 316 | while (c) { |
| 317 | if (max<min) { |
| 318 | std::cerr << "1"; |
| 319 | return false; |
| 320 | } |
| 321 | if ((max+1)>=c->min()) { |
| 322 | std::cerr << "2"; |
| 323 | return false; |
| 324 | } |
| 325 | if (c->next()==nullptr && c!=lst()) { |
| 326 | std::cerr << "3"; |
| 327 | return false; |
| 328 | } |
| 329 | |
| 330 | min = c->min(); |
| 331 | max = c->max(); |
| 332 | |
| 333 | nc=c->next(); |
| 334 | p=c; c=nc; |
| 335 | } |
| 336 | #endif |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | |
| 341 | }} |
no test coverage detected