Skip to content

Commit

Permalink
Test Cartesian_const_iterator with Concatenate_iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
afabri committed Dec 27, 2024
1 parent c51fac5 commit 3189228
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions STL_Extension/test/STL_Extension/test_Concatenate_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <CGAL/Concatenate_iterator.h>
#include <CGAL/use.h>
#include <CGAL/Simple_cartesian.h>

template<class C1, class C2>
class Concatenate_container
Expand Down Expand Up @@ -218,6 +219,53 @@ int main()
assert( test(v2, v2) );
}

// Cartesian_const_iterator
{
using Kernel = CGAL::Simple_cartesian<double>;
using Point = Kernel::Point_3;
using Cartesian_const_iterator = typename Kernel::Cartesian_const_iterator_3;
using Construct_cartesian_const_iterator = typename Kernel::Construct_cartesian_const_iterator_3;
using Concatenate_iterator =CGAL::Concatenate_iterator<Cartesian_const_iterator,Cartesian_const_iterator>;

Point p0(0,1,2), p1(10,11,12);
Construct_cartesian_const_iterator ccc;
// return Iterator(c1.end(), c2.begin(), c1.begin());
Concatenate_iterator ppb(ccc(p0,0), ccc(p1), ccc(p0));

// return Iterator(c1.end(), c2.begin(), c2.end(), 0);
Concatenate_iterator ppe(ccc(p0,0), ccc(p1), ccc(p1,0),0);
assert(ppb != ppe);
++ppb;
assert(ppb != ppe);
++ppb;
assert(ppb != ppe);
++ppb;
assert(ppb != ppe);
for(; ppb != ppe; ++ppb){
std::cout << *ppb << std::endl;
}
}
{
using Kernel = CGAL::Simple_cartesian<double>;
using Point = Kernel::Point_3;
using Cartesian_const_iterator = typename Kernel::Cartesian_const_iterator_3;
using Construct_cartesian_const_iterator = typename Kernel::Construct_cartesian_const_iterator_3;
using Concatenate_iterator =CGAL::Concatenate_iterator<Cartesian_const_iterator,Cartesian_const_iterator>;
Point p[2] = {Point(0,1,2), Point(10,11,12)};

Construct_cartesian_const_iterator ccc;
Concatenate_iterator ppb(ccc(p[0],0), ccc(p[1]), ccc(p[0]));
Concatenate_iterator ppe(ccc(p[0],0), ccc(p[1]), ccc(p[1],0),0);
assert(ppb != ppe);
++ppb;
assert(ppb != ppe);
++ppb;
assert(ppb != ppe);
++ppb;
assert(ppb != ppe);
}


//------------------------------------------------------------------
#if 0
{
Expand Down

0 comments on commit 3189228

Please sign in to comment.