Changeset 1490 for trunk/test/iterator_test.cc
- Timestamp:
- Sep 12, 2008, 12:10:26 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/iterator_test.cc
r1487 r1490 32 32 #include "yat/utility/stl_utility.h" 33 33 #include "yat/utility/Vector.h" 34 #include "yat/utility/VectorView.h" 35 #include "yat/utility/VectorConstView.h" 34 36 #include "yat/utility/WeightIterator.h" 35 37 … … 72 74 void test_random_access_iterator(RandomAccessIterator, test::Suite&); 73 75 76 void test_stride_iterator(test::Suite& suite); 77 74 78 int main(int argc, char* argv[]) 75 79 { … … 77 81 suite.err() << "testing iterator" << std::endl; 78 82 83 test_stride_iterator(suite); 79 84 old_main(suite); 80 85 test_boost_util(suite); … … 111 116 suite.add(false); 112 117 118 suite.err() << "sorting..."; 113 119 utility::Vector::iterator end=vec.end(); 114 120 std::sort(begin, end); 121 suite.err() << " sorting done\n"; 115 122 116 123 suite.err() << "testing classifier::DataLookup1D::const_iterator" << std::endl; … … 371 378 if (ok_cached && !suite.ok()) 372 379 suite.err() << "failed" << std::endl; 373 374 375 } 380 } 381 382 void test_stride_iterator(test::Suite& suite) 383 { 384 suite.err() << "testing StrideIterator" << std::endl; 385 using utility::Vector; 386 Vector a(10); 387 // stride 2 388 utility::VectorConstView b(a, 0, 5, 2); 389 if (!suite.add(b.end()-b.begin()==5)) 390 suite.err() << "ERROR: StrideIterator::operator- returned: " 391 << b.end()-b.begin() 392 << " expected 5\n"; 393 utility::VectorView c(a, 0, 3, 2); 394 Vector::iterator begin = c.begin(); 395 Vector::iterator end = c.end(); 396 Vector::const_iterator cbegin = begin; 397 Vector::const_iterator cend = end; 398 399 if (!suite.add(c.size()==3)) 400 suite.err() << "c.size() incorrect" << std::endl; 401 if (!suite.add(cend-cbegin == 3)) 402 suite.err() << "cend-cbegin failed\n"; 403 }
Note: See TracChangeset
for help on using the changeset viewer.