37 #include "DGtal/base/Common.h" 
   38 #include "DGtal/base/Labels.h" 
   40 using namespace DGtal;
 
   43 template <
typename Container1, 
typename Container2>
 
   45 isEqual( Container1 & c1, Container2 & c2 )
 
   47   if ( c1.size() == c2.size() )
 
   49       for ( 
unsigned int i = 0; i < c1.size(); ++i )
 
   51           if ( c1.test( i ) != c2.test( i ) )
 
   59 template <
typename VContainer1, 
typename LContainer2>
 
   60 void insert( VContainer1 & c1, LContainer2 & c2, 
unsigned int idx )
 
   66 template <
typename VContainer1, 
typename LContainer2>
 
   68 checkInsert( VContainer1 & v, LContainer2 & l,
 
   71   for ( 
unsigned int i = 0; i < nb; ++i )
 
   73       unsigned int idx = random() % ( l.size() );
 
   76   return isEqual( v, l );
 
   79 template <
typename VContainer1, 
typename LContainer2>
 
   80 void erase( VContainer1 & c1, LContainer2 & c2, 
unsigned int idx )
 
   86 template <
typename VContainer1, 
typename LContainer2>
 
   88 checkErase( VContainer1 & v, LContainer2 & l,
 
   91   for ( 
unsigned int i = 0; i < nb; ++i )
 
   93       unsigned int idx = random() % ( l.size() );
 
   96   return isEqual( v, l );
 
  103   typedef MyLabels::ConstIterator LabelsConstIterator;
 
  104   typedef bitset<80> MyBitset;
 
  106   BOOST_CONCEPT_ASSERT(( boost::ForwardIterator< LabelsConstIterator > ));
 
  109   unsigned int nbok = 0;
 
  113   ++nb, nbok += isEqual( v, l ) ? 1 : 0;
 
  114   std::cout << 
"(" << nbok << 
"/" << nb << 
") l=" << l << std::endl; 
 
  117   ++nb, nbok += isEqual( v, l ) ? 1 : 0;
 
  118   std::cout << 
"(" << nbok << 
"/" << nb << 
") l=" << l << std::endl; 
 
  124   ++nb, nbok += isEqual( v, l ) ? 1 : 0;
 
  125   std::cout << 
"(" << nbok << 
"/" << nb << 
") l=" << l << std::endl; 
 
  126   checkInsert( v, l, 40 );
 
  127   ++nb, nbok += isEqual( v, l ) ? 1 : 0;
 
  128   std::cout << 
"(" << nbok << 
"/" << nb << 
") l=" << l << std::endl; 
 
  129   checkErase( v, l, 200 );
 
  130   ++nb, nbok += isEqual( v, l ) ? 1 : 0;
 
  131   std::cout << 
"(" << nbok << 
"/" << nb << 
") l=" << l << std::endl; 
 
  132   for ( LabelsConstIterator it = l.begin(), it_end = l.end();
 
  134     std::cout << 
" " << *it;
 
  135   std::cout << std::endl;
 
  137   return ( nb == nbok ) ? 0 : 1;