Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81903 - trunk/libs/algorithm/test
From: marshall_at_[hidden]
Date: 2012-12-13 12:22:23


Author: marshall
Date: 2012-12-13 12:22:23 EST (Thu, 13 Dec 2012)
New Revision: 81903
URL: http://svn.boost.org/trac/boost/changeset/81903

Log:
Still more tests for string_ref
Text files modified:
   trunk/libs/algorithm/test/string_ref_test1.cpp | 18 ++++++++++++++++--
   1 files changed, 16 insertions(+), 2 deletions(-)

Modified: trunk/libs/algorithm/test/string_ref_test1.cpp
==============================================================================
--- trunk/libs/algorithm/test/string_ref_test1.cpp (original)
+++ trunk/libs/algorithm/test/string_ref_test1.cpp 2012-12-13 12:22:23 EST (Thu, 13 Dec 2012)
@@ -26,6 +26,20 @@
     BOOST_CHECK ( std::equal ( str.rbegin (), str.rend (), ref.rbegin ()));
     }
 
+void null_tests ( const char *p ) {
+// All zero-length string-refs should be equal
+ string_ref sr1; // NULL, 0
+ string_ref sr2 ( NULL, 0 );
+ string_ref sr3 ( p, 0 );
+ string_ref sr4 ( p );
+ sr4.clear ();
+
+ BOOST_CHECK ( sr1 == sr2 );
+ BOOST_CHECK ( sr1 == sr3 );
+ BOOST_CHECK ( sr2 == sr3 );
+ BOOST_CHECK ( sr1 == sr4 );
+ }
+
 // make sure that substrings work just like strings
 void test_substr ( const std::string &str ) {
     const size_t sz = str.size ();
@@ -83,11 +97,11 @@
 int test_main( int , char* [] ) {
 
     const char **p = &test_strings[0];
-
+
     while ( *p != NULL ) {
         interop ( *p, *p );
         test_substr ( *p );
- test_remove ( *p );
+ test_remove ( *p );
     
         p++;
         }


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