Changeset 2070


Ignore:
Timestamp:
Sep 23, 2009, 10:38:58 PM (11 years ago)
Author:
Peter
Message:

fixing iterator_test that failed due to problem iterating backward from a map::begin()

Location:
trunk/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Suite.h

    r1998 r2070  
    268268    err() << "  testing Bidirectional features" << std::endl;
    269269    const BidirectionalIterator i = iter;
    270     BidirectionalIterator tmp = iter--;
    271     add(tmp==i);
    272     ++iter;
    273     tmp = --iter;
    274     if (!add(tmp==iter))
    275       err() << "operator-- failed" << std::endl;
    276     add(++tmp==i);
     270    BidirectionalIterator tmp = iter++;
     271    if (!add(tmp==i)) {
     272      err() << "iter++ does not return iter\n";
     273    }
     274    if (!add(++tmp==iter)) {
     275      err() << "++iter failed\n";
     276    }
     277    if (!add(--tmp==i)) {
     278      err() << "--iter failed\n";
     279    }
     280    tmp = iter--;
     281    if (!add(--tmp==iter))
     282      err() << "iter-- failed" << std::endl;
    277283    if (ok_cached && !ok())
    278284      err() << "failed" << std::endl;
  • trunk/test/iterator_test.cc

    r2068 r2070  
    7474  test_stride_iterator(suite);
    7575  old_main(suite);
     76  suite.out() << "testing boost_util\n";
    7677  test_boost_util(suite);
     78  suite.out() << "testing pair_second_iterator\n";
    7779  test_pair_second_iterator(suite);
     80  suite.out() << "testing weighted iterator\n";
    7881  test_weighted_iterator(suite);
    7982  return suite.return_value();
     
    148151  utility::DataIterator<classifier::DataLookupWeighted1D::const_iterator>
    149152    data_iter(aw2.begin());
     153  suite.out() << "testing data_iter\n";
    150154  suite.test_random_access_iterator(data_iter);
     155  suite.out() << "testing weight_iter\n";
    151156  suite.test_random_access_iterator(weight_iterator(aw2.begin()));
    152157  suite.add(*data_iter == 1.0);
     
    163168
    164169  // testing constness conversion
     170  suite.out() << "testing const conversion\n";
    165171  std::vector<double>::const_iterator c_iter(stl_vec.begin());
    166172  std::vector<double>::iterator iter(stl_vec.begin());
Note: See TracChangeset for help on using the changeset viewer.