RangeForWrapper_test.cc
Go to the documentation of this file.
1 /**
2  * @file RangeForWrapper_test.cc
3  * @brief Test for RangeForWrapper utilities
4  * @author Gianluca Petrillo (petrillo@fnal.gov)
5  * @date December 29, 2016
6  * @see RangeForWrapper.h
7  *
8  * The test is run with no arguments.
9  *
10  */
11 
12 // LArSoft libraries
14 
15 // Boost libraries
16 #define BOOST_TEST_MODULE ( RangeForWrapper_test )
17 #include <boost/test/unit_test.hpp>
18 
19 // C/C++ standard libraries
20 #include <iterator>
21 #include <numeric> // std::accumulate()
22 #include <limits> // std::numeric_limits<>
23 #include <type_traits> // std::is_same<>, std::is_lvalue_reference<>, ...
24 #include <initializer_list>
25 
26 
27 //------------------------------------------------------------------------------
28 //--- make up a class with begin and end iterators with different types
29 //---
30 
31 template <typename Value>
33  using traits_t = std::iterator_traits<Value*>;
34  public:
35  using difference_type = typename traits_t::difference_type;
36  using value_type = typename traits_t::value_type;
37  using pointer = typename traits_t::pointer;
38  using reference = typename traits_t::reference;
39  using iterator_category = typename traits_t::iterator_category;
40 
42 
43  base_iterator(pointer ptr = nullptr): ptr(ptr) {}
44 
45  reference operator* () const { return *ptr; }
46  pointer operator-> () const { return ptr; }
47 
48  base_iterator& operator++ () { ++ptr; return *this; }
49  base_iterator& operator-- () { --ptr; return *this; }
50 
51  reference operator[] (difference_type offset) const { return ptr[offset]; }
52 
54  { return ptr - other.ptr; }
55 
56 };
57 
58 template <typename ValueL, typename ValueR>
60  { return a.ptr != b.ptr; }
61 
63 struct end_iterator_t : base_iterator<int> {};
64 
65 struct begin_const_iterator_t : base_iterator<int const> {};
66 struct end_const_iterator_t : base_iterator<int const> {};
67 
70 BOOST_TEST_DONT_PRINT_LOG_VALUE(wrapper_type)
71 BOOST_TEST_DONT_PRINT_LOG_VALUE(const_wrapper_type)
72 
73 struct Data {
74  std::vector<int> data;
75 
80 
81  Data(std::initializer_list<int> data): data(data) {}
82 
83  begin_const_iterator begin() const { return { &*data.cbegin() }; }
84  begin_iterator begin() { return { &*data.begin() }; }
85  end_const_iterator end() const { return { &*data.cend() }; }
86  end_iterator end() { return { &*data.end() }; }
87 
88  bool empty() const { return data.empty(); }
89  auto size() const { return data.size(); }
90  auto operator[](std::size_t index) -> decltype(auto)
91  { return data[index]; }
92  auto operator[](std::size_t index) const -> decltype(auto)
93  { return data[index]; }
94 
95 }; // class Data
96 
97 template <typename T>
98 T copy(T const& v) { return v; }
99 
100 
101 //------------------------------------------------------------------------------
102 
103 template <typename DataColl>
104 void const_test(DataColl const& data, int expected_total)
105 {
106  static_assert(
107  !std::is_lvalue_reference
108  <decltype(copy(data) | util::range_for)>::value,
109  "util::range_for on a rvalue should return a rvalue"
110  );
111 
112  int total = 0;
113  for (int d: data | util::range_for) total += d;
114 
115  BOOST_TEST(total == expected_total);
116 
117  // from a temporary
118  total = 0;
119  for (int d: copy(data) | util::range_for) total += d;
120 
121  BOOST_TEST(total == expected_total);
122 
123 } // const_test()
124 
125 
126 template <typename DataColl>
127 void test(DataColl& data, int expected_total) {
128  static_assert(
129  !std::is_lvalue_reference
130  <decltype(copy(data) | util::range_for)>::value,
131  "util::range_for on a rvalue should return a rvalue"
132  );
133 
134  //
135  // from a lvalue
136  //
137  int total = 0;
138  for (int d: data | util::range_for) total += d;
139 
140  BOOST_TEST(total == expected_total);
141 
142  //
143  // from a rvalue (temporary)
144  //
145  total = 0;
146  for (int d: copy(data) | util::range_for) total += d;
147 
148  BOOST_TEST(total == expected_total);
149 
150  //
151  // from a temporary, which is changed
152  //
153  total = 0;
154  for (int& d: copy(data) | util::range_for) total += (d *= 3);
155 
156  BOOST_TEST(total == 3 * expected_total);
157 
158  // original value is still unchanged
159  total = 0;
160  for (int d: data | util::range_for) total += d;
161 
162  BOOST_TEST(total == expected_total);
163 
164  //
165  // from a lvalue, which is changed
166  //
167  for (int& d: data | util::range_for) d *= 3;
168 
169  total = 0;
170  for (int d: data | util::range_for) total += d;
171 
172  BOOST_TEST(total == 3 * expected_total);
173 
174 } // test()
175 
176 
177 //-----------------------------------------------------------------------------
178 // iterator tests
179 
180 template <typename Iter, typename RefIter>
181 void iterator_tests
182  (Iter iter, RefIter refIter, RefIter refEnd)
183 {
184  // these asserts do not completely test the concepts;
185  // for example, the copy-constructable concept requires that the value of
186  // the copy-constructed object and the one it was constructed from are
187  // "equivalent", while std::is_copy_constructable only guarantees that
188  // copy construction can happen, not testing the equivalence.
189  static_assert
190  (std::is_move_constructible<Iter>(), "Iterator concept violation");
191  static_assert
192  (std::is_copy_constructible<Iter>(), "Iterator concept violation");
193  static_assert
194  (std::is_copy_assignable<Iter>(), "Iterator concept violation");
195  static_assert
196  (std::is_destructible<Iter>(), "Iterator concept violation");
197  // C++17
198 // static_assert
199 // (std::is_swappable<Iter>(), "Iterator concept violation");
200 
201  const bool isEnd = refIter == refEnd;
202  const bool isSingular = (iter == Iter());
203  const bool isDereferenciable = !isEnd && !isSingular;
204  const bool isLast = (std::next(refIter) == refEnd);
205 
206  Iter ia = iter;
207  BOOST_TEST(bool(ia == iter));
208 
209  if (isDereferenciable) {
210  //BOOST_TEST(*iter == *refIter);
211  BOOST_TEST((*iter == *refIter));
212  }
213  if (!isLast && !isEnd && !isSingular) {
214  //BOOST_TEST(*++iter == *++refIter);
215  BOOST_TEST((*++iter == *++refIter));
216  }
217 
218 } // iterator_tests()
219 
220 
221 template <typename Iter, typename RefIter>
223  (Iter iter, RefIter refIter, RefIter refEnd)
224 {
225  const bool isEnd = refIter == refEnd;
226  const bool isSingular = (iter == Iter());
227  const bool isNormal = !isEnd && !isSingular;
228 // const bool isDereferenciable = isNormal;
229  const bool isLast = (std::next(refIter) == refEnd);
230 
231  static_assert(std::is_same<
232  typename std::iterator_traits<Iter>::reference,
233  decltype(Iter(iter).operator*())
234  >(), "Inconsistent return type for dereference operator");
235 
236  if (!isEnd) {
237  auto ia = iter;
238  if (!isSingular) BOOST_TEST(++ia != iter);
239  }
240 
241  if (isNormal) {
242  auto ia = iter, ib = iter;
243  ia++; ++ib;
244  BOOST_TEST(ia == ib);
245  if (!isLast) {
246  auto ia = iter;
247  BOOST_TEST(*(ia++) == *iter);
248  }
249  }
250 
251  {
252  auto ia = iter;
253  if (!isEnd)
254  (void)ia++;
255  }
256 
257 
258 } // const_input_iterator_tests()
259 
260 template <typename Iter, typename RefIter>
262  (Iter iter, RefIter refIter, RefIter refEnd)
263 {
264  const_input_iterator_tests(iter, refIter, refEnd);
265 } // input_iterator_tests()
266 
267 
268 template <typename Iter, typename RefIter>
270  (Iter iter, RefIter refIter, RefIter refEnd)
271 {
272  const bool isEnd = refIter == refEnd;
273  const bool isSingular = (iter == Iter());
274  const bool isNormal = !isEnd && !isSingular;
275 // const bool isDereferenciable = isNormal;
276 // const bool isLast = (std::next(refIter) == refEnd);
277 
278  static_assert(std::is_same<
279  typename std::iterator_traits<Iter>::reference,
280  decltype(Iter(iter).operator*())
281  >(), "Inconsistent return type for dereference operator");
282 
283  if (!isEnd) {
284  auto ia = iter;
285  auto addr = &ia;
286  if (!isSingular) {
287  BOOST_TEST((++ia != iter));
288  BOOST_TEST((&++ia == addr));
289  }
290  }
291 
292  if (isNormal) {
293  auto ia = iter, ib = iter;
294  ia++; ++ib;
295  BOOST_TEST(ia == ib);
296  }
297 
298  {
299  auto ia = iter;
300  if (!isEnd) (void)ia++;
301  }
302 
303 
304 } // const_output_iterator_tests()
305 
306 template <typename Iter, typename RefIter>
308  (Iter iter, RefIter refIter, RefIter refEnd)
309 {
310  const bool isEnd = refIter == refEnd;
311 
312  const_output_iterator_tests(iter, refIter, refEnd);
313 
314  if (!isEnd) {
315  auto value = *iter;
316 
318 
319  *iter = newValue;
320 
321  // we couldn't check the result since an output operator is not expected
322  // to return anything useful with *iter; but since we have already used it
323  // to store the old value...
324  BOOST_TEST((*iter == newValue));
325 
326  *iter = value;
327  BOOST_TEST((*iter == value));
328 
329  auto ia = iter, ib = iter;
330 
331  *ia++ = newValue;
332  ++ib;
333  BOOST_TEST((*iter == newValue));
334  BOOST_TEST(ia == ib);
335 
336  *iter = value;
337  BOOST_TEST((*iter == value));
338  }
339 
340 } // output_iterator_tests()
341 
342 
343 template <typename Iter, typename RefIter>
345  (Iter iter, RefIter refIter, RefIter refEnd)
346 {
347  const bool isEnd = refIter == refEnd;
348  const bool isSingular = (iter == Iter());
349  const bool isNormal = !isEnd && !isSingular;
350  const bool isDereferenciable = isNormal;
351 
352  static_assert(std::is_default_constructible<Iter>(),
353  "Forward iterator concept violation");
354 
355  using traits_t = std::iterator_traits<Iter>;
356  using dereference_t = std::remove_reference_t<decltype(*iter)>;
357  constexpr bool isConst = std::is_const<dereference_t>();
358 
359  static_assert(
360  std::is_same<
361  typename traits_t::reference,
362  std::add_lvalue_reference_t<
363  std::conditional_t<isConst,
364  std::add_const_t<typename traits_t::value_type>,
365  typename traits_t::value_type
366  >
367  >
368  >(),
369  "Forward iterator concept violation"
370  );
371 
372  if (isDereferenciable) {
373  auto ia = iter, ib = iter;
374 
375  BOOST_TEST((ia == ib));
376 
377  BOOST_TEST((&*ia == &*ib));
378 
379  BOOST_TEST((++ia == ++ib));
380 
381  }
382 
383 } // const_forward_iterator_tests()
384 
385 template <typename Iter, typename RefIter>
387  (Iter iter, RefIter refIter, RefIter refEnd)
388 {
389  const_forward_iterator_tests(iter, refIter, refEnd);
390 } // forward_iterator_tests()
391 
392 
393 template <typename Iter, typename RefIter>
395  (Iter iter, RefIter refIter, RefIter refEnd)
396 {
397  const bool isEnd = refIter == refEnd;
398 // const bool isLast = std::next(refIter) == refEnd;
399  const bool isSingular = (iter == Iter());
400  const bool isNormal = !isEnd && !isSingular;
401  const bool isDereferenciable = isNormal;
402 
403  auto ia = isEnd? iter: std::next(iter);
404  auto iaRef = isEnd? refIter: std::next(refIter);
405 
406  auto ib = ia;
407  --ib;
408  BOOST_TEST((ib != ia));
409  BOOST_TEST((*ib == *std::prev(iaRef)));
410  BOOST_TEST((++ib == ia));
411  if (isDereferenciable) BOOST_TEST((*ib == *iaRef));
412 
413  ib--;
414  BOOST_TEST((ib != ia));
415  BOOST_TEST((*ib == *std::prev(iaRef)));
416  BOOST_TEST((++ib == ia));
417  if (isDereferenciable) BOOST_TEST((*ib == *iaRef));
418 
419 } // const_bidirectional_iterator_tests()
420 
421 template <typename Iter, typename RefIter>
423  (Iter iter, RefIter refIter, RefIter refEnd)
424 {
425  const_bidirectional_iterator_tests(iter, refIter, refEnd);
426 } // bidirectional_iterator_tests()
427 
428 
429 template <typename Iter, typename RefIter>
431  (Iter iter, RefIter refIter, RefIter refEnd)
432 {
433 } // const_random_access_iterator_tests()
434 
435 template <typename Iter, typename RefIter>
437  (Iter iter, RefIter refIter, RefIter refEnd)
438 {
439  const_random_access_iterator_tests(iter, refIter, refEnd);
440 } // random_access_iterator_tests()
441 
442 
443 //
444 // dispatching
445 //
446 template <bool IsConst, typename Iter, typename RefIter>
447 std::enable_if_t<IsConst> iterator_test_impl
448  (Iter iter, RefIter refIter, RefIter refEnd, std::input_iterator_tag)
449 {
450  iterator_tests(iter, refIter, refEnd);
451  const_input_iterator_tests(iter, refIter, refEnd);
452 } // iterator_test_impl<const>(input iterator)
453 
454 
455 template <bool IsConst, typename Iter, typename RefIter>
456 std::enable_if_t<!IsConst> iterator_test_impl
457  (Iter iter, RefIter refIter, RefIter refEnd, std::input_iterator_tag tag)
458 {
459  iterator_tests(iter, refIter, refEnd);
460  input_iterator_tests(iter, refIter, refEnd);
461 } // iterator_test_impl<non-const>(input iterator)
462 
463 
464 template <bool IsConst, typename Iter, typename RefIter>
465 std::enable_if_t<IsConst> iterator_test_impl
466  (Iter iter, RefIter refIter, RefIter refEnd, std::output_iterator_tag)
467 {
468  iterator_tests(iter, refIter, refEnd);
469  const_output_iterator_tests(iter, refIter, refEnd);
470 } // iterator_test_impl<const>(output iterator)
471 
472 
473 template <bool IsConst, typename Iter, typename RefIter>
474 std::enable_if_t<!IsConst> iterator_test_impl
475  (Iter iter, RefIter refIter, RefIter refEnd, std::output_iterator_tag tag)
476 {
477  iterator_tests(iter, refIter, refEnd);
478  output_iterator_tests(iter, refIter, refEnd);
479 } // iterator_test_impl<non-const>(output iterator)
480 
481 
482 template <bool IsConst, typename Iter, typename RefIter>
483 std::enable_if_t<IsConst> iterator_test_impl
484  (Iter iter, RefIter refIter, RefIter refEnd, std::forward_iterator_tag)
485 {
486  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::input_iterator_tag{});
487  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::output_iterator_tag{});
488  const_forward_iterator_tests(iter, refIter, refEnd);
489 } // iterator_test_impl<const>(random access iterator)
490 
491 
492 template <bool IsConst, typename Iter, typename RefIter>
493 std::enable_if_t<!IsConst> iterator_test_impl
494  (Iter iter, RefIter refIter, RefIter refEnd, std::forward_iterator_tag tag)
495 {
496  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::input_iterator_tag{});
497  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::output_iterator_tag{});
498  forward_iterator_tests(iter, refIter, refEnd);
499 } // iterator_test_impl<non-const>(forward iterator)
500 
501 
502 template <bool IsConst, typename Iter, typename RefIter>
503 std::enable_if_t<IsConst> iterator_test_impl
504  (Iter iter, RefIter refIter, RefIter refEnd, std::bidirectional_iterator_tag)
505 {
506  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::forward_iterator_tag{});
507  const_random_access_iterator_tests(iter, refIter, refEnd);
508 } // iterator_test_impl<const>(forward iterator)
509 
510 
511 template <bool IsConst, typename Iter, typename RefIter>
512 std::enable_if_t<!IsConst> iterator_test_impl
513  (Iter iter, RefIter refIter, RefIter refEnd, std::bidirectional_iterator_tag tag)
514 {
515  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::forward_iterator_tag{});
516  bidirectional_iterator_tests(iter, refIter, refEnd);
517 } // iterator_test_impl<non-const>(bidirectional iterator)
518 
519 
520 template <bool IsConst, typename Iter, typename RefIter>
521 std::enable_if_t<IsConst> iterator_test_impl
522  (Iter iter, RefIter refIter, RefIter refEnd, std::random_access_iterator_tag)
523 {
524  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::bidirectional_iterator_tag{});
525  const_bidirectional_iterator_tests(iter, refIter, refEnd);
526 } // iterator_test_impl<const>(bidirectional iterator)
527 
528 
529 template <bool IsConst, typename Iter, typename RefIter>
530 std::enable_if_t<!IsConst> iterator_test_impl
531  (Iter iter, RefIter refIter, RefIter refEnd, std::random_access_iterator_tag tag)
532 {
533  iterator_test_impl<IsConst>(iter, refIter, refEnd, std::bidirectional_iterator_tag{});
534  random_access_iterator_tests(iter, refIter, refEnd);
535 } // iterator_test_impl<non-const>(random access iterator)
536 
537 
538 template <typename Iter, typename RefIter>
539 void iterator_test(Iter iter, RefIter refIter, RefIter refEnd) {
540  //
541  // dispatcher
542  //
543  using traits_t = std::iterator_traits<Iter>;
544  constexpr bool IsConst
545  = std::is_const<std::remove_reference_t<decltype(*iter)>>();
546 
547  iterator_test_impl<IsConst>
548  (iter, refIter, refEnd, typename traits_t::iterator_category{});
549 
550 } // iterator_test()
551 
552 
553 template <bool IsConst>
555 
556  using base_reference_container_t = std::vector<int>;
557  using reference_container_t = std::conditional_t
558  <IsConst, base_reference_container_t const, base_reference_container_t>;
559  reference_container_t vdata = { 2, 3, 4 };
560  using basic_container_t = Data;
561 
562  static_assert(std::is_same<basic_container_t::begin_iterator::reference, int&>());
563  static_assert(std::is_same<typename std::iterator_traits<basic_container_t::begin_iterator>::reference, int&>());
564 
565  static_assert(std::is_same<basic_container_t::begin_const_iterator::reference, std::add_const_t<int>&>());
566  static_assert(std::is_same<typename std::iterator_traits<basic_container_t::begin_const_iterator>::reference, std::add_const_t<int>&>());
567 
568  using container_t
569  = std::conditional_t<IsConst, basic_container_t const, basic_container_t>;
570  //
571  // non-const iterator interface (iterators may still be constant)
572  //
573  container_t data = { 2, 3, 4 };
574  auto range = data | util::range_for;
575  using std::begin;
576  using std::end;
577  auto rbegin = begin(range);
578  auto rend = end(range);
579 
580  auto vbegin = vdata.begin();
581  auto vend = vdata.end();
582 
583  BOOST_TEST((unsigned)std::distance(rbegin, rend) == vdata.size());
584 
585  iterator_test(rbegin, vbegin, vend);
586  iterator_test(rend, vend, vend);
587 
588 
589  //
590  // const iterator interface
591  //
592  using std::cbegin;
593  using std::cend;
594  auto rcbegin = cbegin(range);
595  auto rcend = cend(range);
596 
597  auto vcbegin = vdata.cbegin();
598  auto vcend = vdata.cend();
599 
600  BOOST_TEST((unsigned)std::distance(rcbegin, rcend) == vdata.size());
601 
602  iterator_test(rcbegin, vcbegin, vcend);
603  iterator_test(rcend, vcend, vcend);
604 
605  //
606  // extra access (partial support for random access)
607  //
608  BOOST_TEST(range.size() == data.size());
609  BOOST_TEST(range.empty() == data.empty());
610  for (std::size_t i = 0; i < data.size(); ++i) {
611  BOOST_TEST(range[i] == data[i]);
612  }
613 
614 } // RangeForWrapperIteratorStandardsTest()
615 
616 
617 //-----------------------------------------------------------------------------
618 BOOST_AUTO_TEST_CASE(RangeForWrapperSameIterator_test) {
619 
620  std::vector vdata { 2, 3, 4 };
621 
622  // static checks
623  static_assert(std::is_same<
624  std::decay_t<decltype(vdata)>,
625  std::decay_t<decltype(vdata | util::range_for)>
626  >::value,
627  "util::range_for should be pass-through!"
628  );
629  static_assert(
630  std::is_lvalue_reference<decltype(vdata | util::range_for)>::value,
631  "Pass-through on a lvalue should return a lvalue reference"
632  );
633 
634  static_assert(
635  !std::is_lvalue_reference
636  <decltype(copy(vdata) | util::range_for)>::value,
637  "Pass-through on a rvalue should return a rvalue (or its reference)"
638  );
639 
640  BOOST_TEST(&vdata == &(vdata | util::range_for));
641 
642  auto const expected_total = std::accumulate(vdata.begin(), vdata.end(), 0);
643 
644  const_test(vdata, expected_total);
645 
646  test(vdata, expected_total);
647 
648 } // BOOST_AUTO_TEST_CASE(RangeForWrapperSameIterator_test_test)
649 
650 
651 BOOST_AUTO_TEST_CASE(RangeForWrapperDifferentIterator_test) {
652 
653  std::vector vdata { 2, 3, 4 };
654 
655  Data data { 2, 3, 4 };
656 
657  auto expected_total = std::accumulate(vdata.begin(), vdata.end(), 0);
658 
659  // static check
660  static_assert(!std::is_same<
661  std::decay_t<decltype(data)>,
662  std::decay_t<decltype(data | util::range_for)>
663  >::value,
664  "util::range_for should generate a wrapper!"
665  );
666 
667 // for (double d: data); // this should fail compilation
668 
669  const_test(data, expected_total);
670 
671  test(data, expected_total);
672 
673 } // BOOST_AUTO_TEST_CASE(RangeForWrapperDifferentIterator_test_test)
674 
675 
676 BOOST_AUTO_TEST_CASE(RangeForWrapperIteratorStandardsTestCase) {
677 
678  RangeForWrapperIteratorStandardsTest<false>(); // mutable range test
679  RangeForWrapperIteratorStandardsTest<true>(); // constant range test
680 
681 } // BOOST_AUTO_TEST_CASE(RangeForWrapperIteratorStandardsTestCase)
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
auto size() const
void const_bidirectional_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
bool empty() const
base_iterator & operator--()
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
Definition: StdUtils.h:87
begin_iterator begin()
void const_random_access_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
std::enable_if_t< IsConst > iterator_test_impl(Iter iter, RefIter refIter, RefIter refEnd, std::input_iterator_tag)
typename traits_t::value_type value_type
Utility function to enable range-for on different type iterators.
base_iterator & operator++()
struct vector vector
reference operator[](difference_type offset) const
typename traits_t::reference reference
void const_output_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
end_const_iterator end() const
void random_access_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
typename traits_t::iterator_category iterator_category
void RangeForWrapperIteratorStandardsTest()
void forward_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
auto operator[](std::size_t index) const -> decltype(auto)
constexpr RangeForWrapperTag range_for
auto operator[](std::size_t index) -> decltype(auto)
const double a
void const_input_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
bool operator!=(base_iterator< ValueL > const &a, base_iterator< ValueR > const &b)
void const_test(DataColl const &data, int expected_total)
double distance(double x1, double y1, double z1, double x2, double y2, double z2)
static int max(int a, int b)
typename traits_t::pointer pointer
end_iterator end()
void const_forward_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
void test(DataColl &data, int expected_total)
void output_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
difference_type operator-(base_iterator const &other) const
BOOST_AUTO_TEST_CASE(RangeForWrapperSameIterator_test)
pointer operator->() const
Fw2dFFT::Data Data
void input_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
base_iterator(pointer ptr=nullptr)
void iterator_test(Iter iter, RefIter refIter, RefIter refEnd)
Data(std::initializer_list< int > data)
typename traits_t::difference_type difference_type
std::vector< int > data
T copy(T const &v)
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
Definition: StdUtils.h:82
begin_const_iterator begin() const
static bool * b
Definition: config.cpp:1043
void iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
constexpr std::enable_if_t< are_cv_compatible< TO, FROM >::value, std::add_pointer_t< std::remove_pointer_t< TO > > > addr(FROM &from)
Definition: ensurePointer.h:35
reference operator*() const
void bidirectional_iterator_tests(Iter iter, RefIter refIter, RefIter refEnd)
std::iterator_traits< int const * > traits_t