stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant...@apache.org
Subject svn commit: r410782 - in /incubator/stdcxx/trunk/tests/strings: 21.string.append.cpp 21.string.assign.cpp 21.string.cons.cpp 21.string.insert.cpp 21.string.op.plus.equal.cpp 21.string.replace.cpp
Date Thu, 01 Jun 2006 07:57:52 GMT
Author: antonp
Date: Thu Jun  1 00:57:51 2006
New Revision: 410782

URL: http://svn.apache.org/viewvc?rev=410782&view=rev
Log:
2006-06-01  Anton Pevtsov  <antonp@moscow.vdiweb.com>

	* 21.string.cons.cpp (cptr_test_cases, cstr_test_cases, ...): Added
	new test cases which contains strings with special length to 
	exercise memory allocation,
	(test_cons_range): Changed signature
	to take StringTestCaseData<charT> instead of charT* arrays and
	their sizes and simplified definition.
	(test_cons): Same.
	(DEFINE_STRING_TEST_FUNCTIONS): Used to define an array of
	pointers to specializations of the test_cons template,
	thus obviating the need for the dispatch function.
	(main): Passed test_cons_func_array defined by the macro
	above to rw_run_string_test.
	21.string.append.cpp: Added new test cases which contains strings 
	with special length to exercise memory allocation,
	21.string.assign.cpp: Same
	21.string.insert.cpp: Same
	21.string.op.plus.equal.cpp: Same
	21.string.replace.cpp: Same

Modified:
    incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp

Modified: incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.append.cpp?rev=410782&r1=410781&r2=410782&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.append.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.append.cpp Thu Jun  1 00:57:51 2006
@@ -99,6 +99,16 @@
     TEST ("x@4096",     "",           "x@4096",               0),
     TEST ("x@4096",     "x@4096",     "x@8192",               0),
 
+    TEST ("x@10",       "x@118",      "x@128",                0),
+    TEST ("x@128",      "x@79",       "x@207",                0),
+    TEST ("x@207",      "x@127",      "x@334",                0),
+    TEST ("x@334",      "x@206",      "x@540",                0),
+    TEST ("x@540",      "x@333",      "x@873",                0),
+    TEST ("x@539",      "x@873",      "x@1412",               0),
+    TEST ("x@872",      "x@1412",     "x@2284",               0),
+    TEST ("x@1411",     "x@2284",     "x@3695",               0),
+    TEST ("x@1412",     "x@2284",     "x@3696",               0),
+
     TEST ("",           0,            "",                     0),
     TEST ("abc",        0,            "abcabc",               0),
     TEST ("a\0\0bc",    0,            "a\0\0bca",             0),
@@ -161,6 +171,16 @@
     TEST ("x@4096",     "",           "x@4096",               0),
     TEST ("x@4096",     "x@4096",     "x@8192",               0),
 
+    TEST ("x@10",       "x@118",      "x@128",                0),
+    TEST ("x@128",      "x@79",       "x@207",                0),
+    TEST ("x@207",      "x@127",      "x@334",                0),
+    TEST ("x@334",      "x@206",      "x@540",                0),
+    TEST ("x@540",      "x@333",      "x@873",                0),
+    TEST ("x@539",      "x@873",      "x@1412",               0),
+    TEST ("x@872",      "x@1412",     "x@2284",               0),
+    TEST ("x@1411",     "x@2284",     "x@3695",               0),
+    TEST ("x@1412",     "x@2284",     "x@3696",               0),
+
     TEST ("",           0,            "",                     0),
     TEST ("abc",        0,            "abcabc",               0),
     TEST ("a\0\0bc",    0,            "a\0\0bca\0\0bc",       0),
@@ -219,6 +239,19 @@
     TEST ("\0ab\0\0c", "\0e\0",     1,  "\0ab\0\0c\0",    0),
     TEST ("a\0bc\0\0", "\0e",       2,  "a\0bc\0\0\0e",   0),
 
+    TEST ("x@10",      "x@118",   118,   "x@128",         0),
+    TEST ("x@128",     "x@79",     79,   "x@207",         0),
+    TEST ("x@207",     "x@127",   127,   "x@334",         0),
+    TEST ("x@207",     "x@207",   127,   "x@334",         0),
+    TEST ("x@334",     "x@206",   206,   "x@540",         0),
+    TEST ("x@540",     "x@333",   333,   "x@873",         0),
+    TEST ("x@539",     "x@873",   873,   "x@1412",        0),
+    TEST ("x@873",     "x@540",   539,   "x@1412",        0),
+    TEST ("x@872",     "x@1412", 1412,   "x@2284",        0),
+    TEST ("x@1411",    "x@2284", 2284,   "x@3695",        0),
+    TEST ("x@1411",    "x@3695", 2284,   "x@3695",        0),
+    TEST ("x@1412",    "x@2284", 2284,   "x@3696",        0),
+
     TEST ("",          0,           0,  "",               0),
     TEST ("abc",       0,           0,  "abc",            0),
     TEST ("abc",       0,           1,  "abca",           0),
@@ -312,11 +345,24 @@
     TEST ("x@4096",    "",          0,    0, "x@4096",        0),
     TEST ("x@4096",    "a@4096",  100,   10, "x@4096a@10",    0),
 
-    TEST ("",          "\0",        2, 0,  "",                1),
-    TEST ("",          "a",         2, 0,  "",                1),
-    TEST ("",          "x@4096", 4106, 0,  "",                1),
+    TEST ("x@10",      "x@118",     0,  118, "x@128",         0),
+    TEST ("x@128",     "x@129",    50,   79, "x@207",         0),
+    TEST ("x@207",     "x@127",     0,  127, "x@334",         0),
+    TEST ("x@207",     "x@207",    10,  127, "x@334",         0),
+    TEST ("x@334",     "x@208",     2,  206, "x@540",         0),
+    TEST ("x@540",     "x@336",     3,  333, "x@873",         0),
+    TEST ("x@539",     "x@873",     0,  873, "x@1412",        0),
+    TEST ("x@873",     "x@540",     1,  539, "x@1412",        0),
+    TEST ("x@872",     "x@1412",    0, 1412, "x@2284",        0),
+    TEST ("x@1411",    "x@2288",    4, 2284, "x@3695",        0),
+    TEST ("x@1411",    "x@3695",  128, 2284, "x@3695",        0),
+    TEST ("x@1412",    "x@2284",    0, 2284, "x@3696",        0),
+
+    TEST ("",          "\0",        2,    0, "",              1),
+    TEST ("",          "a",         2,    0, "",              1),
+    TEST ("",          "x@4096", 4106,    0, "",              1),
 
-    TEST ("last",      "test",      0, 4, "lasttest",         0)
+    TEST ("last",      "test",      0,    4, "lasttest",      0)
 };
 
 /**************************************************************************/
@@ -375,6 +421,15 @@
     TEST ("",       4096, 'x', "x@4096",           0),
     TEST ("x@4096",    0, 'x', "x@4096",           0),
 
+    TEST ("x@127",     1, 'x', "x@128",            0),
+    TEST ("x@200",     7, 'x', "x@207",            0),
+    TEST ("x@331",     3, 'x', "x@334",            0),
+    TEST ("x@539",     1, 'x', "x@540",            0),
+    TEST ("x@539",   873, 'x', "x@1412",           0),
+    TEST ("x@873",  1411, 'x', "x@2284",           0),
+    TEST ("x@3694",    1, 'x', "x@3695",           0),
+    TEST ("x@540",     1, 'x', "x@541",            0),
+
     TEST ("last",      4, 't', "lasttttt",         0)
 };
 
@@ -413,6 +468,15 @@
     TEST ("\0abc\0\0", 'a', "\0abc\0\0a",       0),
 
     TEST ("x@4095",    'x', "x@4096",           0),
+
+    TEST ("x@127",     'x',  "x@128",           0),
+    TEST ("x@206",     'x',  "x@207",           0),
+    TEST ("x@333",     'x',  "x@334",           0),
+    TEST ("x@539",     'x',  "x@540",           0),
+    TEST ("x@1411",    'x',  "x@1412",          0),
+    TEST ("x@2283",    'x',  "x@2284",          0),
+    TEST ("x@3694",    'x',  "x@3695",          0),
+    TEST ("x@540",     'x',  "x@541",           0),
 
     TEST ("last",      't', "lastt",            0)
 };

Modified: incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp?rev=410782&r1=410781&r2=410782&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp Thu Jun  1 00:57:51 2006
@@ -92,6 +92,15 @@
     TEST ("x@4096",     "",           "",              0),
     TEST ("a@4096",     "b@4096",     "b@4096",        0),
 
+    TEST ("",           "x@207",      "x@207",         0),
+    TEST ("x@128",      "x@207",      "x@207",         0),
+    TEST ("x@540",      "x@207",      "x@207",         0),
+    TEST ("",           "x@1412",     "x@1412",        0),
+    TEST ("x@128",      "x@1412",     "x@1412",        0),
+    TEST ("x@3695",     "x@1412",     "x@1412",        0),
+    TEST ("x@872",      "x@873",      "x@873",         0),
+    TEST ("x@873",      "x@3695",     "x@3695",        0),
+
     TEST ("",           0,            "",              0),
     TEST ("abc",        0,            "abc",           0),
     TEST ("a\0\0bc",    0,            "a",             0),
@@ -156,6 +165,15 @@
     TEST ("x@4096",     "",           "",            0),
     TEST ("a@4096",     "b@4096",     "b@4096",      0),
 
+    TEST ("",           "x@207",      "x@207",       0),
+    TEST ("x@128",      "x@207",      "x@207",       0),
+    TEST ("x@540",      "x@207",      "x@207",       0),
+    TEST ("",           "x@1412",     "x@1412",      0),
+    TEST ("x@128",      "x@1412",     "x@1412",      0),
+    TEST ("x@3695",     "x@1412",     "x@1412",      0),
+    TEST ("x@872",      "x@873",      "x@873",       0),
+    TEST ("x@873",      "x@3695",     "x@3695",      0),
+
     TEST ("",           0,            "",            0),
     TEST ("abc",        0,            "abc",         0),
     TEST ("a\0\0bc",    0,            "a\0\0bc",     0),
@@ -233,6 +251,15 @@
     TEST ("x@4096",    "",          0,  "",           0),
     TEST ("a@4096",    "b@4096", 2048,  "b@2048",     0),
 
+    TEST ("",          "x@207",   207,  "x@207",      0),
+    TEST ("x@128",     "x@334",   207,  "x@207",      0),
+    TEST ("x@540",     "x@207",   128,  "x@128",      0),
+    TEST ("",          "x@1412",  873,  "x@873",      0),
+    TEST ("x@128",     "x@1412", 1412,  "x@1412",     0),
+    TEST ("x@3695",    "x@1412",  540,  "x@540",      0),
+    TEST ("x@872",     "x@873",   873,  "x@873",      0),
+    TEST ("x@873",     "x@3695", 2284,  "x@2284",     0),
+
     TEST ("",          "",         -1,  "",           2),
 
     TEST ("last",      "test",      4, "test",        0)
@@ -318,6 +345,15 @@
     TEST ("",          "x@4096",    0, 4096, "x@4096",   0),
     TEST ("",          "x@4096",  100, 2000, "x@2000",   0),
 
+    TEST ("",          "x@207",     0, 207,  "x@207",    0),
+    TEST ("x@128",     "x@334",    10, 207,  "x@207",    0),
+    TEST ("x@540",     "x@207",    50, 128,  "x@128",    0),
+    TEST ("",          "x@1412",  128, 873,  "x@873",    0),
+    TEST ("x@128",     "x@1412",    0,1412,  "x@1412",   0),
+    TEST ("x@3695",    "x@1412",  207, 540,  "x@540",    0),
+    TEST ("x@872",     "x@874",     1, 873,  "x@873",    0),
+    TEST ("x@873",     "x@3695",   10, 2284, "x@2284",   0),
+
     TEST ("",          "\0",        2, 0,  "",           1),
     TEST ("",          "a",         2, 0,  "",           1),
     TEST ("",          "x@4096", 4106, 0,  "",           1),
@@ -376,6 +412,15 @@
 
     TEST ("",       4096, 'x',  "x@4096",       0),
     TEST ("x@4096",    0, 'x',  "",             0),
+
+    TEST ("x@127",   128, 'x', "x@128",         0),
+    TEST ("x@200",   207, 'x', "x@207",         0),
+    TEST ("x@334",   128, 'x', "x@128",         0),
+    TEST ("",        540, 'x', "x@540",         0),
+    TEST ("xx",      873, 'x', "x@873",         0),
+    TEST ("x@873",  1412, 'x', "x@1412",        0),
+    TEST ("x@3695",  207, 'x', "x@207",         0),
+    TEST ("x@540",  3695, 'x', "x@3695",        0),
 
     TEST ("",         -1, 'x',  "",             2),
 

Modified: incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp?rev=410782&r1=410781&r2=410782&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp Thu Jun  1 00:57:51 2006
@@ -46,7 +46,7 @@
 // exercises:
 // basic_string (void)
 static const StringTestCase
-void_test_cases [] = {
+void_test_cases [] = { 
 
 #undef TEST
 #define TEST(dummy) {                            \
@@ -96,6 +96,13 @@
     TEST ("ab\0\0",     "ab"),  
     TEST ("abefdcc\0a", "abefdcc"),  
 
+    TEST ("x@128",      "x@128"),
+    TEST ("x@207",      "x@207"),
+    TEST ("x@334",      "x@334"),
+    TEST ("x@540",      "x@540"),
+    TEST ("x@873",      "x@873"),
+    TEST ("x@1412",     "x@1412"),
+    TEST ("x@3695",     "x@3695"),
     TEST ("x@4096",     "x@4096"),     
 
     TEST ("last test",  "last test")
@@ -135,6 +142,13 @@
     TEST ("ab\0\0",     "ab\0\0"),  
     TEST ("abefdcc\0a", "abefdcc\0a"),  
 
+    TEST ("x@128",      "x@128"),
+    TEST ("x@207",      "x@207"),
+    TEST ("x@334",      "x@334"),
+    TEST ("x@540",      "x@540"),
+    TEST ("x@873",      "x@873"),
+    TEST ("x@1412",     "x@1412"),
+    TEST ("x@3695",     "x@3695"),
     TEST ("x@4096",     "x@4096"),     
 
     TEST ("last test",  "last test")
@@ -177,6 +191,14 @@
     TEST ("abefdcc\0a", 8, "abefdcc\0"), 
     TEST ("abefdcc\0a", 9, "abefdcc\0a"), 
 
+    TEST ("x@207",    207, "x@207"),
+    TEST ("x@334",    207, "x@207"),
+    TEST ("x@207",    128, "x@128"),
+    TEST ("x@1412",   873, "x@873"),
+    TEST ("x@1412",  1412, "x@1412"),
+    TEST ("x@1412",   540, "x@540"),
+    TEST ("x@873",    873, "x@873"),
+    TEST ("x@3695",  2284, "x@2284"),
     TEST ("x@4096",  4096, "x@4096"),     
 
     TEST ("last test",  9, "last test")
@@ -210,16 +232,31 @@
     TEST ("",           0, "",            0),   
     TEST ("\0",         0, "\0",          0),
     TEST ("\0\0",       0, "\0\0",        0),
+    TEST ("\0\0",       1, "\0",          0),
+    TEST ("\0\0",       2, "",            0),
 
     TEST ("a",          0, "a",           0),       
     TEST ("bcd",        0, "bcd",         0),       
     TEST ("cdefaihjb",  0, "cdefaihjb",   0),      
 
-    TEST ("\0\0ab",     0, "\0\0ab",      0),  
+    TEST ("\0\0ab",     0, "\0\0ab",      0), 
+    TEST ("\0\0ab",     1, "\0ab",        0),
     TEST ("a\0\0b",     0, "a\0\0b",      0), 
-    TEST ("ab\0\0",     0, "ab\0\0",      0),  
+    TEST ("a\0\0b",     1, "\0\0b",       0), 
+    TEST ("a\0\0b",     2, "\0b",         0),
+    TEST ("ab\0\0",     0, "ab\0\0",      0), 
+    TEST ("ab\0\0",     2, "\0\0",        0),
+    TEST ("ab\0\0",     4, "",            0),
     TEST ("abefdcc\0a", 0, "abefdcc\0a",  0),  
+    TEST ("abefdcc\0a", 7, "\0a",         0),
 
+    TEST ("x@207",      0, "x@207",       0),
+    TEST ("x@334",    127, "x@207",       0),
+    TEST ("x@1412",   872, "x@540",       0),
+    TEST ("x@1412",     0, "x@1412",      0),
+    TEST ("x@1412",   539, "x@873",       0),
+    TEST ("x@873",      0, "x@873",       0),
+    TEST ("x@3695",     0, "x@3695",      0), 
     TEST ("x@4096",     0, "x@4096",      0),
 
     TEST ("abc",        5, "abc",         1),
@@ -270,6 +307,14 @@
     TEST ("ab\0\0",     0,  4, "ab\0\0",      0),  
     TEST ("abefdcc\0a", 0,  9, "abefdcc\0a",  0),  
 
+    TEST ("x@207",      0,  207, "x@207",     0),
+    TEST ("x@334",     10,  207, "x@207",     0),
+    TEST ("x@207",     50,  128, "x@128",     0),
+    TEST ("x@1412",   128,  873, "x@873",     0),
+    TEST ("x@1412",     0, 1412, "x@1412",    0),
+    TEST ("x@1412",   207,  540, "x@540",     0),
+    TEST ("x@874",      1,  873, "x@873",     0),
+    TEST ("x@3695",    10, 2284, "x@2284",    0),
     TEST ("x@4096",     0, 4096, "x@4096",    0),     
 
     TEST ("abc",        5,  3, "abc",         1), 
@@ -307,6 +352,13 @@
     TEST (5,        '\0', "\0\0\0\0\0"),
     TEST (10,       'a',  "aaaaaaaaaa"), 
 
+    TEST (128,      'x',  "x@128"),
+    TEST (207,      'x',  "x@207"),
+    TEST (540,      'x',  "x@540"),
+    TEST (873,      'x',  "x@873"),
+    TEST (1412,     'x',  "x@1412"),
+    TEST (3695,     'x',  "x@3695"),
+
     TEST (4096,     'x',  "x@4096"),
 
     TEST (4,        't',  "tttt") 
@@ -357,13 +409,22 @@
     TEST ("\0a",    "abefdcc\0a", "abefdcc",     0),  
     TEST ("x@4096", "abefdcc\0a", "abefdcc",     0),
 
+    TEST ("",       "x@207",      "x@207",       0),
+    TEST ("x@128",  "x@207",      "x@207",       0),
+    TEST ("x@540",  "x@207",      "x@207",       0),
+    TEST ("",       "x@1412",     "x@1412",      0),
+    TEST ("x@128",  "x@1412",     "x@1412",      0),
+    TEST ("x@3695", "x@1412",     "x@1412",      0),
+    TEST ("x@872",  "x@873",      "x@873",       0),
+    TEST ("x@873",  "x@3695",     "x@3695",      0),
+
     TEST ("abc",    "x@4096",     "x@4096",      0),  
 
     TEST ("",       0,            "",            0),
     TEST ("a\0b\0", 0,            "a",           0), 
     TEST ("x@4096", 0,            "x@4096",      0), 
 
-    TEST ("abcd",   "x@4096",     "x@4096",     -1), 
+    TEST ("abcd",   "x@4096",     "x@4096",      0), 
 
     TEST ("",       "last test",  "last test",   0)
 };
@@ -413,6 +474,15 @@
     TEST ("\0a",    "abefdcc\0a", "abefdcc\0a",  0),  
     TEST ("x@4096", "abefdcc\0a", "abefdcc\0a",  0),
 
+    TEST ("",       "x@207",      "x@207",       0),
+    TEST ("x@128",  "x@207",      "x@207",       0),
+    TEST ("x@540",  "x@207",      "x@207",       0),
+    TEST ("",       "x@1412",     "x@1412",      0),
+    TEST ("x@128",  "x@1412",     "x@1412",      0),
+    TEST ("x@3695", "x@1412",     "x@1412",      0),
+    TEST ("x@872",  "x@873",      "x@873",       0),
+    TEST ("x@873",  "x@3695",     "x@3695",      0),
+
     TEST ("abc",    "x@4096",     "x@4096",      0),   
 
     TEST ("",       0,            "",            0),
@@ -448,7 +518,12 @@
     TEST ("",       '\0', "\0"),
     TEST ("a",      '\0', "\0"),
     TEST ("\0\0",   'x',  "x"),
+
+    TEST ("x@207",  'a',  "a"), 
+    TEST ("x@873",  '\0', "\0"),
+    TEST ("x@2284", 't',  "t"),
     TEST ("x@4096", 'x',  "x"),
+
     TEST ("",       't',  "t") 
 };
 
@@ -456,107 +531,89 @@
 /**************************************************************************/
 
 template <class charT, class Traits, class Allocator, class Iterator>
-void test_ctor_range (const charT*    warg,
-                      std::size_t     warg_len,
-                      std::size_t     res_len,
-                      Traits*, Allocator*,
-                      const Iterator &it,
-                      const StringTestCase &tcase)
+void test_ctor_range (const StringTestCaseData<charT> &tdata,
+                      Traits*, Allocator*, const Iterator &it)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
     typedef typename String::iterator                    StringIter;
 
+    const StringTestCase &tcase = tdata.tcase_;
+
     const char* const itname =
         tcase.arg ? type_name (it, (charT*)0) : "basic_string::iterator";
 
-    /*const*/ String s_arg (warg, warg_len);
+    // construct the string argument 
+    /* const */ String arg (tdata.arg_, tdata.arglen_);
+
+    std::size_t off1 = std::size_t (tcase.off) < tdata.arglen_ ?
+             std::size_t (tcase.off) : tdata.arglen_;
 
-    std::size_t off_last = tcase.off + tcase.size;
+    std::size_t ext1 = off1 + tcase.size < tdata.arglen_ ?
+             std::size_t (tcase.size) : tdata.arglen_ - off1;
 
-    const StringIter it_first (std::size_t (tcase.off) >= s_arg.size () ?
-                               s_arg.end () : s_arg.begin () + tcase.off);
-    const StringIter it_last  (std::size_t (off_last) >= s_arg.size () ?
-                               s_arg.end () : s_arg.begin () + off_last);
+    // create a pair of iterators into the string object being modified
+    const StringIter it_first (arg.begin () + off1);
+    const StringIter it_last  (it_first + ext1);
 
-    const String s_str (it_first, it_last);
+    const String str (it_first, it_last);
 
-    const std::size_t match =
-        rw_match (tcase.res, s_str.c_str(), tcase.nres);
+    // detrmine whether the produced sequence matches the exepceted result
+    const std::size_t match = rw_match (tcase.res, str.data (), tcase.nres);
 
-    rw_assert (match == res_len, 0, tcase.line,
+    rw_assert (match == tdata.reslen_, 0, tcase.line,
                "line %d. %{$FUNCALL} expected %{#*s}, got %{/*.*Gs}, "
                "difference at offset %zu for %s",
                __LINE__, int (tcase.nres), tcase.res,
-               int (sizeof (charT)), int (s_str.size ()), s_str.c_str (),
+               int (sizeof (charT)), int (str.size ()), str.c_str (),
                match, itname);
 }
 
 /**************************************************************************/
 
 template <class charT, class Traits, class Allocator>
-void test_ctor_range (const charT* warg,
-                      std::size_t  warg_len,
-                      std::size_t  res_len,
-                      Traits*, Allocator*, 
-                      const StringTestCase &tcase)
+void test_ctor_range (const StringTestCaseData<charT> &tdata,
+                      Traits*, Allocator*)
 {
-    if (tcase.bthrow)  // this method doesn't throw
+    if (tdata.tcase_.bthrow) {
         return;
+    }
 
-    test_ctor_range (warg, warg_len, res_len, (Traits*)0, (Allocator*)0, 
-                     InputIter<charT>(0, 0, 0), tcase);
+    test_ctor_range (tdata, (Traits*)0, (Allocator*)0, 
+                     InputIter<charT>(0, 0, 0));
 
-    test_ctor_range (warg, warg_len, res_len, (Traits*)0, (Allocator*)0,
-                     ConstFwdIter<charT>(0, 0, 0), tcase);
+    test_ctor_range (tdata, (Traits*)0, (Allocator*)0,
+                     ConstFwdIter<charT>(0, 0, 0));
 
-    test_ctor_range (warg, warg_len, res_len, (Traits*)0, (Allocator*)0,
-                     ConstBidirIter<charT>(0, 0, 0), tcase);
+    test_ctor_range (tdata, (Traits*)0, (Allocator*)0,
+                     ConstBidirIter<charT>(0, 0, 0));
 
-    test_ctor_range (warg, warg_len, res_len, (Traits*)0, (Allocator*)0,
-                     ConstRandomAccessIter<charT>(0, 0, 0), tcase);
+    test_ctor_range (tdata, (Traits*)0, (Allocator*)0,
+                     ConstRandomAccessIter<charT>(0, 0, 0));
 }
 
 /**************************************************************************/
 
 template <class charT, class Traits, class Allocator>
-void test_ctor (charT, Traits*, Allocator*,
-                const StringFunc     &func,
-                const StringTestCase &tcase)
+void test_ctor (charT*, Traits*, Allocator*,
+                const StringTestCaseData<charT> &tdata)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
 
-    static const std::size_t BUFSIZE = 256;
-
-    static charT warg_buf [BUFSIZE];
-    std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
-    charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
-
-    static charT wres_buf [BUFSIZE];
-    std::size_t res_len = sizeof wres_buf / sizeof *wres_buf;
-    charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
+    const StringFunc     &func  = tdata.func_;
+    const StringTestCase &tcase = tdata.tcase_;
 
     if (Ctor (range) == func.which_) {
-        test_ctor_range (warg, arg_len, res_len, 
-                        (Traits*)0, (Allocator*)0, tcase);
-
-        if (warg != warg_buf)
-            delete[] warg;
-
-        if (wres != wres_buf)
-            delete[] wres;
-
+        // special processing for the ctor() template member
+        // function to exercise all iterator categories
+        test_ctor_range (tdata, (Traits*)0, (Allocator*)0);
         return;
     }
 
-    // construct the string object to be modified
-    // and the (possibly unused) argument string
-    const String  arg (warg, arg_len, Allocator ());
-    if (warg != warg_buf)
-        delete[] warg;
-
-    warg = 0;
+    // construct the argument string 
+    const String arg (tdata.arg_, tdata.arglen_);
 
     // offset and extent function arguments
+    // offset and extent function arguments
     const std::size_t arg_off  = std::size_t (tcase.off);
     const std::size_t arg_size = std::size_t (tcase.size);
 
@@ -564,6 +621,7 @@
     const charT* const arg_ptr = arg.c_str ();
     const String&      arg_str = arg;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
+    const Allocator    arg_alc;
 
     // (name of) expected and caught exception
     const char* expected = 0;
@@ -578,12 +636,8 @@
 
 #else   // if defined (_RWSTD_NO_EXCEPTIONS)
 
-    if (tcase.bthrow) {
-        if (wres != wres_buf)
-            delete[] wres;
-
+    if (tcase.bthrow)
         return;
-    }
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
@@ -601,7 +655,7 @@
             break;
 
         case Ctor (alloc):
-            ret_ptr = new String (Allocator ());
+            ret_ptr = new String (arg_alc);
             break;
 
         case Ctor (cptr):
@@ -609,7 +663,7 @@
             break;
 
         case Ctor (cptr_alloc):
-            ret_ptr = new String (arg_ptr, Allocator ());
+            ret_ptr = new String (arg_ptr, arg_alc);
             break;
 
         case Ctor (cstr):
@@ -621,7 +675,7 @@
             break;
 
         case Ctor (cptr_size_alloc):
-            ret_ptr = new String (arg_ptr, arg_size, Allocator ());
+            ret_ptr = new String (arg_ptr, arg_size, arg_alc);
             break;
 
         case Ctor (cstr_size):
@@ -633,7 +687,7 @@
             break;
 
         case Ctor (cstr_size_size_alloc):
-            ret_ptr = new String (arg_str, arg_off, arg_size, Allocator ());
+            ret_ptr = new String (arg_str, arg_off, arg_size, arg_alc);
             break;
 
         case Ctor (size_val):
@@ -641,27 +695,31 @@
             break;
 
         case Ctor (size_val_alloc):
-            ret_ptr = new String (tcase.size, arg_val, Allocator ());
+            ret_ptr = new String (tcase.size, arg_val, arg_alc);
             break;
 
         default:
             RW_ASSERT (!"logic error: unknown constructor overload");
         }
             
+        // for convenience
+        static const int cwidth = sizeof (charT);
+
         // verify that returned pointer is valid
         rw_assert (0 != ret_ptr, 0, tcase.line,
-                   "line %d. %{$FUNCALL} expected %{#*s}, got null",
-                   __LINE__, int (res_len), tcase.res);
+                   "line %d. %{$FUNCALL} expected %{/*.*Gs}, got null",
+                   __LINE__, cwidth, int (tdata.reslen_), tdata.res_);
 
         if (0 != ret_ptr) {
-            // verify the length of the resulting string
-            rw_assert (res_len == ret_ptr->size (), 0, tcase.line,
-                       "line %d. %{$FUNCALL} expected %{#*s} with length "
-                       "%zu, got %{/*.*Gs} with length %zu",
-                       __LINE__, int (res_len), tcase.res, 
-                       res_len, int (sizeof (charT)), 
-                       int (ret_ptr->size ()), ret_ptr->c_str (), 
-                       ret_ptr->size ());
+
+            // verfiy that the length of the resulting string
+            rw_assert (tdata.reslen_ == ret_ptr->size (), 0, tcase.line,
+                       "line %d. %{$FUNCALL} expected %{/*.*Gs} with "
+                       "length %zu, got %{/*.*Gs} with length %zu",
+                       __LINE__,
+                       cwidth, int (tdata.reslen_), tdata.res_, 
+                       tdata.reslen_, cwidth, int (ret_ptr->size ()), 
+                       ret_ptr->data (), ret_ptr->size ());
 
             if (Ctor (void) != func.which_) {
                 // verify the capacity of the resulting string
@@ -672,20 +730,20 @@
                            ret_ptr->capacity (), ret_ptr->size ());
             }
 
-            if (res_len == ret_ptr->size ()) {
+            if (tdata.reslen_ == ret_ptr->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, ret_ptr->c_str (), tcase.nres);
 
-                rw_assert (match == res_len, 0, tcase.line,
+                rw_assert (match == tdata.reslen_, 0, tcase.line,
                            "line %d. %{$FUNCALL} expected %{/*.*Gs}, "
                            "got %{/*.*Gs}, difference at offset %zu",
-                           __LINE__, int (sizeof (charT)), int (res_len), 
-                           wres, int (sizeof (charT)), 
-                           int (ret_ptr->size ()), ret_ptr->c_str (), 
-                           match);
+                           __LINE__,
+                           cwidth, int (tdata.reslen_), tdata.res_,
+                           cwidth, int (ret_ptr->size ()), 
+                           ret_ptr->data (), match);
             }
 
             delete ret_ptr;
@@ -742,49 +800,24 @@
     rw_assert (nblocks == expect_blocks, 0, tcase.line,
                "line %d. %{$FUNCALL} allocated %td bytes in %td blocks",
                __LINE__, nbytes, expect_blocks);
-
-    if (wres != wres_buf)
-        delete[] wres;
 }
 
 /**************************************************************************/
 
 template <class charT, class Traits, class Allocator>
-void test_op_set (charT, Traits*, Allocator*,
-                  const StringFunc     &func,
-                  const StringTestCase &tcase)
+void test_op_set (charT*, Traits*, Allocator*,
+                  const StringTestCaseData<charT> &tdata)
 {
     typedef std::basic_string <charT, Traits, Allocator> String;
-    typedef typename UserTraits<charT>::MemFun           UTMemFun;
-
-    static const std::size_t BUFSIZE = 256;
-
-    static charT wstr_buf [BUFSIZE];
-    static charT warg_buf [BUFSIZE];
+    typedef typename UserTraits<charT>::MemFun           TraitsFunc;
 
-    std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf;
-    std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
-
-    charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len);
-    charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
+    const StringFunc     &func  = tdata.func_;
+    const StringTestCase &tcase = tdata.tcase_;
 
     // construct the string object to be modified
     // and the (possibly unused) argument string
-    /* const */ String  str (wstr, str_len, Allocator ());
-    const       String  arg (warg, arg_len, Allocator ());
-
-    if (wstr != wstr_buf)
-        delete[] wstr;
-
-    if (warg != warg_buf)
-        delete[] warg;
-
-    wstr = 0;
-    warg = 0;
-
-    static charT wres_buf [BUFSIZE];
-    std::size_t res_len = sizeof wres_buf / sizeof *wres_buf;
-    charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
+    /* const */ String str (tdata.str_, tdata.strlen_, Allocator ());
+    const       String arg (tdata.arg_, tdata.arglen_, Allocator ());
 
     // save the state of the string object before the call
     // to detect wxception safety violations (changes to
@@ -792,7 +825,7 @@
     const StringState str_state (rw_get_string_state (str));
 
     // string function argument
-    const charT* const arg_ptr = tcase.arg ? arg.c_str () : str.c_str ();
+    const charT* const arg_ptr = tcase.arg ? arg.data () : str.data ();
     const String&      arg_str = tcase.arg ? arg : str;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
 
@@ -802,15 +835,16 @@
         rw_get_call_counters ((Traits*)0, (charT*)0) : 0;
 
     if (rg_calls)
-        total_length_calls = rg_calls [UTMemFun::length];
+        total_length_calls = rg_calls [TraitsFunc::length];
 
     rwt_free_store* const pst = rwt_get_free_store (0);
+    SharedAlloc*    const pal = SharedAlloc::instance ();
 
     // iterate for`throw_after' starting at the next call to operator new,
     // forcing each call to throw an exception, until the function finally
     // succeeds (i.e, no exception is thrown)
-    std::size_t throw_after;
-    for (throw_after = 0; ; ++throw_after) {
+    std::size_t throw_count;
+    for (throw_count = 0; ; ++throw_count) {
 
         // (name of) expected and caught exception
         const char* expected = 0;
@@ -818,24 +852,29 @@
 
 #ifndef _RWSTD_NO_EXCEPTIONS
 
-        if (-1 == tcase.bthrow) {
+        if (0 == tcase.bthrow) {
+            // by default excercise the exception safety of the function
+            // by iteratively inducing an exception at each call to operator
+            // new or Allocator::allocate() until the call succeeds
             expected = exceptions [3];      // bad_alloc
-            *pst->throw_at_calls_ [0] = pst->new_calls_ [0] + throw_after + 1;
+            *pst->throw_at_calls_ [0] = pst->new_calls_ [0] + throw_count + 1;
+            pal->throw_at_calls_ [pal->m_allocate] =
+                pal->throw_at_calls_ [pal->m_allocate] + throw_count + 1;
+        }
+        else {
+            // exceptions disabled for this test case
         }
 
 #else   // if defined (_RWSTD_NO_EXCEPTIONS)
 
         if (tcase.bthrow) {
-            if (wres != wres_buf)
-                delete[] wres;
-
             return;
         }
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
         // start checking for memory leaks
-        rwt_check_leaks (0, 0);
+        rw_check_leaks (str.get_allocator ());
 
         try {
             switch (func.which_) {
@@ -856,27 +895,31 @@
                 RW_ASSERT (!"logic error: unknown operator= overload");
             }
             
-            // verify the length of the resulting string
-            rw_assert (res_len == str.size (), 0, tcase.line,
-                       "line %d. %{$FUNCALL} expected %{#*s} with length "
-                       "%zu, got %{/*.*Gs} with length %zu",
-                       __LINE__, int (res_len), tcase.res, 
-                       res_len, int (sizeof (charT)), 
-                       int (str.size ()), str.c_str (), str.size ());
+            // for convenience
+            static const int cwidth = sizeof (charT);
 
-            if (res_len == str.size ()) {
+            // verfiy that the length of the resulting string
+            rw_assert (tdata.reslen_ == str.size (), 0, tcase.line,
+                       "line %d. %{$FUNCALL} expected %{/*.*Gs} with "
+                       "length %zu, got %{/*.*Gs} with length %zu",
+                       __LINE__,
+                       cwidth, int (tdata.reslen_), tdata.res_, 
+                       tdata.reslen_, cwidth, int (str.size ()), str.data (),
+                       str.size ());
+
+            if (tdata.reslen_ == 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, str.c_str (), tcase.nres);
 
-                rw_assert (match == res_len, 0, tcase.line,
+                rw_assert (match == tdata.reslen_, 0, tcase.line,
                            "line %d. %{$FUNCALL} expected %{/*.*Gs}, "
                            "got %{/*.*Gs}, difference at offset %zu",
-                            __LINE__, int (sizeof (charT)), int (res_len), 
-                            wres, int (sizeof (charT)), 
-                            int (str.size ()), str.c_str (), match);
+                           __LINE__,
+                           cwidth, int (tdata.reslen_), tdata.res_,
+                           cwidth, int (str.size ()),str.data (), match);
             }
 
             // verify that Traits::length was used
@@ -891,7 +934,7 @@
 
         catch (const std::bad_alloc &ex) {
             caught = exceptions [3];
-            rw_assert (-1 == tcase.bthrow, 0, tcase.line,
+            rw_assert (0 == tcase.bthrow, 0, tcase.line,
                        "line %d. %{$FUNCALL} %{?}expected %s,%{:}"
                        "unexpectedly%{;} caught std::%s(%#s)",
                        __LINE__, 0 != expected, expected, caught, ex.what ());
@@ -913,30 +956,25 @@
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
-        /* const */ std::size_t nbytes;
-        const       std::size_t nblocks = rwt_check_leaks (&nbytes, 0);
-
         // FIXME: verify the number of blocks the function call
         // is expected to allocate and detect any memory leaks
-        const std::size_t expect_blocks = nblocks;
-
-        rw_assert (nblocks == expect_blocks, 0, tcase.line,
-                   "line %d. %{$FUNCALL} allocated %td bytes in %td blocks",
-                   __LINE__, nbytes, expect_blocks);
+        rw_check_leaks (str.get_allocator (), tcase.line,
+                        std::size_t (-1), std::size_t (-1));
 
         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 (str),
                                     __LINE__, tcase.line, caught);
-            if (-1 == tcase.bthrow) {
+
+            if (0 == tcase.bthrow) {
                 // allow this call to operator new to succeed and try
                 // to make the next one to fail during the next call
                 // to the same function again
                 continue;
             }
         }
-        else if (-1 != tcase.bthrow) {
+        else if (0 < tcase.bthrow) {
             rw_assert (caught == expected, 0, tcase.line,
                        "line %d. %{$FUNCALL} %{?}expected %s, caught %s"
                        "%{:}unexpectedly caught %s%{;}",
@@ -946,40 +984,51 @@
         break;
     }
 
+    std::size_t expect_throws = 0;
+
+    if (OpSet (cstr) != func.which_) {
+
 #ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
-    // verify that if exceptions are enabled and when capacity changes
-    // at least one exception is thrown
-    rw_assert (   *pst->throw_at_calls_ [0] == std::size_t (-1)
-               || throw_after,
-               0, tcase.line,
-               "line %d: %{$FUNCALL}: failed to throw an expected exception",
-               __LINE__);
+        // verify that if exceptions are enabled and when capacity changes
+        // at least one exception is thrown
+        expect_throws = str_state.capacity_ < str.capacity ();
+
+#else   // if defined (_RWSTD_NO_REPLACEABLE_NEW_DELETE)
+
+        expect_throws = StringIds::UserAlloc == func.alloc_id_ ?
+            str_state.capacity_ < str.capacity () : 0;
 
 #endif   // _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
-    *pst->throw_at_calls_ [0] = std::size_t (-1);
+    }
 
-    if (wres != wres_buf)
-        delete[] wres;
+    rw_assert (expect_throws == throw_count, 0, tcase.line,
+               "line %d: %{$FUNCALL}: expected exactly 1 %s exception "
+               "while changing capacity from %zu to %zu, got %zu",
+               __LINE__, exceptions [3],
+               str_state.capacity_, str.capacity (), throw_count);
+
+    // disable bad_alloc exceptions
+    *pst->throw_at_calls_ [0] = 0;
+    pal->throw_at_calls_ [pal->m_allocate] = 0;
 }
 
 /**************************************************************************/
 
 template <class charT, class Traits, class Allocator>
-void test_cons (charT, Traits*, Allocator*,
-                const StringFunc     &func,
-                const StringTestCase &tcase)
+void test_cons (charT*, Traits*, Allocator*,
+                const StringTestCaseData<charT> &tdata)
 {
-    if (StringIds::fid_op_set == (func.which_ & StringIds::fid_mask))
-        test_op_set (charT (), (Traits*)0, (Allocator*)0, func, tcase);
+    if (StringIds::fid_op_set == (tdata.func_.which_ & StringIds::fid_mask))
+        test_op_set ((charT*)0, (Traits*)0, (Allocator*)0, tdata);
     else
-        test_ctor (charT (), (Traits*)0, (Allocator*)0, func, tcase);
+        test_ctor ((charT*)0, (Traits*)0, (Allocator*)0, tdata);
 }
 
 /**************************************************************************/
 
-DEFINE_STRING_TEST_DISPATCH (test_cons);
+DEFINE_STRING_TEST_FUNCTIONS (test_cons);
 
 int main (int argc, char** argv)
 {
@@ -1016,7 +1065,10 @@
 
     const std::size_t test_count = sizeof tests / sizeof *tests;
 
-    return rw_run_string_test (argc, argv, __FILE__,
-                               "lib.string.cons",
-                               test_cons, tests, test_count);
+    const int status =
+        rw_run_string_test (argc, argv, __FILE__,
+                            "lib.string.cons",
+                            test_cons_func_array, tests, test_count);
+
+    return status;
 }

Modified: incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp?rev=410782&r1=410781&r2=410782&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp Thu Jun  1 00:57:51 2006
@@ -109,6 +109,16 @@
     TEST ("x@4096",    2, "a@100",    "xxa@100x@4094",      0),
     TEST ("a@102",     2, "x@4096",   "aax@4096a@100",      0),
 
+    TEST ("x@10",      1, "x@118",    "x@128",              0),
+    TEST ("x@128",   128, "x@79",     "x@207",              0),
+    TEST ("x@207",     0, "x@127",    "x@334",              0),
+    TEST ("x@334",     1, "x@206",    "x@540",              0),
+    TEST ("x@540",   539, "x@333",    "x@873",              0),
+    TEST ("x@539",   539, "x@873",    "x@1412",             0),
+    TEST ("x@872",     0, "x@1412",   "x@2284",             0),
+    TEST ("x@1411",  207, "x@2284",   "x@3695",             0),
+    TEST ("x@1412",    0, "x@2284",   "x@3696",             0),
+
     TEST ("\0",        2, "",         "",                   1),
     TEST ("a",         2, "",         "",                   1),
     TEST ("x@4096", 4106, "",         "",                   1),
@@ -178,6 +188,16 @@
     TEST ("x@4096",    2, "a@100",    "xxa@100x@4094",      0),
     TEST ("a@102",     2, "x@4096",   "aax@4096a@100",      0),
 
+    TEST ("x@10",      1, "x@118",    "x@128",              0),
+    TEST ("x@128",   128, "x@79",     "x@207",              0),
+    TEST ("x@207",     0, "x@127",    "x@334",              0),
+    TEST ("x@334",     1, "x@206",    "x@540",              0),
+    TEST ("x@540",   539, "x@333",    "x@873",              0),
+    TEST ("x@539",   539, "x@873",    "x@1412",             0),
+    TEST ("x@872",     0, "x@1412",   "x@2284",             0),
+    TEST ("x@1411",  207, "x@2284",   "x@3695",             0),
+    TEST ("x@1412",    0, "x@2284",   "x@3696",             0),
+
     TEST ("\0",        2, "",         "",                   1),
     TEST ("a",         2, "",         "",                   1),
     TEST ("x@4096", 4106, "",         "",                   1),
@@ -266,16 +286,29 @@
     TEST ("a@1000",  999, "b@1001",    2, 1000, "a@999b@999a",   0),
     TEST ("a@1000",    2, "b@1002",  999, 1001, "aabbba@998",    0),
 
-    TEST ("\0",        2, "",          0, 0,  "",                1),
-    TEST ("",          0, "\0",        2, 0,  "",                2),
+    TEST ("x@10",      1, "x@118",     0,  118, "x@128",         0),
+    TEST ("x@128",     0, "x@129",    50,   79, "x@207",         0),
+    TEST ("x@207",   207, "x@127",     0,  127, "x@334",         0),
+    TEST ("x@207",   128, "x@207",    10,  127, "x@334",         0),
+    TEST ("x@334",   334, "x@208",     2,  206, "x@540",         0),
+    TEST ("x@540",     0, "x@336",     3,  333, "x@873",         0),
+    TEST ("x@539",   538, "x@873",     0,  873, "x@1412",        0),
+    TEST ("x@873",   540, "x@540",     1,  539, "x@1412",        0),
+    TEST ("x@872",     0, "x@1412",    0, 1412, "x@2284",        0),
+    TEST ("x@1411", 1411, "x@2288",    4, 2284, "x@3695",        0),
+    TEST ("x@1411",  872, "x@3695",  128, 2284, "x@3695",        0),
+    TEST ("x@1412",    0, "x@2284",    0, 2284, "x@3696",        0),
+
+    TEST ("\0",        2, "",          0,    0,  "",             1),
+    TEST ("",          0, "\0",        2,    0,  "",             2),
 
-    TEST ("a",         2, "",          0, 0,  "",                1),
-    TEST ("",          0, "a",         2, 0,  "",                2),
+    TEST ("a",         2, "",          0,    0,  "",             1),
+    TEST ("",          0, "a",         2,    0,  "",             2),
 
-    TEST ("x@4096", 4106, "",          0, 0,  "",                1),
-    TEST ("",          0, "x@4096", 4106, 0,  "",                2),
+    TEST ("x@4096", 4106, "",          0,    0,  "",             1),
+    TEST ("",          0, "x@4096", 4106,    0,  "",             2),
 
-    TEST ("last",      4, "test",      0, 4,  "lasttest",        0)
+    TEST ("last",      4, "test",      0,    4,  "lasttest",     0)
 };
 
 /**************************************************************************/
@@ -344,8 +377,23 @@
     TEST ("x@4096", 4095, "ab",        1, "x@4095ax",        0),
     TEST ("x@4096", 4094, "\0\0",      2, "x@4094\0\0xx",    0),
 
-    TEST ("",          0, "x@4096", 4096,  "x@4096",         0),
-    TEST ("x@4096",    0, "",          0,  "x@4096",         0),
+    TEST ("",          0, "x@4096", 4096, "x@4096",          0),
+    TEST ("x@4096",    0, "",          0, "x@4096",          0),
+
+    TEST ("",          0, "x@873",   540, "x@540",           0),
+    TEST ("x@10",      1, "x@118",   118, "x@128",           0),
+    TEST ("x@128",   128, "x@79",     79, "x@207",           0),
+    TEST ("x@207",     0, "x@127",   127, "x@334",           0),
+    TEST ("x@207",   207, "x@207",   127, "x@334",           0),
+    TEST ("x@334",   128, "x@206",   206, "x@540",           0),
+    TEST ("x@540",   540, "x@333",   333, "x@873",           0),
+    TEST ("x@539",     0, "x@873",   873, "x@1412",          0),
+    TEST ("x@873",     5, "x@540",   539, "x@1412",          0),
+    TEST ("x@872",     0, "x@1412", 1412, "x@2284",          0),
+    TEST ("x@1411", 1411, "x@2284", 2284, "x@3695",          0),
+    TEST ("x@1411",  873, "x@3695", 2284, "x@3695",          0),
+    TEST ("x@1412",    0, "x@2284", 2284, "x@3696",          0),
+    TEST ("",          0, "x@3696", 3696, "x@3696",          0),
 
     TEST ("\0",        2, "",          0,  "",               1),
     TEST ("a",         2, "",          0,  "",               1),
@@ -420,6 +468,16 @@
     TEST ("x@4096",    1, 2, 'a',  "xaax@4095",       0),
     TEST ("x@4096",    1, 1, '\0', "x\0x@4095",       0),
 
+    TEST ("x@127",     0, 1,    'x', "x@128",         0),
+    TEST ("x@200",   128, 7,    'x', "x@207",         0),
+    TEST ("x@331",   331, 3,    'x', "x@334",         0),
+    TEST ("x@539",     0, 1,    'x', "x@540",         0),
+    TEST ("x@539",     0, 873,  'x', "x@1412",        0),
+    TEST ("x@873",   873, 1411, 'x', "x@2284",        0),
+    TEST ("x@3694",  128, 1,    'x', "x@3695",        0),
+    TEST ("x@540",     0, 1,    'x', "x@541",         0),
+    TEST ("",          0, 3695, 'x', "x@3695",        0),
+
     TEST ("a",         0, 4095, 'x', "x@4095a",       0),
     TEST ("x@4096",    0, 2047, 'b', "b@2047x@4096",  0),
     TEST ("x@4096", 2047, 2048, 'x', "x@6144",        0),
@@ -473,6 +531,15 @@
     TEST ("x@4096",    0,  'a',  "ax@4096",     0),
     TEST ("x@4096",    1,  'a',  "xax@4095",    0),
     TEST ("x@4096",    1, '\0',  "x\0x@4095",   0),
+
+    TEST ("x@127",     0, 'x',  "x@128",        0),
+    TEST ("x@206",     1, 'x',  "x@207",        0),
+    TEST ("x@333",   333, 'x',  "x@334",        0),
+    TEST ("x@539",   128, 'x',  "x@540",        0),
+    TEST ("x@1411",    0, 'x',  "x@1412",       0),
+    TEST ("x@2283",   10, 'x',  "x@2284",       0),
+    TEST ("x@3694", 3694, 'x',  "x@3695",       0),
+    TEST ("x@540",   538, 'x',  "x@541",        0),
 
     TEST ("last",      4,  't', "lastt",        0)
 };

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=410782&r1=410781&r2=410782&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 Thu Jun  1 00:57:51 2006
@@ -95,6 +95,16 @@
     TEST ("x@4096",     "",           "x@4096",               0),
     TEST ("x@2048",     "y@2048",     "x@2048y@2048",         0),
 
+    TEST ("x@10",       "x@118",      "x@128",                0),
+    TEST ("x@128",      "x@79",       "x@207",                0),
+    TEST ("x@207",      "x@127",      "x@334",                0),
+    TEST ("x@334",      "x@206",      "x@540",                0),
+    TEST ("x@540",      "x@333",      "x@873",                0),
+    TEST ("x@539",      "x@873",      "x@1412",               0),
+    TEST ("x@872",      "x@1412",     "x@2284",               0),
+    TEST ("x@1411",     "x@2284",     "x@3695",               0),
+    TEST ("x@1412",     "x@2284",     "x@3696",               0),
+
     TEST ("",           0,            "",                     0),
     TEST ("abc",        0,            "abcabc",               0),
     TEST ("a\0\0bc",    0,            "a\0\0bca",             0),
@@ -154,6 +164,16 @@
     TEST ("x@4096",     "",           "x@4096",               0),
     TEST ("x@2048",     "y@2048",     "x@2048y@2048",         0),
 
+    TEST ("x@10",       "x@118",      "x@128",                0),
+    TEST ("x@128",      "x@79",       "x@207",                0),
+    TEST ("x@207",      "x@127",      "x@334",                0),
+    TEST ("x@334",      "x@206",      "x@540",                0),
+    TEST ("x@540",      "x@333",      "x@873",                0),
+    TEST ("x@539",      "x@873",      "x@1412",               0),
+    TEST ("x@872",      "x@1412",     "x@2284",               0),
+    TEST ("x@1411",     "x@2284",     "x@3695",               0),
+    TEST ("x@1412",     "x@2284",     "x@3696",               0),
+
     TEST ("",           0,            "",                     0),
     TEST ("abc",        0,            "abcabc",               0),
     TEST ("a\0\0bc",    0,            "a\0\0bca\0\0bc",       0),
@@ -200,7 +220,16 @@
     TEST ("\0ab\0\0c", '\0', "\0ab\0\0c\0", 0),
     TEST ("a\0bc\0\0", 'a',  "a\0bc\0\0a",  0),
 
-    TEST ("last",      't', "lastt",        0)
+    TEST ("x@127",     'x',  "x@128",       0),
+    TEST ("x@206",     'x',  "x@207",       0),
+    TEST ("x@333",     'x',  "x@334",       0),
+    TEST ("x@539",     'x',  "x@540",       0),
+    TEST ("x@1411",    'x',  "x@1412",      0),
+    TEST ("x@2283",    'x',  "x@2284",      0),
+    TEST ("x@3694",    'x',  "x@3695",      0),
+    TEST ("x@540",     'x',  "x@541",       0),
+
+    TEST ("last",      't',  "lastt",       0)
 };
 
 /**************************************************************************/

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=410782&r1=410781&r2=410782&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp Thu Jun  1 00:57:51 2006
@@ -122,6 +122,16 @@
     TEST ("x@4096",    0, 4094, "ab",    "abxx",          0),
     TEST ("x@4096",    1, 4093, "",      "xxx",           0),
 
+    TEST ("x@20",      1,   10, "x@118", "x@128",         0),
+    TEST ("x@128",   128,    0, "x@79",  "x@207",         0),
+    TEST ("x@207",     0,    0, "x@127", "x@334",         0),
+    TEST ("x@334",     1,    1, "x@207", "x@540",         0),
+    TEST ("x@540",     0,  539, "x@334", "x@335",         0),
+    TEST ("x@539",   539,    0, "x@873", "x@1412",        0),
+    TEST ("x@3695",    0, 2283, "",      "x@1412",        0),
+    TEST ("x@1412",  207,    1, "x@2284", "x@3695",       0),
+    TEST ("x@207",     0,  207, "x@2284", "x@2284",       0),
+
     TEST ("",          0,    0, "x@4096", "x@4096",       0),
     TEST ("a",         0,    1, "x@4096", "x@4096",       0),
     TEST ("x@4096",    0, 4095, "x@4096", "x@4097",       0),
@@ -228,6 +238,16 @@
     TEST ("x@4096",     1, 4093, "",      "xxx",               0),
     TEST ("x@4096",     1, 4092, "\0\0",  "x\0\0xxx",          0),
 
+    TEST ("x@20",       1,   10, "x@118", "x@128",             0),
+    TEST ("x@128",    128,    0, "x@79",  "x@207",             0),
+    TEST ("x@207",      0,    0, "x@127", "x@334",             0),
+    TEST ("x@334",      1,    1, "x@207", "x@540",             0),
+    TEST ("x@540",      0,  539, "x@334", "x@335",             0),
+    TEST ("x@539",    539,    0, "x@873", "x@1412",            0),
+    TEST ("x@3695",     0, 2283, "",      "x@1412",            0),
+    TEST ("x@1412",   207,    1, "x@2284", "x@3695",           0),
+    TEST ("x@207",      0,  207, "x@2284", "x@2284",           0),
+
     TEST ("",           0,    0, "x@4096", "x@4096",           0),
     TEST ("a",          0,    1, "x@4096", "x@4096",           0),
     TEST ("x@4096",     0, 4095, "x@4096", "x@4097",           0),
@@ -324,6 +344,20 @@
     TEST ("x@4096",    1, 4093, "",          0, "xxx",          0),
     TEST ("x@4096",    1, 4092, "\0\0",      2, "x\0\0xxx",     0),
 
+    TEST ("",          0,    0, "x@873",   540, "x@540",        0),
+    TEST ("x@20",      1,   10, "x@118",   118, "x@128",        0),
+    TEST ("x@128",   128,    0, "x@79",     79, "x@207",        0),
+    TEST ("x@207",     0,    0, "x@127",   127, "x@334",        0),
+    TEST ("x@207",   207,  207, "x@207",   127, "x@334",        0),
+    TEST ("x@334",     0,  207, "x@545",   540, "x@667",        0),
+    TEST ("x@539",     0,  539, "x@873",   873, "x@873",        0),
+    TEST ("x@878",     5,    5, "x@540",   539, "x@1412",       0),
+    TEST ("x@872",     0,    0, "x@1412", 1412, "x@2284",       0),
+    TEST ("x@1411", 1411,    0, "x@2284", 2284, "x@3695",       0),
+    TEST ("x@1411",  873,  538, "x@3695", 2822, "x@3695",       0),
+    TEST ("x@1412",    0,    0, "x@2284", 2284, "x@3696",       0),
+    TEST ("",          0,    0, "x@3696", 3696, "x@3696",       0),
+
     TEST ("a",         0,    1, "x@4096", 4095, "x@4095",       0),
     TEST ("x@4096",    0, 4095, "y@4096", 4095, "y@4095x",      0),
     TEST ("x@4096",    0, 2047, "x@4096", 2047, "x@4096",       0),
@@ -505,6 +539,20 @@
     TEST ("x@4096", 0,  4095, "x@4096",   0, 4095, "x@4096",         0),
     TEST ("x@4096", 0,  2047, "x@4096",   0, 2047, "x@4096",         0),
 
+    TEST ("",       0,     0, "x@334",    0,  207, "x@207",          0),
+    TEST ("x@20",   1,    10, "x@118",    0,  118, "x@128",          0),
+    TEST ("x@128",  0,     0, "x@129",   50,   79, "x@207",          0),
+    TEST ("x@207",  207,   0, "x@127",    0,  127, "x@334",          0),
+    TEST ("x@208",  128,   1, "x@207",   10,  127, "x@334",          0),
+    TEST ("x@335",  334,   1, "x@208",    2,  206, "x@540",          0),
+    TEST ("x@540",    0,   0, "x@336",    3,  333, "x@873",          0),
+    TEST ("x@334",    0, 334, "x@873",    0,  873, "x@873",          0),
+    TEST ("x@873",    0, 873, "x@541",    1,  540, "x@540",          0),
+    TEST ("x@872",    0,   0, "x@1412",   0, 1412, "x@2284",         0),
+    TEST ("x@1411", 1411,  0, "x@2288",   4, 2284, "x@3695",         0),
+    TEST ("x@873",   540,333, "x@3695",3695,    0, "x@540",          0),
+    TEST ("x@1412",  0, 1412, "x@3696",    0,3695, "x@3695",         0),
+
     TEST ("x@4096", 2047, 2048, "x@4096", 0, 2048,  "x@4096",        0),
 
     TEST ("\0",         2, 0, "",           0, 0, "\0",              1),
@@ -636,11 +684,21 @@
     TEST ("a\0b\0c\0", 6, 0, 2, '\0', "a\0b\0c\0\0\0", 0),
     TEST ("\0ab\0\0c", 5, 0, 1, '\0', "\0ab\0\0\0c",   0),
 
-    TEST ("x@4096",    0, 4095, 2, 'a',  "aax",        0),
-    TEST ("x@4096",    1, 4094, 2, 'a',  "xaax",       0),
-    TEST ("x@4096",    0, 4094, 2, 'a',  "aaxx",       0),
-    TEST ("x@4096",    1, 4093, 0, 'a',  "xxx",        0),
-    TEST ("x@4096",    1, 4092, 1, '\0', "x\0xxx",     0),
+    TEST ("x@4096",    0, 4095,  2, 'a',  "aax",       0),
+    TEST ("x@4096",    1, 4094,  2, 'a',  "xaax",      0),
+    TEST ("x@4096",    0, 4094,  2, 'a',  "aaxx",      0),
+    TEST ("x@4096",    1, 4093,  0, 'a',  "xxx",       0),
+    TEST ("x@4096",    1, 4092,  1, '\0', "x\0xxx",    0),
+
+    TEST ("x@127",     0,    0,  1, 'x', "x@128",      0),
+    TEST ("x@200",   128,    7, 14, 'x', "x@207",      0),
+    TEST ("x@331",   331,    1,  3, 'x', "x@334",      0),
+    TEST ("x@539",   539,    0,  1, 'x', "x@540",      0),
+    TEST ("x@539",     0,    0,873, 'x', "x@1412",     0),
+    TEST ("x@873",   873,  0, 1411, 'x', "x@2284",     0),
+    TEST ("x@3694",  128,    1,  2, 'x', "x@3695",     0),
+    TEST ("x@539",   537,    2,  3, 'a', "x@537aaa",   0),
+    TEST ("",          0,  0, 3695, 'x', "x@3695",     0),
 
     TEST ("a",         0,    1, 4095, 'x', "x@4095",       0),
     TEST ("x@4096",    0, 4095, 4095, 'a', "a@4095x",      0),



Mime
View raw message