bool testContinuedFraction() { typedef typename SB::Quotient Quotient; typedef typename SB::Fraction::ConstIterator ConstIterator; typedef typename SB::Fraction Fraction; Fraction f; std::vector<Quotient> quotients; std::vector<Quotient> qcfrac; std::back_insert_iterator< Fraction > itout = std::back_inserter( f ); unsigned int size = ( random() % 20 ) + 10; for ( unsigned int i = 0; i < size; ++i ) { Quotient q = ( i == 0 ) ? ( random() % 5 ) : ( random() % 5 ) + 1; *itout++ = std::make_pair( q, (Quotient) i ); quotients.push_back( q ); } for ( ConstIterator it = f.begin(), it_end = f.end(); it != it_end; ++it ) qcfrac.push_back( (*it).first ); // f.getCFrac( qcfrac ); bool ok = equalCFrac( quotients, qcfrac ); trace.info() << ( ok ? "(OK)" : "(ERR)" ); for ( unsigned int i = 0; i < quotients.size(); ++i ) std::cerr << " " << quotients[ i ]; trace.info() << std::endl; trace.info() << " f="; f.selfDisplay( std::cerr ); trace.info() << std::endl; return ok; }