Changeset 3149
- Timestamp:
- Dec 23, 2013, 7:02:47 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Suite.h
r3114 r3149 127 127 template<typename TrivialIterator> 128 128 void test_trivial_iterator(const TrivialIterator&); 129 129 130 130 template<typename InputIterator> 131 131 void test_input_iterator(InputIterator&); 132 132 133 133 template<typename OutputIterator> 134 134 void test_output_iterator(OutputIterator&); 135 135 136 136 template<typename ForwardIterator> 137 137 void test_forward_iterator(ForwardIterator); 138 138 139 139 template<typename BidirectionalIterator> 140 140 void test_bidirectional_iterator(BidirectionalIterator); 141 141 142 142 template<typename RandomAccessIterator> 143 143 void test_random_access_iterator(RandomAccessIterator); … … 202 202 typedef T value_type; 203 203 typedef const T& const_reference; 204 typedef const T* const_iterator; 204 typedef const T* const_iterator; 205 205 typedef const_iterator const_column_iterator; 206 206 typedef const_iterator const_row_iterator; … … 213 213 size_t columns(void) const { return 0; } 214 214 size_t rows(void) const { return 0; } 215 const_reference operator()(size_t row, size_t column) const 215 const_reference operator()(size_t row, size_t column) const 216 216 { return element_; } 217 217 … … 232 232 public: 233 233 typedef T& reference; 234 typedef T* iterator; 234 typedef T* iterator; 235 235 typedef iterator column_iterator; 236 236 typedef iterator row_iterator; … … 278 278 public: 279 279 neighbor_weighting_archetype(void) {} 280 void operator()(const utility::VectorBase& distance, 280 void operator()(const utility::VectorBase& distance, 281 281 const std::vector<size_t>& k_sorted, 282 const classifier::Target& target, 282 const classifier::Target& target, 283 283 utility::VectorMutable& prediction) const {} 284 284 neighbor_weighting_archetype& operator=(const neighbor_weighting_archetype&) … … 341 341 bool ok = ss2.str()==ss.str(); 342 342 if (!ok) { 343 this->err() << "ERROR: first object gave following output:\n" 343 this->err() << "ERROR: first object gave following output:\n" 344 344 << ss.str() << "\n" 345 << "ERROR: and second object gave following output:\n" 345 << "ERROR: and second object gave following output:\n" 346 346 << ss2.str() << "\n"; 347 347 } … … 358 358 default_constructed == default_constructed; // avoid compiler warning 359 359 } 360 360 361 361 template<typename InputIterator> 362 362 void Suite::test_input_iterator(InputIterator& iter) … … 370 370 } 371 371 } 372 372 373 373 template<typename OutputIterator> 374 374 void Suite::test_output_iterator(OutputIterator& iter) 375 375 { 376 test_trivial_iterator(iter);377 376 err() << " testing Output features" << std::endl; 378 } 379 377 // OutputIterator should be default constructible and assignable 378 OutputIterator oi; 379 oi = iter; 380 ++oi; 381 } 382 380 383 template<typename ForwardIterator> 381 384 void Suite::test_forward_iterator(ForwardIterator iter) … … 384 387 test_input_iterator(iter); 385 388 err() << " testing Forward features" << std::endl; 386 389 387 390 typename std::iterator_traits<ForwardIterator>::value_type tmp = *iter; 388 391 // testing multiple traversing is possible and does not change the data … … 394 397 add(tmp==*iter); 395 398 } 396 399 397 400 template<typename BidirectionalIterator> 398 401 void Suite::test_bidirectional_iterator(BidirectionalIterator iter) … … 433 436 err() << "operator-(int) failed" << std::endl; 434 437 add(++iter2 == iter3); 435 438 436 439 RandomAccessIterator iter5 = iter + 0; 437 440 RandomAccessIterator iter6 = 0 + iter; 438 441 add(iter6 == iter5); 439 442 440 443 RandomAccessIterator iter7 = iter - 0; 441 444 add(iter7 == iter); 442 445 add(iter7 - iter == 0); 443 446 add(! (iter7<iter)); 444 447 445 448 typename RandomAccessIterator::value_type tmp = iter[0]; 446 449 typename RandomAccessIterator::value_type tmp2 = *iter; … … 490 493 column_iterator ci = mc.begin_column(0); 491 494 row_iterator ri = mc.begin_row(0); 492 *i = *ci; 493 *ci = *i; 494 *ri = *i; 495 *i = *ci; 496 *ci = *i; 497 *ri = *i; 495 498 i = mc.end(); 496 499 ci = mc.end_column(0);
Note: See TracChangeset
for help on using the changeset viewer.