Boost logo

Boost-Commit :

From: chintanraoh_at_[hidden]
Date: 2008-06-09 00:10:29


Author: chintanraoh
Date: 2008-06-09 00:10:29 EDT (Mon, 09 Jun 2008)
New Revision: 46270
URL: http://svn.boost.org/trac/boost/changeset/46270

Log:
test for trie::size()
Text files modified:
   sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_trie_string.cpp | 16 +++++++++++++---
   1 files changed, 13 insertions(+), 3 deletions(-)

Modified: sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_trie_string.cpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_trie_string.cpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test_trie_string.cpp 2008-06-09 00:10:29 EDT (Mon, 09 Jun 2008)
@@ -21,13 +21,21 @@
         BOOST_CHECK( tr.find("hello")==tr.end() );
         BOOST_CHECK( tr.find("")==tr.end() );
 
+ BOOST_CHECK(tr.size()==0);
         tr.insert( make_pair("hello",1) );
+ BOOST_CHECK(tr.size()==1);
         tr.insert( make_pair("world",2) );
+ BOOST_CHECK(tr.size()==2);
         tr.insert( make_pair("",3) );
+ BOOST_CHECK(tr.size()==3);
         tr.insert( make_pair("hel",4) );
+ BOOST_CHECK(tr.size()==4);
         tr.insert( make_pair("wor",5) );
+ BOOST_CHECK(tr.size()==5);
         tr.insert( make_pair("worry",6) );
+ BOOST_CHECK(tr.size()==6);
         tr.insert( make_pair("hellish",7) );
+ BOOST_CHECK(tr.size()==7);
 
         BOOST_CHECK( tr.find("hello")!=tr.end() );
         BOOST_CHECK( *tr.find("hello")==1 );
@@ -162,6 +170,7 @@
         //"" 3<"hel" 4<"hellish" 7<"hello" 1<"wor" 5<"world" 2<"worry" 6
         //std::cout<<"bloody gods"<<std::endl;
         typename T::iterator it=tr.begin();
+ BOOST_CHECK(tr.size()==7);
 
 // std::cout<<"test_iteration:"<<*(tr.find(""))<<std::endl;
         BOOST_CHECK(it==tr.find(""));
@@ -336,15 +345,16 @@
         test_copy_simple<trie_type>();
 
         trie_type tr;
- tr=test_insert<trie_type>();
+ BOOST_CHECK(tr.begin()==tr.end());
+// std::cout<<tr.size()<<std::endl;
+ BOOST_CHECK(tr.size()==0);
 
+ tr=test_insert<trie_type>();
         test_copy(tr);
         test_bound(tr);
         test_erase(tr);
         test_iteration(tr);
- //test_erase_iterator<trie_type>();
         test_prefix_range(test_insert<trie_type>());
- //test_erase_range(tr);
 
         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