• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// (C) Copyright Dave Abrahams and Thomas Becker 2003. Distributed
2// under the Boost Software License, Version 1.0. (See accompanying
3// file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5//
6
7// File:
8// =====
9// zip_iterator_test_main.cpp
10
11// Author:
12// =======
13// Thomas Becker
14
15// Created:
16// ========
17// Jul 15, 2003
18
19// Purpose:
20// ========
21// Test driver for zip_iterator.hpp
22
23// Compilers Tested:
24// =================
25// Metrowerks Codewarrior Pro 7.2, 8.3
26// gcc 2.95.3
27// gcc 3.2
28// Microsoft VC 6sp5 (test fails due to some compiler bug)
29// Microsoft VC 7 (works)
30// Microsoft VC 7.1
31// Intel 5
32// Intel 6
33// Intel 7.1
34// Intel 8
35// Borland 5.5.1 (broken due to lack of support from Boost.Tuples)
36
37/////////////////////////////////////////////////////////////////////////////
38//
39// Includes
40//
41/////////////////////////////////////////////////////////////////////////////
42
43#include <boost/iterator/zip_iterator.hpp>
44#include <boost/iterator/zip_iterator.hpp> // 2nd #include tests #include guard.
45#include <iostream>
46#include <vector>
47#include <list>
48#include <set>
49#include <string>
50#include <functional>
51#include <boost/iterator/transform_iterator.hpp>
52#include <boost/iterator/is_readable_iterator.hpp>
53#include <boost/type_traits/is_same.hpp>
54#include <boost/detail/workaround.hpp>
55#include <stddef.h>
56
57
58/// Tests for https://svn.boost.org/trac/boost/ticket/1517
59int to_value(int const &v)
60{
61    return v;
62}
63
64void category_test()
65{
66    std::list<int> rng1;
67    std::string rng2;
68
69    boost::make_zip_iterator(
70        ZI_MAKE_TUPLE(
71            boost::make_transform_iterator(rng1.begin(), &to_value), // BidirectionalInput
72            rng2.begin() // RandomAccess
73        )
74    );
75}
76///
77
78/////////////////////////////////////////////////////////////////////////////
79//
80// Das Main Funktion
81//
82/////////////////////////////////////////////////////////////////////////////
83
84int main( void )
85{
86
87  category_test();
88
89  std::cout << "\n"
90            << "***********************************************\n"
91            << "*                                             *\n"
92            << "* Test driver for boost::zip_iterator         *\n"
93            << "* Copyright Thomas Becker 2003                *\n"
94            << "*                                             *\n"
95            << "***********************************************\n\n"
96            << std::flush;
97
98  size_t num_successful_tests = 0;
99  size_t num_failed_tests = 0;
100
101  /////////////////////////////////////////////////////////////////////////////
102  //
103  // Zip iterator construction and dereferencing
104  //
105  /////////////////////////////////////////////////////////////////////////////
106
107  std::cout << "Zip iterator construction and dereferencing: "
108            << std::flush;
109
110  std::vector<double> vect1(3);
111  vect1[0] = 42.;
112  vect1[1] = 43.;
113  vect1[2] = 44.;
114
115  std::set<int> intset;
116  intset.insert(52);
117  intset.insert(53);
118  intset.insert(54);
119  //
120
121  typedef
122  boost::zip_iterator<
123      ZI_TUPLE<
124          std::set<int>::iterator
125        , std::vector<double>::iterator
126      >
127  > zit_mixed;
128
129  zit_mixed zip_it_mixed = zit_mixed(
130    ZI_MAKE_TUPLE(
131        intset.begin()
132      , vect1.begin()
133    )
134  );
135
136  ZI_TUPLE<int, double> val_tuple(
137      *zip_it_mixed);
138
139  ZI_TUPLE<const int&, double&> ref_tuple(
140      *zip_it_mixed);
141
142  double dblOldVal = ZI_TUPLE_GET(1)(ref_tuple);
143  ZI_TUPLE_GET(1)(ref_tuple) -= 41.;
144
145  if( 52 == ZI_TUPLE_GET(0)(val_tuple) &&
146      42. == ZI_TUPLE_GET(1)(val_tuple) &&
147      52 == ZI_TUPLE_GET(0)(ref_tuple)  &&
148      1. == ZI_TUPLE_GET(1)(ref_tuple)  &&
149      1. == *vect1.begin()
150    )
151  {
152    ++num_successful_tests;
153    std::cout << "OK" << std::endl;
154  }
155  else
156  {
157    ++num_failed_tests;
158    std::cout << "not OK" << std::endl;
159  }
160
161  // Undo change to vect1
162  ZI_TUPLE_GET(1)(ref_tuple) = dblOldVal;
163
164#if defined(ZI_USE_BOOST_TUPLE)
165
166  /////////////////////////////////////////////////////////////////////////////
167  //
168  // Zip iterator with 12 components
169  //
170  /////////////////////////////////////////////////////////////////////////////
171
172  std::cout << "Zip iterators with 12 components:            "
173            << std::flush;
174
175  // Declare 12 containers
176  //
177  std::list<int> li1;
178  li1.push_back(1);
179  std::set<int> se1;
180  se1.insert(2);
181  std::vector<int> ve1;
182  ve1.push_back(3);
183  //
184  std::list<int> li2;
185  li2.push_back(4);
186  std::set<int> se2;
187  se2.insert(5);
188  std::vector<int> ve2;
189  ve2.push_back(6);
190  //
191  std::list<int> li3;
192  li3.push_back(7);
193  std::set<int> se3;
194  se3.insert(8);
195  std::vector<int> ve3;
196  ve3.push_back(9);
197  //
198  std::list<int> li4;
199  li4.push_back(10);
200  std::set<int> se4;
201  se4.insert(11);
202  std::vector<int> ve4;
203  ve4.push_back(12);
204
205  // typedefs for cons lists of iterators.
206  typedef boost::tuples::cons<
207    std::set<int>::iterator,
208    ZI_TUPLE<
209      std::vector<int>::iterator,
210      std::list<int>::iterator,
211      std::set<int>::iterator,
212      std::vector<int>::iterator,
213      std::list<int>::iterator,
214      std::set<int>::iterator,
215      std::vector<int>::iterator,
216      std::list<int>::iterator,
217      std::set<int>::iterator,
218      std::vector<int>::const_iterator
219      >::inherited
220    > cons_11_its_type;
221  //
222  typedef boost::tuples::cons<
223    std::list<int>::const_iterator,
224    cons_11_its_type
225    > cons_12_its_type;
226
227  // typedefs for cons lists for dereferencing the zip iterator
228  // made from the cons list above.
229  typedef boost::tuples::cons<
230    const int&,
231    ZI_TUPLE<
232      int&,
233      int&,
234      const int&,
235      int&,
236      int&,
237      const int&,
238      int&,
239      int&,
240      const int&,
241      const int&
242      >::inherited
243    > cons_11_refs_type;
244  //
245  typedef boost::tuples::cons<
246    const int&,
247    cons_11_refs_type
248    > cons_12_refs_type;
249
250  // typedef for zip iterator with 12 elements
251  typedef boost::zip_iterator<cons_12_its_type> zip_it_12_type;
252
253  // Declare a 12-element zip iterator.
254  zip_it_12_type zip_it_12(
255    cons_12_its_type(
256      li1.begin(),
257      cons_11_its_type(
258        se1.begin(),
259        ZI_MAKE_TUPLE(
260          ve1.begin(),
261          li2.begin(),
262          se2.begin(),
263          ve2.begin(),
264          li3.begin(),
265          se3.begin(),
266          ve3.begin(),
267          li4.begin(),
268          se4.begin(),
269          ve4.begin()
270          )
271        )
272      )
273    );
274
275  // Dereference, mess with the result a little.
276  cons_12_refs_type zip_it_12_dereferenced(*zip_it_12);
277  ZI_TUPLE_GET(9)(zip_it_12_dereferenced) = 42;
278
279  // Make a copy and move it a little to force some instantiations.
280  zip_it_12_type zip_it_12_copy(zip_it_12);
281  ++zip_it_12_copy;
282
283  if( ZI_TUPLE_GET(11)(zip_it_12.get_iterator_tuple()) == ve4.begin() &&
284      ZI_TUPLE_GET(11)(zip_it_12_copy.get_iterator_tuple()) == ve4.end() &&
285      1 == ZI_TUPLE_GET(0)(zip_it_12_dereferenced) &&
286      12 == ZI_TUPLE_GET(11)(zip_it_12_dereferenced) &&
287      42 == *(li4.begin())
288    )
289  {
290    ++num_successful_tests;
291    std::cout << "OK" << std::endl;
292  }
293  else
294  {
295    ++num_failed_tests;
296    std::cout << "not OK" << std::endl;
297  }
298
299#endif
300
301  /////////////////////////////////////////////////////////////////////////////
302  //
303  // Zip iterator incrementing and dereferencing
304  //
305  /////////////////////////////////////////////////////////////////////////////
306
307  std::cout << "Zip iterator ++ and *:                       "
308            << std::flush;
309
310  std::vector<double> vect2(3);
311  vect2[0] = 2.2;
312  vect2[1] = 3.3;
313  vect2[2] = 4.4;
314
315  boost::zip_iterator<
316    ZI_TUPLE<
317      std::vector<double>::const_iterator,
318      std::vector<double>::const_iterator
319      >
320    >
321  zip_it_begin(
322    ZI_MAKE_TUPLE(
323     vect1.begin(),
324     vect2.begin()
325     )
326  );
327
328  boost::zip_iterator<
329    ZI_TUPLE<
330      std::vector<double>::const_iterator,
331      std::vector<double>::const_iterator
332      >
333    >
334  zip_it_run(
335    ZI_MAKE_TUPLE(
336     vect1.begin(),
337     vect2.begin()
338     )
339  );
340
341  boost::zip_iterator<
342    ZI_TUPLE<
343      std::vector<double>::const_iterator,
344      std::vector<double>::const_iterator
345      >
346    >
347  zip_it_end(
348    ZI_MAKE_TUPLE(
349     vect1.end(),
350     vect2.end()
351     )
352  );
353
354  if( zip_it_run == zip_it_begin &&
355      42. == ZI_TUPLE_GET(0)(*zip_it_run) &&
356      2.2 == ZI_TUPLE_GET(1)(*zip_it_run) &&
357      43. == ZI_TUPLE_GET(0)(*(++zip_it_run)) &&
358      3.3 == ZI_TUPLE_GET(1)(*zip_it_run) &&
359      44. == ZI_TUPLE_GET(0)(*(++zip_it_run)) &&
360      4.4 == ZI_TUPLE_GET(1)(*zip_it_run) &&
361      zip_it_end == ++zip_it_run
362    )
363  {
364    ++num_successful_tests;
365    std::cout << "OK" << std::endl;
366  }
367  else
368  {
369    ++num_failed_tests;
370    std::cout << "not OK" << std::endl;
371  }
372
373  /////////////////////////////////////////////////////////////////////////////
374  //
375  // Zip iterator decrementing and dereferencing
376  //
377  /////////////////////////////////////////////////////////////////////////////
378
379  std::cout << "Zip iterator -- and *:                       "
380            << std::flush;
381
382  if( zip_it_run == zip_it_end &&
383      zip_it_end == zip_it_run-- &&
384      44. == ZI_TUPLE_GET(0)(*zip_it_run) &&
385      4.4 == ZI_TUPLE_GET(1)(*zip_it_run) &&
386      43. == ZI_TUPLE_GET(0)(*(--zip_it_run)) &&
387      3.3 == ZI_TUPLE_GET(1)(*zip_it_run) &&
388      42. == ZI_TUPLE_GET(0)(*(--zip_it_run)) &&
389      2.2 == ZI_TUPLE_GET(1)(*zip_it_run) &&
390      zip_it_begin == zip_it_run
391    )
392  {
393    ++num_successful_tests;
394    std::cout << "OK" << std::endl;
395  }
396  else
397  {
398    ++num_failed_tests;
399    std::cout << "not OK" << std::endl;
400  }
401
402  /////////////////////////////////////////////////////////////////////////////
403  //
404  // Zip iterator copy construction and equality
405  //
406  /////////////////////////////////////////////////////////////////////////////
407
408  std::cout << "Zip iterator copy construction and equality: "
409            << std::flush;
410
411  boost::zip_iterator<
412    ZI_TUPLE<
413      std::vector<double>::const_iterator,
414      std::vector<double>::const_iterator
415      >
416    > zip_it_run_copy(zip_it_run);
417
418  if(zip_it_run == zip_it_run && zip_it_run == zip_it_run_copy)
419  {
420    ++num_successful_tests;
421    std::cout << "OK" << std::endl;
422  }
423  else
424  {
425    ++num_failed_tests;
426    std::cout << "not OK" << std::endl;
427  }
428
429  /////////////////////////////////////////////////////////////////////////////
430  //
431  // Zip iterator inequality
432  //
433  /////////////////////////////////////////////////////////////////////////////
434
435  std::cout << "Zip iterator inequality:                     "
436            << std::flush;
437
438  if(!(zip_it_run != zip_it_run_copy) && zip_it_run != ++zip_it_run_copy)
439  {
440    ++num_successful_tests;
441    std::cout << "OK" << std::endl;
442  }
443  else
444  {
445    ++num_failed_tests;
446    std::cout << "not OK" << std::endl;
447  }
448
449  /////////////////////////////////////////////////////////////////////////////
450  //
451  // Zip iterator less than
452  //
453  /////////////////////////////////////////////////////////////////////////////
454
455  std::cout << "Zip iterator less than:                      "
456            << std::flush;
457
458  // Note: zip_it_run_copy == zip_it_run + 1
459  //
460  if( zip_it_run < zip_it_run_copy  &&
461      !( zip_it_run < --zip_it_run_copy) &&
462      zip_it_run == zip_it_run_copy
463    )
464  {
465    ++num_successful_tests;
466    std::cout << "OK" << std::endl;
467  }
468  else
469  {
470    ++num_failed_tests;
471    std::cout << "not OK" << std::endl;
472  }
473
474  /////////////////////////////////////////////////////////////////////////////
475  //
476  // Zip iterator less than or equal
477  //
478  /////////////////////////////////////////////////////////////////////////////
479
480  std::cout << "zip iterator less than or equal:             "
481            << std::flush;
482
483  // Note: zip_it_run_copy == zip_it_run
484  //
485  ++zip_it_run;
486  zip_it_run_copy += 2;
487
488  if( zip_it_run <= zip_it_run_copy &&
489      zip_it_run <= --zip_it_run_copy &&
490      !( zip_it_run <= --zip_it_run_copy) &&
491      zip_it_run <= zip_it_run
492    )
493  {
494    ++num_successful_tests;
495    std::cout << "OK" << std::endl;
496  }
497  else
498  {
499    ++num_failed_tests;
500    std::cout << "not OK" << std::endl;
501  }
502
503  /////////////////////////////////////////////////////////////////////////////
504  //
505  // Zip iterator greater than
506  //
507  /////////////////////////////////////////////////////////////////////////////
508
509  std::cout << "Zip iterator greater than:                   "
510            << std::flush;
511
512  // Note: zip_it_run_copy == zip_it_run - 1
513  //
514  if( zip_it_run > zip_it_run_copy &&
515      !( zip_it_run > ++zip_it_run_copy) &&
516      zip_it_run == zip_it_run_copy
517    )
518  {
519    ++num_successful_tests;
520    std::cout << "OK" << std::endl;
521  }
522  else
523  {
524    ++num_failed_tests;
525    std::cout << "not OK" << std::endl;
526  }
527
528  /////////////////////////////////////////////////////////////////////////////
529  //
530  // Zip iterator greater than or equal
531  //
532  /////////////////////////////////////////////////////////////////////////////
533
534  std::cout << "Zip iterator greater than or equal:          "
535            << std::flush;
536
537  ++zip_it_run;
538
539  // Note: zip_it_run == zip_it_run_copy + 1
540  //
541  if( zip_it_run >= zip_it_run_copy &&
542      --zip_it_run >= zip_it_run_copy &&
543      ! (zip_it_run >= ++zip_it_run_copy)
544    )
545  {
546    ++num_successful_tests;
547    std::cout << "OK" << std::endl;
548  }
549  else
550  {
551    ++num_failed_tests;
552    std::cout << "not OK" << std::endl;
553  }
554
555  /////////////////////////////////////////////////////////////////////////////
556  //
557  // Zip iterator + int
558  //
559  /////////////////////////////////////////////////////////////////////////////
560
561  std::cout << "Zip iterator + int:                          "
562            << std::flush;
563
564  // Note: zip_it_run == zip_it_run_copy - 1
565  //
566  zip_it_run = zip_it_run + 2;
567  ++zip_it_run_copy;
568
569  if( zip_it_run == zip_it_run_copy && zip_it_run == zip_it_begin + 3 )
570  {
571    ++num_successful_tests;
572    std::cout << "OK" << std::endl;
573  }
574  else
575  {
576    ++num_failed_tests;
577    std::cout << "not OK" << std::endl;
578  }
579
580  /////////////////////////////////////////////////////////////////////////////
581  //
582  // Zip iterator - int
583  //
584  /////////////////////////////////////////////////////////////////////////////
585
586  std::cout << "Zip iterator - int:                          "
587            << std::flush;
588
589  // Note: zip_it_run == zip_it_run_copy, and both are at end position
590  //
591  zip_it_run = zip_it_run - 2;
592  --zip_it_run_copy;
593  --zip_it_run_copy;
594
595  if( zip_it_run == zip_it_run_copy && (zip_it_run - 1) == zip_it_begin )
596  {
597    ++num_successful_tests;
598    std::cout << "OK" << std::endl;
599  }
600  else
601  {
602    ++num_failed_tests;
603    std::cout << "not OK" << std::endl;
604  }
605
606  /////////////////////////////////////////////////////////////////////////////
607  //
608  // Zip iterator +=
609  //
610  /////////////////////////////////////////////////////////////////////////////
611
612  std::cout << "Zip iterator +=:                             "
613            << std::flush;
614
615  // Note: zip_it_run == zip_it_run_copy, and both are at begin + 1
616  //
617  zip_it_run += 2;
618  if( zip_it_run == zip_it_begin + 3 )
619  {
620    ++num_successful_tests;
621    std::cout << "OK" << std::endl;
622  }
623  else
624  {
625    ++num_failed_tests;
626    std::cout << "not OK" << std::endl;
627  }
628
629  /////////////////////////////////////////////////////////////////////////////
630  //
631  // Zip iterator -=
632  //
633  /////////////////////////////////////////////////////////////////////////////
634
635  std::cout << "Zip iterator -=:                             "
636            << std::flush;
637
638  // Note: zip_it_run is at end position, zip_it_run_copy is at
639  // begin plus one.
640  //
641  zip_it_run -= 2;
642  if( zip_it_run == zip_it_run_copy )
643  {
644    ++num_successful_tests;
645    std::cout << "OK" << std::endl;
646  }
647  else
648  {
649    ++num_failed_tests;
650    std::cout << "not OK" << std::endl;
651  }
652
653  /////////////////////////////////////////////////////////////////////////////
654  //
655  // Zip iterator getting member iterators
656  //
657  /////////////////////////////////////////////////////////////////////////////
658
659  std::cout << "Zip iterator member iterators:               "
660            << std::flush;
661
662  // Note: zip_it_run and zip_it_run_copy are both at
663  // begin plus one.
664  //
665  if( ZI_TUPLE_GET(0)(zip_it_run.get_iterator_tuple()) == vect1.begin() + 1 &&
666      ZI_TUPLE_GET(1)(zip_it_run.get_iterator_tuple()) == vect2.begin() + 1
667    )
668  {
669    ++num_successful_tests;
670    std::cout << "OK" << std::endl;
671  }
672  else
673  {
674    ++num_failed_tests;
675    std::cout << "not OK" << std::endl;
676  }
677
678  /////////////////////////////////////////////////////////////////////////////
679  //
680  // Making zip iterators
681  //
682  /////////////////////////////////////////////////////////////////////////////
683
684  std::cout << "Making zip iterators:                        "
685            << std::flush;
686
687  std::vector<ZI_TUPLE<double, double> >
688    vect_of_tuples(3);
689
690  std::copy(
691    boost::make_zip_iterator(
692    ZI_MAKE_TUPLE(
693      vect1.begin(),
694      vect2.begin()
695      )
696    ),
697    boost::make_zip_iterator(
698    ZI_MAKE_TUPLE(
699      vect1.end(),
700      vect2.end()
701      )
702    ),
703    vect_of_tuples.begin()
704  );
705
706  if( 42. == ZI_TUPLE_GET(0)(*vect_of_tuples.begin()) &&
707      2.2 == ZI_TUPLE_GET(1)(*vect_of_tuples.begin()) &&
708      43. == ZI_TUPLE_GET(0)(*(vect_of_tuples.begin() + 1)) &&
709      3.3 == ZI_TUPLE_GET(1)(*(vect_of_tuples.begin() + 1)) &&
710      44. == ZI_TUPLE_GET(0)(*(vect_of_tuples.begin() + 2)) &&
711      4.4 == ZI_TUPLE_GET(1)(*(vect_of_tuples.begin() + 2))
712    )
713  {
714    ++num_successful_tests;
715    std::cout << "OK" << std::endl;
716  }
717  else
718  {
719    ++num_failed_tests;
720    std::cout << "not OK" << std::endl;
721  }
722
723  /////////////////////////////////////////////////////////////////////////////
724  //
725  // Zip iterator non-const --> const conversion
726  //
727  /////////////////////////////////////////////////////////////////////////////
728
729  std::cout << "Zip iterator non-const to const conversion:  "
730            << std::flush;
731
732  boost::zip_iterator<
733    ZI_TUPLE<
734      std::set<int>::const_iterator,
735      std::vector<double>::const_iterator
736      >
737    >
738  zip_it_const(
739    ZI_MAKE_TUPLE(
740      intset.begin(),
741      vect2.begin()
742    )
743  );
744  //
745  boost::zip_iterator<
746    ZI_TUPLE<
747      std::set<int>::iterator,
748      std::vector<double>::const_iterator
749      >
750    >
751  zip_it_half_const(
752    ZI_MAKE_TUPLE(
753      intset.begin(),
754      vect2.begin()
755    )
756  );
757  //
758  boost::zip_iterator<
759    ZI_TUPLE<
760      std::set<int>::iterator,
761      std::vector<double>::iterator
762      >
763    >
764  zip_it_non_const(
765    ZI_MAKE_TUPLE(
766      intset.begin(),
767      vect2.begin()
768    )
769  );
770
771  zip_it_half_const = ++zip_it_non_const;
772  zip_it_const = zip_it_half_const;
773  ++zip_it_const;
774//  zip_it_non_const = ++zip_it_const;  // Error: can't convert from const to non-const
775
776  if( 54 == ZI_TUPLE_GET(0)(*zip_it_const) &&
777      4.4 == ZI_TUPLE_GET(1)(*zip_it_const)  &&
778      53 == ZI_TUPLE_GET(0)(*zip_it_half_const)  &&
779      3.3 == ZI_TUPLE_GET(1)(*zip_it_half_const)
780    )
781  {
782    ++num_successful_tests;
783    std::cout << "OK" << std::endl;
784  }
785  else
786  {
787    ++num_failed_tests;
788    std::cout << "not OK" << std::endl;
789  }
790
791
792#if defined(ZI_USE_BOOST_TUPLE)
793
794  /////////////////////////////////////////////////////////////////////////////
795  //
796  // Zip iterator categories
797  //
798  /////////////////////////////////////////////////////////////////////////////
799
800  std::cout << "Zip iterator categories:                     "
801            << std::flush;
802
803  // The big iterator of the previous test has vector, list, and set iterators.
804  // Therefore, it must be bidirectional, but not random access.
805  bool bBigItIsBidirectionalIterator = boost::is_convertible<
806    boost::iterator_traversal<zip_it_12_type>::type
807        , boost::bidirectional_traversal_tag
808        >::value;
809
810  bool bBigItIsRandomAccessIterator = boost::is_convertible<
811    boost::iterator_traversal<zip_it_12_type>::type
812        , boost::random_access_traversal_tag
813        >::value;
814
815  // A combining iterator with all vector iterators must have random access
816  // traversal.
817  //
818  typedef boost::zip_iterator<
819    ZI_TUPLE<
820      std::vector<double>::const_iterator,
821      std::vector<double>::const_iterator
822      >
823    > all_vects_type;
824
825  bool bAllVectsIsRandomAccessIterator = boost::is_convertible<
826    boost::iterator_traversal<all_vects_type>::type
827        , boost::random_access_traversal_tag
828    >::value;
829
830  // The big test.
831  if( bBigItIsBidirectionalIterator &&
832      ! bBigItIsRandomAccessIterator &&
833      bAllVectsIsRandomAccessIterator
834    )
835  {
836    ++num_successful_tests;
837    std::cout << "OK" << std::endl;
838  }
839  else
840  {
841    ++num_failed_tests;
842    std::cout << "not OK" << std::endl;
843  }
844
845#endif
846
847  // Done
848  //
849  std::cout << "\nTest Result:"
850            << "\n============"
851            << "\nNumber of successful tests: " << static_cast<unsigned int>(num_successful_tests)
852            << "\nNumber of failed tests: " << static_cast<unsigned int>(num_failed_tests)
853            << std::endl;
854
855  return num_failed_tests;
856}
857
858