Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r66221 - trunk/libs/algorithm/string/test
From: droba_at_[hidden]
Date: 2010-10-27 16:42:24


Author: pavol_droba
Date: 2010-10-27 16:42:22 EDT (Wed, 27 Oct 2010)
New Revision: 66221
URL: http://svn.boost.org/trac/boost/changeset/66221

Log:
test for empty string split added

Text files modified:
   trunk/libs/algorithm/string/test/split_test.cpp | 20 ++++++++++++++++++++
   1 files changed, 20 insertions(+), 0 deletions(-)

Modified: trunk/libs/algorithm/string/test/split_test.cpp
==============================================================================
--- trunk/libs/algorithm/string/test/split_test.cpp (original)
+++ trunk/libs/algorithm/string/test/split_test.cpp 2010-10-27 16:42:22 EDT (Wed, 27 Oct 2010)
@@ -40,6 +40,7 @@
     string str1("xx-abc--xx-abb");
     string str2("Xx-abc--xX-abb-xx");
     string str3("xx");
+ string strempty("");
     const char* pch1="xx-abc--xx-abb";
     vector<string> tokens;
     vector< vector<int> > vtokens;
@@ -123,6 +124,25 @@
     BOOST_CHECK( tokens[3]==string("xx") );
     BOOST_CHECK( tokens[4]==string("abb") );
 
+ split(
+ tokens,
+ str3,
+ is_any_of(","),
+ token_compress_off);
+
+ BOOST_REQUIRE( tokens.size()==1 );
+ BOOST_CHECK( tokens[0]==string("xx") );
+
+ split(
+ tokens,
+ strempty,
+ is_punct(),
+ token_compress_off);
+
+ BOOST_REQUIRE( tokens.size()==1 );
+ BOOST_CHECK( tokens[0]==string("") );
+
+
     find_iterator<string::iterator> fiter=make_find_iterator(str1, first_finder("xx"));
     BOOST_CHECK(equals(*fiter, "xx"));
     ++fiter;


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