Boost logo

Boost-Commit :

From: chintanraoh_at_[hidden]
Date: 2008-08-07 11:34:48


Author: chintanraoh
Date: 2008-08-07 11:34:48 EDT (Thu, 07 Aug 2008)
New Revision: 48018
URL: http://svn.boost.org/trac/boost/changeset/48018

Log:
minor fix
Text files modified:
   sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_pat_trie.cpp | 38 +++++++++++++++++++++++++-------------
   1 files changed, 25 insertions(+), 13 deletions(-)

Modified: sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_pat_trie.cpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_pat_trie.cpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_pat_trie.cpp 2008-08-07 11:34:48 EDT (Thu, 07 Aug 2008)
@@ -8,6 +8,19 @@
 using namespace boost::dsearch;
 using namespace boost::minimal_test;
 
+
+template<class T>
+void print_pat(const T &pat)
+{
+ typename T::const_iterator it;
+ std::cout<<"<print pat>"<<std::endl;
+ for ( it=pat.begin(); it!=pat.end(); it++ )
+ {
+ std::cout<<(*it).first<<" "<<(*it).second<<std::endl;
+ }
+ std::cout<<"</print pat>"<<std::endl;
+}
+
 template<class T>
 struct select_iterator{
         typedef typename T::iterator type;
@@ -27,10 +40,12 @@
         
         //std::cout<<"into iterator_test"<<std::endl;
         
+ print_pat(pat);
+
         for ( it=pat.begin(), rit=pat.rend(); rit!=pat.rbegin() && it!=pat.end(); ++it )
         {
                 BOOST_CHECK( (*--rit).first==(*it).first);
- //std::cout<<(*it).first<<"=="<<(*rit).first<<std::endl;
+ std::cout<<(*it).first<<"=="<<(*rit).first<<std::endl;
         }
         BOOST_CHECK ( rit==pat.rbegin() );
         BOOST_CHECK( it==pat.end() );
@@ -39,22 +54,14 @@
         for ( it=pat.end(),rit=pat.rbegin(); it!=pat.begin() && rit!=pat.rend();rit++)
         {
                 BOOST_CHECK( (*rit).first==(*--it).first) ;
- //std::cout<<(*it).first<<std::endl;
+ std::cout<<(*it).first<<std::endl;
         }
         
         //std::cout<<"out of iterator_test"<<std::endl;
         return;
 }
 
-template<class T>
-void print_pat(const T &pat)
-{
- typename T::const_iterator it;
- for ( it=pat.begin(); it!=pat.end(); it++ )
- {
- std::cout<<(*it).first<<" "<<(*it).second<<std::endl;
- }
-}
+
 template<class T>
 void print_pat(const T &beg,const T &end)
 {
@@ -66,7 +73,7 @@
 void insert_test_1()
 {
         T pat;
- BOOST_CHECK ( pat.exists("") == 0 ) ;
+ BOOST_CHECK ( pat.exists("") == 0 );
 
         pat.insert ( std::make_pair("",1) );
         BOOST_CHECK ( pat.exists("") );
@@ -531,7 +538,7 @@
 
 int test_main(int argc,char **argv)
 {
- typedef patricia< std::string, int, pat_key_traits> pat_type;
+ typedef patricia< std::string, int, pat_string_traits> pat_type;
 
 #ifndef NOTEST
         insert_test_1<pat_type>();
@@ -544,5 +551,10 @@
 #endif
         if ( argc > 1 )
                 insert_test_3<pat_type>(argv[1]);
+
+ pat_type pat_trie;
+ pat_trie["hello"]=1;
+ pat_trie["aello"]=1;
+ BOOST_CHECK( (*pat_trie.rbegin()).first==std::string("hello") );
         return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk