stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r475497 - /incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp
Date Wed, 15 Nov 2006 23:40:49 GMT
Author: sebor
Date: Wed Nov 15 15:40:48 2006
New Revision: 475497

URL: http://svn.apache.org/viewvc?view=rev&rev=475497
Log:
2006-11-15  Martin Sebor  <sebor@roguewave.com>

	* 21.find.last.not.of.cpp (cptr_size_size_test_cases): Cast NPOS
	to int to silence Compaq C++ warning: integer conversion resulted
	in truncation.
	Stripped trailing whitespace.

Modified:
    incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp

Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp?view=diff&rev=475497&r1=475496&r2=475497
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp Wed Nov 15 15:40:48
2006
@@ -1,6 +1,6 @@
 /***************************************************************************
  *
- * 21.string.find.last.not.of.cpp - 
+ * 21.string.find.last.not.of.cpp -
  *      string test exercising lib.string.find.last.not.of
  *
  * $Id$
@@ -23,7 +23,7 @@
  * 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
@@ -47,9 +47,9 @@
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (const value_type*)
-static const StringTestCase 
+static const StringTestCase
 cptr_test_cases [] = {
 
 #undef TEST
@@ -61,70 +61,70 @@
 
     //    +----------------------------------- controlled sequence
     //    |             +--------------------- sequence to be found
-    //    |             |                +---- expected result 
-    //    |             |                |                               
-    //    |             |                |                     
-    //    V             V                V        
-    TEST ("ab",         "c",             1),   
-
-    TEST ("",           "",           NPOS),   
-    TEST ("",           "\0",         NPOS),    
-    TEST ("",           "a",          NPOS),   
-
-    TEST ("\0",         "",              0),    
-    TEST ("\0",         "\0",            0),   
-    TEST ("\0",         "a",             0),   
-
-    TEST ("bbcdefghij", "a",             9),    
-    TEST ("bcdefghija", "a",             8),  
-    TEST ("abcdedaaaa", "a",             5),     
-    TEST ("aabaaacaaa", "a",             6),     
-
-    TEST ("edfcbbhjig", "cba",           9),    
-    TEST ("edfcbaacba", "bca",           2),    
-    TEST ("edhcbahcba", "cba",           6),   
-    TEST ("cbacbbcbac", "cab",        NPOS),  
-
-    TEST ("e\0cb\0\0g", "b\0\0g",        6),    
-    TEST ("e\0cb\0\0g", "ecbg",          5),    
-    TEST ("\0cb\0\0ge", "\0\0ge",        6),   
-    TEST ("ge\0\0\0cb", "bc\0",          4),      
-    TEST ("e\0cdg\0\0", "abc",           6),  
-    TEST ("a\0b",       "e\0gbg\0\0",    2),    
-    TEST ("a\0b",       "ab\0gg\0\0",    1), 
-    TEST ("\0ab",       "b\0gg\0\0a",    1),  
+    //    |             |                +---- expected result
+    //    |             |                |
+    //    |             |                |
+    //    V             V                V
+    TEST ("ab",         "c",             1),
+
+    TEST ("",           "",           NPOS),
+    TEST ("",           "\0",         NPOS),
+    TEST ("",           "a",          NPOS),
+
+    TEST ("\0",         "",              0),
+    TEST ("\0",         "\0",            0),
+    TEST ("\0",         "a",             0),
+
+    TEST ("bbcdefghij", "a",             9),
+    TEST ("bcdefghija", "a",             8),
+    TEST ("abcdedaaaa", "a",             5),
+    TEST ("aabaaacaaa", "a",             6),
+
+    TEST ("edfcbbhjig", "cba",           9),
+    TEST ("edfcbaacba", "bca",           2),
+    TEST ("edhcbahcba", "cba",           6),
+    TEST ("cbacbbcbac", "cab",        NPOS),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        6),
+    TEST ("e\0cb\0\0g", "ecbg",          5),
+    TEST ("\0cb\0\0ge", "\0\0ge",        6),
+    TEST ("ge\0\0\0cb", "bc\0",          4),
+    TEST ("e\0cdg\0\0", "abc",           6),
+    TEST ("a\0b",       "e\0gbg\0\0",    2),
+    TEST ("a\0b",       "ab\0gg\0\0",    1),
+    TEST ("\0ab",       "b\0gg\0\0a",    1),
 
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),     
-    TEST ("aaaaabaaaa", "ccccccccca",    5),   
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),
+    TEST ("aaaaabaaaa", "ccccccccca",    5),
     TEST ("aabaabaaaa", "ccccccccca",    5),
-    TEST ("bbb",        "aaaaaaaaba", NPOS),        
-    TEST ("bbb",        "aaaaaaaaaa",    2), 
+    TEST ("bbb",        "aaaaaaaaba", NPOS),
+    TEST ("bbb",        "aaaaaaaaaa",    2),
     TEST ("abcdefghij", "jihgfedcba", NPOS),
 
-    TEST ("x@4096",     "",           4095),     
-    TEST ("x@4096",     "a",          4095),  
-    TEST ("x@4096",     "x",          NPOS),    
-    TEST ("x@4096",     "xxx",        NPOS),    
-    TEST ("x@4096",     "aax",        NPOS),   
-    TEST ("abc",        "x@4096",        2),    
-    TEST ("xxxxxxxxxx", "x@4096",     NPOS),  
+    TEST ("x@4096",     "",           4095),
+    TEST ("x@4096",     "a",          4095),
+    TEST ("x@4096",     "x",          NPOS),
+    TEST ("x@4096",     "xxx",        NPOS),
+    TEST ("x@4096",     "aax",        NPOS),
+    TEST ("abc",        "x@4096",        2),
+    TEST ("xxxxxxxxxx", "x@4096",     NPOS),
     TEST ("xxax@2048",  "x@4096",        2),
 
-    TEST ("abcdefghij", 0,            NPOS),      
-    TEST ("\0cb\0\0ge", 0,               6),       
-    TEST ("x@4096",     0,            NPOS),  
+    TEST ("abcdefghij", 0,            NPOS),
+    TEST ("\0cb\0\0ge", 0,               6),
+    TEST ("x@4096",     0,            NPOS),
 
-    TEST ("last test",  "test",          4)       
+    TEST ("last test",  "test",          4)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (const basic_string&)
-static const StringTestCase 
+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,             \
@@ -133,69 +133,69 @@
 
     //    +------------------------------------ controlled sequence
     //    |             +---------------------- sequence to be found
-    //    |             |                +----- expected result 
-    //    |             |                |                               
-    //    |             |                |                     
-    //    V             V                V        
-    TEST ("ab",         "c",             1),   
-
-    TEST ("",           "",           NPOS),   
-    TEST ("",           "\0",         NPOS),    
-    TEST ("",           "a",          NPOS),   
+    //    |             |                +----- expected result
+    //    |             |                |
+    //    |             |                |
+    //    V             V                V
+    TEST ("ab",         "c",             1),
+
+    TEST ("",           "",           NPOS),
+    TEST ("",           "\0",         NPOS),
+    TEST ("",           "a",          NPOS),
 
-    TEST ("\0",         "",              0),    
-    TEST ("\0",         "\0",         NPOS),  
+    TEST ("\0",         "",              0),
+    TEST ("\0",         "\0",         NPOS),
     TEST ("\0\0",       "\0",         NPOS),
-    TEST ("\0",         "a",             0),  
-    TEST ("a",          "\0",            0), 
+    TEST ("\0",         "a",             0),
+    TEST ("a",          "\0",            0),
 
-    TEST ("bbcdefghij", "a",             9),    
-    TEST ("bcdefghija", "a",             8),  
-    TEST ("abcdedaaaa", "a",             5),     
-    TEST ("aabaaacaaa", "a",             6),     
-
-    TEST ("edfcbbhjig", "cba",           9),    
-    TEST ("edfcbaacba", "bca",           2),    
-    TEST ("edhcbahcba", "cba",           6),   
-    TEST ("cbacbbcbac", "cab",        NPOS),  
-
-    TEST ("e\0bb\0\0g", "b\0\0g",        0),    
-    TEST ("e\0cb\0\0g", "ecbg",          5),    
-    TEST ("\0cb\0\0ge", "\0\0ge",        2),   
-    TEST ("be\0\0\0cb", "bc\0",          1),      
-    TEST ("e\0cdg\0\0", "abc",           6),  
-    TEST ("a\0b",       "e\0gbg\0\0",    0),    
-    TEST ("a\0b",       "ab\0gg\0\0", NPOS), 
-    TEST ("\0ab",       "abcdefghij",    0),  
+    TEST ("bbcdefghij", "a",             9),
+    TEST ("bcdefghija", "a",             8),
+    TEST ("abcdedaaaa", "a",             5),
+    TEST ("aabaaacaaa", "a",             6),
+
+    TEST ("edfcbbhjig", "cba",           9),
+    TEST ("edfcbaacba", "bca",           2),
+    TEST ("edhcbahcba", "cba",           6),
+    TEST ("cbacbbcbac", "cab",        NPOS),
+
+    TEST ("e\0bb\0\0g", "b\0\0g",        0),
+    TEST ("e\0cb\0\0g", "ecbg",          5),
+    TEST ("\0cb\0\0ge", "\0\0ge",        2),
+    TEST ("be\0\0\0cb", "bc\0",          1),
+    TEST ("e\0cdg\0\0", "abc",           6),
+    TEST ("a\0b",       "e\0gbg\0\0",    0),
+    TEST ("a\0b",       "ab\0gg\0\0", NPOS),
+    TEST ("\0ab",       "abcdefghij",    0),
 
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),     
-    TEST ("aaaaabaaaa", "ccccccccca",    5),   
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),
+    TEST ("aaaaabaaaa", "ccccccccca",    5),
     TEST ("aabaabaaaa", "ccccccccca",    5),
-    TEST ("bbb",        "aaaaaaaaba", NPOS),        
-    TEST ("bbb",        "aaaaaaaaaa",    2), 
+    TEST ("bbb",        "aaaaaaaaba", NPOS),
+    TEST ("bbb",        "aaaaaaaaaa",    2),
     TEST ("abcdefghij", "jihgfedcba", NPOS),
 
-    TEST ("x@4096",     "",           4095),     
-    TEST ("x@4096",     "a",          4095),  
-    TEST ("x@4096",     "x",          NPOS),    
-    TEST ("x@4096",     "xxx",        NPOS),    
-    TEST ("x@4096",     "aax",        NPOS),   
-    TEST ("abc",        "x@4096",        2),    
-    TEST ("xxxxxxxxxx", "x@4096",     NPOS), 
+    TEST ("x@4096",     "",           4095),
+    TEST ("x@4096",     "a",          4095),
+    TEST ("x@4096",     "x",          NPOS),
+    TEST ("x@4096",     "xxx",        NPOS),
+    TEST ("x@4096",     "aax",        NPOS),
+    TEST ("abc",        "x@4096",        2),
+    TEST ("xxxxxxxxxx", "x@4096",     NPOS),
     TEST ("xxax@2048",  "x@4096",        2),
 
-    TEST ("abcdefghij", 0,            NPOS),      
-    TEST ("\0cb\0\0ge", 0,            NPOS),       
-    TEST ("x@4096",     0,            NPOS),  
+    TEST ("abcdefghij", 0,            NPOS),
+    TEST ("\0cb\0\0ge", 0,            NPOS),
+    TEST ("x@4096",     0,            NPOS),
 
-    TEST ("last test",  "test",          4)      
+    TEST ("last test",  "test",          4)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (const value_type*, size_type)
-static const StringTestCase 
+static const StringTestCase
 cptr_size_test_cases [] = {
 
 #undef TEST
@@ -208,97 +208,97 @@
     //    +----------------------------------- controlled sequence
     //    |            +---------------------- sequence to be found
     //    |            |               +------ find_last_not_of() off argument
-    //    |            |               |     +-- expected result  
-    //    |            |               |     |                             
-    //    |            |               |     |             
-    //    V            V               V     V                 
-    TEST ("ab",        "c",            0,    0),   
-
-    TEST ("",           "",            0, NPOS),    
-    TEST ("",           "\0",          0, NPOS),    
-    TEST ("",           "a",           0, NPOS),    
-
-    TEST ("\0",         "",            0,    0),  
-    TEST ("\0",         "",            1,    0), 
-    TEST ("\0",         "\0",          0,    0),   
-    TEST ("\0",         "\0",          1,    0),    
-    TEST ("\0",         "a",           0,    0),    
+    //    |            |               |     +-- expected result
+    //    |            |               |     |
+    //    |            |               |     |
+    //    V            V               V     V
+    TEST ("ab",        "c",            0,    0),
+
+    TEST ("",           "",            0, NPOS),
+    TEST ("",           "\0",          0, NPOS),
+    TEST ("",           "a",           0, NPOS),
+
+    TEST ("\0",         "",            0,    0),
+    TEST ("\0",         "",            1,    0),
+    TEST ("\0",         "\0",          0,    0),
+    TEST ("\0",         "\0",          1,    0),
+    TEST ("\0",         "a",           0,    0),
 
-    TEST ("bbcdefghij", "a",           9,    9),    
+    TEST ("bbcdefghij", "a",           9,    9),
     TEST ("bcdefghija", "a",           9,    8),
     TEST ("bbcdefghij", "a",           0,    0),
-    TEST ("bcadefghij", "a",           2,    1),    
-    TEST ("aaadefghij", "a",           2, NPOS),   
-    TEST ("abcdeaaaij", "a",           7,    4),     
-
-    TEST ("edfcbbhjig", "cba",         9,    9),    
-    TEST ("edfcbacbag", "cba",         7,    2),     
-    TEST ("ebccbahjig", "cba",         4,    0),    
-    TEST ("edfcbahcba", "cba",         9,    6), 
-    TEST ("cbacbahcba", "cba",         5, NPOS), 
-    TEST ("edfcbahcba", "cba",         3,    2),    
-    TEST ("cbahbahabc", "cba",         9,    6),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      5,    5),    
-    TEST ("b\0bc\0\0g", "b\0\0g",      2,    1),    
-    TEST ("e\0cb\0\0g", "ecb",         7,    6),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,    6), 
-    TEST ("b\0\0\0gec", "cb\0",        0, NPOS),     
+    TEST ("bcadefghij", "a",           2,    1),
+    TEST ("aaadefghij", "a",           2, NPOS),
+    TEST ("abcdeaaaij", "a",           7,    4),
+
+    TEST ("edfcbbhjig", "cba",         9,    9),
+    TEST ("edfcbacbag", "cba",         7,    2),
+    TEST ("ebccbahjig", "cba",         4,    0),
+    TEST ("edfcbahcba", "cba",         9,    6),
+    TEST ("cbacbahcba", "cba",         5, NPOS),
+    TEST ("edfcbahcba", "cba",         3,    2),
+    TEST ("cbahbahabc", "cba",         9,    6),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      5,    5),
+    TEST ("b\0bc\0\0g", "b\0\0g",      2,    1),
+    TEST ("e\0cb\0\0g", "ecb",         7,    6),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,    6),
+    TEST ("b\0\0\0gec", "cb\0",        0, NPOS),
     TEST ("\0cb\0\0ge", "cb\0",        1,    0),
     TEST ("\0cb\0\0ge", "cb\0",        2,    0),
-    TEST ("e\0cbg\0\0", "bg",          4,    2),  
-    TEST ("e\0\0\0bbg", "bg",          5,    3),   
-    TEST ("a\0b",       "b\0gbg\0\0",  3,    1),    
-    TEST ("\0ba",       "ab\0gg\0\0",  3,    0), 
+    TEST ("e\0cbg\0\0", "bg",          4,    2),
+    TEST ("e\0\0\0bbg", "bg",          5,    3),
+    TEST ("a\0b",       "b\0gbg\0\0",  3,    1),
+    TEST ("\0ba",       "ab\0gg\0\0",  3,    0),
     TEST ("ab\0",       "ba\0d\0\0a",  1, NPOS),
 
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, NPOS),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4, NPOS),    
-    TEST ("aaaaabaaaa", "ccccccccca",  8,    5),   
-    TEST ("aabaabaaaa", "ccccccccca",  9,    5),  
-    TEST ("aabaabaaaa", "ccccccccca",  3,    2), 
-    TEST ("bbb",        "aaaaaaaaba",  2, NPOS),  
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, NPOS),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4, NPOS),
+    TEST ("aaaaabaaaa", "ccccccccca",  8,    5),
+    TEST ("aabaabaaaa", "ccccccccca",  9,    5),
+    TEST ("aabaabaaaa", "ccccccccca",  3,    2),
+    TEST ("bbb",        "aaaaaaaaba",  2, NPOS),
     TEST ("cab",        "aaaaaaaaba",  0,    0),
-    TEST ("bbb",        "aaaaaaaaaa",  3,    2),      
+    TEST ("bbb",        "aaaaaaaaaa",  3,    2),
 
-    TEST ("x@4096",     "",         4096, 4095),    
-    TEST ("x@4096",     "a",        4096, 4095),     
-    TEST ("x@4096",     "x",        4096, NPOS),   
+    TEST ("x@4096",     "",         4096, 4095),
+    TEST ("x@4096",     "a",        4096, 4095),
+    TEST ("x@4096",     "x",        4096, NPOS),
     TEST ("x@4096",     "xxx",      4095, NPOS),
     TEST ("x@4096",     "xxx",         0, NPOS),
-    TEST ("x@4096",     "xxx",      4087, NPOS),    
-    TEST ("x@4096",     "aax",      4087, NPOS),     
-    TEST ("abc",        "x@4096",      2,    2),    
-    TEST ("xxxxxxxxxx", "x@4096",      6, NPOS),   
+    TEST ("x@4096",     "xxx",      4087, NPOS),
+    TEST ("x@4096",     "aax",      4087, NPOS),
+    TEST ("abc",        "x@4096",      2,    2),
+    TEST ("xxxxxxxxxx", "x@4096",      6, NPOS),
     TEST ("xxxxaxxxxx", "x@4096",      9,    4),
 
-    TEST ("x@4096",     "xxx",         3, NPOS), 
+    TEST ("x@4096",     "xxx",         3, NPOS),
     TEST ("x@4096",     "xxx",         2, NPOS),
     TEST ("xxax@2048",  "x@4096",   2052,    2),
 
-    TEST ("abcdefghij", 0,             0, NPOS),    
-    TEST ("abcdefghij", 0,             9, NPOS),   
-    TEST ("\0cb\0\0ge", 0,             5,    5),    
-    TEST ("x@4096",     0,             0, NPOS),  
-    TEST ("x@4096",     0,             1, NPOS),    
-
-    TEST ("",           "",            1, NPOS),  
-    TEST ("defghijabc", "abc",        15,    6),   
-    TEST ("defgabcabc", "cba",        15,    3), 
+    TEST ("abcdefghij", 0,             0, NPOS),
+    TEST ("abcdefghij", 0,             9, NPOS),
+    TEST ("\0cb\0\0ge", 0,             5,    5),
+    TEST ("x@4096",     0,             0, NPOS),
+    TEST ("x@4096",     0,             1, NPOS),
+
+    TEST ("",           "",            1, NPOS),
+    TEST ("defghijabc", "abc",        15,    6),
+    TEST ("defgabcabc", "cba",        15,    3),
 
-    TEST ("last test", "test",         9,    4)      
+    TEST ("last test", "test",         9,    4)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (const value_type*, size_type, size_type)
-static const StringTestCase 
+static const StringTestCase
 cptr_size_size_test_cases [] = {
 
 #undef TEST
 #define TEST(str, arg, off, size, res, bthrow)      \
-    { __LINE__, off, size, NPOS, -1, -1,            \
+    { __LINE__, off, size, int (NPOS), -1, -1,      \
       str, sizeof str - 1, arg,                     \
       sizeof arg - 1, 0, res, bthrow                \
     }
@@ -306,14 +306,14 @@
     //    +----------------------------------- controlled sequence
     //    |            +---------------------- sequence to be found
     //    |            |               +------ find_last_not_of() off argument
-    //    |            |               |   +-- find_last_not_of() n argument 
-    //    |            |               |   |     +-- expected result  
-    //    |            |               |   |     |   exception info 
-    //    |            |               |   |     |   |   0 - no exception        
-    //    |            |               |   |     |   |   1 - length_error  
-    //    |            |               |   |     |   |                           
-    //    |            |               |   |     |   +----+             
-    //    V            V               V   V     V        V             
+    //    |            |               |   +-- find_last_not_of() n argument
+    //    |            |               |   |     +-- expected result
+    //    |            |               |   |     |   exception info
+    //    |            |               |   |     |   |   0 - no exception
+    //    |            |               |   |     |   |   1 - length_error
+    //    |            |               |   |     |   |
+    //    |            |               |   |     |   +----+
+    //    V            V               V   V     V        V
     TEST ("ab",        "c",            0,  1,    0,       0),
 
     TEST ("",           "",            0,  0, NPOS,       0),
@@ -354,11 +354,11 @@
     TEST ("\0cb\0\0ge", "cb\0",        4,  3, NPOS,       0),
     TEST ("e\0bcg\0\0", "bg",          1,  2,    1,       0),
     TEST ("e\0bcg\0\0", "bg",          6,  2,    6,       0),
-    TEST ("a\0b",       "a\0gbg\0\0",  2,  1,    2,       0),    
-    TEST ("\0ba",       "ab\0gg\0\0",  1,  2,    0,       0), 
+    TEST ("a\0b",       "a\0gbg\0\0",  2,  1,    2,       0),
+    TEST ("\0ba",       "ab\0gg\0\0",  1,  2,    0,       0),
     TEST ("ba\0",       "e\0gg\0\0a",  3,  7,    0,       0),
     TEST ("a\0b",       "e\0gg\0\0a",  0,  7, NPOS,       0),
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  3,    0,       0), 
+    TEST ("a\0b",       "eb\0gg\0\0",  1,  3,    0,       0),
 
     TEST ("e\0a\0",     "e\0a\0\0",    2,  4, NPOS,       0),
     TEST ("e\0a\0",     "e\0a\0\0",    3,  5, NPOS,       0),
@@ -370,8 +370,8 @@
     TEST ("aaaaabaaaa", "ccccccccca",  9, 10,    5,       0),
     TEST ("aabaabaaab", "cccacccccc",  8,  4,    5,       0),
     TEST ("aaaabaaaab", "cccca",       9,  5,    9,       0),
-    TEST ("aabaabaaaa", "cacccccccb",  7,  5,    5,       0), 
-    TEST ("bbb",        "aaaaaaaaba",  1,  2,    1,       0),  
+    TEST ("aabaabaaaa", "cacccccccb",  7,  5,    5,       0),
+    TEST ("bbb",        "aaaaaaaaba",  1,  2,    1,       0),
     TEST ("bbb",        "aaaaaaaaab",  1,  9,    1,       0),
     TEST ("bab",        "aaaaaaaaba",  0,  0,    0,       0),
     TEST ("bab",        "ccccccccba",  1, 10, NPOS,       0),
@@ -414,9 +414,9 @@
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (const basic_string&, size_type)
-static const StringTestCase 
+static const StringTestCase
 cstr_size_test_cases [] = {
 
 #undef TEST
@@ -429,94 +429,94 @@
     //    +----------------------------------- controlled sequence
     //    |             +--------------------- sequence to be found
     //    |             |              +------ find_last_not_of() off argument
-    //    |             |              |     +-- expected result 
-    //    |             |              |     |                          
-    //    |             |              |     |           
-    //    V             V              V     V                
-    TEST ("ab",         "c",           1,    1),     
-
-    TEST ("",           "",            0, NPOS),    
-    TEST ("",           "\0",          0, NPOS),    
-    TEST ("",           "a",           0, NPOS),    
-
-    TEST ("\0",         "",            0,    0),  
-    TEST ("\0",         "",            1,    0), 
-    TEST ("\0",         "\0",          0, NPOS),   
-    TEST ("\0",         "\0",          1, NPOS),    
+    //    |             |              |     +-- expected result
+    //    |             |              |     |
+    //    |             |              |     |
+    //    V             V              V     V
+    TEST ("ab",         "c",           1,    1),
+
+    TEST ("",           "",            0, NPOS),
+    TEST ("",           "\0",          0, NPOS),
+    TEST ("",           "a",           0, NPOS),
+
+    TEST ("\0",         "",            0,    0),
+    TEST ("\0",         "",            1,    0),
+    TEST ("\0",         "\0",          0, NPOS),
+    TEST ("\0",         "\0",          1, NPOS),
     TEST ("\0\0",       "\0",          1, NPOS),
-    TEST ("\0",         "a",           0,    0),  
-    TEST ("a",          "\0",          1,    0), 
+    TEST ("\0",         "a",           0,    0),
+    TEST ("a",          "\0",          1,    0),
 
-    TEST ("bbcdefghij", "a",           9,    9),    
+    TEST ("bbcdefghij", "a",           9,    9),
     TEST ("bcdefghija", "a",           9,    8),
     TEST ("bbcdefghij", "a",           0,    0),
-    TEST ("bcadefghij", "a",           2,    1),    
-    TEST ("aaadefghij", "a",           2, NPOS),   
-    TEST ("abcdeaaaij", "a",           7,    4),     
-
-    TEST ("edfcbbhjig", "cba",         9,    9),    
-    TEST ("edfcbacbag", "cba",         7,    2),     
-    TEST ("ebccbahjig", "cba",         4,    0),    
-    TEST ("edfcbahcba", "cba",         9,    6), 
-    TEST ("cbacbahcba", "cba",         5, NPOS), 
-    TEST ("edfcbahcba", "cba",         3,    2),    
-    TEST ("cbahbahabc", "cba",         9,    6),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      5,    2),    
-    TEST ("c\0bg\0\0g", "b\0\0g",      2,    0),    
-    TEST ("e\0cb\0\0g", "ecb",         7,    6),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,    2), 
-    TEST ("b\0\0\0gec", "cb\0",        2, NPOS),     
+    TEST ("bcadefghij", "a",           2,    1),
+    TEST ("aaadefghij", "a",           2, NPOS),
+    TEST ("abcdeaaaij", "a",           7,    4),
+
+    TEST ("edfcbbhjig", "cba",         9,    9),
+    TEST ("edfcbacbag", "cba",         7,    2),
+    TEST ("ebccbahjig", "cba",         4,    0),
+    TEST ("edfcbahcba", "cba",         9,    6),
+    TEST ("cbacbahcba", "cba",         5, NPOS),
+    TEST ("edfcbahcba", "cba",         3,    2),
+    TEST ("cbahbahabc", "cba",         9,    6),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      5,    2),
+    TEST ("c\0bg\0\0g", "b\0\0g",      2,    0),
+    TEST ("e\0cb\0\0g", "ecb",         7,    6),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,    2),
+    TEST ("b\0\0\0gec", "cb\0",        2, NPOS),
     TEST ("\0cb\0\0ge", "cb\0",        1, NPOS),
     TEST ("\0cb\0\0ge", "cb\0",        6,    6),
-    TEST ("e\0cbg\0\0", "bg",          4,    2),  
-    TEST ("e\0\0\0bbg", "bg",          5,    3),   
-    TEST ("a\0b",       "b\0gbg\0\0",  3,    0),    
-    TEST ("\0ba",       "ab\0gg\0\0",  3, NPOS), 
+    TEST ("e\0cbg\0\0", "bg",          4,    2),
+    TEST ("e\0\0\0bbg", "bg",          5,    3),
+    TEST ("a\0b",       "b\0gbg\0\0",  3,    0),
+    TEST ("\0ba",       "ab\0gg\0\0",  3, NPOS),
     TEST ("ab\0",       "ba\0d\0\0a",  2, NPOS),
 
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, NPOS),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4, NPOS),    
-    TEST ("aaaaabaaaa", "ccccccccca",  8,    5),   
-    TEST ("aabaabaaaa", "ccccccccca",  9,    5),  
-    TEST ("aabaabaaaa", "ccccccccca",  3,    2), 
-    TEST ("bbb",        "aaaaaaaaba",  2, NPOS),  
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, NPOS),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4, NPOS),
+    TEST ("aaaaabaaaa", "ccccccccca",  8,    5),
+    TEST ("aabaabaaaa", "ccccccccca",  9,    5),
+    TEST ("aabaabaaaa", "ccccccccca",  3,    2),
+    TEST ("bbb",        "aaaaaaaaba",  2, NPOS),
     TEST ("cab",        "aaaaaaaaba",  0,    0),
-    TEST ("bbb",        "aaaaaaaaaa",  3,    2),      
+    TEST ("bbb",        "aaaaaaaaaa",  3,    2),
 
-    TEST ("x@4096",     "",         4096, 4095),    
-    TEST ("x@4096",     "a",        4096, 4095),     
-    TEST ("x@4096",     "x",        4096, NPOS),   
+    TEST ("x@4096",     "",         4096, 4095),
+    TEST ("x@4096",     "a",        4096, 4095),
+    TEST ("x@4096",     "x",        4096, NPOS),
     TEST ("x@4096",     "xxx",      4095, NPOS),
     TEST ("x@4096",     "xxx",         0, NPOS),
-    TEST ("x@4096",     "xxx",      4087, NPOS),    
-    TEST ("x@4096",     "aax",      4087, NPOS),     
-    TEST ("abc",        "x@4096",      2,    2),    
-    TEST ("xxxxxxxxxx", "x@4096",      6, NPOS),   
+    TEST ("x@4096",     "xxx",      4087, NPOS),
+    TEST ("x@4096",     "aax",      4087, NPOS),
+    TEST ("abc",        "x@4096",      2,    2),
+    TEST ("xxxxxxxxxx", "x@4096",      6, NPOS),
     TEST ("xxxxaxxxxx", "x@4096",      9,    4),
     TEST ("xxax@2048",  "x@4096",   2050,    2),
 
-    TEST ("x@4096",     "xxx",         3, NPOS), 
-    TEST ("x@4096",     "xxx",         2, NPOS),     
+    TEST ("x@4096",     "xxx",         3, NPOS),
+    TEST ("x@4096",     "xxx",         2, NPOS),
 
-    TEST ("abcdefghij", 0,             0, NPOS),    
-    TEST ("abcdefghij", 0,             9, NPOS),   
-    TEST ("\0cb\0\0ge", 0,             5, NPOS),    
-    TEST ("x@4096",     0,             0, NPOS),  
-    TEST ("x@4096",     0,             1, NPOS),    
-
-    TEST ("",           "",            1, NPOS),  
-    TEST ("defghijabc", "abc",        15,    6),   
-    TEST ("defgabcabc", "cba",        15,    3), 
+    TEST ("abcdefghij", 0,             0, NPOS),
+    TEST ("abcdefghij", 0,             9, NPOS),
+    TEST ("\0cb\0\0ge", 0,             5, NPOS),
+    TEST ("x@4096",     0,             0, NPOS),
+    TEST ("x@4096",     0,             1, NPOS),
+
+    TEST ("",           "",            1, NPOS),
+    TEST ("defghijabc", "abc",        15,    6),
+    TEST ("defgabcabc", "cba",        15,    3),
 
-    TEST ("last test",  "test",        9,    4)     
+    TEST ("last test",  "test",        9,    4)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (value_type)
-static const StringTestCase 
+static const StringTestCase
 val_test_cases [] = {
 
 #undef TEST
@@ -528,41 +528,41 @@
 
     //    +----------------------------- controlled sequence
     //    |              +-------------- character to be found
-    //    |              |       +------ expected result  
-    //    |              |       |                           
-    //    |              |       |                
-    //    V              V       V                 
-    TEST ("ab",          'c',    1),   
-
-    TEST ("",            'a', NPOS),  
-    TEST ("",           '\0', NPOS),   
-
-    TEST ("\0",         '\0', NPOS),   
-    TEST ("\0\0",       '\0', NPOS),  
-    TEST ("\0",          'a',    0),  
-    TEST ("a\0",        '\0',    0),  
+    //    |              |       +------ expected result
+    //    |              |       |
+    //    |              |       |
+    //    V              V       V
+    TEST ("ab",          'c',    1),
+
+    TEST ("",            'a', NPOS),
+    TEST ("",           '\0', NPOS),
+
+    TEST ("\0",         '\0', NPOS),
+    TEST ("\0\0",       '\0', NPOS),
+    TEST ("\0",          'a',    0),
+    TEST ("a\0",        '\0',    0),
 
-    TEST ("e\0cbg\0\0", '\0',    4), 
+    TEST ("e\0cbg\0\0", '\0',    4),
     TEST ("e\0cgg\0\0", '\0',    4),
-    TEST ("e\0cb\0\0b",  'b',    5),      
-    TEST ("\0cbge\0\0", '\0',    4),   
-    TEST ("\0cbgb\0\0",  'b',    6),    
-    TEST ("aaaaaaaaaa",  'a', NPOS), 
+    TEST ("e\0cb\0\0b",  'b',    5),
+    TEST ("\0cbge\0\0", '\0',    4),
+    TEST ("\0cbgb\0\0",  'b',    6),
+    TEST ("aaaaaaaaaa",  'a', NPOS),
     TEST ("\0aaaaaaaa",  'a',    0),
 
-    TEST ("x@4096",      'x', NPOS),  
-    TEST ("x@4096",     '\0', 4095),   
-    TEST ("x@4096",      'a', 4095), 
+    TEST ("x@4096",      'x', NPOS),
+    TEST ("x@4096",     '\0', 4095),
+    TEST ("x@4096",      'a', 4095),
     TEST ("xxax@2048",   'x',    2),
 
-    TEST ("last test",   't',    7)    
+    TEST ("last test",   't',    7)
 };
 
 /**************************************************************************/
 
-// used to exercise 
+// used to exercise
 // find_last_not_of (value_type, size_type)
-static const StringTestCase 
+static const StringTestCase
 val_size_test_cases [] = {
 
 #undef TEST
@@ -575,41 +575,41 @@
     //    +------------------------------ controlled sequence
     //    |              +--------------- character to be found
     //    |              |     +--------- find_last_not_of() off argument
-    //    |              |     |     +--- expected result  
-    //    |              |     |     |                              
-    //    |              |     |     |               
-    //    V              V     V     V                   
-    TEST ("ab",          'c',  1,    1),    
-
-    TEST ("",            'a',  0, NPOS),   
-    TEST ("",           '\0',  0, NPOS),    
-
-    TEST ("\0",         '\0',  1, NPOS),    
-    TEST ("\0",          'a',  0,    0),   
-    TEST ("\0\0",       '\0',  2, NPOS),    
-    TEST ("\0\0",        'a',  3,    1),   
-    TEST ("\0\0",       '\0',  3, NPOS),    
-
-    TEST ("e\0cb\0\0g", '\0',  1,    0),    
-    TEST ("e\0cb\0\0g", '\0',  5,    3),    
-    TEST ("\0ecb\0\0g", '\0',  0, NPOS),    
-    TEST ("e\0cb\0\0b",  'b',  7,    5),    
-    TEST ("e\0cb\0\0g",  'b',  4,    4),    
-    TEST ("e\0cbg\0\0",  'a',  6,    6),   
-    TEST ("\0cbee\0\0", '\0',  0, NPOS),   
-    TEST ("\0cbee\0\0", '\0',  6,    4),  
+    //    |              |     |     +--- expected result
+    //    |              |     |     |
+    //    |              |     |     |
+    //    V              V     V     V
+    TEST ("ab",          'c',  1,    1),
+
+    TEST ("",            'a',  0, NPOS),
+    TEST ("",           '\0',  0, NPOS),
+
+    TEST ("\0",         '\0',  1, NPOS),
+    TEST ("\0",          'a',  0,    0),
+    TEST ("\0\0",       '\0',  2, NPOS),
+    TEST ("\0\0",        'a',  3,    1),
+    TEST ("\0\0",       '\0',  3, NPOS),
+
+    TEST ("e\0cb\0\0g", '\0',  1,    0),
+    TEST ("e\0cb\0\0g", '\0',  5,    3),
+    TEST ("\0ecb\0\0g", '\0',  0, NPOS),
+    TEST ("e\0cb\0\0b",  'b',  7,    5),
+    TEST ("e\0cb\0\0g",  'b',  4,    4),
+    TEST ("e\0cbg\0\0",  'a',  6,    6),
+    TEST ("\0cbee\0\0", '\0',  0, NPOS),
+    TEST ("\0cbee\0\0", '\0',  6,    4),
     TEST ("\0cb\0\0\0", '\0',  9,    2),
-    TEST ("aaaaaaaaaa",  'a',  6, NPOS), 
+    TEST ("aaaaaaaaaa",  'a',  6, NPOS),
     TEST ("\0aaaaaaaa",  'a',  6,    0),
 
     TEST ("x@4096",      'x',    0, NPOS),
-    TEST ("x@4096",      'x', 4096, NPOS),      
-    TEST ("x@4096",     '\0', 4096, 4095),    
-    TEST ("x@4096",      'a', 4094, 4094),     
+    TEST ("x@4096",      'x', 4096, NPOS),
+    TEST ("x@4096",     '\0', 4096, 4095),
+    TEST ("x@4096",      'a', 4094, 4094),
     TEST ("x@4096",      'x', 4106, NPOS),
     TEST ("xxax@2048",   'x', 2050,    2),
 
-    TEST ("last test",   't',  9,    7)      
+    TEST ("last test",   't',  9,    7)
 };
 
 /**************************************************************************/
@@ -716,8 +716,8 @@
         // 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);
     }
 



Mime
View raw message