|
Boost-Commit : |
From: chintanraoh_at_[hidden]
Date: 2008-06-02 03:29:56
Author: chintanraoh
Date: 2008-06-02 03:29:56 EDT (Mon, 02 Jun 2008)
New Revision: 46038
URL: http://svn.boost.org/trac/boost/changeset/46038
Log:
added basic tests in test.cpp for the iterator
Text files modified:
sandbox/SOC/2008/digital_searching/dsearch/libs/dsearch/test/test.cpp | 36 ++++++++++++++++++++++++++++++++++--
1 files changed, 34 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-02 03:29:56 EDT (Mon, 02 Jun 2008)
@@ -14,6 +14,7 @@
{
T tr;
typename T::cursor c;
+ typename T::iterator tr_it;
std::string str="hello";
tr.insert( std::make_pair(str,1) );
tr.insert( std::make_pair("he",2) );
@@ -38,11 +39,42 @@
tr.insert( std::make_pair("it",3) );
c=tr.root().begin();
c++;
- std::cout<<"GRR.............AT THE END"<<std::endl;
+
tr.begin();
tr.clear();
+ std::cout<<"GRR...AT THE END"<<std::endl;
+ tr.begin(); //should not segfault.
+ tr["hello"]=10;
+ tr["heat"]=9;
+ tr_it=tr.begin();
+ assert((*tr_it)==9);
+ ++tr_it;
+ std::cout<<*tr_it<<std::endl;
+ assert((*tr_it)==10);
+ --tr_it;
+ assert((*tr_it)==9);
+ ++tr_it;
+ assert((*tr_it)==10);
+ tr["h"]=11;
+ tr["he"]=12;
+ tr_it=tr.begin();
+ assert(*tr_it==11);
+ tr_it++;
+ assert(*tr_it==12);
+ tr_it++;
+ assert(*tr_it==9);
+ tr_it++;
+ assert(*tr_it==10);
+ assert(tr_it==(--tr.end()));
+
+ tr_it=tr.end();
+ --tr_it;
+ std::cout<<*tr_it<<std::endl;
+ assert(*tr_it==10);
-// tr.clear();
+ assert(tr_it==tr_it);
+
+ tr.clear();
//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