Changeset 2349


Ignore:
Timestamp:
Nov 17, 2010, 8:18:19 PM (12 years ago)
Author:
Peter
Message:

adding some tests for SegmentSet?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/segment_test.cc

    r2296 r2349  
    117117  if (!suite.add(set.lower_bound(Segment<double>(-1,2))==set.begin()))
    118118    suite.err() << "error: expected set.lower_bound to return begin()\n";
     119  if (!suite.add(set.lower_bound(Segment<double>(1,3))==set.begin()))
     120    suite.err() << "error: expected set.lower_bound to return begin()\n";
     121  if (!suite.add(set.lower_bound(Segment<double>(2,3))==set.end()))
     122    suite.err() << "error: expected set.lower_bound to return end()\n";
     123
    119124  if (!suite.add(set.upper_bound(Segment<double>(-1,2))==set.end()))
    120125    suite.err() << "error: expected set.upper_bound to return end()\n";
     126
     127  set.insert_merge(Segment<double>(3,4));
     128  SegmentSet<double>::const_iterator i=set.lower_bound(Segment<double>(3.5,5));
     129  if (i->begin() != 3 || i->end() != 4) {
     130    suite.add(false);
     131    suite.out() << "found: " << i->begin() << " " << i->end() << "\n";
     132    suite.out() << "expected: 3 4\n";
     133  }
     134
     135  i=set.lower_bound(Segment<double>(1,2.1));
     136  if (i->begin() != 0 || i->end() != 2) {
     137    suite.add(false);
     138    suite.out() << "found: " << i->begin() << " " << i->end() << "\n";
     139    suite.out() << "expected: 0 2\n";
     140  }
     141
    121142  set.clear();
    122143}
Note: See TracChangeset for help on using the changeset viewer.