Changeset 3649 for trunk/test/segment.cc
- Timestamp:
- Jun 15, 2017, 5:27:23 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/segment.cc
r3598 r3649 33 33 void test_count(test::Suite&); 34 34 void test_erase(test::Suite&); 35 void test_includes(test::Suite&); 35 36 void test_insert(test::Suite&); 36 37 void test_insert_merge(test::Suite&); 37 38 void test_make_segment(test::Suite&); 39 void test_overlap(test::Suite&); 38 40 void test_segment(test::Suite& suite); 39 41 void test_operator(test::Suite& suite); … … 51 53 test_count(suite); 52 54 test_erase(suite); 55 test_includes(suite); 53 56 test_insert(suite); 54 57 test_insert_merge(suite); 55 58 test_make_segment(suite); 59 test_overlap(suite); 56 60 test_segment(suite); 57 61 test_set_bound(suite); … … 329 333 330 334 } 335 336 337 void test_includes(test::Suite& suite, const Segment<int>& a, 338 const Segment<int>& b, bool answer) 339 { 340 if (includes(a, b) != answer) { 341 suite.add(false); 342 suite.err() << "error: includes: " 343 << "[" << a.begin() << ", " 344 << a.end() << ") " 345 << "[" << b.begin() << ", " 346 << b.end() << ") " 347 << "expected: " << answer << "\n"; 348 } 349 } 350 351 352 void test_includes(test::Suite& suite) 353 { 354 Segment<int> a(0, 10); 355 Segment<int> b(0, 5); 356 Segment<int> c(5, 10); 357 358 test_includes(suite, a, a, true); 359 test_includes(suite, a, b, false); 360 test_includes(suite, a, c, false); 361 362 test_includes(suite, b, a, true); 363 test_includes(suite, b, b, true); 364 test_includes(suite, b, c, false); 365 366 test_includes(suite, c, a, true); 367 test_includes(suite, c, b, false); 368 test_includes(suite, c, c, true); 369 } 370 371 372 void test_overlap(test::Suite& suite, const Segment<int>& a, 373 const Segment<int>& b, bool answer) 374 { 375 if (overlap(a, b) != answer) { 376 suite.add(false); 377 suite.err() << "error: overlap: " 378 << "[" << a.begin() << ", " 379 << a.end() << ") " 380 << "[" << b.begin() << ", " 381 << b.end() << ") " 382 << "expected: " << answer << "\n"; 383 } 384 } 385 386 387 void test_overlap(test::Suite& suite) 388 { 389 Segment<int> a(0, 10); 390 Segment<int> b(0, 5); 391 Segment<int> c(5, 10); 392 393 test_overlap(suite, a, a, true); 394 test_overlap(suite, a, b, true); 395 test_overlap(suite, a, c, true); 396 397 test_overlap(suite, b, a, true); 398 test_overlap(suite, b, b, true); 399 test_overlap(suite, b, c, false); 400 401 test_overlap(suite, c, a, true); 402 test_overlap(suite, c, b, false); 403 test_overlap(suite, c, c, true); 404 }
Note: See TracChangeset
for help on using the changeset viewer.