Changeset 1400 for trunk


Ignore:
Timestamp:
Aug 7, 2008, 2:20:39 PM (13 years ago)
Author:
Peter
Message:

why repeating when we can loop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/iterator_test.cc

    r1399 r1400  
    198198  std::vector<std::string> vec(m.size());
    199199  std::copy(first_iterator, first_iterator_end, vec.begin());
    200   if (!suite.add(vec[0]=="April"))
    201     suite.err() << "Error: vec[0] = " << vec[0] << " expected April\n";
    202   if (!suite.add(vec[1]=="July"))
    203     suite.err() << "Error: vec[1] = " << vec[1] << " expected July\n";
    204   if (!suite.add(vec[2]=="June"))
    205     suite.err() << "Error: vec[2] = " << vec[2] << " expected June\n";
    206   if (!suite.add(vec[3]=="September"))
    207     suite.err() << "Error: vec[3] = " << vec[3] << " expected September\n";
     200  std::vector<std::string> correct;
     201  correct.push_back("April");
     202  correct.push_back("July");
     203  correct.push_back("June");
     204  correct.push_back("September");
     205  for (size_t i=0; i<vec.size(); ++i)
     206    if (!suite.add(vec[i]==correct[i]))
     207      suite.err() << "Error: vec[" << i << "] = " << vec[i]
     208                  << " expected " << correct[i] << "\n";
    208209
    209210  std::vector<std::string> vec2(m.size());
Note: See TracChangeset for help on using the changeset viewer.