Changeset 2611 for trunk/test/segment.cc


Ignore:
Timestamp:
Nov 5, 2011, 12:03:50 AM (10 years ago)
Author:
Peter
Message:

fixes #680 and #679

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/segment.cc

    r2370 r2611  
    3030void test_compare(test::Suite& suite);
    3131void test_count(test::Suite&);
     32void test_erase(test::Suite&);
    3233void test_insert(test::Suite&);
    3334void test_insert_merge(test::Suite&);
     
    4546  test_compare(suite);
    4647  test_count(suite);
     48  test_erase(suite);
    4749  test_insert(suite);
    4850  test_insert_merge(suite);
     
    99101  test_compare(suite, 0, 0, 0, 0, 0);
    100102  test_compare(suite, 0, 0, -1, -1, 1);
     103}
     104
     105
     106void test_erase(test::Suite& suite)
     107{
     108  suite.out() << "test_erase\n";
     109  suite.out() << "  SegmentSet\n";
     110  SegmentSet<double> set;
     111  set.insert(Segment<double>(0,2));
     112  set.insert(Segment<double>(10,20));
     113  set.insert(Segment<double>(30,50));
     114  SegmentSet<double>::iterator iter = set.find(15);
     115  set.erase(iter);
     116  if (!suite.add(set.size()==2))
     117    suite.err() << "size: " << set.size() << " expected 2\n";
     118  set.erase(set.begin(), set.end());
     119  if (!suite.add(set.size()==0))
     120    suite.err() << "size: " << set.size() << " expected 0\n";
     121  suite.out() << "  SegmentMap\n";
     122  typedef SegmentMap<double, std::string> Map;
     123  Map map;
     124  Map::key_type s(0,2);
     125  map.insert(Map::value_type(s, "aha"));
     126  map.erase(map.begin());
     127  map.erase(map.begin(), map.end());
    101128}
    102129
Note: See TracChangeset for help on using the changeset viewer.