stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant...@apache.org
Subject svn commit: r398878 [3/4] - in /incubator/stdcxx/trunk/tests/strings: 21.string.find.cpp 21.string.find.first.not.of.cpp 21.string.find.first.of.cpp 21.string.find.last.not.of.cpp 21.string.find.last.of.cpp 21.string.rfind.cpp
Date Tue, 02 May 2006 09:33:27 GMT
Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp?rev=398878&r1=398877&r2=398878&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp Tue May  2 02:32:36 2006
@@ -44,6 +44,7 @@
 /**************************************************************************/
 
 // for convenience and brevity
+#define NPOS      _RWSTD_SIZE_MAX
 #define LSTR      StringMembers::long_string
 #define LLEN      StringMembers::long_string_len
 
@@ -61,68 +62,68 @@
 #undef TEST
 #define TEST(str, arg, res)                                    \
     { __LINE__, -1, -1, -1, -1, -1, str, sizeof str - 1, arg,  \
-      sizeof arg - 1, 0, 0, res, 0 }
+      sizeof arg - 1, 0, res, 0 }
 
     //    +----------------------------------- controlled sequence
     //    |             +--------------------- sequence to be found
-    //    |             |              +------ expected result 
-    //    |             |              |                               
-    //    |             |              |                     
-    //    V             V              V        
-    TEST ("ab",         "a",           0),   
-
-    TEST ("",           "",           -1),   
-    TEST ("",           "\0",         -1),    
-    TEST ("",           "a",          -1),   
-
-    TEST ("\0",         "",           -1),    
-    TEST ("\0",         "\0",         -1),   
-    TEST ("\0",         "a",          -1),   
-
-    TEST ("bbcdefghij", "a",          -1),    
-    TEST ("abcdefghij", "a",           0),  
-    TEST ("abcdefghij", "f",           5),  
-    TEST ("abcdefghij", "j",           9),  
-
-    TEST ("edfcbbhjig", "cba",         5),    
-    TEST ("edfcbahjig", "bca",         5),    
-    TEST ("edfcbahcba", "cba",         9),   
-    TEST ("cbacbbhjig", "cab",         5),  
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      3),    
-    TEST ("e\0cb\0\0g", "ecb",         3),    
-    TEST ("\0cb\0\0ge", "\0\0ge",     -1),   
-    TEST ("\0cb\0\0ge", "bc\0",        2),   
-    TEST ("e\0cbg\0\0", "eg\0",        4),    
-    TEST ("e\0cdg\0\0", "abc",         2),  
-    TEST ("a\0b",       "e\0gbg\0\0", -1),    
-    TEST ("a\0b",       "eb\0gg\0\0",  2), 
-    TEST ("a\0b",       "e\0gg\0\0a", -1),
-
-    TEST ("bcbedfbjih", "a",          -1),   
-    TEST ("bcaedfajih", "a",           6),    
-    TEST ("bcedfaajih", "a",           6),    
-    TEST ("bcaaedfaji", "a",           7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9),     
-    TEST ("aaaaabaaaa", "cccccccccb",  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  5),
-    TEST ("bbb",        "aaaaaaaaba",  2),        
-    TEST ("bbb",        "aaaaaaaaaa", -1),   
-
-    TEST (LSTR,         "",           -1),     
-    TEST (LSTR,         "a",          -1),  
-    TEST (LSTR,         "x",    LLEN - 2),    
-    TEST (LSTR,         "xxx",  LLEN - 2),    
-    TEST (LSTR,         "aax",  LLEN - 2),   
-    TEST ("abc",        LSTR,         -1),    
-    TEST ("xxxxxxxxxx", LSTR,          9),  
-
-    TEST ("abcdefghij", 0,             9),      
-    TEST ("\0cb\0\0ge", 0,            -1),       
-    TEST (LSTR,         0,      LLEN - 2),  
+    //    |             |                +---- expected result 
+    //    |             |                |                               
+    //    |             |                |                     
+    //    V             V                V        
+    TEST ("ab",         "a",             0),   
+
+    TEST ("",           "",           NPOS),   
+    TEST ("",           "\0",         NPOS),    
+    TEST ("",           "a",          NPOS),   
+
+    TEST ("\0",         "",           NPOS),    
+    TEST ("\0",         "\0",         NPOS),   
+    TEST ("\0",         "a",          NPOS),   
+
+    TEST ("bbcdefghij", "a",          NPOS),    
+    TEST ("abcdefghij", "a",             0),  
+    TEST ("abcdefghij", "f",             5),  
+    TEST ("abcdefghij", "j",             9),  
+
+    TEST ("edfcbbhjig", "cba",           5),    
+    TEST ("edfcbahjig", "bca",           5),    
+    TEST ("edfcbahcba", "cba",           9),   
+    TEST ("cbacbbhjig", "cab",           5),  
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        3),    
+    TEST ("e\0cb\0\0g", "ecb",           3),    
+    TEST ("\0cb\0\0ge", "\0\0ge",     NPOS),   
+    TEST ("\0cb\0\0ge", "bc\0",          2),   
+    TEST ("e\0cbg\0\0", "eg\0",          4),    
+    TEST ("e\0cdg\0\0", "abc",           2),  
+    TEST ("a\0b",       "e\0gbg\0\0", NPOS),    
+    TEST ("a\0b",       "eb\0gg\0\0",    2), 
+    TEST ("a\0b",       "e\0gg\0\0a", NPOS),
+
+    TEST ("bcbedfbjih", "a",          NPOS),   
+    TEST ("bcaedfajih", "a",             6),    
+    TEST ("bcedfaajih", "a",             6),    
+    TEST ("bcaaedfaji", "a",             7),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    9),     
+    TEST ("aaaaabaaaa", "cccccccccb",    5),   
+    TEST ("aabaabaaaa", "cccccccccb",    5),
+    TEST ("bbb",        "aaaaaaaaba",    2),        
+    TEST ("bbb",        "aaaaaaaaaa", NPOS),   
+
+    TEST (LSTR,         "",           NPOS),     
+    TEST (LSTR,         "a",          NPOS),  
+    TEST (LSTR,         "x",      LLEN - 2),    
+    TEST (LSTR,         "xxx",    LLEN - 2),    
+    TEST (LSTR,         "aax",    LLEN - 2),   
+    TEST ("abc",        LSTR,         NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,            9),  
+
+    TEST ("abcdefghij", 0,               9),      
+    TEST ("\0cb\0\0ge", 0,            NPOS),       
+    TEST (LSTR,         0,        LLEN - 2),  
 
-    TEST ("last test",  "test",        8)       
+    TEST ("last test",  "test",          8)       
 };
 
 /**************************************************************************/
@@ -134,69 +135,69 @@
 #undef TEST     
 #define TEST(str, arg, res)                                    \
     { __LINE__, -1, -1, -1, -1, -1, str, sizeof str - 1, arg,  \
-      sizeof arg - 1, 0, 0, res, 0 }
+      sizeof arg - 1, 0, res, 0 }
 
     //    +------------------------------------ controlled sequence
     //    |             +---------------------- sequence to be found
-    //    |             |              +------- expected result 
-    //    |             |              |                               
-    //    |             |              |                     
-    //    V             V              V        
-    TEST ("ab",         "a",           0),   
-
-    TEST ("",           "",           -1),   
-    TEST ("",           "\0",         -1),    
-    TEST ("",           "a",          -1),   
-
-    TEST ("\0",         "",           -1),    
-    TEST ("\0",         "\0",          0),   
-    TEST ("\0",         "a",          -1),   
-
-    TEST ("bbcdefghij", "a",          -1),    
-    TEST ("abcdefghij", "a",           0),  
-    TEST ("abcdefghij", "f",           5),  
-    TEST ("abcdefghij", "j",           9),  
-
-    TEST ("edfcbbhjig", "cba",         5),    
-    TEST ("edfcbahjig", "bca",         5),    
-    TEST ("edfcbahcba", "cba",         9),   
-    TEST ("cbacbbhjig", "cab",         5),  
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      6),    
-    TEST ("e\0cb\0\0g", "ecb",         3),    
-    TEST ("\0cb\0\0ge", "\0\0ge",      6),   
-    TEST ("\0cb\0\0ge", "bc\0",        4),   
-    TEST ("e\0cbg\0\0", "eg\0",        6),  
-    TEST ("\0cbdaaaaa", "eg\0",        0),
-    TEST ("e\0cdg\0\0", "abc",         2),  
-    TEST ("a\0b",       "e\0gbg\0\0",  2),    
-    TEST ("a\0b",       "ea\0gg\0\0",  1), 
-    TEST ("\0ab",       "e\0gg\0\0a",  1),
-
-    TEST ("bcbedfbjih", "a",          -1),   
-    TEST ("bcaedfajih", "a",           6),    
-    TEST ("bcedfaajih", "a",           6),    
-    TEST ("bcaaedfaji", "a",           7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9),     
-    TEST ("aaaaabaaaa", "cccccccccb",  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  5),
-    TEST ("bbb",        "aaaaaaaaba",  2),        
-    TEST ("bbb",        "aaaaaaaaaa", -1),   
-
-    TEST (LSTR,         "",           -1),     
-    TEST (LSTR,         "a",          -1),  
-    TEST (LSTR,         "x",    LLEN - 2),    
-    TEST (LSTR,         "xxx",  LLEN - 2),    
-    TEST (LSTR,         "aax",  LLEN - 2),   
-    TEST ("abc",        LSTR,         -1),    
-    TEST ("xxxxxxxxxx", LSTR,          9),  
-
-    TEST ("abcdefghij", 0,             9),      
-    TEST ("\0cb\0\0ge", 0,             6),       
-    TEST (LSTR,         0,      LLEN - 2),  
+    //    |             |                +----- expected result 
+    //    |             |                |                               
+    //    |             |                |                     
+    //    V             V                V        
+    TEST ("ab",         "a",             0),   
+
+    TEST ("",           "",           NPOS),   
+    TEST ("",           "\0",         NPOS),    
+    TEST ("",           "a",          NPOS),   
+
+    TEST ("\0",         "",           NPOS),    
+    TEST ("\0",         "\0",            0),   
+    TEST ("\0",         "a",          NPOS),   
+
+    TEST ("bbcdefghij", "a",          NPOS),    
+    TEST ("abcdefghij", "a",             0),  
+    TEST ("abcdefghij", "f",             5),  
+    TEST ("abcdefghij", "j",             9),  
+
+    TEST ("edfcbbhjig", "cba",           5),    
+    TEST ("edfcbahjig", "bca",           5),    
+    TEST ("edfcbahcba", "cba",           9),   
+    TEST ("cbacbbhjig", "cab",           5),  
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        6),    
+    TEST ("e\0cb\0\0g", "ecb",           3),    
+    TEST ("\0cb\0\0ge", "\0\0ge",        6),   
+    TEST ("\0cb\0\0ge", "bc\0",          4),   
+    TEST ("e\0cbg\0\0", "eg\0",          6),  
+    TEST ("\0cbdaaaaa", "eg\0",          0),
+    TEST ("e\0cdg\0\0", "abc",           2),  
+    TEST ("a\0b",       "e\0gbg\0\0",    2),    
+    TEST ("a\0b",       "ea\0gg\0\0",    1), 
+    TEST ("\0ab",       "e\0gg\0\0a",    1),
+
+    TEST ("bcbedfbjih", "a",          NPOS),   
+    TEST ("bcaedfajih", "a",             6),    
+    TEST ("bcedfaajih", "a",             6),    
+    TEST ("bcaaedfaji", "a",             7),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    9),     
+    TEST ("aaaaabaaaa", "cccccccccb",    5),   
+    TEST ("aabaabaaaa", "cccccccccb",    5),
+    TEST ("bbb",        "aaaaaaaaba",    2),        
+    TEST ("bbb",        "aaaaaaaaaa", NPOS),   
+
+    TEST (LSTR,         "",           NPOS),     
+    TEST (LSTR,         "a",          NPOS),  
+    TEST (LSTR,         "x",      LLEN - 2),    
+    TEST (LSTR,         "xxx",    LLEN - 2),    
+    TEST (LSTR,         "aax",    LLEN - 2),   
+    TEST ("abc",        LSTR,         NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,            9),  
+
+    TEST ("abcdefghij", 0,               9),      
+    TEST ("\0cb\0\0ge", 0,               6),       
+    TEST (LSTR,         0,        LLEN - 2),  
 
-    TEST ("last test",  "test",        8)      
+    TEST ("last test",  "test",          8)      
 };
 
 /**************************************************************************/
@@ -207,94 +208,94 @@
 
 #undef TEST
 #define TEST(str, arg, off, res)                                    \
-    { __LINE__, off, -1, -1, -1, -1, str, sizeof str - 1, arg,      \
-      sizeof arg - 1, 0, 0, res, 0 }
+    { __LINE__, off, NPOS, -1, -1, -1, str, sizeof str - 1, arg,      \
+      sizeof arg - 1, 0, res, 0 }
 
     //    +-------------------------------------- controlled sequence
     //    |            +------------------------- sequence to be found
     //    |            |               +--------- find_last_of() off argument
-    //    |            |               |   +----- expected result  
-    //    |            |               |   |                             
-    //    |            |               |   |             
-    //    V            V               V   V                 
-    TEST ("ab",        "a",            0,  0),   
-
-    TEST ("",           "",            0, -1),    
-    TEST ("",           "\0",          0, -1),    
-    TEST ("",           "a",           0, -1),    
-
-    TEST ("\0",         "",            0, -1),  
-    TEST ("\0",         "",            1, -1), 
-    TEST ("\0",         "\0",          0, -1),   
-    TEST ("\0",         "\0",          1, -1),    
-    TEST ("\0",         "a",           0, -1),    
-
-    TEST ("bbcdefghij", "a",           0, -1),    
-    TEST ("abcdefghij", "a",           0,  0),   
-    TEST ("abcdefghij", "a",           2,  0),    
-    TEST ("abcdefghij", "f",           2, -1),   
-    TEST ("abcdefghij", "f",           7,  5),    
-    TEST ("abcdefghij", "j",           9,  9),  
-
-    TEST ("edfcbbhjig", "cba",         9,  5),    
-    TEST ("edfcbahjag", "cba",         7,  5),     
-    TEST ("edfcbahjig", "cba",         4,  4),    
-    TEST ("edfcbahcba", "cba",         1, -1), 
-    TEST ("edfcbahcba", "cba",         9,  9), 
-    TEST ("edfcbahcba", "cba",         3,  3),    
-    TEST ("cbacbahjig", "cba",         4,  4),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      5,  3),    
-    TEST ("e\0cb\0\0g", "b\0\0g",      2, -1),    
-    TEST ("e\0cb\0\0g", "ecb",         7,  3),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      6, -1), 
-    TEST ("\0cb\0\0ge", "cb\0",        0, -1),     
-    TEST ("\0cb\0\0ge", "cb\0",        1,  1),
-    TEST ("\0cb\0\0ge", "cb\0",        2,  2),
-    TEST ("e\0cbg\0\0", "bg",          1, -1),  
-    TEST ("e\0cbg\0\0", "bg",          5,  4),   
-    TEST ("a\0b",       "e\0gbg\0\0",  3, -1),    
-    TEST ("a\0b",       "eb\0gg\0\0",  3,  2), 
-    TEST ("a\0b",       "e\0gg\0\0a",  3, -1),
-
-    TEST ("bcbedfbjih", "a",           0, -1),    
-    TEST ("bcaedfajih", "a",           8,  6),     
-    TEST ("bcedfaajih", "a",           6,  6),    
-    TEST ("bcaaedfaji", "a",           8,  7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9,  9),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,  4),    
-    TEST ("aaaaabaaaa", "cccccccccb",  8,  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  9,  5),  
-    TEST ("aabaabaaaa", "cccccccccb",  3,  2), 
-    TEST ("bbb",        "aaaaaaaaba",  2,  2),  
-    TEST ("bab",        "aaaaaaaaba",  0,  0),
-    TEST ("bbb",        "aaaaaaaaaa",  3, -1),      
+    //    |            |               |     +--- expected result  
+    //    |            |               |     |                             
+    //    |            |               |     |             
+    //    V            V               V     V                 
+    TEST ("ab",        "a",            0,    0),   
+
+    TEST ("",           "",            0, NPOS),    
+    TEST ("",           "\0",          0, NPOS),    
+    TEST ("",           "a",           0, NPOS),    
+
+    TEST ("\0",         "",            0, NPOS),  
+    TEST ("\0",         "",            1, NPOS), 
+    TEST ("\0",         "\0",          0, NPOS),   
+    TEST ("\0",         "\0",          1, NPOS),    
+    TEST ("\0",         "a",           0, NPOS),    
+
+    TEST ("bbcdefghij", "a",           0, NPOS),    
+    TEST ("abcdefghij", "a",           0,    0),   
+    TEST ("abcdefghij", "a",           2,    0),    
+    TEST ("abcdefghij", "f",           2, NPOS),   
+    TEST ("abcdefghij", "f",           7,    5),    
+    TEST ("abcdefghij", "j",           9,    9),  
+
+    TEST ("edfcbbhjig", "cba",         9,    5),    
+    TEST ("edfcbahjag", "cba",         7,    5),     
+    TEST ("edfcbahjig", "cba",         4,    4),    
+    TEST ("edfcbahcba", "cba",         1, NPOS), 
+    TEST ("edfcbahcba", "cba",         9,    9), 
+    TEST ("edfcbahcba", "cba",         3,    3),    
+    TEST ("cbacbahjig", "cba",         4,    4),    
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      5,    3),    
+    TEST ("e\0cb\0\0g", "b\0\0g",      2, NPOS),    
+    TEST ("e\0cb\0\0g", "ecb",         7,    3),     
+    TEST ("\0cb\0\0ge", "\0\0ge",      6, NPOS), 
+    TEST ("\0cb\0\0ge", "cb\0",        0, NPOS),     
+    TEST ("\0cb\0\0ge", "cb\0",        1,    1),
+    TEST ("\0cb\0\0ge", "cb\0",        2,    2),
+    TEST ("e\0cbg\0\0", "bg",          1, NPOS),  
+    TEST ("e\0cbg\0\0", "bg",          5,    4),   
+    TEST ("a\0b",       "e\0gbg\0\0",  3, NPOS),    
+    TEST ("a\0b",       "eb\0gg\0\0",  3,    2), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3, NPOS),
+
+    TEST ("bcbedfbjih", "a",           0, NPOS),    
+    TEST ("bcaedfajih", "a",           8,    6),     
+    TEST ("bcedfaajih", "a",           6,    6),    
+    TEST ("bcaaedfaji", "a",           8,    7),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9,    9),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,    4),    
+    TEST ("aaaaabaaaa", "cccccccccb",  8,    5),   
+    TEST ("aabaabaaaa", "cccccccccb",  9,    5),  
+    TEST ("aabaabaaaa", "cccccccccb",  3,    2), 
+    TEST ("bbb",        "aaaaaaaaba",  2,    2),  
+    TEST ("bab",        "aaaaaaaaba",  0,    0),
+    TEST ("bbb",        "aaaaaaaaaa",  3, NPOS),      
 
-    TEST (LSTR,         "",     LLEN - 1, -1),    
-    TEST (LSTR,         "a",    LLEN - 1, -1),     
+    TEST (LSTR,         "",     LLEN - 1, NPOS),    
+    TEST (LSTR,         "a",    LLEN - 1, NPOS),     
     TEST (LSTR,         "x",    LLEN - 1,  LLEN - 2),   
     TEST (LSTR,         "xxx",  LLEN - 2,  LLEN - 2),
-    TEST (LSTR,         "xxx",         0,  0),
+    TEST (LSTR,         "xxx",         0,    0),
     TEST (LSTR,         "xxx", LLEN - 10,  LLEN - 10),    
     TEST (LSTR,         "aax", LLEN - 10,  LLEN - 10),     
-    TEST ("abc",        LSTR,          2, -1),    
-    TEST ("xxxxxxxxxx", LSTR,          6,  6),   
+    TEST ("abc",        LSTR,          2, NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,          6,    6),   
 
-    TEST (LSTR,         "xxx",         3,  3), 
-    TEST (LSTR,         "xxx",         2,  2),     
+    TEST (LSTR,         "xxx",         3,    3), 
+    TEST (LSTR,         "xxx",         2,    2),     
 
-    TEST ("abcdefghij", 0,             0,  0),    
-    TEST ("abcdefghij", 0,             9,  9),   
-    TEST ("\0cb\0\0ge", 0,             5, -1),    
-    TEST (LSTR,         0,             0,  0),  
-    TEST (LSTR,         0,             1,  1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10,  2),   
-    TEST ("abcdefghij", "cba",        10,  2), 
+    TEST ("abcdefghij", 0,             0,    0),    
+    TEST ("abcdefghij", 0,             9,    9),   
+    TEST ("\0cb\0\0ge", 0,             5, NPOS),    
+    TEST (LSTR,         0,             0,    0),  
+    TEST (LSTR,         0,             1,    1),    
+
+    TEST ("",           "",            1, NPOS),  
+    TEST ("abcdefghij", "abc",        10,    2),   
+    TEST ("abcdefghij", "cba",        10,    2), 
 
-    TEST ("last test", "test",         9,  8)      
+    TEST ("last test", "test",         9,    8)      
 };
 
 /**************************************************************************/
@@ -306,116 +307,116 @@
 #undef TEST
 #define TEST(str, arg, off, size, res, bthrow)                        \
     { __LINE__, off, size, -1, -1, -1, str, sizeof str - 1, arg,      \
-      sizeof arg - 1, 0, 0, res, bthrow }
+      sizeof arg - 1, 0, res, bthrow }
 
     //    +--------------------------------------- controlled sequence
     //    |            +-------------------------- sequence to be found
     //    |            |               +---------- find_last_of() off argument 
     //    |            |               |   +------ find_last_of() n argument 
-    //    |            |               |   |   +-- expected result  
-    //    |            |               |   |   |   exception info 
-    //    |            |               |   |   |   |   0 - no exception        
-    //    |            |               |   |   |   |   1 - length_error  
-    //    |            |               |   |   |   |                           
-    //    |            |               |   |   |   +----+             
-    //    V            V               V   V   V        V             
-    TEST ("ab",        "a",            0,  1,  0,       0),
-
-    TEST ("",           "",            0,  0, -1,       0),
-    TEST ("",           "\0",          0,  0, -1,       0),
-    TEST ("",           "\0",          0,  1, -1,       0),
-    TEST ("",           "a",           0,  0, -1,       0),
-    TEST ("",           "a",           0,  1, -1,       0),
-
-    TEST ("\0",         "",            0,  0, -1,       0),
-    TEST ("\0",         "\0",          0,  1,  0,       0),
-    TEST ("\0",         "\0",          1,  1,  0,       0),
-    TEST ("\0\0",       "\0\0",        1,  1,  1,       0),
-    TEST ("\0",         "a",           0,  1, -1,       0),
-
-    TEST ("edfcbbhjig", "cba",         0,  3, -1,       0),
-    TEST ("edfcbbhjig", "cba",         0,  2, -1,       0),
-    TEST ("edfcbbhjig", "cba",         9,  2,  5,       0),
-    TEST ("edfcbahjig", "cba",         8,  3,  5,       0),
-    TEST ("edfcbahjig", "cba",         2,  3, -1,       0),
-    TEST ("edfcbahjig", "cba",         2,  1, -1,       0),
-    TEST ("edfcbahcba", "cba",         8,  3,  8,       0),
-    TEST ("edfcbehcba", "cab",         8,  2,  7,       0),
-    TEST ("edfcbahcba", "cba",         9,  3,  9,       0),
-    TEST ("cbacbahjig", "cba",         5,  3,  5,       0),
-    TEST ("cbacbahjig", "cba",         2,  1,  0,       0),
-    TEST ("cbacbahjcg", "cba",         7,  1,  3,       0),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4, -1,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      7,  4,  6,       0),
-    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,  3,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      7,  2,  6,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      2,  2,  2,       0),
-    TEST ("\0b\0\0b\0g","b\0g\0",      7,  3,  6,       0),
-    TEST ("e\0cb\0\0g", "ecb",         7,  2,  2,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4,  6,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      2,  0, -1,       0),
-    TEST ("\0cb\0\0ge", "cb\0",        1,  3,  1,       0),
-    TEST ("e\0cbg\0\0", "bg",          1,  2, -1,       0),
-    TEST ("a\0b",       "e\0gbg\0\0",  2,  1, -1,       0),    
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  2, -1,       0), 
-    TEST ("a\0b",       "e\0gg\0\0a",  3,  6,  1,       0),
-    TEST ("a\0b",       "e\0gg\0\0a",  0,  7,  0,       0),
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  3,  1,       0), 
-
-    TEST ("e\0a\0",     "e\0a\0\0",    2,  4,  2,       0),
-    TEST ("e\0a\0",     "e\0a\0\0",    3,  5,  3,       0),
-    TEST ("ee\0a\0",    "b\0c\0\0",    3,  4,  2,       0),
-    TEST ("e\0a\0b",    "fdbcb\0a",    3,  5, -1,       0),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, 10,  9,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  8, 10,  8,       0),
-    TEST ("aaaaabaaaa", "cccccccccc",  9, 10, -1,       0),
-    TEST ("aaaaabaaaa", "cccbcccccc",  8,  4,  5,       0),
-    TEST ("aaaabaaaaa", "cccca",       9,  5,  9,       0),
-    TEST ("aabaabaaaa", "cbccccccca",  7,  5,  5,       0), 
-    TEST ("bbb",        "aaaaaaaaba",  1,  2, -1,       0),  
-    TEST ("bbb",        "aaaaaaaaaa",  0,  9, -1,       0),
-    TEST ("bab",        "aaaaaaaaba",  0,  0, -1,       0),
-    TEST ("bab",        "ccccccccba",  1, 10,  1,       0),
-
-    TEST (LSTR,         "",     LLEN - 1,  0, -1,       0),
-    TEST (LSTR,         "a",    LLEN - 1,  1, -1,       0),
-    TEST (LSTR,         "x",    LLEN - 1,  1, LLEN - 2, 0),
-    TEST (LSTR,         "xxx",  LLEN - 9,  3, LLEN - 9, 0),
-    TEST (LSTR,         "axa",  LLEN - 9,  3, LLEN - 9, 0),
-    TEST ("abc",        LSTR,          2, 10, -1,       0),
-    TEST ("xxxxxxxxxx", LSTR,          0, LLEN - 1, 0,  0),
-    TEST ("xxxxxxxxxx", LSTR,          2,  4,  2,       0),
-
-    TEST (LSTR,         "xxx",  LLEN - 4,  3, LLEN - 4, 0),
-    TEST (LSTR,         "xxx",  LLEN - 3,  3, LLEN - 3, 0),
-    TEST (LSTR,         "xxx",  LLEN - 3,  2, LLEN - 3, 0),
-
-    TEST ("abcdefghij", 0,             0,  9,  0,       0),
-    TEST ("abcdefghij", 0,             8,  9,  8,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  7,  5,       0),
-    TEST ("\0cb\0ge\0", 0,             6,  1,  6,       0),
-    TEST ("\0c\0e\0cg", 0,             6,  2,  5,       0),
-    TEST (LSTR,         0,             0, LLEN - 1,  0, 0),
-    TEST (LSTR,         0,             1, LLEN - 1,  1, 0),
-    TEST (LSTR,         0,             5, LLEN - 6,  5, 0),
-    TEST (LSTR,         0,      LLEN - 6,  1, LLEN - 6, 0),
-
-    TEST ("",           "",            1,  0, -1,       0),
-    TEST ("abcdefghij", "abc",        10,  3,  2,       0),
-    TEST ("abcdefghij", "cba",        10,  1,  2,       0),
+    //    |            |               |   |     +-- expected result  
+    //    |            |               |   |     |   exception info 
+    //    |            |               |   |     |   |   0 - no exception        
+    //    |            |               |   |     |   |   1 - length_error  
+    //    |            |               |   |     |   |                           
+    //    |            |               |   |     |   +----+             
+    //    V            V               V   V     V        V             
+    TEST ("ab",        "a",            0,  1,    0,       0),
+
+    TEST ("",           "",            0,  0, NPOS,       0),
+    TEST ("",           "\0",          0,  0, NPOS,       0),
+    TEST ("",           "\0",          0,  1, NPOS,       0),
+    TEST ("",           "a",           0,  0, NPOS,       0),
+    TEST ("",           "a",           0,  1, NPOS,       0),
+
+    TEST ("\0",         "",            0,  0, NPOS,       0),
+    TEST ("\0",         "\0",          0,  1,    0,       0),
+    TEST ("\0",         "\0",          1,  1,    0,       0),
+    TEST ("\0\0",       "\0\0",        1,  1,    1,       0),
+    TEST ("\0",         "a",           0,  1, NPOS,       0),
+
+    TEST ("edfcbbhjig", "cba",         0,  3, NPOS,       0),
+    TEST ("edfcbbhjig", "cba",         0,  2, NPOS,       0),
+    TEST ("edfcbbhjig", "cba",         9,  2,    5,       0),
+    TEST ("edfcbahjig", "cba",         8,  3,    5,       0),
+    TEST ("edfcbahjig", "cba",         2,  3, NPOS,       0),
+    TEST ("edfcbahjig", "cba",         2,  1, NPOS,       0),
+    TEST ("edfcbahcba", "cba",         8,  3,    8,       0),
+    TEST ("edfcbehcba", "cab",         8,  2,    7,       0),
+    TEST ("edfcbahcba", "cba",         9,  3,    9,       0),
+    TEST ("cbacbahjig", "cba",         5,  3,    5,       0),
+    TEST ("cbacbahjig", "cba",         2,  1,    0,       0),
+    TEST ("cbacbahjcg", "cba",         7,  1,    3,       0),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4, NPOS,       0),
+    TEST ("e\0cb\0\0g", "b\0\0g",      7,  4,    6,       0),
+    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,    3,       0),
+    TEST ("\0b\0\0gb\0","b\0\0g",      7,  2,    6,       0),
+    TEST ("\0b\0\0gb\0","b\0\0g",      2,  2,    2,       0),
+    TEST ("\0b\0\0b\0g","b\0g\0",      7,  3,    6,       0),
+    TEST ("e\0cb\0\0g", "ecb",         7,  2,    2,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4,    6,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      2,  0, NPOS,       0),
+    TEST ("\0cb\0\0ge", "cb\0",        1,  3,    1,       0),
+    TEST ("e\0cbg\0\0", "bg",          1,  2, NPOS,       0),
+    TEST ("a\0b",       "e\0gbg\0\0",  2,  1, NPOS,       0),    
+    TEST ("a\0b",       "eb\0gg\0\0",  1,  2, NPOS,       0), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3,  6,    1,       0),
+    TEST ("a\0b",       "e\0gg\0\0a",  0,  7,    0,       0),
+    TEST ("a\0b",       "eb\0gg\0\0",  1,  3,    1,       0), 
+
+    TEST ("e\0a\0",     "e\0a\0\0",    2,  4,    2,       0),
+    TEST ("e\0a\0",     "e\0a\0\0",    3,  5,    3,       0),
+    TEST ("ee\0a\0",    "b\0c\0\0",    3,  4,    2,       0),
+    TEST ("e\0a\0b",    "fdbcb\0a",    3,  5, NPOS,       0),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, 10,    9,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  8, 10,    8,       0),
+    TEST ("aaaaabaaaa", "cccccccccc",  9, 10, NPOS,       0),
+    TEST ("aaaaabaaaa", "cccbcccccc",  8,  4,    5,       0),
+    TEST ("aaaabaaaaa", "cccca",       9,  5,    9,       0),
+    TEST ("aabaabaaaa", "cbccccccca",  7,  5,    5,       0), 
+    TEST ("bbb",        "aaaaaaaaba",  1,  2, NPOS,       0),  
+    TEST ("bbb",        "aaaaaaaaaa",  0,  9, NPOS,       0),
+    TEST ("bab",        "aaaaaaaaba",  0,  0, NPOS,       0),
+    TEST ("bab",        "ccccccccba",  1, 10,    1,       0),
+
+    TEST (LSTR,         "",     LLEN - 1,  0, NPOS,       0),
+    TEST (LSTR,         "a",    LLEN - 1,  1, NPOS,       0),
+    TEST (LSTR,         "x",    LLEN - 1,  1, LLEN - 2,   0),
+    TEST (LSTR,         "xxx",  LLEN - 9,  3, LLEN - 9,   0),
+    TEST (LSTR,         "axa",  LLEN - 9,  3, LLEN - 9,   0),
+    TEST ("abc",        LSTR,          2, 10, NPOS,       0),
+    TEST ("xxxxxxxxxx", LSTR,          0, LLEN - 1, 0,    0),
+    TEST ("xxxxxxxxxx", LSTR,          2,  4,    2,       0),
+
+    TEST (LSTR,         "xxx",  LLEN - 4,  3, LLEN - 4,   0),
+    TEST (LSTR,         "xxx",  LLEN - 3,  3, LLEN - 3,   0),
+    TEST (LSTR,         "xxx",  LLEN - 3,  2, LLEN - 3,   0),
+
+    TEST ("abcdefghij", 0,             0,  9,    0,       0),
+    TEST ("abcdefghij", 0,             8,  9,    8,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  7,    5,       0),
+    TEST ("\0cb\0ge\0", 0,             6,  1,    6,       0),
+    TEST ("\0c\0e\0cg", 0,             6,  2,    5,       0),
+    TEST (LSTR,         0,             0, LLEN - 1,  0,   0),
+    TEST (LSTR,         0,             1, LLEN - 1,  1,   0),
+    TEST (LSTR,         0,             5, LLEN - 6,  5,   0),
+    TEST (LSTR,         0,      LLEN - 6,  1, LLEN - 6,   0),
+
+    TEST ("",           "",            1,  0, NPOS,       0),
+    TEST ("abcdefghij", "abc",        10,  3,    2,       0),
+    TEST ("abcdefghij", "cba",        10,  1,    2,       0),
 
 #ifndef _RWSTD_NO_EXCEPTIONS
 
-    TEST ("",           "cba",         0, -1,  0,       1),
-    TEST ("abcdefghij", "cba",         0, -1,  0,       1),
-    TEST (LSTR,         "xxx",         0, -1,  0,       1),
-    TEST ("abcdefghij", LSTR,          0, -1,  0,       1),
+    TEST ("",           "cba",         0, -1,    0,       1),
+    TEST ("abcdefghij", "cba",         0, -1,    0,       1),
+    TEST (LSTR,         "xxx",         0, -1,    0,       1),
+    TEST ("abcdefghij", LSTR,          0, -1,    0,       1),
 
 #endif   // _RWSTD_NO_EXCEPTIONS
 
-    TEST ("last test", "test",         9,  4,  8,       0)
+    TEST ("last test", "test",         9,  4,    8,       0)
 };
 
 /**************************************************************************/
@@ -427,93 +428,93 @@
 #undef TEST
 #define TEST(str, arg, off, res)                                    \
     { __LINE__, off, -1, -1, -1, -1, str, sizeof str - 1, arg,      \
-      sizeof arg - 1, 0, 0, res, 0 }
+      sizeof arg - 1, 0, res, 0 }
 
     //    +--------------------------------------- controlled sequence
     //    |             +------------------------- sequence to be found
     //    |             |              +---------- find_last_of() off argument
-    //    |             |              |   +------ expected result 
-    //    |             |              |   |                          
-    //    |             |              |   |           
-    //    V             V              V   V                
-    TEST ("ab",         "a",           0,  0),     
-
-    TEST ("",           "",            0, -1),    
-    TEST ("",           "\0",          0, -1),    
-    TEST ("",           "a",           0, -1),    
-
-    TEST ("\0",         "",            0, -1),  
-    TEST ("\0",         "",            1, -1), 
-    TEST ("\0",         "\0",          0,  0),   
-    TEST ("\0",         "\0",          1,  0),    
-    TEST ("\0",         "a",           0, -1),    
-
-    TEST ("bbcdefghij", "a",           0, -1),    
-    TEST ("abcdefghij", "a",           0,  0),   
-    TEST ("abcdefghij", "a",           2,  0),    
-    TEST ("abcdefghij", "f",           2, -1),   
-    TEST ("abcdefghij", "f",           7,  5),    
-    TEST ("abcdefghij", "j",           9,  9),  
-
-    TEST ("edfcbbhjig", "cba",         9,  5),    
-    TEST ("edfcbahjag", "cba",         7,  5),     
-    TEST ("edfcbahjig", "cba",         4,  4),    
-    TEST ("edfcbahcba", "cba",         1, -1), 
-    TEST ("edfcbahcba", "cba",         9,  9), 
-    TEST ("edfcbahcba", "cba",         3,  3),    
-    TEST ("cbacbahjig", "cba",         4,  4),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      5,  5),    
-    TEST ("e\0cb\0\0g", "b\0\0g",      2,  1),    
-    TEST ("e\0cb\0\0g", "ecb",         7,  3),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  6), 
-    TEST ("\0cb\0\0ge", "cb\0",        0,  0),     
-    TEST ("\0cb\0\0ge", "cb\0",        1,  1),
-    TEST ("\0cb\0\0ge", "cb\0",        2,  2),
-    TEST ("e\0cbg\0\0", "bg",          1, -1),  
-    TEST ("e\0cbg\0\0", "bg",          5,  4),   
-    TEST ("a\0b",       "e\0gbg\0\0",  2,  2),    
-    TEST ("a\0b",       "eb\0gg\0\0",  2,  2), 
-    TEST ("a\0b",       "e\0gg\0\0a",  3,  1),
-
-    TEST ("bcbedfbjih", "a",           0, -1),    
-    TEST ("bcaedfajih", "a",           8,  6),     
-    TEST ("bcedfaajih", "a",           6,  6),    
-    TEST ("bcaaedfaji", "a",           8,  7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9,  9),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,  4),    
-    TEST ("aaaaabaaaa", "cccccccccb",  8,  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  9,  5),  
-    TEST ("aabaabaaaa", "cccccccccb",  3,  2), 
-    TEST ("bbb",        "aaaaaaaaba",  2,  2),  
-    TEST ("bab",        "aaaaaaaaba",  0,  0),
-    TEST ("bbb",        "aaaaaaaaaa",  3, -1),      
+    //    |             |              |     +---- expected result 
+    //    |             |              |     |                          
+    //    |             |              |     |           
+    //    V             V              V     V                
+    TEST ("ab",         "a",           0,    0),     
+
+    TEST ("",           "",            0, NPOS),    
+    TEST ("",           "\0",          0, NPOS),    
+    TEST ("",           "a",           0, NPOS),    
+
+    TEST ("\0",         "",            0, NPOS),  
+    TEST ("\0",         "",            1, NPOS), 
+    TEST ("\0",         "\0",          0,    0),   
+    TEST ("\0",         "\0",          1,    0),    
+    TEST ("\0",         "a",           0, NPOS),    
+
+    TEST ("bbcdefghij", "a",           0, NPOS),    
+    TEST ("abcdefghij", "a",           0,    0),   
+    TEST ("abcdefghij", "a",           2,    0),    
+    TEST ("abcdefghij", "f",           2, NPOS),   
+    TEST ("abcdefghij", "f",           7,    5),    
+    TEST ("abcdefghij", "j",           9,    9),  
+
+    TEST ("edfcbbhjig", "cba",         9,    5),    
+    TEST ("edfcbahjag", "cba",         7,    5),     
+    TEST ("edfcbahjig", "cba",         4,    4),    
+    TEST ("edfcbahcba", "cba",         1, NPOS), 
+    TEST ("edfcbahcba", "cba",         9,    9), 
+    TEST ("edfcbahcba", "cba",         3,    3),    
+    TEST ("cbacbahjig", "cba",         4,    4),    
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      5,    5),    
+    TEST ("e\0cb\0\0g", "b\0\0g",      2,    1),    
+    TEST ("e\0cb\0\0g", "ecb",         7,    3),     
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,    6), 
+    TEST ("\0cb\0\0ge", "cb\0",        0,    0),     
+    TEST ("\0cb\0\0ge", "cb\0",        1,    1),
+    TEST ("\0cb\0\0ge", "cb\0",        2,    2),
+    TEST ("e\0cbg\0\0", "bg",          1, NPOS),  
+    TEST ("e\0cbg\0\0", "bg",          5,    4),   
+    TEST ("a\0b",       "e\0gbg\0\0",  2,    2),    
+    TEST ("a\0b",       "eb\0gg\0\0",  2,    2), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3,    1),
+
+    TEST ("bcbedfbjih", "a",           0, NPOS),    
+    TEST ("bcaedfajih", "a",           8,    6),     
+    TEST ("bcedfaajih", "a",           6,    6),    
+    TEST ("bcaaedfaji", "a",           8,    7),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9,    9),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,    4),    
+    TEST ("aaaaabaaaa", "cccccccccb",  8,    5),   
+    TEST ("aabaabaaaa", "cccccccccb",  9,    5),  
+    TEST ("aabaabaaaa", "cccccccccb",  3,    2), 
+    TEST ("bbb",        "aaaaaaaaba",  2,    2),  
+    TEST ("bab",        "aaaaaaaaba",  0,    0),
+    TEST ("bbb",        "aaaaaaaaaa",  3, NPOS),      
 
-    TEST (LSTR,         "",     LLEN - 1, -1),    
-    TEST (LSTR,         "a",    LLEN - 1, -1),     
+    TEST (LSTR,         "",     LLEN - 1, NPOS),    
+    TEST (LSTR,         "a",    LLEN - 1, NPOS),     
     TEST (LSTR,         "x",    LLEN - 1,  LLEN - 2),   
     TEST (LSTR,         "xxx",  LLEN - 2,  LLEN - 2),
-    TEST (LSTR,         "xxx",         0,  0),
+    TEST (LSTR,         "xxx",         0,    0),
     TEST (LSTR,         "xxx", LLEN - 10,  LLEN - 10),    
     TEST (LSTR,         "aax", LLEN - 10,  LLEN - 10),     
-    TEST ("abc",        LSTR,          2, -1),    
-    TEST ("xxxxxxxxxx", LSTR,          6,  6),   
+    TEST ("abc",        LSTR,          2, NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,          6,    6),   
 
-    TEST (LSTR,         "xxx",         3,  3), 
-    TEST (LSTR,         "xxx",         2,  2),     
+    TEST (LSTR,         "xxx",         3,    3), 
+    TEST (LSTR,         "xxx",         2,    2),     
 
-    TEST ("abcdefghij", 0,             0,  0),    
-    TEST ("abcdefghij", 0,             9,  9),   
-    TEST ("\0cb\0\0ge", 0,             5,  5),    
-    TEST (LSTR,         0,             0,  0),  
-    TEST (LSTR,         0,             1,  1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10,  2),   
-    TEST ("abcdefghij", "cba",        10,  2), 
+    TEST ("abcdefghij", 0,             0,    0),    
+    TEST ("abcdefghij", 0,             9,    9),   
+    TEST ("\0cb\0\0ge", 0,             5,    5),    
+    TEST (LSTR,         0,             0,    0),  
+    TEST (LSTR,         0,             1,    1),    
+
+    TEST ("",           "",            1, NPOS),  
+    TEST ("abcdefghij", "abc",        10,    2),   
+    TEST ("abcdefghij", "cba",        10,    2), 
 
-    TEST ("last test",  "test",        9,  8)     
+    TEST ("last test",  "test",        9,    8)     
 };
 
 /**************************************************************************/
@@ -525,35 +526,35 @@
 #undef TEST
 #define TEST(str, val, res)                                     \
     { __LINE__, -1, -1, -1, -1, val, str, sizeof str - 1,       \
-      0, 0, 0, 0, res, 0 }
+      0, 0, 0, res, 0 }
 
     //    +----------------------------- controlled sequence
     //    |              +-------------- character to be found
-    //    |              |     +-------- expected result  
-    //    |              |     |                           
-    //    |              |     |                
-    //    V              V     V                 
-    TEST ("ab",          'a',  0),   
-
-    TEST ("",            'a', -1),  
-    TEST ("",           '\0', -1),   
-
-    TEST ("\0",         '\0',  0),   
-    TEST ("\0\0",       '\0',  1),  
-    TEST ("\0",          'a', -1),   
-
-    TEST ("e\0cb\0\0g", '\0',  5),    
-    TEST ("e\0cb\0\0g",  'b',  3),    
-    TEST ("e\0cb\0\0g",  'a', -1),   
-    TEST ("\0cbge\0\0", '\0',  6),   
-    TEST ("\0cbge\0\0",  'b',  2),   
-    TEST ("\0cbge\0\0",  'a', -1),   
+    //    |              |       +------ expected result  
+    //    |              |       |                           
+    //    |              |       |                
+    //    V              V       V                 
+    TEST ("ab",          'a',    0),   
+
+    TEST ("",            'a', NPOS),  
+    TEST ("",           '\0', NPOS),   
+
+    TEST ("\0",         '\0',    0),   
+    TEST ("\0\0",       '\0',    1),  
+    TEST ("\0",          'a', NPOS),   
+
+    TEST ("e\0cb\0\0g", '\0',    5),    
+    TEST ("e\0cb\0\0g",  'b',    3),    
+    TEST ("e\0cb\0\0g",  'a', NPOS),   
+    TEST ("\0cbge\0\0", '\0',    6),   
+    TEST ("\0cbge\0\0",  'b',    2),   
+    TEST ("\0cbge\0\0",  'a', NPOS),   
 
     TEST (LSTR,          'x',  LLEN - 2),  
-    TEST (LSTR,         '\0', -1),   
-    TEST (LSTR,          'a', -1), 
+    TEST (LSTR,         '\0', NPOS),   
+    TEST (LSTR,          'a', NPOS), 
 
-    TEST ("last test",   't',  8)    
+    TEST ("last test",   't',    8)    
 };
 
 /**************************************************************************/
@@ -565,48 +566,48 @@
 #undef TEST
 #define TEST(str, val, off, res)                                     \
     { __LINE__, off, -1, -1, -1, val, str, sizeof str - 1,           \
-      0, 0, 0, 0, res, 0 }
+      0, 0, 0, res, 0 }
 
     //    +------------------------------ controlled sequence
     //    |              +--------------- character to be found
     //    |              |     +--------- find_last_of() off argument
-    //    |              |     |   +----- expected result  
-    //    |              |     |   |                              
-    //    |              |     |   |               
-    //    V              V     V   V                   
-    TEST ("ab",          'a',  0,  0),    
-
-    TEST ("",            'a',  0, -1),   
-    TEST ("",           '\0',  0, -1),    
-
-    TEST ("\0",         '\0',  1,  0),    
-    TEST ("\0",          'a',  0, -1),   
-    TEST ("\0\0",       '\0',  2,  1),    
-    TEST ("\0\0",        'a',  3, -1),   
-    TEST ("\0\0",       '\0',  3,  1),    
-
-    TEST ("e\0cb\0\0g", '\0',  1,  1),    
-    TEST ("e\0cb\0\0g", '\0',  5,  5),    
-    TEST ("e\0cb\0\0g", '\0',  0, -1),    
-    TEST ("e\0cb\0\0g",  'b',  1, -1),    
-    TEST ("e\0cb\0\0g",  'b',  4,  3),    
-    TEST ("e\0cb\0\0g",  'a',  6, -1),   
-    TEST ("\0cbge\0\0", '\0',  0,  0),   
-    TEST ("\0cbge\0\0", '\0',  5,  5),  
-    TEST ("\0cbge\0\0", '\0',  9,  6),    
-    TEST ("\0cbge\0\0",  'b',  5,  2),  
-    TEST ("\0bgeb\0\0",  'b',  5,  4),   
-    TEST ("\0cbge\0\0",  'a',  6, -1),    
+    //    |              |     |     +--- expected result  
+    //    |              |     |     |                              
+    //    |              |     |     |               
+    //    V              V     V     V                   
+    TEST ("ab",          'a',  0,    0),    
+
+    TEST ("",            'a',  0, NPOS),   
+    TEST ("",           '\0',  0, NPOS),    
+
+    TEST ("\0",         '\0',  1,    0),    
+    TEST ("\0",          'a',  0, NPOS),   
+    TEST ("\0\0",       '\0',  2,    1),    
+    TEST ("\0\0",        'a',  3, NPOS),   
+    TEST ("\0\0",       '\0',  3,    1),    
+
+    TEST ("e\0cb\0\0g", '\0',  1,    1),    
+    TEST ("e\0cb\0\0g", '\0',  5,    5),    
+    TEST ("e\0cb\0\0g", '\0',  0, NPOS),    
+    TEST ("e\0cb\0\0g",  'b',  1, NPOS),    
+    TEST ("e\0cb\0\0g",  'b',  4,    3),    
+    TEST ("e\0cb\0\0g",  'a',  6, NPOS),   
+    TEST ("\0cbge\0\0", '\0',  0,    0),   
+    TEST ("\0cbge\0\0", '\0',  5,    5),  
+    TEST ("\0cbge\0\0", '\0',  9,    6),    
+    TEST ("\0cbge\0\0",  'b',  5,    2),  
+    TEST ("\0bgeb\0\0",  'b',  5,    4),   
+    TEST ("\0cbge\0\0",  'a',  6, NPOS),    
 
-    TEST (LSTR,          'x',  0,  0),
-    TEST (LSTR,          'x',  5,  5),
+    TEST (LSTR,          'x',  0,    0),
+    TEST (LSTR,          'x',  5,    5),
     TEST (LSTR,          'x', LLEN - 1, LLEN - 2),      
-    TEST (LSTR,         '\0', LLEN - 1, -1),    
-    TEST (LSTR,          'a', LLEN - 3, -1),     
+    TEST (LSTR,         '\0', LLEN - 1, NPOS),    
+    TEST (LSTR,          'a', LLEN - 3, NPOS),     
     TEST (LSTR,          'x', LLEN - 2, LLEN - 2),
     TEST (LSTR,          'x', LLEN + 9, LLEN - 2),
 
-    TEST ("last test",   't',  9,  8)      
+    TEST ("last test",   't',  9,    8)      
 };
 
 /**************************************************************************/
@@ -630,7 +631,7 @@
     const TestString s_arg (warg, cs.arg_len);
 
     std::size_t res = 0;
-    std::size_t exp_res = -1 != cs.nres ? cs.nres : TestString::npos;
+    std::size_t exp_res = NPOS != cs.nres ? cs.nres : TestString::npos;
 
     const std::size_t     ssize    = s_str.size ();
     const std::size_t     capacity = s_str.capacity ();
@@ -704,7 +705,7 @@
         rw_assert (exp_res == res, 0, cs.line,
                    "line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
                    "got %{?}%zu%{;}%{?}npos%{;}", 
-                   __LINE__, -1 != cs.nres, exp_res, -1 == cs.nres, 
+                   __LINE__, NPOS != cs.nres, exp_res, NPOS == cs.nres, 
                    TestString::npos != res, res, TestString::npos == res);
     }
 



Mime
View raw message