You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/05/25 03:31:03 UTC

svn commit: r409280 [4/4] - in /incubator/stdcxx/trunk/tests: include/ src/ strings/

Modified: incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp?rev=409280&r1=409279&r2=409280&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp Wed May 24 18:31:01 2006
@@ -25,12 +25,12 @@
  *
  **************************************************************************/
 
-#include <string>        // for string
-#include <stdexcept>     // for out_of_range, length_error
+#include <string>         // for string
+#include <stdexcept>      // for out_of_range, length_error
 
-#include <cstddef>       // for size_t
+#include <cstddef>        // for size_t
 
-#include <21.strings.h>   // for StringMembers
+#include <21.strings.h>   // for StringIds
 #include <alg_test.h>     // for InputIter
 #include <driver.h>       // for rw_test()
 #include <rw_allocator.h> // for UserAlloc
@@ -40,10 +40,7 @@
 /**************************************************************************/
 
 // for convenience and brevity
-#define OpPlusEq(which)           StringMembers::op_plus_eq_ ## which
-
-typedef StringMembers::TestCase   TestCase;
-typedef StringMembers::Function   Function;
+#define OpPlusEq(sig) StringIds::op_plus_eq_ ## sig
 
 static const char* const exceptions[] = {
     "unknown exception", "out_of_range", "length_error",
@@ -54,8 +51,8 @@
 
 // exercises:
 // operator += (const value_type*)
-static const TestCase
-ptr_test_cases [] = {
+static const StringTestCase
+cptr_test_cases [] = {
 
 #undef TEST
 #define TEST(str, src, res, bthrow)                            \
@@ -115,8 +112,8 @@
 
 // exercises:
 // operator += (const basic_string&)
-static const TestCase
-str_test_cases [] = {
+static const StringTestCase
+cstr_test_cases [] = {
 
 #undef TEST
 #define TEST(str, src, res, bthrow)                            \
@@ -177,7 +174,7 @@
 
 // exercises:
 // operator+= (value_type)
-static const TestCase
+static const StringTestCase
 val_test_cases [] = {
 
 #undef TEST
@@ -217,8 +214,8 @@
 
 template <class charT, class Traits, class Allocator>
 void test_op_plus_eq (charT, Traits*, Allocator*,
-                      const Function &func,
-                      const TestCase &tcase)
+                      const StringFunc     &func,
+                      const StringTestCase &tcase)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
     typedef typename String::iterator                    StringIter;
@@ -241,8 +238,8 @@
 
     // construct the string object to be modified
     // and the (possibly unused) argument string
-    /* const */ String  s_str (wstr, str_len);
-    const       String  s_arg (warg, arg_len);
+    /* const */ String str (wstr, str_len);
+    const       String arg (warg, arg_len);
 
     if (wstr != wstr_buf)
         delete[] wstr;
@@ -256,12 +253,10 @@
     // save the state of the string object before the call
     // to detect wxception safety violations (changes to
     // the state of the object after an exception)
-    const StringState str_state (rw_get_string_state (s_str));
-
-    std::size_t res_off = 0;
+    const StringState str_state (rw_get_string_state (str));
 
-    const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
-    const String&      arg_str = tcase.arg ? s_arg : s_str;
+    const charT* const arg_ptr = tcase.arg ? arg.c_str () : str.c_str ();
+    const String&      arg_str = tcase.arg ? arg : str;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
 
     std::size_t total_length_calls = 0;
@@ -294,72 +289,76 @@
 
 #else   // if defined (_RWSTD_NO_EXCEPTIONS)
 
-    if (tcase.bthrow) {
-        if (wres != wres_buf)
-            delete[] wres;
+        if (tcase.bthrow) {
+            if (wres != wres_buf)
+                delete[] wres;
 
-        return;
-    }
+            return;
+        }
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
         try {
+
+            // pointer to the returned reference
+            const String* ret_ptr = 0;
+
             switch (func.which_) {
-            case OpPlusEq (ptr): {
-                const String& s_res = s_str += arg_ptr;
-                res_off = &s_res - &s_str;
+
+            case OpPlusEq (cptr):
+                ret_ptr = &str.operator+= (arg_ptr);
                 if (rg_calls)
                     n_length_calls = rg_calls [UTMemFun::length];
                 break;
-            }
 
-            case OpPlusEq (str): {
-                const String& s_res = s_str += arg_str;
-                res_off = &s_res - &s_str;
+            case OpPlusEq (cstr):
+                ret_ptr = &str.operator+= (arg_str);
                 break;
-            }
 
-            case OpPlusEq (val): {
-                const String& s_res = s_str += arg_val;
-                res_off = &s_res - &s_str;
+            case OpPlusEq (val):
+                ret_ptr = &str.operator+= (arg_val);
                 break;
-            }
 
             default:
                 RW_ASSERT ("test logic error: unknown operator += overload");
                 return;
             }
 
+            // verify that the reference returned from the function
+            // refers to the modified string object (i.e., *this
+            // within the function)
+            const std::ptrdiff_t ret_off = ret_ptr - &str;
+
             // verify the returned value
-            rw_assert (0 == res_off, 0, tcase.line,
+            rw_assert (0 == ret_off, 0, tcase.line,
                        "line %d. %{$FUNCALL} returned invalid reference, "
-                       "offset is %zu", __LINE__, res_off);
+                       "offset is %td", __LINE__, ret_off);
 
             // verfiy that strings length are equal
-            rw_assert (res_len == s_str.size (), 0, tcase.line,
+            rw_assert (res_len == str.size (), 0, tcase.line,
                        "line %d. %{$FUNCALL} expected %{#*s} "
                        "with length %zu, got %{/*.*Gs} with length %zu",
                        __LINE__, int (tcase.nres), tcase.res, res_len,
-                       int (sizeof (charT)), int (s_str.size ()),
-                       s_str.c_str (), s_str.size ());
+                       int (sizeof (charT)), int (str.size ()),
+                       str.c_str (), str.size ());
 
-            if (res_len == s_str.size ()) {
+            if (res_len == str.size ()) {
                 // if the result length matches the expected length
                 // (and only then), also verify that the modified
                 // string matches the expected result
                 const std::size_t match =
-                    rw_match (tcase.res, s_str.c_str(), tcase.nres);
+                    rw_match (tcase.res, str.c_str(), tcase.nres);
 
                 rw_assert (match == res_len, 0, tcase.line,
                            "line %d. %{$FUNCALL} expected %{#*s}, "
                            "got %{/*.*Gs}, difference at offset %zu",
                            __LINE__, int (tcase.nres), tcase.res,
-                           int (sizeof (charT)), int (s_str.size ()),
-                           s_str.c_str (), match);
+                           int (sizeof (charT)), int (str.size ()),
+                           str.c_str (), match);
             }
 
             // verify that Traits::length was used
-            if (OpPlusEq (ptr) == func.which_ && rg_calls) {
+            if (OpPlusEq (cptr) == func.which_ && rg_calls) {
                 rw_assert (n_length_calls - total_length_calls > 0, 
                            0, tcase.line, "line %d. %{$FUNCALL} doesn't "
                            "use traits::length()", __LINE__);
@@ -402,7 +401,7 @@
         if (caught) {
             // verify that an exception thrown during allocation
             // didn't cause a change in the state of the object
-            str_state.assert_equal (rw_get_string_state (s_str),
+            str_state.assert_equal (rw_get_string_state (str),
                                     __LINE__, tcase.line, caught);
 
             if (-1 == tcase.bthrow) {
@@ -446,23 +445,23 @@
 
 int main (int argc, char** argv)
 {
-    static const StringMembers::Test
+    static const StringTest
     tests [] = {
 
 #undef TEST
-#define TEST(tag) {                                             \
-        StringMembers::op_plus_eq_ ## tag, tag ## _test_cases,  \
-        sizeof tag ## _test_cases / sizeof *tag ## _test_cases  \
+#define TEST(sig) {                                             \
+        OpPlusEq (sig), sig ## _test_cases,                     \
+        sizeof sig ## _test_cases / sizeof *sig ## _test_cases  \
     }
 
-        TEST (ptr),
-        TEST (str),
+        TEST (cptr),
+        TEST (cstr),
         TEST (val)
     };
 
     const std::size_t test_count = sizeof tests / sizeof *tests;
 
-    return StringMembers::run_test (argc, argv, __FILE__,
-                                    "lib.string.op+=",
-                                    test_op_plus_eq, tests, test_count);
+    return rw_run_string_test (argc, argv, __FILE__,
+                               "lib.string.op+=",
+                               test_op_plus_eq, tests, test_count);
 }

Modified: incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp?rev=409280&r1=409279&r2=409280&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp Wed May 24 18:31:01 2006
@@ -40,10 +40,7 @@
 /**************************************************************************/
 
 // for convenience and brevity
-#define Replace(which)    StringMembers::replace_ ## which
-
-typedef StringMembers::Function  Function;
-typedef StringMembers::TestCase  TestCase;
+#define Replace(which)    StringIds::replace_ ## which
 
 static const char* const exceptions[] = {
     "unknown exception", "out_of_range", "length_error",
@@ -55,11 +52,11 @@
 // exercises:
 // replace (size_type, size_type, const value_type*)
 // replace (iterator, iterator, const value_type*)
-static const TestCase
-iter_iter_ptr_test_cases [] = {
+static const StringTestCase
+iter_iter_cptr_test_cases [] = {
 
-// iter_iter_ptr_test_cases serves a double duty
-#define size_size_ptr_test_cases iter_iter_ptr_test_cases
+// iter_iter_cptr_test_cases serves a double duty
+#define size_size_cptr_test_cases iter_iter_cptr_test_cases
 
 #undef TEST
 #define TEST(str, off, size, arg, res, bthrow) {                \
@@ -155,11 +152,11 @@
 // exercises:
 // replace (size_type, size_type, const basic_string&)
 // replace (iterator, iterator, const basic_string&)
-static const TestCase
-iter_iter_str_test_cases [] = {
+static const StringTestCase
+iter_iter_cstr_test_cases [] = {
 
-// iter_iter_str_test_cases serves a double duty
-#define size_size_str_test_cases iter_iter_str_test_cases
+// iter_iter_cstr_test_cases serves a double duty
+#define size_size_cstr_test_cases iter_iter_cstr_test_cases
 
 #undef TEST
 #define TEST(s, off, size, arg, res, bthrow) {                  \
@@ -259,11 +256,11 @@
 // exercises:
 // replace (size_type, size_type, const value_type*, size_type)
 // replace (iterator, iterator, const value_type*, size_type)
-static const TestCase
-iter_iter_ptr_size_test_cases [] = {
+static const StringTestCase
+iter_iter_cptr_size_test_cases [] = {
 
-// iter_iter_ptr_size_test_cases serves a double duty
-#define size_size_ptr_size_test_cases iter_iter_ptr_size_test_cases
+// iter_iter_cptr_size_test_cases serves a double duty
+#define size_size_cptr_size_test_cases iter_iter_cptr_size_test_cases
 
 #undef TEST
 #define TEST(str, off, size, arg, count, res, bthrow) {         \
@@ -363,11 +360,11 @@
 // exercises:
 // replace (size_type, size_type, basic_string&, size_type, size_type)
 // replace (iterator, Iterator, InputIterator, InputIterator)
-static const TestCase
+static const StringTestCase
 iter_iter_range_test_cases [] = {
 
 // iter_iter_range_test_cases serves a double duty
-#define size_size_str_size_size_test_cases iter_iter_range_test_cases
+#define size_size_cstr_size_size_test_cases iter_iter_range_test_cases
 
 #undef TEST
 #define TEST(str, off, size, arg, off2, size2, res, bthrow) {   \
@@ -567,7 +564,7 @@
 // exercises:
 // replace (size_type, size_type, value_type, size_type)
 // replace (iterator, iterator, size_type, value_type)
-static const TestCase
+static const StringTestCase
 iter_iter_size_val_test_cases [] = {
 
 // iter_iter_size_val_test_cases serves a double duty
@@ -672,7 +669,7 @@
                          Traits*,
                          Allocator*,
                          const Iterator &it,
-                         const TestCase &tcase)
+                         const StringTestCase &tcase)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
     typedef typename String::iterator                    StringIter;
@@ -746,7 +743,7 @@
                          std::size_t     res_len,
                          Traits*,
                          Allocator*,
-                         const TestCase &tcase)
+                         const StringTestCase &tcase)
 {
     if (tcase.bthrow) {
         // FIXME: exercise exceptions
@@ -781,8 +778,8 @@
 
 template <class charT, class Traits, class Allocator>
 void test_replace (charT, Traits*, Allocator*,
-                   const Function &func,
-                   const TestCase &tcase)
+                   const StringFunc     &func,
+                   const StringTestCase &tcase)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
     typedef typename String::iterator                    StringIter;
@@ -871,8 +868,8 @@
     // or 0 when no such counter exists (i.e., when Traits is not
     // UserTraits)
     std::size_t* length_calls =
-           Replace (size_size_ptr) == func.which_
-        || Replace (iter_iter_ptr) == func.which_ ?
+           Replace (size_size_cptr) == func.which_
+        || Replace (iter_iter_cptr) == func.which_ ?
         rw_get_call_counters ((Traits*)0, (charT*)0) : 0;
 
     if (length_calls) {
@@ -886,10 +883,8 @@
     // out_of_range is only generated from size_type overloads
     // of replace() and not from the iterator equivalents of
     // the same functions
-    const bool use_iters = Replace (iter_iter_ptr) <= func.which_;
-
-    // pointer to the returned reference
-    const String* ret_ptr = 0;
+    const bool use_iters =
+        StringIds::arg_iter == StringIds::arg_type (func.which_, 2);
 
     // iterate for`throw_count' starting at the next call to operator new,
     // forcing each call to throw an exception, until the function finally
@@ -933,24 +928,27 @@
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
+        // pointer to the returned reference
+        const String* ret_ptr = 0;
+
         // start checking for memory leaks
         rw_check_leaks (str.get_allocator ());
 
         try {
             switch (func.which_) {
-            case Replace (size_size_ptr):
+            case Replace (size_size_cptr):
                 ret_ptr = &str.replace (arg_off, arg_size, arg_ptr);
                 break;
 
-            case Replace (size_size_str):
+            case Replace (size_size_cstr):
                 ret_ptr = &str.replace (arg_off, arg_size, arg_str);
                 break;
 
-            case Replace (size_size_ptr_size):
+            case Replace (size_size_cptr_size):
                 ret_ptr = &str.replace (arg_off, arg_size, arg_ptr, arg_size2);
                 break;
 
-            case Replace (size_size_str_size_size):
+            case Replace (size_size_cstr_size_size):
                 ret_ptr = &str.replace (arg_off, arg_size, arg_str,
                                         arg_off2, arg_size2);
                 break;
@@ -959,15 +957,15 @@
                 ret_ptr = &str.replace (arg_off, arg_size, arg_size2, arg_val);
                 break;
 
-            case Replace (iter_iter_ptr):
+            case Replace (iter_iter_cptr):
                 ret_ptr = &str.replace (first, last, arg_ptr);
                 break;
 
-            case Replace (iter_iter_str):
+            case Replace (iter_iter_cstr):
                 ret_ptr = &str.replace (first, last, arg_str);
                 break;
 
-            case Replace (iter_iter_ptr_size):
+            case Replace (iter_iter_cptr_size):
                 ret_ptr = &str.replace (first, last, arg_ptr, arg_size2);
                 break;
 
@@ -982,14 +980,12 @@
             // verify that the reference returned from the function
             // refers to the modified string object (i.e., *this
             // within the function)
-            const std::ptrdiff_t res_off = ret_ptr - &str;
+            const std::ptrdiff_t ret_off = ret_ptr - &str;
 
             // verify the returned value
-            rw_assert (0 == res_off, 0, tcase.line,
+            rw_assert (0 == ret_off, 0, tcase.line,
                        "line %d. %{$FUNCALL} returned invalid reference, "
-                       "offset is %td", __LINE__, res_off);
-
-            
+                       "offset is %td", __LINE__, ret_off);
 
             // verfiy that the length of the resulting string
             rw_assert (res_len == str.size (), 0, tcase.line,
@@ -1122,23 +1118,23 @@
 
 int main (int argc, char** argv)
 {
-    static const StringMembers::Test
+    static const StringTest
     tests [] = {
 
 #undef TEST
-#define TEST(tag) {                                             \
-        StringMembers::replace_ ## tag, tag ## _test_cases,     \
-        sizeof tag ## _test_cases / sizeof *tag ## _test_cases  \
+#define TEST(which) {                                                   \
+        StringIds::replace_ ## which, which ## _test_cases,         \
+        sizeof which ## _test_cases / sizeof *which ## _test_cases,     \
     }
 
-        TEST (size_size_ptr),
-        TEST (size_size_str),
-        TEST (size_size_ptr_size),
-        TEST (size_size_str_size_size),
+        TEST (size_size_cptr),
+        TEST (size_size_cstr),
+        TEST (size_size_cptr_size),
+        TEST (size_size_cstr_size_size),
         TEST (size_size_size_val),
-        TEST (iter_iter_ptr),
-        TEST (iter_iter_str),
-        TEST (iter_iter_ptr_size),
+        TEST (iter_iter_cptr),
+        TEST (iter_iter_cstr),
+        TEST (iter_iter_cptr_size),
         TEST (iter_iter_size_val),
         TEST (iter_iter_range)
     };
@@ -1146,9 +1142,9 @@
     const std::size_t test_count = sizeof tests / sizeof *tests;
 
     const int status =
-        StringMembers::run_test (argc, argv, __FILE__,
-                                 "lib.string.replace",
-                                 test_replace, tests, test_count);
+        rw_run_string_test (argc, argv, __FILE__,
+                            "lib.string.replace",
+                            test_replace, tests, test_count);
 
     return status;
 }

Modified: incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp?rev=409280&r1=409279&r2=409280&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp Wed May 24 18:31:01 2006
@@ -22,14 +22,13 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
  **************************************************************************/
 
 #include <string>           // for string
 #include <cstdlib>          // for free(), size_t
-#include <stdexcept>        // for length_error
 
-#include <21.strings.h>     // for StringMembers
+#include <21.strings.h>     // for StringIds
 #include <driver.h>         // for rw_test()
 #include <rw_allocator.h>   // for UserAlloc
 #include <rw_char.h>        // for rw_expand()
@@ -37,11 +36,7 @@
 /**************************************************************************/
 
 // for convenience and brevity
-#define NPOS                      _RWSTD_SIZE_MAX
-#define RFind(which)              StringMembers::rfind_ ## which
-
-typedef StringMembers::TestCase   TestCase;
-typedef StringMembers::Function   Function;
+#define RFind(sig)                StringIds::rfind_ ## sig
 
 static const char* const exceptions[] = {
     "unknown exception", "out_of_range", "length_error",
@@ -50,10 +45,10 @@
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (const value_type*)
-static const TestCase 
-ptr_test_cases [] = {
+static const StringTestCase
+cptr_test_cases [] = {
 
 #undef TEST
 #define TEST(str, arg, res)                 \
@@ -64,73 +59,73 @@
 
     //    +----------------------------------- controlled sequence
     //    |             +--------------------- sequence to be found
-    //    |             |                +---- expected result 
-    //    |             |                |                               
-    //    |             |                |                     
-    //    V             V                V        
-    TEST ("ab",         "a",             0),   
-
-    TEST ("",           "",              0),   
-    TEST ("",           "\0",            0),    
-    TEST ("",           "a",          NPOS),   
-
-    TEST ("\0",         "",              1),    
-    TEST ("\0",         "\0",            1),   
-    TEST ("\0",         "a",          NPOS),   
-
-    TEST ("bbcdefghij", "a",          NPOS),    
-    TEST ("abcdefghij", "a",             0),  
-    TEST ("abcdefghij", "f",             5),  
-    TEST ("abcdefghij", "j",             9),  
-
-    TEST ("edfcbbhjig", "cba",        NPOS),    
-    TEST ("edfcbahjig", "cba",           3),    
-    TEST ("edfcbahcba", "cba",           7),   
-    TEST ("cbacbahjig", "cba",           3),  
-
-    TEST ("e\0cb\0\0g", "b\0\0g",        3),    
-    TEST ("e\0cb\0\0g", "ecb",        NPOS),    
-    TEST ("\0cb\0\0ge", "\0\0ge",        7),   
-    TEST ("\0cb\0\0ge", "cb\0",          1),   
-    TEST ("e\0cbg\0\0", "bg",            3),    
-    TEST ("e\0cbg\0\0", "cba",        NPOS),  
-
-    TEST ("bcbedfbjih", "a",          NPOS),   
-    TEST ("bcaedfajih", "a",             6),    
-    TEST ("bcedfaajih", "a",             6),    
-    TEST ("bcaaedfaji", "a",             7),    
+    //    |             |                +---- expected result
+    //    |             |                |
+    //    |             |                |
+    //    V             V                V
+    TEST ("ab",         "a",             0),
+
+    TEST ("",           "",              0),
+    TEST ("",           "\0",            0),
+    TEST ("",           "a",          NPOS),
+
+    TEST ("\0",         "",              1),
+    TEST ("\0",         "\0",            1),
+    TEST ("\0",         "a",          NPOS),
+
+    TEST ("bbcdefghij", "a",          NPOS),
+    TEST ("abcdefghij", "a",             0),
+    TEST ("abcdefghij", "f",             5),
+    TEST ("abcdefghij", "j",             9),
+
+    TEST ("edfcbbhjig", "cba",        NPOS),
+    TEST ("edfcbahjig", "cba",           3),
+    TEST ("edfcbahcba", "cba",           7),
+    TEST ("cbacbahjig", "cba",           3),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        3),
+    TEST ("e\0cb\0\0g", "ecb",        NPOS),
+    TEST ("\0cb\0\0ge", "\0\0ge",        7),
+    TEST ("\0cb\0\0ge", "cb\0",          1),
+    TEST ("e\0cbg\0\0", "bg",            3),
+    TEST ("e\0cbg\0\0", "cba",        NPOS),
+
+    TEST ("bcbedfbjih", "a",          NPOS),
+    TEST ("bcaedfajih", "a",             6),
+    TEST ("bcedfaajih", "a",             6),
+    TEST ("bcaaedfaji", "a",             7),
 
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),     
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),
     TEST ("aaaaabaaaa", "aaaaaaaaaa", NPOS),
-    TEST ("aaaaabaaaa", "aaaaa",         0), 
-    TEST ("aaaabaaaaa", "aaaaa",         5), 
+    TEST ("aaaaabaaaa", "aaaaa",         0),
+    TEST ("aaaabaaaaa", "aaaaa",         5),
     TEST ("aaaabaaaaa", "aaaa",          6),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",     1),    
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa", NPOS),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",     1),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa", NPOS),
 
-    TEST ("x@4096",     "",           4096),     
-    TEST ("x@4096",     "a",          NPOS),  
-    TEST ("x@4096",     "x",          4095),    
-    TEST ("x@4096",     "xxx",        4093),    
-    TEST ("x@4096",     "xxa",        NPOS),   
-    TEST ("abc",        "x@4096",     NPOS),    
-    TEST ("xxxxxxxxxx", "x@4096",     NPOS),  
-
-    TEST ("abcdefghij", 0,               0),      
-    TEST ("\0cb\0\0ge", 0,               7),       
-    TEST ("x@4096",     0,               0),       
+    TEST ("x@4096",     "",           4096),
+    TEST ("x@4096",     "a",          NPOS),
+    TEST ("x@4096",     "x",          4095),
+    TEST ("x@4096",     "xxx",        4093),
+    TEST ("x@4096",     "xxa",        NPOS),
+    TEST ("abc",        "x@4096",     NPOS),
+    TEST ("xxxxxxxxxx", "x@4096",     NPOS),
+
+    TEST ("abcdefghij", 0,               0),
+    TEST ("\0cb\0\0ge", 0,               7),
+    TEST ("x@4096",     0,               0),
 
-    TEST ("last test",  "test",          5)       
+    TEST ("last test",  "test",          5)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (const basic_string&)
-static const TestCase 
-str_test_cases [] = {
+static const StringTestCase
+cstr_test_cases [] = {
 
-#undef TEST     
+#undef TEST
 #define TEST(str, arg, res)                 \
     { __LINE__, -1, -1, -1, -1, -1,         \
       str, sizeof str - 1, arg,             \
@@ -139,76 +134,76 @@
 
     //    +------------------------------------ controlled sequence
     //    |             +---------------------- sequence to be found
-    //    |             |                +----- expected result 
-    //    |             |                |                               
-    //    |             |                |                     
-    //    V             V                V        
-    TEST ("ab",         "a",             0),   
-
-    TEST ("",           "",              0),   
-    TEST ("",           "\0",         NPOS),   
-    TEST ("",           "a",          NPOS),  
-
-    TEST ("\0",         "",              1),    
-    TEST ("\0",         "\0",            0),   
-    TEST ("\0",         "\0\0",       NPOS),   
-    TEST ("\0",         "a",          NPOS),   
-    TEST ("\0a",        "a\0",        NPOS),   
-
-    TEST ("bbcdefghij", "a",          NPOS),    
-    TEST ("abcdefghij", "a",             0),   
-    TEST ("abcdefghij", "f",             5),   
-    TEST ("abcdefghij", "j",             9),   
-
-    TEST ("edfcbbhjig", "cba",        NPOS),   
-    TEST ("edfcbahjig", "cba",           3),    
-    TEST ("edfcbahcba", "cba",           7),  
-    TEST ("cbacbahjig", "cba",           3),   
-
-    TEST ("e\0cb\0\0g", "b\0\0g",        3),    
-    TEST ("e\0cb\0\0g", "ecb",        NPOS),    
-    TEST ("\0cb\0\0ge", "\0\0ge",        3),  
-    TEST ("\0cb\0\0ge", "cb\0",          1),  
-    TEST ("\0cb\0\0ge", "cb\0a",      NPOS),    
-    TEST ("e\0cbg\0\0", "bg",            3),   
+    //    |             |                +----- expected result
+    //    |             |                |
+    //    |             |                |
+    //    V             V                V
+    TEST ("ab",         "a",             0),
+
+    TEST ("",           "",              0),
+    TEST ("",           "\0",         NPOS),
+    TEST ("",           "a",          NPOS),
+
+    TEST ("\0",         "",              1),
+    TEST ("\0",         "\0",            0),
+    TEST ("\0",         "\0\0",       NPOS),
+    TEST ("\0",         "a",          NPOS),
+    TEST ("\0a",        "a\0",        NPOS),
+
+    TEST ("bbcdefghij", "a",          NPOS),
+    TEST ("abcdefghij", "a",             0),
+    TEST ("abcdefghij", "f",             5),
+    TEST ("abcdefghij", "j",             9),
+
+    TEST ("edfcbbhjig", "cba",        NPOS),
+    TEST ("edfcbahjig", "cba",           3),
+    TEST ("edfcbahcba", "cba",           7),
+    TEST ("cbacbahjig", "cba",           3),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        3),
+    TEST ("e\0cb\0\0g", "ecb",        NPOS),
+    TEST ("\0cb\0\0ge", "\0\0ge",        3),
+    TEST ("\0cb\0\0ge", "cb\0",          1),
+    TEST ("\0cb\0\0ge", "cb\0a",      NPOS),
+    TEST ("e\0cbg\0\0", "bg",            3),
     TEST ("e\0cbg\0\0", "\0\0",          5),
-    TEST ("\0\0cg\0\0", "\0\0",          4), 
-    TEST ("e\0cbg\0\0", "\0\0a",      NPOS),   
-    TEST ("e\0cbg\0\0", "cba",        NPOS),  
-
-    TEST ("bcbedfbjih", "a",          NPOS),    
-    TEST ("bcaedfajih", "a",             6),     
-    TEST ("bcedfaajih", "a",             6),   
-    TEST ("bcaaedfaji", "a",             7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),   
-    TEST ("aaaaabaaaa", "aaaaaaaaaa", NPOS),    
-    TEST ("aaaabaaaaa", "aaaaa",         5), 
+    TEST ("\0\0cg\0\0", "\0\0",          4),
+    TEST ("e\0cbg\0\0", "\0\0a",      NPOS),
+    TEST ("e\0cbg\0\0", "cba",        NPOS),
+
+    TEST ("bcbedfbjih", "a",          NPOS),
+    TEST ("bcaedfajih", "a",             6),
+    TEST ("bcedfaajih", "a",             6),
+    TEST ("bcaaedfaji", "a",             7),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa", NPOS),
+    TEST ("aaaabaaaaa", "aaaaa",         5),
     TEST ("aaaaabaaaa", "aaaa",          6),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",     1), 
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa", NPOS),  
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",     1),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa", NPOS),
 
-    TEST ("x@4096",     "",           4096),    
-    TEST ("x@4096",     "a",          NPOS),    
-    TEST ("x@4096",     "x",          4095),  
-    TEST ("x@4096",     "xxx",        4093),    
-    TEST ("x@4096",     "xxa",        NPOS),    
-    TEST ("abc",        "x@4096",     NPOS),   
-    TEST ("xxxxxxxxxx", "x@4096",     NPOS),    
-
-    TEST ("abcdefghij", 0,               0),    
-    TEST ("\0cb\0\0ge", 0,               0),    
-    TEST ("x@4096",     0,               0),     
+    TEST ("x@4096",     "",           4096),
+    TEST ("x@4096",     "a",          NPOS),
+    TEST ("x@4096",     "x",          4095),
+    TEST ("x@4096",     "xxx",        4093),
+    TEST ("x@4096",     "xxa",        NPOS),
+    TEST ("abc",        "x@4096",     NPOS),
+    TEST ("xxxxxxxxxx", "x@4096",     NPOS),
+
+    TEST ("abcdefghij", 0,               0),
+    TEST ("\0cb\0\0ge", 0,               0),
+    TEST ("x@4096",     0,               0),
 
-    TEST ("last test",  "test",          5)      
+    TEST ("last test",  "test",          5)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (const value_type*, size_type)
-static const TestCase 
-ptr_size_test_cases [] = {
+static const StringTestCase
+cptr_size_test_cases [] = {
 
 #undef TEST
 #define TEST(str, arg, off, res)            \
@@ -219,217 +214,215 @@
 
     //    +-------------------------------------- controlled sequence
     //    |            +------------------------- sequence to be found
-    //    |            |               +--------- rfind() off argument 
-    //    |            |               |     +--- expected result  
-    //    |            |               |     |                             
-    //    |            |               |     |             
-    //    V            V               V     V                 
-    TEST ("ab",        "a",            0,    0),   
-
-    TEST ("",           "",            0,    0),    
-    TEST ("",           "\0",          0,    0),    
-    TEST ("",           "a",           0, NPOS),    
-
-    TEST ("\0",         "",            0,    0),  
-    TEST ("\0",         "",            1,    1), 
-    TEST ("\0",         "\0",          0,    0),   
-    TEST ("\0",         "\0",          1,    1),    
-    TEST ("\0",         "a",           0, NPOS),    
-
-    TEST ("bbcdefghij", "a",           0, NPOS),    
-    TEST ("abcdefghij", "a",           0,    0),   
-    TEST ("abcdefghij", "a",           2,    0),    
-    TEST ("abcdefghij", "f",           2, NPOS),   
-    TEST ("abcdefghij", "f",           7,    5),    
-    TEST ("abcdefghij", "j",           9,    9),  
-
-    TEST ("edfcbbhjig", "cba",         0, NPOS),    
-    TEST ("edfcbahjig", "cba",         1, NPOS),     
-    TEST ("edfcbahjig", "cba",         5,    3),    
-    TEST ("edfcbahcba", "cba",         1, NPOS), 
-    TEST ("edfcbahcba", "cba",         9,    7), 
-    TEST ("edfcbahcba", "cba",         5,    3),    
-    TEST ("cbacbahjig", "cba",         5,    3),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      5,    3),    
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,    3),    
-    TEST ("e\0cb\0\0g", "ecb",         7, NPOS),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,    6), 
-    TEST ("\0cb\0\0ge", "cb\0",        0, NPOS),     
+    //    |            |               +--------- rfind() off argument
+    //    |            |               |     +--- expected result
+    //    |            |               |     |
+    //    |            |               |     |
+    //    V            V               V     V
+    TEST ("ab",        "a",            0,    0),
+
+    TEST ("",           "",            0,    0),
+    TEST ("",           "\0",          0,    0),
+    TEST ("",           "a",           0, NPOS),
+
+    TEST ("\0",         "",            0,    0),
+    TEST ("\0",         "",            1,    1),
+    TEST ("\0",         "\0",          0,    0),
+    TEST ("\0",         "\0",          1,    1),
+    TEST ("\0",         "a",           0, NPOS),
+
+    TEST ("bbcdefghij", "a",           0, NPOS),
+    TEST ("abcdefghij", "a",           0,    0),
+    TEST ("abcdefghij", "a",           2,    0),
+    TEST ("abcdefghij", "f",           2, NPOS),
+    TEST ("abcdefghij", "f",           7,    5),
+    TEST ("abcdefghij", "j",           9,    9),
+
+    TEST ("edfcbbhjig", "cba",         0, NPOS),
+    TEST ("edfcbahjig", "cba",         1, NPOS),
+    TEST ("edfcbahjig", "cba",         5,    3),
+    TEST ("edfcbahcba", "cba",         1, NPOS),
+    TEST ("edfcbahcba", "cba",         9,    7),
+    TEST ("edfcbahcba", "cba",         5,    3),
+    TEST ("cbacbahjig", "cba",         5,    3),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      5,    3),
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,    3),
+    TEST ("e\0cb\0\0g", "ecb",         7, NPOS),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,    6),
+    TEST ("\0cb\0\0ge", "cb\0",        0, NPOS),
     TEST ("\0cb\0\0ge", "cb\0",        1,    1),
     TEST ("\0cb\0\0ge", "cb\0",        2,    1),
-    TEST ("e\0cbg\0\0", "bg",          1, NPOS),  
-    TEST ("e\0cbg\0\0", "bg",          5,    3), 
-    TEST ("e\0cbg\0\0", "cba",         7, NPOS),    
-
-    TEST ("bcbedfbjih", "a",           0, NPOS),    
-    TEST ("bcaedfajih", "a",           8,    6),     
-    TEST ("bcedfaajih", "a",           6,    6),    
-    TEST ("bcaaedfaji", "a",           8,    7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,    0),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  8,    0),    
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  9, NPOS),    
-    TEST ("aaaabaaaaa", "aaaaa",       9,    5),    
-    TEST ("aaaabaaaaa", "aaaaa",       6,    5),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   9,    1),     
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   8,    1),   
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   7,    1),    
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  8, NPOS),    
-
-    TEST ("x@4096",     "",         4096, 4096),    
-    TEST ("x@4096",     "a",           0, NPOS),     
-    TEST ("x@4096",     "x",        4096, 4095),   
+    TEST ("e\0cbg\0\0", "bg",          1, NPOS),
+    TEST ("e\0cbg\0\0", "bg",          5,    3),
+    TEST ("e\0cbg\0\0", "cba",         7, NPOS),
+
+    TEST ("bcbedfbjih", "a",           0, NPOS),
+    TEST ("bcaedfajih", "a",           8,    6),
+    TEST ("bcedfaajih", "a",           6,    6),
+    TEST ("bcaaedfaji", "a",           8,    7),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,    0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  8,    0),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  9, NPOS),
+    TEST ("aaaabaaaaa", "aaaaa",       9,    5),
+    TEST ("aaaabaaaaa", "aaaaa",       6,    5),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   9,    1),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   8,    1),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   7,    1),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  8, NPOS),
+
+    TEST ("x@4096",     "",         4096, 4096),
+    TEST ("x@4096",     "a",           0, NPOS),
+    TEST ("x@4096",     "x",        4096, 4095),
     TEST ("x@4096",     "xxx",      4095, 4093),
     TEST ("x@4096",     "xxx",         0,    0),
-    TEST ("x@4096",     "xxx",      4087, 4087),    
-    TEST ("x@4096",     "xxa",      4087, NPOS),     
-    TEST ("abc",        "x@4096",      2, NPOS),    
-    TEST ("xxxxxxxxxx", "x@4096",      6, NPOS),   
-
-    TEST ("x@4096",     "xxx",         3,    3), 
-    TEST ("x@4096",     "xxx",         2,    2),     
-
-    TEST ("abcdefghij", 0,             0,    0),    
-    TEST ("abcdefghij", 0,             1,    0),   
-    TEST ("\0cb\0\0ge", 0,             5,    5),    
-    TEST ("x@4096",     0,             0,    0),  
-    TEST ("x@4096",     0,             1,    0),    
-
-    TEST ("",           "",            1,    0),  
-    TEST ("abcdefghij", "abc",        10,    0),   
-    TEST ("abcdefghij", "cba",        10, NPOS), 
+    TEST ("x@4096",     "xxx",      4087, 4087),
+    TEST ("x@4096",     "xxa",      4087, NPOS),
+    TEST ("abc",        "x@4096",      2, NPOS),
+    TEST ("xxxxxxxxxx", "x@4096",      6, NPOS),
+
+    TEST ("x@4096",     "xxx",         3,    3),
+    TEST ("x@4096",     "xxx",         2,    2),
+
+    TEST ("abcdefghij", 0,             0,    0),
+    TEST ("abcdefghij", 0,             1,    0),
+    TEST ("\0cb\0\0ge", 0,             5,    5),
+    TEST ("x@4096",     0,             0,    0),
+    TEST ("x@4096",     0,             1,    0),
+
+    TEST ("",           "",            1,    0),
+    TEST ("abcdefghij", "abc",        10,    0),
+    TEST ("abcdefghij", "cba",        10, NPOS),
 
-    TEST ("last test", "test",         9,    5)      
+    TEST ("last test", "test",         9,    5)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (const value_type*, size_type, size_type)
-static const TestCase 
-ptr_size_size_test_cases [] = {
+static const StringTestCase
+cptr_size_size_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, off, size, res, bthrow)      \
-    { __LINE__, off, size, -1, -1, -1,              \
-      str, sizeof str - 1, arg,                     \
-      sizeof arg - 1, 0, res, bthrow                \
+#define TEST(str, arg, off, size, res) {        \
+        __LINE__, off, size, -1, -1, -1,        \
+         str, sizeof str - 1, arg,              \
+         sizeof arg - 1, 0, res, 0              \
     }
 
     //    +--------------------------------------- controlled sequence
     //    |            +-------------------------- sequence to be found
-    //    |            |               +---------- rfind() off argument 
-    //    |            |               |   +------ rfind() n argument 
-    //    |            |               |   |     +-- expected result  
-    //    |            |               |   |     |   exception info 
-    //    |            |               |   |     |   |   0 - no exception        
-    //    |            |               |   |     |   |   1 - length_error  
-    //    |            |               |   |     |   |                           
-    //    |            |               |   |     |   +----+             
-    //    V            V               V   V     V        V             
-    TEST ("ab",        "a",            0,  1,    0,       0),
-
-    TEST ("",           "",            0,  0,    0,       0),
-    TEST ("",           "\0",          0,  0,    0,       0),
-    TEST ("",           "\0",          0,  1, NPOS,       0),
-    TEST ("",           "a",           0,  0,    0,       0),
-    TEST ("",           "a",           0,  1, NPOS,       0),
-
-    TEST ("\0",         "",            0,  0,    0,       0),
-    TEST ("\0",         "\0",          0,  1,    0,       0),
-    TEST ("\0",         "\0",          1,  1,    0,       0),
-    TEST ("\0\0",       "\0\0",        1,  1,    1,       0),
-    TEST ("\0",         "a",           0,  1, NPOS,       0),
-
-    TEST ("edfcbbhjig", "cba",         0,  3, NPOS,       0),
-    TEST ("edfcbbhjig", "cba",         0,  2, NPOS,       0),
-    TEST ("edfcbbhjig", "cba",         9,  2,    3,       0),
-    TEST ("edfcbahjig", "cba",         8,  3,    3,       0),
-    TEST ("edfcbahjig", "cba",         2,  3, NPOS,       0),
-    TEST ("edfcbahjig", "cba",         2,  1, NPOS,       0),
-    TEST ("edfcbahcba", "cba",         8,  3,    7,       0),
-    TEST ("edfcbehcba", "cba",         8,  2,    7,       0),
-    TEST ("edfcbahcba", "cba",         9,  3,    7,       0),
-    TEST ("cbacbahjig", "cba",         5,  3,    3,       0),
-    TEST ("cbacbahjig", "cba",         2,  3,    0,       0),
-    TEST ("cbacbahjcg", "cba",         2,  1,    0,       0),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4, NPOS,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      7,  4,    3,       0),
-    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,    3,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      7,  2,    5,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      2,  2,    1,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      7,  3,    1,       0),
-    TEST ("e\0cb\0\0g", "ecb",         7,  2, NPOS,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4,    3,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      2,  0,    2,       0),
-    TEST ("\0cb\0\0ge", "cb\0",        1,  3,    1,       0),
-    TEST ("e\0cbg\0\0", "bg",          1,  2, NPOS,       0),
-    TEST ("e\0cbg\0\0", "cba",         7,  3, NPOS,       0),
-    TEST ("e\0cbg\0\0", "cba",         7,  2,    2,       0),
-
-    TEST ("e\0a\0",     "e\0a\0\0",    3,  4,    0,       0),
-    TEST ("e\0a\0",     "e\0a\0\0",    3,  5, NPOS,       0),
-    TEST ("ee\0a\0",    "e\0a\0\0",    4,  4,    1,       0),
-    TEST ("ee\0a\0",    "e\0a\0\0",    4,  5, NPOS,       0),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, 10,    0,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1, 10,    0,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1,  9,    1,       0),
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, 10, NPOS,       0),
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,  4,    1,       0),
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  7,  4,    6,       0),
-    TEST ("aaaabaaaaa", "aaaaa",       0,  5, NPOS,       0),
-    TEST ("aaaabaaaaa", "aaaaa",       0,  4,    0,       0),
-    TEST ("aaaabaaaaa", "aaaaa",       6,  5,    5,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,  9,    0,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,  9,    1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  9,    1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   7,  8,    2,       0),
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  9, 10, NPOS,       0),
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  8,  7,    2,       0),
-
-    TEST ("x@4096",     "",         4096,  0, 4096,       0),
-    TEST ("x@4096",     "a",        4096,  1, NPOS,       0),
-    TEST ("x@4096",     "x",        4096,  1, 4095,       0),
-    TEST ("x@4096",     "xxx",      4087,  3, 4087,       0),
-    TEST ("x@4096",     "xxa",      4087,  3, NPOS,       0),
-    TEST ("x@4096",     "xxa",      4096,  2, 4094,       0),
-    TEST ("abc",        "x@4096",      2, 10, NPOS,       0),
-    TEST ("xxxxxxxxxx", "x@4096",      0, 4096, NPOS,     0),
-    TEST ("xxxxxxxxxx", "x@4096",      2,  4,    2,       0),
-
-    TEST ("x@4096",     "xxx",      4093,  3, 4093,       0),
-    TEST ("x@4096",     "xxx",      4094,  3, 4093,       0),
-    TEST ("x@4096",     "xxx",      4094,  2, 4094,       0),
-
-    TEST ("abcdefghij", 0,             0,  9,    0,       0),
-    TEST ("abcdefghij", 0,             1,  9,    0,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  7,    0,       0),
-    TEST ("\0cb\0ge\0", 0,             6,  1,    6,       0),
-    TEST ("x@4096",     0,             0, 4096,  0,       0),
-    TEST ("x@4096",     0,             1, 4096,  0,       0),
-    TEST ("x@4096",     0,             5, 4091,  5,       0),
-
-    TEST ("",           "",            1,  0,    0,       0),
-    TEST ("abcdefghij", "abc",        10,  3,    0,       0),
-    TEST ("abcdefghij", "cba",        10,  1,    2,       0),
-
-    TEST ("",           "cba",         0, -1,    0,       1),
-    TEST ("abcdefghij", "cba",         0, -1,    0,       1),
-    TEST ("x@4096",     "xxx",         0, -1,    0,       1),
-    TEST ("abcdefghij", "x@4096",      0, -1,    0,       1),
+    //    |            |               +---------- rfind() off argument
+    //    |            |               |   +------ rfind() n argument
+    //    |            |               |   |     +-- expected result
+    //    |            |               |   |     |
+    //    |            |               |   |     |
+    //    V            V               V   V     V
+    TEST ("ab",        "a",            0,  1,    0),
+
+    TEST ("",           "",            0,  0,    0),
+    TEST ("",           "\0",          0,  0,    0),
+    TEST ("",           "\0",          0,  1, NPOS),
+    TEST ("",           "a",           0,  0,    0),
+    TEST ("",           "a",           0,  1, NPOS),
+
+    TEST ("\0",         "",            0,  0,    0),
+    TEST ("\0",         "\0",          0,  1,    0),
+    TEST ("\0",         "\0",          1,  1,    0),
+    TEST ("\0\0",       "\0\0",        1,  1,    1),
+    TEST ("\0",         "a",           0,  1, NPOS),
+
+    TEST ("edfcbbhjig", "cba",         0,  3, NPOS),
+    TEST ("edfcbbhjig", "cba",         0,  2, NPOS),
+    TEST ("edfcbbhjig", "cba",         9,  2,    3),
+    TEST ("edfcbahjig", "cba",         8,  3,    3),
+    TEST ("edfcbahjig", "cba",         2,  3, NPOS),
+    TEST ("edfcbahjig", "cba",         2,  1, NPOS),
+    TEST ("edfcbahcba", "cba",         8,  3,    7),
+    TEST ("edfcbehcba", "cba",         8,  2,    7),
+    TEST ("edfcbahcba", "cba",         9,  3,    7),
+    TEST ("cbacbahjig", "cba",         5,  3,    3),
+    TEST ("cbacbahjig", "cba",         2,  3,    0),
+    TEST ("cbacbahjcg", "cba",         2,  1,    0),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4, NPOS),
+    TEST ("e\0cb\0\0g", "b\0\0g",      7,  4,    3),
+    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,    3),
+    TEST ("\0b\0\0gb\0","b\0\0g",      7,  2,    5),
+    TEST ("\0b\0\0gb\0","b\0\0g",      2,  2,    1),
+    TEST ("\0b\0\0gb\0","b\0\0g",      7,  3,    1),
+    TEST ("e\0cb\0\0g", "ecb",         7,  2, NPOS),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4,    3),
+    TEST ("\0cb\0\0ge", "\0\0ge",      2,  0,    2),
+    TEST ("\0cb\0\0ge", "cb\0",        1,  3,    1),
+    TEST ("e\0cbg\0\0", "bg",          1,  2, NPOS),
+    TEST ("e\0cbg\0\0", "cba",         7,  3, NPOS),
+    TEST ("e\0cbg\0\0", "cba",         7,  2,    2),
+
+    TEST ("e\0a\0",     "e\0a\0\0",    3,  4,    0),
+    TEST ("e\0a\0",     "e\0a\0\0",    3,  5, NPOS),
+    TEST ("ee\0a\0",    "e\0a\0\0",    4,  4,    1),
+    TEST ("ee\0a\0",    "e\0a\0\0",    4,  5, NPOS),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, 10,    0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1, 10,    0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1,  9,    1),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, 10, NPOS),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,  4,    1),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  7,  4,    6),
+    TEST ("aaaabaaaaa", "aaaaa",       0,  5, NPOS),
+    TEST ("aaaabaaaaa", "aaaaa",       0,  4,    0),
+    TEST ("aaaabaaaaa", "aaaaa",       6,  5,    5),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,  9,    0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,  9,    1),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  9,    1),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   7,  8,    2),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  9, 10, NPOS),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  8,  7,    2),
+
+    TEST ("x@4096",     "",         4096,  0, 4096),
+    TEST ("x@4096",     "a",        4096,  1, NPOS),
+    TEST ("x@4096",     "x",        4096,  1, 4095),
+    TEST ("x@4096",     "xxx",      4087,  3, 4087),
+    TEST ("x@4096",     "xxa",      4087,  3, NPOS),
+    TEST ("x@4096",     "xxa",      4096,  2, 4094),
+    TEST ("abc",        "x@4096",      2, 10, NPOS),
+    TEST ("xxxxxxxxxx", "x@4096",      0, 4096, NPOS),
+    TEST ("xxxxxxxxxx", "x@4096",      2,  4,    2),
+
+    TEST ("x@4096",     "xxx",      4093,  3, 4093),
+    TEST ("x@4096",     "xxx",      4094,  3, 4093),
+    TEST ("x@4096",     "xxx",      4094,  2, 4094),
+
+    TEST ("abcdefghij", 0,             0,  9,    0),
+    TEST ("abcdefghij", 0,             1,  9,    0),
+    TEST ("\0cb\0\0ge", 0,             5,  7,    0),
+    TEST ("\0cb\0ge\0", 0,             6,  1,    6),
+    TEST ("x@4096",     0,             0, 4096,  0),
+    TEST ("x@4096",     0,             1, 4096,  0),
+    TEST ("x@4096",     0,             5, 4091,  5),
+
+    TEST ("",           "",            1,  0,    0),
+    TEST ("abcdefghij", "abc",        10,  3,    0),
+    TEST ("abcdefghij", "cba",        10,  1,    2),
+
+    // exercised invalid arguments (undefined behavior)
+    TEST ("",           "cba",         0, -1, NPOS),
+    TEST ("abcdefghij", "cba",         0, -1, NPOS),
+    TEST ("x@4096",     "xxx",         0, -1, NPOS),
+    TEST ("abcdefghij", "x@4096",      0, -1, NPOS),
 
-    TEST ("last test", "test",         9,  4,    5,       0)
+    TEST ("last test", "test",         9,  4,    5)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (const basic_string&, size_type)
-static const TestCase 
-str_size_test_cases [] = {
+static const StringTestCase
+cstr_size_test_cases [] = {
 
 #undef TEST
 #define TEST(str, arg, off, res)            \
@@ -441,89 +434,89 @@
     //    +--------------------------------------- controlled sequence
     //    |             +------------------------- sequence to be found
     //    |             |              +---------- rfind() off argument
-    //    |             |              |     +---- expected result 
-    //    |             |              |     |                          
-    //    |             |              |     |           
-    //    V             V              V     V                
-    TEST ("ab",         "a",           0,    0),     
-
-    TEST ("",           "",            0,    0),     
-    TEST ("",           "\0",          0, NPOS),    
-    TEST ("",           "a",           0, NPOS),    
-
-    TEST ("\0",         "",            0,    0),    
-    TEST ("\0",         "\0",          0,    0),   
-    TEST ("\0",         "\0",          1,    0),    
-    TEST ("\0\0",       "\0",          2,    1),   
-    TEST ("\0",         "a",           0, NPOS),    
-
-    TEST ("bbcdefghij", "a",           0, NPOS),    
-    TEST ("abcdefghij", "a",           0,    0),   
-    TEST ("abcdefghij", "a",           9,    0),   
-    TEST ("abcdefghij", "f",           2, NPOS),    
-    TEST ("abcdefghij", "f",           7,    5),   
-    TEST ("abcdefghij", "j",           9,    9),    
-
-    TEST ("edfcbbhjig", "cba",         9, NPOS),    
-    TEST ("edfcbahjig", "cba",         1, NPOS),    
-    TEST ("edfcbahjig", "cba",         4,    3),   
-    TEST ("edfcbahcba", "cba",         9,    7),   
-    TEST ("edfcbahcba", "cba",         6,    3),   
-    TEST ("cbacbahjig", "cba",         5,    3),   
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      7,    3),   
-    TEST ("e\0cb\0\0g", "b\0\0g",      2, NPOS),    
-    TEST ("e\0cb\0\0g", "ecb",         7, NPOS),   
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,    3),   
-    TEST ("\0cb\0\0ge", "\0\0ge",      1, NPOS),    
-    TEST ("\0cb\0\0ge", "cb\0",        2,    1),    
-    TEST ("\0cbg\0\0e", "cb\0",        0, NPOS),    
-    TEST ("e\0cbg\0\0", "bg",          6,    3),   
-    TEST ("e\0cbg\0\0", "cba",         7, NPOS),   
-
-    TEST ("bcbedfbjih", "a",           9, NPOS),    
-    TEST ("bcaedfajih", "a",           9,    6),   
-    TEST ("bcedfaajih", "a",           6,    6),    
-    TEST ("bcaaedfaji", "a",           5,    3),   
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,    0),   
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9,    0),    
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  9, NPOS),    
-    TEST ("aaaabaaaaa", "aaaaa",       9,    5),    
-    TEST ("aaaabaaaaa", "aaaaa",       3, NPOS),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   9,    1),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,    0),    
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  8, NPOS),    
-
-    TEST ("x@4096",     "",         4096, 4096),    
-    TEST ("x@4096",     "a",        4096, NPOS),    
-    TEST ("x@4096",     "x",        4096, 4095),   
-    TEST ("x@4096",     "xxx",      4087, 4087),     
-    TEST ("x@4096",     "xxa",      4087, NPOS),    
-    TEST ("abc",        "x@4096",      2, NPOS),   
-    TEST ("xxxxxxxxxx", "x@4096",   4096, NPOS),    
-
-    TEST ("x@4096",     "xxx",      4096, 4093), 
-    TEST ("x@4096",     "xxx",      4091, 4091),   
-
-    TEST ("abcdefghij", 0,             9,    0),    
-    TEST ("abcdefghij", 0,             1,    0),   
-    TEST ("\0cb\0\0ge", 0,             5,    0),      
-    TEST ("x@4096",     0,             0,    0),    
-    TEST ("x@4096",     0,             1,    0),   
+    //    |             |              |     +---- expected result
+    //    |             |              |     |
+    //    |             |              |     |
+    //    V             V              V     V
+    TEST ("ab",         "a",           0,    0),
+
+    TEST ("",           "",            0,    0),
+    TEST ("",           "\0",          0, NPOS),
+    TEST ("",           "a",           0, NPOS),
+
+    TEST ("\0",         "",            0,    0),
+    TEST ("\0",         "\0",          0,    0),
+    TEST ("\0",         "\0",          1,    0),
+    TEST ("\0\0",       "\0",          2,    1),
+    TEST ("\0",         "a",           0, NPOS),
+
+    TEST ("bbcdefghij", "a",           0, NPOS),
+    TEST ("abcdefghij", "a",           0,    0),
+    TEST ("abcdefghij", "a",           9,    0),
+    TEST ("abcdefghij", "f",           2, NPOS),
+    TEST ("abcdefghij", "f",           7,    5),
+    TEST ("abcdefghij", "j",           9,    9),
+
+    TEST ("edfcbbhjig", "cba",         9, NPOS),
+    TEST ("edfcbahjig", "cba",         1, NPOS),
+    TEST ("edfcbahjig", "cba",         4,    3),
+    TEST ("edfcbahcba", "cba",         9,    7),
+    TEST ("edfcbahcba", "cba",         6,    3),
+    TEST ("cbacbahjig", "cba",         5,    3),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      7,    3),
+    TEST ("e\0cb\0\0g", "b\0\0g",      2, NPOS),
+    TEST ("e\0cb\0\0g", "ecb",         7, NPOS),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,    3),
+    TEST ("\0cb\0\0ge", "\0\0ge",      1, NPOS),
+    TEST ("\0cb\0\0ge", "cb\0",        2,    1),
+    TEST ("\0cbg\0\0e", "cb\0",        0, NPOS),
+    TEST ("e\0cbg\0\0", "bg",          6,    3),
+    TEST ("e\0cbg\0\0", "cba",         7, NPOS),
+
+    TEST ("bcbedfbjih", "a",           9, NPOS),
+    TEST ("bcaedfajih", "a",           9,    6),
+    TEST ("bcedfaajih", "a",           6,    6),
+    TEST ("bcaaedfaji", "a",           5,    3),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,    0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9,    0),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  9, NPOS),
+    TEST ("aaaabaaaaa", "aaaaa",       9,    5),
+    TEST ("aaaabaaaaa", "aaaaa",       3, NPOS),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   9,    1),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,    0),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  8, NPOS),
+
+    TEST ("x@4096",     "",         4096, 4096),
+    TEST ("x@4096",     "a",        4096, NPOS),
+    TEST ("x@4096",     "x",        4096, 4095),
+    TEST ("x@4096",     "xxx",      4087, 4087),
+    TEST ("x@4096",     "xxa",      4087, NPOS),
+    TEST ("abc",        "x@4096",      2, NPOS),
+    TEST ("xxxxxxxxxx", "x@4096",   4096, NPOS),
+
+    TEST ("x@4096",     "xxx",      4096, 4093),
+    TEST ("x@4096",     "xxx",      4091, 4091),
+
+    TEST ("abcdefghij", 0,             9,    0),
+    TEST ("abcdefghij", 0,             1,    0),
+    TEST ("\0cb\0\0ge", 0,             5,    0),
+    TEST ("x@4096",     0,             0,    0),
+    TEST ("x@4096",     0,             1,    0),
 
-    TEST ("",           "",            1,    0),   
-    TEST ("abcdefghij", "abc",        10,    0),  
+    TEST ("",           "",            1,    0),
+    TEST ("abcdefghij", "abc",        10,    0),
     TEST ("abcdefghij", "cba",        10, NPOS),
 
-    TEST ("last test",  "test",        9,    5)     
+    TEST ("last test",  "test",        9,    5)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (value_type)
-static const TestCase 
+static const StringTestCase
 val_test_cases [] = {
 
 #undef TEST
@@ -535,38 +528,38 @@
 
     //    +----------------------------- controlled sequence
     //    |              +-------------- character to be found
-    //    |              |       +------ expected result  
-    //    |              |       |                           
-    //    |              |       |                
-    //    V              V       V                 
-    TEST ("ab",          'a',    0),   
-
-    TEST ("",            'a', NPOS),  
-    TEST ("",           '\0', NPOS),   
-
-    TEST ("\0",         '\0',    0),   
-    TEST ("\0\0",       '\0',    1),  
-    TEST ("\0",          'a', NPOS),   
-
-    TEST ("e\0cb\0\0g", '\0',    5),    
-    TEST ("e\0cb\0\0g",  'b',    3),    
-    TEST ("e\0cb\0\0g",  'a', NPOS),   
-    TEST ("\0cbge\0\0", '\0',    6),   
-    TEST ("\0cbge\0\0",  'b',    2),   
-    TEST ("\0cbge\0\0",  'a', NPOS),   
-
-    TEST ("x@4096",      'x', 4095),  
-    TEST ("x@4096",     '\0', NPOS),   
-    TEST ("x@4096",      'a', NPOS),  
+    //    |              |       +------ expected result
+    //    |              |       |
+    //    |              |       |
+    //    V              V       V
+    TEST ("ab",          'a',    0),
+
+    TEST ("",            'a', NPOS),
+    TEST ("",           '\0', NPOS),
+
+    TEST ("\0",         '\0',    0),
+    TEST ("\0\0",       '\0',    1),
+    TEST ("\0",          'a', NPOS),
+
+    TEST ("e\0cb\0\0g", '\0',    5),
+    TEST ("e\0cb\0\0g",  'b',    3),
+    TEST ("e\0cb\0\0g",  'a', NPOS),
+    TEST ("\0cbge\0\0", '\0',    6),
+    TEST ("\0cbge\0\0",  'b',    2),
+    TEST ("\0cbge\0\0",  'a', NPOS),
+
+    TEST ("x@4096",      'x', 4095),
+    TEST ("x@4096",     '\0', NPOS),
+    TEST ("x@4096",      'a', NPOS),
 
-    TEST ("last test",   't',    8)    
+    TEST ("last test",   't',    8)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // rfind (value_type, size_type)
-static const TestCase 
+static const StringTestCase
 val_size_test_cases [] = {
 
 #undef TEST
@@ -579,51 +572,51 @@
     //    +------------------------------ controlled sequence
     //    |              +--------------- character to be found
     //    |              |     +--------- rfind() off argument
-    //    |              |     |     +--- expected result  
-    //    |              |     |     |                              
-    //    |              |     |     |               
-    //    V              V     V     V                   
-    TEST ("ab",          'a',  0,    0),    
-
-    TEST ("",            'a',  0, NPOS),   
-    TEST ("",           '\0',  0, NPOS),    
-
-    TEST ("\0",         '\0',  1,    0),    
-    TEST ("\0",          'a',  0, NPOS),   
-    TEST ("\0\0",       '\0',  2,    1),    
-    TEST ("\0\0",        'a',  3, NPOS),   
-    TEST ("\0\0",       '\0',  3,    1),    
-
-    TEST ("e\0cb\0\0g", '\0',  1,    1),    
-    TEST ("e\0cb\0\0g", '\0',  5,    5),    
-    TEST ("e\0cb\0\0g", '\0',  0, NPOS),    
-    TEST ("e\0cb\0\0g",  'b',  1, NPOS),    
-    TEST ("e\0cb\0\0g",  'b',  4,    3),    
-    TEST ("e\0cb\0\0g",  'a',  6, NPOS),   
-    TEST ("\0cbge\0\0", '\0',  0,    0),   
-    TEST ("\0cbge\0\0", '\0',  5,    5),  
-    TEST ("\0cbge\0\0", '\0',  9,    6),    
-    TEST ("\0cbge\0\0",  'b',  5,    2),  
-    TEST ("\0bgeb\0\0",  'b',  5,    4),   
-    TEST ("\0cbge\0\0",  'a',  6, NPOS),    
+    //    |              |     |     +--- expected result
+    //    |              |     |     |
+    //    |              |     |     |
+    //    V              V     V     V
+    TEST ("ab",          'a',  0,    0),
+
+    TEST ("",            'a',  0, NPOS),
+    TEST ("",           '\0',  0, NPOS),
+
+    TEST ("\0",         '\0',  1,    0),
+    TEST ("\0",          'a',  0, NPOS),
+    TEST ("\0\0",       '\0',  2,    1),
+    TEST ("\0\0",        'a',  3, NPOS),
+    TEST ("\0\0",       '\0',  3,    1),
+
+    TEST ("e\0cb\0\0g", '\0',  1,    1),
+    TEST ("e\0cb\0\0g", '\0',  5,    5),
+    TEST ("e\0cb\0\0g", '\0',  0, NPOS),
+    TEST ("e\0cb\0\0g",  'b',  1, NPOS),
+    TEST ("e\0cb\0\0g",  'b',  4,    3),
+    TEST ("e\0cb\0\0g",  'a',  6, NPOS),
+    TEST ("\0cbge\0\0", '\0',  0,    0),
+    TEST ("\0cbge\0\0", '\0',  5,    5),
+    TEST ("\0cbge\0\0", '\0',  9,    6),
+    TEST ("\0cbge\0\0",  'b',  5,    2),
+    TEST ("\0bgeb\0\0",  'b',  5,    4),
+    TEST ("\0cbge\0\0",  'a',  6, NPOS),
 
     TEST ("x@4096",      'x',  0,    0),
     TEST ("x@4096",      'x',  5,    5),
-    TEST ("x@4096",      'x', 4096, 4095),      
-    TEST ("x@4096",     '\0', 4096, NPOS),    
-    TEST ("x@4096",      'a', 4094, NPOS),     
+    TEST ("x@4096",      'x', 4096, 4095),
+    TEST ("x@4096",     '\0', 4096, NPOS),
+    TEST ("x@4096",      'a', 4094, NPOS),
     TEST ("x@4096",      'x', 4095, 4095),
     TEST ("x@4096",      'x', 4106, 4095),
 
-    TEST ("last test",   't',  9,    8)      
+    TEST ("last test",   't',  9,    8)
 };
 
 /**************************************************************************/
 
 template <class charT, class Traits, class Allocator>
-void test_rfind (charT, Traits*, Allocator*, 
-                 const Function &func,
-                 const TestCase &tcase)
+void test_rfind (charT, Traits*, Allocator*,
+                 const StringFunc     &func,
+                 const StringTestCase &tcase)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
 
@@ -656,9 +649,6 @@
     // the state of the object after an exception)
     const StringState str_state (rw_get_string_state (s_str));
 
-    std::size_t res = 0;
-    std::size_t exp_res = NPOS != tcase.nres ? tcase.nres : String::npos;
-
     const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
     const String&      arg_str = tcase.arg ? s_arg : s_str;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
@@ -682,64 +672,55 @@
 #endif   // _RWSTD_NO_EXCEPTIONS
 
     try {
+        std::size_t res = 0;
+
         switch (func.which_) {
-        case RFind (ptr): {
+        case RFind (cptr):
             res = s_str.rfind (arg_ptr);
             break;
-        }
 
-        case RFind (str): {
+        case RFind (cstr):
             res = s_str.rfind (arg_str);
             break;
-        }
 
-        case RFind (ptr_size): {
+        case RFind (cptr_size):
             res = s_str.rfind (arg_ptr, tcase.off);
             break;
-        }
 
-        case RFind (ptr_size_size): {
+        case RFind (cptr_size_size):
             res = s_str.rfind (arg_ptr, tcase.off, size);
             break;
-        }
 
-        case RFind (str_size): {
+        case RFind (cstr_size):
             res = s_str.rfind (arg_str, tcase.off);
             break;
-        }
 
-        case RFind (val): {
+        case RFind (val):
             res = s_str.rfind (arg_val);
             break;
-        }
 
-        case RFind (val_size): {
+        case RFind (val_size):
             res = s_str.rfind (arg_val, tcase.off);
             break;
-        }
 
         default:
             RW_ASSERT ("test logic error: unknown rfind overload");
             return;
         }
 
+        const std::size_t exp_res =
+            NPOS != tcase.nres ? tcase.nres : String::npos;
+
         // verify the returned value
         rw_assert (exp_res == res, 0, tcase.line,
                    "line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
-                   "got %{?}%zu%{;}%{?}npos%{;}", 
-                   __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres, 
+                   "got %{?}%zu%{;}%{?}npos%{;}",
+                   __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres,
                    String::npos != res, res, String::npos == res);
     }
 
 #ifndef _RWSTD_NO_EXCEPTIONS
 
-    catch (const std::length_error &ex) {
-        caught = exceptions [2];
-        rw_assert (caught == expected, 0, tcase.line,
-                   "line %d. %{$FUNCALL} %{?}expected %s,%{:}"
-                   "unexpectedly%{;} caught std::%s(%#s)",
-                   __LINE__, 0 != expected, expected, caught, ex.what ());
-    }
     catch (const std::exception &ex) {
         caught = exceptions [4];
         rw_assert (0, 0, tcase.line,
@@ -777,29 +758,27 @@
 
 int main (int argc, char** argv)
 {
-    static const StringMembers::Test
+    static const StringTest
     tests [] = {
 
 #undef TEST
-#define TEST(tag) {                                             \
-        StringMembers::rfind_ ## tag,                           \
-        tag ## _test_cases,                                     \
-        sizeof tag ## _test_cases / sizeof *tag ## _test_cases  \
+#define TEST(sig) {                                             \
+        RFind (sig), sig ## _test_cases,                        \
+        sizeof sig ## _test_cases / sizeof *sig ## _test_cases  \
     }
 
-        TEST (ptr),
-        TEST (str),
-        TEST (ptr_size),
-        TEST (ptr_size_size),
-        TEST (str_size),
+        TEST (cptr),
+        TEST (cstr),
+        TEST (cptr_size),
+        TEST (cptr_size_size),
+        TEST (cstr_size),
         TEST (val),
         TEST (val_size)
     };
 
     const std::size_t test_count = sizeof tests / sizeof *tests;
 
-    return StringMembers::run_test (argc, argv, __FILE__,
-                                    "lib.string.rfind",
-                                    test_rfind, tests, test_count);
+    return rw_run_string_test (argc, argv, __FILE__,
+                               "lib.string.rfind",
+                               test_rfind, tests, test_count);
 }
-

Modified: incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp?rev=409280&r1=409279&r2=409280&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp Wed May 24 18:31:01 2006
@@ -29,7 +29,7 @@
 #include <cstddef>          // for size_t
 #include <stdexcept>        // for out_of_range
 
-#include <21.strings.h>     // for StringMembers
+#include <21.strings.h>     // for StringIds
 #include <driver.h>         // for rw_test()
 #include <rw_allocator.h>   // for UserAlloc
 #include <rw_char.h>        // for rw_expand()
@@ -37,10 +37,7 @@
 /**************************************************************************/
 
 // for convenience and brevity
-#define Substr(which)             StringMembers::substr_ ## which
-
-typedef StringMembers::TestCase   TestCase;
-typedef StringMembers::Function   Function;
+#define Substr(sig)               StringIds::substr_ ## sig
 
 static const char* const exceptions[] = {
     "unknown exception", "out_of_range", "length_error",
@@ -51,7 +48,7 @@
 
 // used to exercise
 // substr ()
-static const TestCase
+static const StringTestCase
 void_test_cases [] = {
 
 #undef TEST
@@ -84,7 +81,7 @@
 
 // used to exercise
 // substr (size_type)
-static const TestCase
+static const StringTestCase
 size_test_cases [] = {
 
 #undef TEST
@@ -139,7 +136,7 @@
 
 // used to exercise
 // substr (size_type, size_type)
-static const TestCase
+static const StringTestCase
 size_size_test_cases [] = {
 
 #undef TEST
@@ -210,8 +207,8 @@
 
 template <class charT, class Traits, class Allocator>
 void test_substr (charT, Traits*, Allocator*,
-                  const Function &func,
-                  const TestCase &tcase)
+                  const StringFunc     &func,
+                  const StringTestCase &tcase)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
 
@@ -259,21 +256,22 @@
 
     try {
         switch (func.which_) {
-            case Substr (void):
-                s_res = str.substr ();
-                break;
-
-            case Substr (size):
-                s_res = str.substr (tcase.off);
-                break;
-
-            case Substr (size_size):
-                s_res = str.substr (tcase.off, tcase.size);
-                break;
-
-            default:
-                RW_ASSERT (!"logic error: unknown substr overload");
-                return;
+
+        case Substr (void):
+            s_res = str.substr ();
+            break;
+
+        case Substr (size):
+            s_res = str.substr (tcase.off);
+            break;
+
+        case Substr (size_size):
+            s_res = str.substr (tcase.off, tcase.size);
+            break;
+
+        default:
+            RW_ASSERT (!"logic error: unknown substr overload");
+            return;
         }
 
         // verfiy that strings length are equal
@@ -343,13 +341,13 @@
 
 int main (int argc, char** argv)
 {
-    static const StringMembers::Test
+    static const StringTest
     tests [] = {
 
 #undef TEST
-#define TEST(tag) {                                             \
-        StringMembers::substr_ ## tag, tag ## _test_cases,      \
-        sizeof tag ## _test_cases / sizeof *tag ## _test_cases  \
+#define TEST(sig) {                                             \
+        Substr (sig), sig ## _test_cases,                       \
+        sizeof sig ## _test_cases / sizeof *sig ## _test_cases  \
     }
 
         TEST (void),
@@ -359,7 +357,7 @@
 
     const std::size_t test_count = sizeof tests / sizeof *tests;
 
-    return StringMembers::run_test (argc, argv, __FILE__,
-                                    "lib.string.substr",
-                                    test_substr, tests, test_count);
+    return rw_run_string_test (argc, argv, __FILE__,
+                               "lib.string.substr",
+                               test_substr, tests, test_count);
 }

Modified: incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp?rev=409280&r1=409279&r2=409280&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp Wed May 24 18:31:01 2006
@@ -29,7 +29,7 @@
 #include <cstddef>          // size_t
 #include <exception>        // for exception
 
-#include <21.strings.h>     // for StringMembers
+#include <21.strings.h>     // for StringIds
 #include <driver.h>         // for rw_assert()
 #include <rw_allocator.h>   // foir UserAlloc
 #include <rw_char.h>        // for rw_expand()
@@ -38,10 +38,7 @@
 /**************************************************************************/
 
 // for convenience and brevity
-#define Swap(which)               StringMembers::swap_ ## which
-
-typedef StringMembers::TestCase   TestCase;
-typedef StringMembers::Function   Function;
+#define Swap(sig)   StringIds::swap_ ## sig
 
 static const char* const exceptions[] = {
     "unknown exception", "out_of_range", "length_error",
@@ -52,7 +49,7 @@
 
 // exercises:
 // swap (basic_string&)
-static const TestCase
+static const StringTestCase
 str_test_cases [] = {
 
 #undef TEST
@@ -108,8 +105,8 @@
 
 template <class charT, class Traits, class Allocator>
 void test_swap (charT, Traits*, Allocator*,
-                const Function&,
-                const TestCase &tcase)
+                const StringFunc&,
+                const StringTestCase &tcase)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
     typedef UserTraits<UserChar>::MemFun                 UTMemFun;
@@ -298,14 +295,13 @@
 
 int main (int argc, char** argv)
 {
-    static const StringMembers::Test
+    static const StringTest
     tests [] = {
 
 #undef TEST
-#define TEST(tag) {                                             \
-        StringMembers::swap_ ## tag,                            \
-        tag ## _test_cases,                                     \
-        sizeof tag ## _test_cases / sizeof *tag ## _test_cases  \
+#define TEST(sig) {                                             \
+        Swap (sig), sig ## _test_cases,                         \
+        sizeof sig ## _test_cases / sizeof *sig ## _test_cases  \
     }
 
         TEST (str)
@@ -313,7 +309,7 @@
 
     const std::size_t test_count = sizeof tests / sizeof *tests;
 
-    return StringMembers::run_test (argc, argv, __FILE__,
-                                    "lib.string.swap",
-                                    test_swap, tests, test_count);
+    return rw_run_string_test (argc, argv, __FILE__,
+                               "lib.string.swap",
+                               test_swap, tests, test_count);
 }