Boost logo

Boost-Commit :

From: chintanraoh_at_[hidden]
Date: 2008-06-03 16:40:44


Author: chintanraoh
Date: 2008-06-03 16:40:44 EDT (Tue, 03 Jun 2008)
New Revision: 46092
URL: http://svn.boost.org/trac/boost/changeset/46092

Log:
added test for upper_bound, lower_bound
Text files modified:
   sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test.cpp | 33 +++++++++++++++++++++++++++++++--
   1 files changed, 31 insertions(+), 2 deletions(-)

Modified: sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test.cpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test.cpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test.cpp 2008-06-03 16:40:44 EDT (Tue, 03 Jun 2008)
@@ -47,6 +47,9 @@
 
         tr.begin();
         tr.clear();
+
+
+
         std::cout<<"GRR...AT THE END"<<std::endl;
         tr.begin(); //should not segfault.
         tr["hello"]=10;
@@ -78,11 +81,37 @@
         assert(*tr_it==10);
 
         assert(tr_it==tr_it);
+ assert(tr.find("hello")==tr_it);
 
- //tr_const_it=const_iterator(tr.begin());
- //tr_const_it++;
+ //std::cout<<*tr_it<<std::endl; //segfaults cannot dereference end
+ assert(++tr_it==tr.end());
+
+ //std::cout<<*tr.upper_bound("helloi")<<std::endl;
+ assert(tr.upper_bound("helloi")==tr.end());
+ assert(tr.upper_bound("hello")==tr.find("hello"));
+ assert(tr.upper_bound("hell")==tr.find("hello"));
+ assert(tr.upper_bound("")==tr.begin());
+ assert(tr.upper_bound("he")==tr.find("he"));
+ assert(tr.upper_bound("hea")==tr.find("heat"));
+ assert(tr.upper_bound("heb")==tr.find("hello"));
+ assert(tr.upper_bound("hex")==tr.end());
+ assert(tr.upper_bound("heata")==tr.find("hello"));
+ assert(tr.upper_bound("x")==tr.end());
+
+ assert(tr.lower_bound("hex")==tr.find("hello"));
+ assert(tr.lower_bound("helloi")==tr.find("hello"));
+ assert(tr.lower_bound("hell")==tr.find("heat"));
+ assert(tr.lower_bound("hel")==tr.find("heat"));
+ assert(tr.lower_bound("heb")==tr.find("heat"));
+ assert(tr.lower_bound("heat")==tr.find("heat"));
+ assert(tr.lower_bound("hea")==tr.find("he"));
+ assert(tr.lower_bound("a")==tr.end());
         
         tr.clear();
+
+ //tr_const_it=const_iterator(tr.begin());
+ //tr_const_it++;
+
         //assert(c->find('h')!=c.begin()->end());
         //assert(c.begin()->find('e')!=c.begin()->end());
 }


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