53bool testOffset(
const Iterator& itb,
const Iterator& ite,
const vector<int>& groundTruth)
60 copy(itb,ite,ostream_iterator<int>(
trace.
info(),
" "));
73 copy(v.begin(),v.end(),ostream_iterator<int>(
trace.
info(),
" "));
77 copy(groundTruth.begin(),groundTruth.end(),ostream_iterator<int>(
trace.
info(),
" "));
80 return equal( v.begin(),v.end(),groundTruth.begin() );
153 ASSERT( cont.size() >= 1 );
154 unsigned int nbok = 0;
158 typedef typename Container::const_iterator I;
170 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
174 if ( (circ1 == circ2) && (circ1 == res) && (circ2 == res) )
177 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
192 ASSERT( cont.size() == 5 );
194 unsigned int nbok = 0;
198 typedef typename Container::const_iterator I;
204 trace.
info() <<
"arithmetic operators" << std::endl;
206 if ( (circ2) == (circ1+4) )
209 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
213 if ( circ1 == circ2 )
216 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
218 if ( (circ1+3) == (3+circ1) )
221 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
224 if ( (circ1+2) == circ2 )
227 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
229 if ( ((circ1-circ2) + (circ2-circ1)) == (cont.end()-cont.begin()) )
232 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
234 trace.
info() <<
"comparison operators" << std::endl;
235 if ( (circ1 < circ2) && (circ1 <= circ2)
236 && (circ2 < circ1) && (circ2 <= circ1) )
239 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
241 if ( !( (circ1 > circ2) && (circ1 >= circ2)
242 && (circ2 > circ1) && (circ2 >= circ1) ) )
245 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " << std::endl;
255int main(
int argc,
char** argv )
259 for (
int i = 0; i < argc; ++i )
294 trace.
info() <<
"(const / not const)" << endl;
298 res = res && (c1 == c2) && (c1 == c3);
300 trace.
info() <<
"(reverse_iterator<Circulator> / Circulator<reverse_iterator>)" << endl;
301 std::reverse_iterator<Circulator<vector<int>::iterator> > rc1( c1 );
302 Circulator <vector<int>::reverse_iterator> c4( v.rend(), v.rbegin(), v.rend() );
303 res = res && (rc1.base().base() == c4.
base().base());
304 trace.
info() <<
"first element: (" << *--rc1 <<
" == " << *--c4 <<
")" << endl;
305 res = res && ((*rc1) == (*c4));
308 std::forward_list<int> fl;
330 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;