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/04/21 03:01:29 UTC

svn commit: r395745 - in /incubator/stdcxx/trunk/tests: include/21.strings.h src/21.strings.cpp strings/21.string.append.cpp strings/21.string.assign.cpp

Author: sebor
Date: Thu Apr 20 18:01:26 2006
New Revision: 395745

URL: http://svn.apache.org/viewcvs?rev=395745&view=rev
Log:
2006-04-20  Martin Sebor  <se...@roguewave.com>

	* 21.strings.h (TestCase): Added new members.
	(Test): Removed the member which (moved to TestCase).
	(format): Removed last argument.
	(opt_no_user_char, opt_no_char_traits, opt_no_user_traits,
	opt_no_exceptions, opt_no_exception_safety): New static members.
	* 21.strings.cpp: Same as above as necessary.
	* 21.string.append.cpp: Reflected the above.
	* 21.string.assign.cpp: Ditto.

Modified:
    incubator/stdcxx/trunk/tests/include/21.strings.h
    incubator/stdcxx/trunk/tests/src/21.strings.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp

Modified: incubator/stdcxx/trunk/tests/include/21.strings.h
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/21.strings.h?rev=395745&r1=395744&r2=395745&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/21.strings.h (original)
+++ incubator/stdcxx/trunk/tests/include/21.strings.h Thu Apr 20 18:01:26 2006
@@ -146,44 +146,55 @@
     // describes a single test case for any overload
     // of any member function
     struct TestCase {
-        int           line;      // test case line number
+        MemberFunction which;     // member function to call
+        int            line;      // test case line number
 
-        int           off;       // offset (position argument)
-        int           size;      // size (count argument)
-        int           val;       // value (single character to append)
+        int            off;       // offset (position argument)
+        int            size;      // size (count argument)
 
-        const char*   str;       // controlled sequence
-        _RWSTD_SIZE_T str_len;   // length of sequence
+        int            off2;      // offset 2 (position argument)
+        int            size2;     // size 2 (count argument)
 
-        const char*   arg;       // sequence to insert
-        _RWSTD_SIZE_T arg_len;   // length of sequence
+        int            val;       // value (single character to append)
 
-        const char*   res;       // resulting sequence
-        _RWSTD_SIZE_T res_len;   // length of sequence
+        const char*    str;       // controlled sequence
+        _RWSTD_SIZE_T  str_len;   // length of sequence
 
-        int           bthrow;    // exception expected
+        const char*    arg;       // sequence to insert
+        _RWSTD_SIZE_T  arg_len;   // length of sequence
+
+        const char*    res;       // resulting sequence
+        _RWSTD_SIZE_T  res_len;   // length of sequence
+
+        int            bthrow;    // exception expected
     };
 
     // describes a set of test cases for a single overload
     // of a member function
     struct Test {
-        MemberFunction   which;        // which overload of assign()
-        const TestCase  *cases;        // test cases to exercise
-        _RWSTD_SIZE_T    case_count;   // number of test cases
-        const char      *funsig;       // function signature
+        const TestCase *cases;        // test cases to exercise
+        _RWSTD_SIZE_T   case_count;   // number of test cases
+        const char     *funsig;       // function signature
     };
 
     // dynamically allocates and formats a string describing
     // the call to the member function, including the values
     // of its arguments, specfified by its arguments
     static char*
-    format (charT, Traits, Allocator, MemberFunction, const TestCase&);
+    format (charT, Traits, Allocator, const TestCase&);
 
     // array of integers to use for command line option
     // processing (to disable individual overloads of all
     // member functions)
     static int
     opt_memfun_disabled [member_functions];
+
+    static int opt_no_user_char;          // for --no-user_char
+    static int opt_no_char_traits;        // for --no-char_traits
+    static int opt_no_user_traits;        // for --no-user_traits
+
+    static int opt_no_exceptions;         // for --no-exceptions
+    static int opt_no_exception_safety;   // for --no-exception-safety
 };
 
 

Modified: incubator/stdcxx/trunk/tests/src/21.strings.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/21.strings.cpp?rev=395745&r1=395744&r2=395745&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/21.strings.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/21.strings.cpp Thu Apr 20 18:01:26 2006
@@ -55,10 +55,24 @@
 int StringMembers::
 opt_memfun_disabled [StringMembers::member_functions];
 
+int StringMembers::
+opt_no_user_char;
+
+int StringMembers::
+opt_no_char_traits;
+
+int StringMembers::
+opt_no_user_traits;
+
+int StringMembers::
+opt_no_exceptions;
+
+int StringMembers::
+opt_no_exception_safety;
+
 
 char* StringMembers::
-format (charT cid, Traits tid, Allocator aid, MemberFunction which,
-        const TestCase &tcase)
+format (charT cid, Traits tid, Allocator aid, const TestCase &tcase)
 {
     char*  buf     = 0;
     size_t bufsize = 0;
@@ -82,7 +96,7 @@
 
     const char *fname = "assign";
 
-    switch (which) {
+    switch (tcase.which) {
     case append_ptr:
         fname = "append";
     case assign_ptr:

Modified: incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.append.cpp?rev=395745&r1=395744&r2=395745&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.append.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.append.cpp Thu Apr 20 18:01:26 2006
@@ -47,7 +47,7 @@
 
 
 #define AppendOverload   StringMembers::MemberFunction
-#define Append(which)   StringMembers::append_ ## which
+#define Append(which)    StringMembers::append_ ## which
 #define Disabled(which)  StringMembers::opt_memfun_disabled [which]
 
 typedef StringMembers::TestCase TestCase;
@@ -88,24 +88,17 @@
 
 /**************************************************************************/
 
-static int rw_opt_no_char_traits;              // for --no-char_traits
-static int rw_opt_no_user_traits;              // for --no-user_traits
-
-static int rw_opt_no_user_chars;               // for --no-user_chars
-static int rw_opt_no_exceptions;               // for --no-exceptions
-static int rw_opt_no_exception_safety;         // for --no-exception-safety
-
-/**************************************************************************/
-
 // used to exercise
 // append (const charT* s)
 static const TestCase
 ptr_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, res, bthrow)                            \
-    { __LINE__, -1, -1, -1, str, sizeof str - 1, arg,          \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, arg, res, bthrow) {                           \
+        Append (ptr), __LINE__, -1, -1, -1, -1, -1,             \
+        str, sizeof str - 1,                                    \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |             +--------------------------- sequence to be appended
@@ -150,12 +143,8 @@
     TEST ("\0\0abc",    0,            "\0\0abc",              0),
     TEST ("abc\0\0",    0,            "abc\0\0abc",           0),
 
-#ifndef _RWSTD_NO_EXCEPTIONS
-
     TEST ("",           LSTR,         LSTR,                  -1),
 
-#endif   // _RWSTD_NO_EXCEPTIONS
-
     TEST ("last",       "test",       "lasttest",             0)
 };
 
@@ -167,9 +156,11 @@
 str_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, res, bthrow)                            \
-    { __LINE__, -1, -1, -1, str, sizeof str - 1, arg,          \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(s, arg, res, bthrow) {                             \
+        Append (str), __LINE__, -1, -1, -1, -1, -1,             \
+        s, sizeof s - 1,                                        \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |             +--------------------------- sequence to be appended
@@ -215,12 +206,8 @@
     TEST ("\0\0abc",    0,            "\0\0abc\0\0abc",       0),
     TEST ("abc\0\0",    0,            "abc\0\0abc\0\0",       0),
 
-#ifndef _RWSTD_NO_EXCEPTIONS
-
     TEST ("",           LSTR,         LSTR,                  -1),
 
-#endif   // _RWSTD_NO_EXCEPTIONS
-
     TEST ("last",       "test",       "lasttest",             0)
 };
 
@@ -232,9 +219,11 @@
 ptr_size_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, size, res, bthrow)                            \
-    { __LINE__, -1, size, -1, str, sizeof str - 1, arg,              \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, arg, size, res, bthrow) {                     \
+        Append (ptr_size), __LINE__, -1, size, -1, -1, -1,      \
+        str, sizeof str - 1,                                    \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +-------------------------------------- controlled sequence
     //    |            +------------------------- sequence to be appended
@@ -282,12 +271,8 @@
     TEST ("",          LSTR, LLEN - 1,  LSTR,             0),
     TEST (LSTR,        "",          0,  LSTR,             0),
 
-#ifndef _RWSTD_NO_EXCEPTIONS
-
     TEST ("",          LSTR, LLEN - 1,  LSTR,            -1),
 
-#endif   // _RWSTD_NO_EXCEPTIONS
-
     TEST ("last",      "test",      4, "lasttest",        0)
 };
 
@@ -303,9 +288,11 @@
 #define str_off_size_test_cases range_test_cases
 
 #undef TEST
-#define TEST(str, arg, off, size, res, bthrow)                            \
-    { __LINE__, off, size, -1, str, sizeof str - 1, arg,                  \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, arg, off, size, res, bthrow) {                \
+        Append (str_off_size), __LINE__, off, size, -1, -1, -1, \
+        str, sizeof str - 1,                                    \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +-------------------------------------- controlled sequence
     //    |            +------------------------- sequence to be appended
@@ -362,16 +349,12 @@
     TEST ("",          LSTR,        0, LLEN, LSTR,            0),
     TEST (LSTR,        "",          0, 0,    LSTR,            0),
 
-#ifndef _RWSTD_NO_EXCEPTIONS
-
     TEST ("",          "\0",        2, 0,  "",                1),
     TEST ("",          "a",         2, 0,  "",                1),
     TEST ("",          LSTR,LLEN + 10, 0,  "",                1),
 
     TEST (LSTR,        0,           0, 0, 0,                 -1),
 
-#endif   // _RWSTD_NO_EXCEPTIONS
-
     TEST ("last",      "test",      0, 4, "lasttest",         0)
 };
 
@@ -383,9 +366,11 @@
 size_val_test_cases [] = {
 
 #undef TEST
-#define TEST(str, size, val, res, bthrow)                            \
-    { __LINE__, -1, size, val, str, sizeof str - 1, 0, 0,            \
-      res, sizeof res - 1, bthrow }
+#define TEST(str, size, val, res, bthrow) {                     \
+        Append (size_val), __LINE__, -1, size, -1, -1, val,     \
+        str, sizeof str - 1,                                    \
+        0, 0, res, sizeof res - 1, bthrow                       \
+    }
 
     //    +-------------------------------------- controlled sequence
     //    |            +------------------------- append() count argument
@@ -429,12 +414,8 @@
     TEST ("",          LLEN - 1, 'x', LSTR,        0),
     TEST (LSTR,        0,        'x', LSTR,        0),
 
-#ifndef _RWSTD_NO_EXCEPTIONS
-
     TEST ("",          LLEN - 1, 'x', LSTR,       -1),
 
-#endif   // _RWSTD_NO_EXCEPTIONS
-
     TEST ("last",      4, 't', "lasttttt",         0)
 };
 
@@ -445,7 +426,7 @@
 
 #undef TEST
 #define TEST(tag, sig) {                                        \
-        Append (tag), tag ## _test_cases,                       \
+        tag ## _test_cases,                                     \
         sizeof tag ## _test_cases / sizeof *tag ## _test_cases, \
         "append " sig                                           \
     }
@@ -461,10 +442,9 @@
 /**************************************************************************/
 
 template <class charT, class Traits>
-void test_append_exceptions (charT, Traits*,
-                             const AppendOverload  which,
-                             const TestCase       &cs,
-                             const char           *funcall)
+void test_exceptions (charT, Traits*,
+                      const TestCase &cs,
+                      const char     *funcall)
 {
     typedef std::basic_string <charT, Traits,
                                std::allocator<charT> > TestString;
@@ -506,22 +486,22 @@
 #endif   // _RWSTD_NO_EXCEPTIONS
 
         _TRY {
-            if (Append (ptr) == which)
+            if (Append (ptr) == cs.which)
                 s_str.append (cs.arg ? wsrc : s_str.c_str ());
 
-            else if (Append (str) == which)
+            else if (Append (str) == cs.which)
                 s_str.append (cs.arg ? s_arg : s_str);
 
-            else if (Append (ptr_size) == which)
+            else if (Append (ptr_size) == cs.which)
                 s_str.append (cs.arg ? wsrc : s_str.c_str (), cs.size);
 
-            else if (Append (str_off_size) == which)
+            else if (Append (str_off_size) == cs.which)
                 s_str.append (cs.arg ? s_arg : s_str, cs.off, cs.size);
 
-            else if (Append (size_val) == which)
+            else if (Append (size_val) == cs.which)
                 s_str.append (cs.size, make_char (char (cs.val), (charT*)0));
 
-            else if (Append (range) == which)
+            else if (Append (range) == cs.which)
                 s_str.append (s_arg.begin (), s_arg.end ());
 
             break;
@@ -671,7 +651,6 @@
 
 template <class charT, class Traits>
 void test_append (charT, Traits*,
-                  const AppendOverload     which,
                   const TestCase &cs,
                   const char     *funcall)
 {
@@ -686,7 +665,7 @@
     rw_widen (wsrc, cs.arg, cs.arg_len);
 
     // special processing for append_range to exercise all iterators
-    if (Append (range) == which) {
+    if (Append (range) == cs.which) {
         test_append_range (wstr, wsrc, (Traits*)0, cs, funcall);
         return;
     }
@@ -700,7 +679,7 @@
 
     // is some exception expected ?
     const char* expected = 0;
-    if (1 == cs.bthrow && Append (str_off_size) == which)
+    if (1 == cs.bthrow && Append (str_off_size) == cs.which)
         expected = exp_exceptions [1];
     if (2 == cs.bthrow)
         expected = exp_exceptions [2];
@@ -709,10 +688,14 @@
 
     try {
 
+#else   // if defined (_RWSTD_NO_EXCEPTIONS)
+
+    if (cs.bthrow)
+        return;
+
 #endif   // _RWSTD_NO_EXCEPTIONS
 
-    switch (which)
-    {
+    switch (cs.which) {
     case Append (ptr): {
         TestString& s_res = s_str.append (cs.arg ? wsrc : s_str.c_str ());
         res_off = &s_res - &s_str;
@@ -798,7 +781,7 @@
 /**************************************************************************/
 
 static void
-test_append (const MemFun *pfid, const AppendOverload which,
+test_append (const MemFun *pfid,
              const TestCase& cs, bool exc_safety_test)
 {
     // format the description of the function call including
@@ -806,13 +789,13 @@
     char* const funcall =
         StringMembers::format (pfid->cid_, pfid->tid_,
                                StringMembers::DefaultAllocator,
-                               which, cs);
+                               cs);
 
 #undef TEST
 #define TEST(charT, Traits)	                                          \
     exc_safety_test ?                                                     \
-        test_append_exceptions (charT (), (Traits*)0, which, cs, funcall) \
-      : test_append (charT (), (Traits*)0, which, cs, funcall)
+        test_exceptions (charT (), (Traits*)0, cs, funcall) \
+      : test_append (charT (), (Traits*)0, cs, funcall)
 
     if (StringMembers::DefaultTraits == pfid->tid_) {
         if (StringMembers::Char == pfid->cid_)
@@ -848,7 +831,7 @@
     rw_info (0, 0, 0, "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::%s",
              pfid->cname_, pfid->tname_, pfid->aname_, test.funsig);
 
-    if (rw_opt_no_exception_safety)
+    if (StringMembers::opt_no_exception_safety)
         rw_note (0, 0, 0,
                  "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::"
                  "%s exception safety test disabled",
@@ -865,22 +848,23 @@
 
     for (std::size_t i = 0; i != test.case_count; ++i) {
 
-        if (!rw_enabled (test.cases[i].line)) {
+        if (!rw_enabled (test.cases [i].line)) {
             rw_note (0, 0, __LINE__,
-                     "test on line %d disabled", test.cases[i].line);
+                     "test on line %d disabled", test.cases [i].line);
             continue;
         }
 
         // do not exercise exceptions if they were disabled
-        if (0 != rw_opt_no_exceptions && 0 != test.cases[i].bthrow)
+        if (   0 != StringMembers::opt_no_exceptions
+            && 0 != test.cases [i].bthrow)
             continue;
 
         // do not exercise exception safety if they were disabled
-        if (0 != rw_opt_no_exception_safety && -1 == test.cases[i].bthrow)
+        if (   0 != StringMembers::opt_no_exception_safety
+            && -1 == test.cases [i].bthrow)
             continue;
 
-        test_append (pfid, test.which, test.cases[i],
-                     -1 == test.cases [i].bthrow);
+        test_append (pfid, test.cases [i], -1 == test.cases [i].bthrow);
     }
 }
 
@@ -890,26 +874,27 @@
 static void
 run_test (const MemFun *pfid)
 {
-    if (StringMembers::UserTraits == pfid->tid_ && rw_opt_no_user_traits) {
-        rw_note (1 < rw_opt_no_user_traits++, 0, 0,
+    if (   StringMembers::UserTraits == pfid->tid_
+        && StringMembers::opt_no_user_traits) {
+        rw_note (1 < StringMembers::opt_no_user_traits++, 0, 0,
                  "user defined traits test disabled");
     }
     else if (   StringMembers::DefaultTraits == pfid->tid_
-             && rw_opt_no_char_traits) {
-        rw_note (1 < rw_opt_no_char_traits++, 0, 0,
+             && StringMembers::opt_no_char_traits) {
+        rw_note (1 < StringMembers::opt_no_char_traits++, 0, 0,
                  "char_traits test disabled");
     }
     else {
 
-        if (rw_opt_no_exceptions)
-            rw_note (1 < rw_opt_no_exceptions++, 0, 0,
+        if (StringMembers::opt_no_exceptions)
+            rw_note (1 < StringMembers::opt_no_exceptions++, 0, 0,
                      "string::append exceptions tests disabled");
 
         static const std::size_t ntests = sizeof tests / sizeof *tests;
 
         for (std::size_t i = 0; i < ntests; i++) {
 
-            if (Disabled (tests [i].which))
+            if (Disabled (tests [i].cases [0].which))
                 rw_note (0, 0, 0,
                          "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::"
                          "%s test disabled", pfid->cname_, pfid->tname_,
@@ -964,7 +949,7 @@
     else
         rw_note (0, 0, 0, "string::append wchar tests disabled");
 
-    if (rw_opt_no_user_chars) {
+    if (StringMembers::opt_no_user_char) {
         rw_note (0, 0, 0, "user defined chars test disabled");
     }
     else {
@@ -991,7 +976,7 @@
                     run_test,
                     "|-no-char_traits# "
                     "|-no-user_traits# "
-                    "|-no-user_chars# "
+                    "|-no-user_char# "
                     "|-no-exceptions# "
                     "|-no-exception-safety# "
 
@@ -1002,11 +987,11 @@
                     "|-no-append-size-val# "
                     "|-no-append-range#",
 
-                    &rw_opt_no_char_traits,
-                    &rw_opt_no_user_traits,
-                    &rw_opt_no_user_chars,
-                    &rw_opt_no_exceptions,
-                    &rw_opt_no_exception_safety,
+                    &StringMembers::opt_no_char_traits,
+                    &StringMembers::opt_no_user_traits,
+                    &StringMembers::opt_no_user_char,
+                    &StringMembers::opt_no_exceptions,
+                    &StringMembers::opt_no_exception_safety,
 
                     &Disabled (Append (ptr)),
                     &Disabled (Append (str)),

Modified: incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp?rev=395745&r1=395744&r2=395745&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp Thu Apr 20 18:01:26 2006
@@ -88,24 +88,17 @@
 
 /**************************************************************************/
 
-static int rw_opt_no_char_traits;              // for --no-char_traits
-static int rw_opt_no_user_traits;              // for --no-user_traits
-
-static int rw_opt_no_user_chars;               // for --no-user_chars
-static int rw_opt_no_exceptions;               // for --no-exceptions
-static int rw_opt_no_exception_safety;         // for --no-exception-safety
-
-/**************************************************************************/
-
 // used to exercise:
 // assign (const value_type*)
 static const TestCase
 ptr_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, res, bthrow)                            \
-    { __LINE__, -1, -1, -1, str, sizeof str - 1, arg,          \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, arg, res, bthrow) {                           \
+        Assign (ptr), __LINE__, -1, -1, -1, -1, -1,             \
+        str, sizeof str - 1,                                    \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |             +--------------------------- sequence to be assigned
@@ -157,9 +150,11 @@
 str_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, res, bthrow)                            \
-    { __LINE__, -1, -1, -1, str, sizeof str - 1, arg,          \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(s, arg, res, bthrow) {                             \
+        Assign (str), __LINE__, -1, -1, -1, -1, -1,             \
+        s, sizeof s - 1,                                        \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |             +--------------------------- sequence to be assigned
@@ -217,9 +212,11 @@
 ptr_size_test_cases [] = {
 
 #undef TEST
-#define TEST(str, arg, size, res, bthrow)                            \
-    { __LINE__, -1, size, -1, str, sizeof str - 1, arg,              \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, arg, size, res, bthrow) {                     \
+        Assign (ptr_size), __LINE__, -1, size, -1, -1, -1,      \
+        str, sizeof str - 1,                                    \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |            +---------------------------- sequence to be assigned
@@ -290,9 +287,11 @@
 #define str_off_size_test_cases range_test_cases
 
 #undef TEST
-#define TEST(str, arg, off, size, res, bthrow)                            \
-    { __LINE__, off, size, -1, str, sizeof str - 1, arg,                  \
-      sizeof arg - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, arg, off, size, res, bthrow) {                \
+        Assign (range), __LINE__, off, size, -1, -1, -1,        \
+        str, sizeof str - 1,                                    \
+        arg, sizeof arg - 1, res, sizeof res - 1, bthrow        \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |            +---------------------------- sequence to be inserted
@@ -370,9 +369,11 @@
 size_val_test_cases [] = {
 
 #undef TEST
-#define TEST(str, size, val, res, bthrow)                            \
-    { __LINE__, -1, size, val, str, sizeof str - 1, 0, 0,            \
-      res, sizeof res - 1, bthrow }
+#define TEST(str, size, val, res, bthrow) {                     \
+        Assign (size_val), __LINE__, -1, size, -1, -1, val,     \
+        str, sizeof str - 1,                                    \
+        0, 0, res, sizeof res - 1, bthrow                       \
+    }
 
     //    +----------------------------------------- controlled sequence
     //    |            +---------------------------- assign() count argument
@@ -425,7 +426,7 @@
 
 #undef TEST
 #define TEST(tag, sig) {                                        \
-        Assign (tag), tag ## _test_cases,                       \
+        tag ## _test_cases,                                     \
         sizeof tag ## _test_cases / sizeof *tag ## _test_cases, \
         "assign " sig                                           \
     }
@@ -441,10 +442,9 @@
 /**************************************************************************/
 
 template <class charT, class Traits>
-void test_assign_exceptions (charT, Traits*,
-                             const AssignOverload  which,
-                             const TestCase       &cs,
-                             const char           *funcall)
+void test_exceptions (charT, Traits*,
+                      const TestCase &cs,
+                      const char     *funcall)
 {
     typedef std::allocator<charT>                        Allocator;
     typedef std::basic_string <charT, Traits, Allocator> TestString;
@@ -490,7 +490,7 @@
 #endif   // _RWSTD_NO_EXCEPTIONS
 
         _TRY {
-            switch (which) {
+            switch (cs.which) {
             case Assign (ptr):
                 s_str.assign (arg_ptr);
                 break;
@@ -669,7 +669,6 @@
 
 template <class charT, class Traits>
 void test_assign (charT, Traits*,
-                  const AssignOverload  which,
                   const TestCase       &cs,
                   const char           *funcall)
 {
@@ -684,7 +683,7 @@
     rw_widen (wsrc, cs.arg, cs.arg_len);
 
     // special processing for assign_range to exercise all iterators
-    if (Assign (range) == which) {
+    if (Assign (range) == cs.which) {
         test_assign_range (wstr, wsrc, (Traits*)0, cs, funcall);
         return;
     }
@@ -706,7 +705,7 @@
 
     // is some exception expected ?
     const char* expected = 0;
-    if (1 == cs.bthrow && Assign (str_off_size) == which)
+    if (1 == cs.bthrow && Assign (str_off_size) == cs.which)
         expected = exp_exceptions [1];
     if (2 == cs.bthrow)
         expected = exp_exceptions [2];
@@ -722,7 +721,7 @@
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
-    switch (which) {
+    switch (cs.which) {
     case Assign (ptr):
         res_ptr = &s_str.assign (arg_ptr);
         break;
@@ -799,21 +798,20 @@
 /**************************************************************************/
 
 static void
-test_assign (const MemFun *pfid, const AssignOverload which,
-             const TestCase& cs, bool exc_safety_test)
+test_assign (const MemFun *pfid, const TestCase& cs, bool exc_safety_test)
 {
     // format the description of the function call including
     // the values of arguments for use in diagnostics
     char* const funcall =
         StringMembers::format (pfid->cid_, pfid->tid_,
                                StringMembers::DefaultAllocator,
-                               which, cs);
+                               cs);
 
 #undef TEST
-#define TEST(charT, Traits)                                                 \
-    exc_safety_test ?                                                       \
-        test_assign_exceptions (charT (), (Traits*)0, which, cs, funcall)   \
-      : test_assign (charT(), (Traits*)0, which, cs, funcall)
+#define TEST(charT, Traits)                                     \
+    exc_safety_test ?                                           \
+        test_exceptions (charT (), (Traits*)0, cs, funcall)     \
+      : test_assign (charT (), (Traits*)0, cs, funcall)
 
     if (StringMembers::DefaultTraits == pfid->tid_) {
         if (StringMembers::Char == pfid->cid_)
@@ -849,7 +847,7 @@
     rw_info (0, 0, 0, "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::%s",
              pfid->cname_, pfid->tname_, pfid->aname_, test.funsig);
 
-    if (rw_opt_no_exception_safety)
+    if (StringMembers::opt_no_exception_safety)
         rw_note (0, 0, 0,
                  "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::"
                  "%s exception safety test disabled",
@@ -873,15 +871,16 @@
         }
 
         // do not exercise exceptions if they were disabled
-        if (0 != rw_opt_no_exceptions && 0 != test.cases [i].bthrow)
+        if (   0 != StringMembers::opt_no_exceptions
+            && 0 != test.cases [i].bthrow)
             continue;
 
         // do not exercise exception safety if they were disabled
-        if (0 != rw_opt_no_exception_safety && -1 == test.cases [i].bthrow)
+        if (   0 != StringMembers::opt_no_exception_safety
+            && -1 == test.cases [i].bthrow)
             continue;
 
-        test_assign (pfid, test.which, test.cases [i],
-                     -1 == test.cases [i].bthrow);
+        test_assign (pfid, test.cases [i], -1 == test.cases [i].bthrow);
     }
 }
 
@@ -891,26 +890,27 @@
 static void
 run_test (const MemFun *pfid)
 {
-    if (StringMembers::UserTraits == pfid->tid_ && rw_opt_no_user_traits) {
-        rw_note (1 < rw_opt_no_user_traits++, 0, 0,
+    if (   StringMembers::UserTraits == pfid->tid_
+        && StringMembers::opt_no_user_traits) {
+        rw_note (1 < StringMembers::opt_no_user_traits++, 0, 0,
                  "user defined traits test disabled");
     }
     else if (   StringMembers::DefaultTraits == pfid->tid_
-             && rw_opt_no_char_traits) {
-        rw_note (1 < rw_opt_no_char_traits++, 0, 0,
+             && StringMembers::opt_no_char_traits) {
+        rw_note (1 < StringMembers::opt_no_char_traits++, 0, 0,
                  "char_traits test disabled");
     }
     else {
 
-        if (rw_opt_no_exceptions)
-            rw_note (1 < rw_opt_no_exceptions++, 0, 0,
+        if (StringMembers::opt_no_exceptions)
+            rw_note (1 < StringMembers::opt_no_exceptions++, 0, 0,
                      "string::assign exceptions tests disabled");
 
         static const std::size_t ntests = sizeof tests / sizeof *tests;
 
         for (std::size_t i = 0; i < ntests; i++) {
 
-            if (Disabled (tests [i].which))
+            if (Disabled (tests [i].cases [0].which))
                 rw_note (0, 0, 0,
                          "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::"
                          "%s test disabled", pfid->cname_, pfid->tname_,
@@ -966,7 +966,7 @@
     else
         rw_note (0, 0, 0, "string::assign wchar tests disabled");
 
-    if (rw_opt_no_user_chars) {
+    if (StringMembers::opt_no_user_char) {
         rw_note (0, 0, 0, "user defined chars test disabled");
     }
     else {
@@ -993,7 +993,7 @@
                     run_test,
                     "|-no-char_traits# "
                     "|-no-user_traits# "
-                    "|-no-user_chars# "
+                    "|-no-user_char# "
                     "|-no-exceptions# "
                     "|-no-exception-safety# "
 
@@ -1004,11 +1004,11 @@
                     "|-no-assign-size-val# "
                     "|-no-assign-range#",
 
-                    &rw_opt_no_char_traits,
-                    &rw_opt_no_user_traits,
-                    &rw_opt_no_user_chars,
-                    &rw_opt_no_exceptions,
-                    &rw_opt_no_exception_safety,
+                    &StringMembers::opt_no_char_traits,
+                    &StringMembers::opt_no_user_traits,
+                    &StringMembers::opt_no_user_char,
+                    &StringMembers::opt_no_exceptions,
+                    &StringMembers::opt_no_exception_safety,
 
                     &Disabled (Assign (ptr)),
                     &Disabled (Assign (str)),