stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant...@apache.org
Subject svn commit: r398878 [2/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.first.of.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp?rev=398878&r1=398877&r2=398878&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.first.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,67 +62,67 @@
 #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",         3),     
-    TEST ("ecdfcbahca", "cba",         1),   
-    TEST ("bacbahjicg", "cba",         0),  
-    TEST ("efhijhjieg", "cba",        -1), 
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      3),    
-    TEST ("e\0cb\0\0g", "cbe",         0),    
-    TEST ("\0cb\0\0ge", "\0\0ge",     -1),   
-    TEST ("\0cb\0\0be", "b\0c",        2),   
-    TEST ("e\0gbg\0\0", "bg",          2),    
-    TEST ("e\0dg\0\0a", "cba",         6),  
-    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",           2),    
-    TEST ("bcedfaajih", "a",           5),    
-    TEST ("bcaaedfaji", "a",           2),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0),     
-    TEST ("aaaaabaaaa", "cccccccccb",  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  2),
-    TEST ("bbb",        "aaaaaaaaba",  0),        
-    TEST ("bbb",        "aaaaaaaaaa", -1),    
-
-    TEST (LSTR,         "",           -1),     
-    TEST (LSTR,         "a",          -1),  
-    TEST (LSTR,         "x",           0),       
-    TEST (LSTR,         "axa",         0),   
-    TEST ("abc",        LSTR,         -1),    
-    TEST ("axbc",       LSTR,          1),  
-
-    TEST ("abcdefghij", 0,             0),      
-    TEST ("\0cb\0\0ge", 0,            -1),       
-    TEST (LSTR,         0,             0),
+    //    |             |                +---- 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",           3),     
+    TEST ("ecdfcbahca", "cba",           1),   
+    TEST ("bacbahjicg", "cba",           0),  
+    TEST ("efhijhjieg", "cba",        NPOS), 
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        3),    
+    TEST ("e\0cb\0\0g", "cbe",           0),    
+    TEST ("\0cb\0\0ge", "\0\0ge",     NPOS),   
+    TEST ("\0cb\0\0be", "b\0c",          2),   
+    TEST ("e\0gbg\0\0", "bg",            2),    
+    TEST ("e\0dg\0\0a", "cba",           6),  
+    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",             2),    
+    TEST ("bcedfaajih", "a",             5),    
+    TEST ("bcaaedfaji", "a",             2),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),     
+    TEST ("aaaaabaaaa", "cccccccccb",    5),   
+    TEST ("aabaabaaaa", "cccccccccb",    2),
+    TEST ("bbb",        "aaaaaaaaba",    0),        
+    TEST ("bbb",        "aaaaaaaaaa", NPOS),    
+
+    TEST (LSTR,         "",           NPOS),     
+    TEST (LSTR,         "a",          NPOS),  
+    TEST (LSTR,         "x",             0),       
+    TEST (LSTR,         "axa",           0),   
+    TEST ("abc",        LSTR,         NPOS),    
+    TEST ("axbc",       LSTR,            1),  
+
+    TEST ("abcdefghij", 0,               0),      
+    TEST ("\0cb\0\0ge", 0,            NPOS),       
+    TEST (LSTR,         0,               0),
 
-    TEST ("last test",  "test",        2)       
+    TEST ("last test",  "test",          2)       
 };
 
 /**************************************************************************/
@@ -133,70 +134,70 @@
 #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",         3),     
-    TEST ("ecdfcbahca", "cba",         1),   
-    TEST ("bacbahjicg", "cba",         0),  
-    TEST ("efhijhjieg", "cba",        -1), 
-
-    TEST ("e\0cb\0\0g", "ad",         -1),  
-    TEST ("e\0cb\0\0g", "b\0\0g",      1),    
-    TEST ("e\0cb\0\0g", "cbe",         0),    
-    TEST ("\0cb\0\0ge", "\0\0ge",      0),   
-    TEST ("\0cb\0\0be", "b\0c",        0),  
-    TEST ("\0cb\0\0be", "bc",          1),
-    TEST ("\0ab\0\0be", "bc",          2),
-    TEST ("e\0gbg\0\0", "bg",          2),    
-    TEST ("e\0dg\0\0a", "cba",         6),  
-    TEST ("a\0b",       "e\0gbg\0\0",  1),    
-    TEST ("a\0b",       "eb\0gg\0\0",  1), 
-    TEST ("a\0b",       "e\0gg\0\0a",  0),
-
-    TEST ("bcbedfbjih", "a",          -1),   
-    TEST ("bcaedfajih", "a",           2),    
-    TEST ("bcedfaajih", "a",           5),    
-    TEST ("bcaaedfaji", "a",           2),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0),     
-    TEST ("aaaaabaaaa", "cccccccccb",  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  2),
-    TEST ("bbb",        "aaaaaaaaba",  0),        
-    TEST ("bbb",        "aaaaaaaaaa", -1),    
-
-    TEST (LSTR,         "",           -1),     
-    TEST (LSTR,         "a",          -1),  
-    TEST (LSTR,         "x",           0),       
-    TEST (LSTR,         "axa",         0),   
-    TEST ("abc",        LSTR,         -1),    
-    TEST ("axbc",       LSTR,          1),  
-
-    TEST ("abcdefghij", 0,             0),      
-    TEST ("\0cb\0\0ge", 0,             0),       
-    TEST (LSTR,         0,             0),
+    //    |             |                +----- 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",           3),     
+    TEST ("ecdfcbahca", "cba",           1),   
+    TEST ("bacbahjicg", "cba",           0),  
+    TEST ("efhijhjieg", "cba",        NPOS), 
+
+    TEST ("e\0cb\0\0g", "ad",         NPOS),  
+    TEST ("e\0cb\0\0g", "b\0\0g",        1),    
+    TEST ("e\0cb\0\0g", "cbe",           0),    
+    TEST ("\0cb\0\0ge", "\0\0ge",        0),   
+    TEST ("\0cb\0\0be", "b\0c",          0),  
+    TEST ("\0cb\0\0be", "bc",            1),
+    TEST ("\0ab\0\0be", "bc",            2),
+    TEST ("e\0gbg\0\0", "bg",            2),    
+    TEST ("e\0dg\0\0a", "cba",           6),  
+    TEST ("a\0b",       "e\0gbg\0\0",    1),    
+    TEST ("a\0b",       "eb\0gg\0\0",    1), 
+    TEST ("a\0b",       "e\0gg\0\0a",    0),
+
+    TEST ("bcbedfbjih", "a",          NPOS),   
+    TEST ("bcaedfajih", "a",             2),    
+    TEST ("bcedfaajih", "a",             5),    
+    TEST ("bcaaedfaji", "a",             2),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),     
+    TEST ("aaaaabaaaa", "cccccccccb",    5),   
+    TEST ("aabaabaaaa", "cccccccccb",    2),
+    TEST ("bbb",        "aaaaaaaaba",    0),        
+    TEST ("bbb",        "aaaaaaaaaa", NPOS),    
+
+    TEST (LSTR,         "",           NPOS),     
+    TEST (LSTR,         "a",          NPOS),  
+    TEST (LSTR,         "x",             0),       
+    TEST (LSTR,         "axa",           0),   
+    TEST ("abc",        LSTR,         NPOS),    
+    TEST ("axbc",       LSTR,            1),  
+
+    TEST ("abcdefghij", 0,               0),      
+    TEST ("\0cb\0\0ge", 0,               0),       
+    TEST (LSTR,         0,               0),
 
-    TEST ("last test",  "test",        2)      
+    TEST ("last test",  "test",          2)      
 };
 
 /**************************************************************************/
@@ -208,86 +209,86 @@
 #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_first_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",         "\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, -1),    
-    TEST ("abcdefghij", "f",           2,  5),   
-    TEST ("abcdefghij", "f",           7, -1),    
-    TEST ("abcdefghij", "j",           9,  9),  
-
-    TEST ("edfcbbhjig", "cba",         0,  3),    
-    TEST ("edfcbahjig", "cba",         4,  4),     
-    TEST ("edfcbahjig", "cba",         6, -1),    
-    TEST ("edfcbahcba", "cba",         9,  9),       
-    TEST ("cbacbahjig", "cba",         7, -1),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  3),    
-    TEST ("e\0cb\0\0g", "b\0\0g",      4, -1),    
-    TEST ("e\0cb\0\0g", "cbe",         0,  0),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      0, -1),  
-    TEST ("\0cb\0\0ge", "cb\0",        6, -1),     
-    TEST ("e\0gbg\0\0", "bg",          1,  2),   
-    TEST ("e\0dg\0\0a", "cba",         0,  6),    
-    TEST ("a\0b",       "e\0gbg\0\0",  0, -1),    
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  2), 
-    TEST ("a\0b",       "e\0gg\0\0a",  3, -1),
-
-    TEST ("bcbedfbjih", "a",           0, -1),    
-    TEST ("bcaedfajih", "a",           1,  2),     
-    TEST ("bcedfaajih", "a",           6,  6),    
-    TEST ("bcaaedfaji", "a",           5,  7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,  0),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,  4),    
-    TEST ("aaaaabaaaa", "cccccccccb",  1,  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  0,  2),  
-    TEST ("aabaabaaaa", "cccccccccb",  6, -1), 
-    TEST ("bbb",        "aaaaaaaaba",  2,  2),  
-    TEST ("bab",        "aaaaaaaaba",  0,  0),
-    TEST ("bbb",        "aaaaaaaaaa",  0, -1),     
-
-    TEST (LSTR,         "",            0, -1),    
-    TEST (LSTR,         "a",           0, -1),     
-    TEST (LSTR,         "x",           0,  0),     
-    TEST (LSTR,         "xxx",        10, 10),    
-    TEST (LSTR,         "axa",        10, 10),     
-    TEST ("abc",        LSTR,          2, -1),    
-    TEST ("xxxxxxxxxx", LSTR,          0,  0),   
+    //    |            |               |     +-- 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",         "\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, NPOS),    
+    TEST ("abcdefghij", "f",           2,    5),   
+    TEST ("abcdefghij", "f",           7, NPOS),    
+    TEST ("abcdefghij", "j",           9,    9),  
+
+    TEST ("edfcbbhjig", "cba",         0,    3),    
+    TEST ("edfcbahjig", "cba",         4,    4),     
+    TEST ("edfcbahjig", "cba",         6, NPOS),    
+    TEST ("edfcbahcba", "cba",         9,    9),       
+    TEST ("cbacbahjig", "cba",         7, NPOS),    
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,    3),    
+    TEST ("e\0cb\0\0g", "b\0\0g",      4, NPOS),    
+    TEST ("e\0cb\0\0g", "cbe",         0,    0),     
+    TEST ("\0cb\0\0ge", "\0\0ge",      0, NPOS),  
+    TEST ("\0cb\0\0ge", "cb\0",        6, NPOS),     
+    TEST ("e\0gbg\0\0", "bg",          1,    2),   
+    TEST ("e\0dg\0\0a", "cba",         0,    6),    
+    TEST ("a\0b",       "e\0gbg\0\0",  0, NPOS),    
+    TEST ("a\0b",       "eb\0gg\0\0",  1,    2), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3, NPOS),
+
+    TEST ("bcbedfbjih", "a",           0, NPOS),    
+    TEST ("bcaedfajih", "a",           1,    2),     
+    TEST ("bcedfaajih", "a",           6,    6),    
+    TEST ("bcaaedfaji", "a",           5,    7),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,    0),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,    4),    
+    TEST ("aaaaabaaaa", "cccccccccb",  1,    5),   
+    TEST ("aabaabaaaa", "cccccccccb",  0,    2),  
+    TEST ("aabaabaaaa", "cccccccccb",  6, NPOS), 
+    TEST ("bbb",        "aaaaaaaaba",  2,    2),  
+    TEST ("bab",        "aaaaaaaaba",  0,    0),
+    TEST ("bbb",        "aaaaaaaaaa",  0, NPOS),     
+
+    TEST (LSTR,         "",            0, NPOS),    
+    TEST (LSTR,         "a",           0, NPOS),     
+    TEST (LSTR,         "x",           0,    0),     
+    TEST (LSTR,         "xxx",        10,   10),    
+    TEST (LSTR,         "axa",        10,   10),     
+    TEST ("abc",        LSTR,          2, NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,          0,    0),   
 
     TEST (LSTR,         "xxx",  LLEN - 4, LLEN - 4), 
-    TEST (LSTR,         "xxx",  LLEN - 1, -1),     
+    TEST (LSTR,         "xxx",  LLEN - 1, NPOS),     
 
-    TEST ("abcdefghij", 0,             0,  0),    
-    TEST ("abcdefghij", 0,             1,  1),   
-    TEST ("\0cb\0\0ge", 0,             5, -1),    
-    TEST (LSTR,         0,             0,  0),  
-    TEST (LSTR,         0,             7,  7),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10, -1),   
-    TEST ("abcdefghij", "cba",        10, -1), 
+    TEST ("abcdefghij", 0,             0,    0),    
+    TEST ("abcdefghij", 0,             1,    1),   
+    TEST ("\0cb\0\0ge", 0,             5, NPOS),    
+    TEST (LSTR,         0,             0,    0),  
+    TEST (LSTR,         0,             7,    7),    
+
+    TEST ("",           "",            1, NPOS),  
+    TEST ("abcdefghij", "abc",        10, NPOS),   
+    TEST ("abcdefghij", "cba",        10, NPOS), 
 
-    TEST ("last test", "test",         0,  2)      
+    TEST ("last test", "test",         0,    2)      
 };
 
 /**************************************************************************/
@@ -299,112 +300,112 @@
 #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_first_of() off argument
     //    |            |               |   +----- find_first_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, -1,       0),
-    TEST ("\0\0",       "\0\0",        1,  1,  1,       0),
-    TEST ("\0",         "a",           0,  1, -1,       0),
-
-    TEST ("edfcbbhjig", "cba",         0,  3,  3,       0),
-    TEST ("edfcbbhjig", "bac",         0,  2,  4,       0),
-    TEST ("edfcbahjig", "cba",         7,  3, -1,       0),
-    TEST ("ebcfeahjig", "cba",         3,  2, -1,       0),
-    TEST ("ebcfeahjig", "cab",         3,  2,  5,       0),
-    TEST ("edfcbahcba", "bac",         6,  3,  7,       0),
-    TEST ("edfcbehcba", "abc",         1,  2,  4,       0),
-    TEST ("edfcbahcba", "cba",         5,  1,  7,       0),
-    TEST ("cbacbahjig", "cba",         6,  3, -1,       0),
-    TEST ("cbacbahjcg", "cba",         5,  1,  8,       0),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4,  1,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4,  4,       0),
-    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,  6,       0),
-    TEST ("\0b\0\0gb\0","bg\0",        2,  2,  4,       0),
-    TEST ("\0b\0\0gb\0","bg\0",        0,  2,  1,       0),
-    TEST ("\0b\0\0gb\0","bg\0",        0,  3,  0,       0),
-    TEST ("e\0cb\0\0g", "afe",         0,  2, -1,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      7,  4, -1,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  0, -1,       0),
-    TEST ("a\0b",       "e\0gbg\0\0",  0,  1, -1,       0),    
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  2,  2,       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",       "e\0gg\0\0a",  0,  4,  1,       0),
-
-    TEST ("e\0a\0",     "e\0a\0\0",    0,  4,  0,       0),
-    TEST ("e\0a\0",     "b\0c\0\0",    0,  5,  1,       0),
-    TEST ("ee\0a\0",    "b\0c\0\0",    1,  4,  2,       0),
-    TEST ("be\0a\0",    "fdbcb\0a",    1,  5, -1,       0),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, 10,  0,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1, 10,  1,       0),
-    TEST ("aaaaabaaaa", "cccccccccc",  0, 10, -1,       0),
-    TEST ("aaaaabaaaa", "cccbcccccc",  1,  4,  5,       0),
-    TEST ("aaaabaaaaa", "cccca",       0,  5,  0,       0),
-    TEST ("aabaabaaaa", "cbccccccca",  0,  5,  2,       0), 
-    TEST ("bbb",        "aaaaaaaaba",  2,  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,         "",            0,  0, -1,       0),
-    TEST (LSTR,         "a",           0,  1, -1,       0),
-    TEST (LSTR,         "x",           0,  1,  0,       0),
-    TEST (LSTR,         "xxx",        10,  3, 10,       0),
-    TEST (LSTR,         "axx",        10,  1, -1,       0),
-    TEST (LSTR,         "xxa",        10,  0, -1,       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,  0, -1,       0),
-    TEST (LSTR,         "xxx",  LLEN - 2,  1, LLEN - 2, 0),
-
-    TEST ("abcdefghij", 0,             0,  9,  0,       0),
-    TEST ("abcdefghij", 0,             1,  9,  1,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  7,  5,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  5, -1,       0),
-    TEST ("\0cb\0ge\0", 0,             6,  1,  6,       0),
-    TEST (LSTR,         0,             0, LLEN - 1,  0, 0),
-    TEST (LSTR,         0,      LLEN - 1, LLEN - 1, -1, 0),
-    TEST (LSTR,         0,      LLEN - 2,  1, LLEN - 2, 0),
-
-    TEST ("",           "",            1,  0, -1,       0),
-    TEST ("abcdefghij", "abc",        10,  3, -1,       0),
-    TEST ("abcdefghij", "cba",        10,  1, -1,       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, NPOS,       0),
+    TEST ("\0\0",       "\0\0",        1,  1,    1,       0),
+    TEST ("\0",         "a",           0,  1, NPOS,       0),
+
+    TEST ("edfcbbhjig", "cba",         0,  3,    3,       0),
+    TEST ("edfcbbhjig", "bac",         0,  2,    4,       0),
+    TEST ("edfcbahjig", "cba",         7,  3, NPOS,       0),
+    TEST ("ebcfeahjig", "cba",         3,  2, NPOS,       0),
+    TEST ("ebcfeahjig", "cab",         3,  2,    5,       0),
+    TEST ("edfcbahcba", "bac",         6,  3,    7,       0),
+    TEST ("edfcbehcba", "abc",         1,  2,    4,       0),
+    TEST ("edfcbahcba", "cba",         5,  1,    7,       0),
+    TEST ("cbacbahjig", "cba",         6,  3, NPOS,       0),
+    TEST ("cbacbahjcg", "cba",         5,  1,    8,       0),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4,    1,       0),
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4,    4,       0),
+    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,    6,       0),
+    TEST ("\0b\0\0gb\0","bg\0",        2,  2,    4,       0),
+    TEST ("\0b\0\0gb\0","bg\0",        0,  2,    1,       0),
+    TEST ("\0b\0\0gb\0","bg\0",        0,  3,    0,       0),
+    TEST ("e\0cb\0\0g", "afe",         0,  2, NPOS,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      7,  4, NPOS,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  0, NPOS,       0),
+    TEST ("a\0b",       "e\0gbg\0\0",  0,  1, NPOS,       0),    
+    TEST ("a\0b",       "eb\0gg\0\0",  1,  2,    2,       0), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3,  6, NPOS,       0),
+    TEST ("a\0b",       "e\0gg\0\0a",  0,  7,    0,       0),
+    TEST ("a\0b",       "e\0gg\0\0a",  0,  4,    1,       0),
+
+    TEST ("e\0a\0",     "e\0a\0\0",    0,  4,    0,       0),
+    TEST ("e\0a\0",     "b\0c\0\0",    0,  5,    1,       0),
+    TEST ("ee\0a\0",    "b\0c\0\0",    1,  4,    2,       0),
+    TEST ("be\0a\0",    "fdbcb\0a",    1,  5, NPOS,       0),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, 10,    0,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1, 10,    1,       0),
+    TEST ("aaaaabaaaa", "cccccccccc",  0, 10, NPOS,       0),
+    TEST ("aaaaabaaaa", "cccbcccccc",  1,  4,    5,       0),
+    TEST ("aaaabaaaaa", "cccca",       0,  5,    0,       0),
+    TEST ("aabaabaaaa", "cbccccccca",  0,  5,    2,       0), 
+    TEST ("bbb",        "aaaaaaaaba",  2,  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,         "",            0,  0, NPOS,       0),
+    TEST (LSTR,         "a",           0,  1, NPOS,       0),
+    TEST (LSTR,         "x",           0,  1,    0,       0),
+    TEST (LSTR,         "xxx",        10,  3,   10,       0),
+    TEST (LSTR,         "axx",        10,  1, NPOS,       0),
+    TEST (LSTR,         "xxa",        10,  0, NPOS,       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,  0, NPOS,       0),
+    TEST (LSTR,         "xxx",  LLEN - 2,  1, LLEN - 2,   0),
+
+    TEST ("abcdefghij", 0,             0,  9,    0,       0),
+    TEST ("abcdefghij", 0,             1,  9,    1,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  7,    5,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  5, NPOS,       0),
+    TEST ("\0cb\0ge\0", 0,             6,  1,    6,       0),
+    TEST (LSTR,         0,             0, LLEN - 1,  0,   0),
+    TEST (LSTR,         0,      LLEN - 1, LLEN - 1, NPOS, 0),
+    TEST (LSTR,         0,      LLEN - 2,  1, LLEN - 2,   0),
+
+    TEST ("",           "",            1,  0, NPOS,       0),
+    TEST ("abcdefghij", "abc",        10,  3, NPOS,       0),
+    TEST ("abcdefghij", "cba",        10,  1, NPOS,       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",         0,  4,  2,       0)
+    TEST ("last test", "test",         0,  4,    2,       0)
 };
 
 /**************************************************************************/
@@ -416,89 +417,89 @@
 #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_first_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",         "\0",          0,  0),   
-    TEST ("\0",         "\0",          1, -1),    
-    TEST ("\0",         "a",           0, -1),    
-
-    TEST ("bbcdefghij", "a",           0, -1),    
-    TEST ("abcdefghij", "a",           0,  0),   
-    TEST ("abcdefghij", "a",           2, -1),    
-    TEST ("abcdefghij", "f",           2,  5),   
-    TEST ("abcdefghij", "f",           7, -1),    
-    TEST ("abcdefghij", "j",           9,  9),  
-
-    TEST ("edfcbbhjig", "cba",         0,  3),    
-    TEST ("edfcbahjig", "cba",         4,  4),     
-    TEST ("edfcbahjig", "cba",         6, -1),    
-    TEST ("edfcbahcba", "cba",         9,  9),       
-    TEST ("cbacbahjig", "cba",         7, -1),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  1),    
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4),    
-    TEST ("e\0cb\0\0g", "cbe",         0,  0),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      0,  0),  
-    TEST ("\0cb\0\0ge", "cb\0",        6, -1),     
-    TEST ("e\0gbg\0\0", "bg",          1,  2),   
-    TEST ("e\0gbg\0\0", "\0bg",        5,  5), 
-    TEST ("e\0dg\0\0a", "cba",         0,  6),    
-    TEST ("a\0b",       "e\0gbg\0\0",  0,  1),    
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  1), 
-    TEST ("a\0b",       "e\0gg\0\0b",  2,  2),
-    TEST ("a\0b",       "e\0gg\0\0a",  3, -1),
-
-    TEST ("bcbedfbjih", "a",           0, -1),    
-    TEST ("bcaedfajih", "a",           1,  2),     
-    TEST ("bcedfaajih", "a",           6,  6),    
-    TEST ("bcaaedfaji", "a",           5,  7),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,  0),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,  4),    
-    TEST ("aaaaabaaaa", "cccccccccb",  1,  5),   
-    TEST ("aabaabaaaa", "cccccccccb",  0,  2),  
-    TEST ("aabaabaaaa", "cccccccccb",  6, -1), 
-    TEST ("bbb",        "aaaaaaaaba",  2,  2),  
-    TEST ("bab",        "aaaaaaaaba",  0,  0),
-    TEST ("bbb",        "aaaaaaaaaa",  0, -1),     
-
-    TEST (LSTR,         "",            0, -1),    
-    TEST (LSTR,         "a",           0, -1),     
-    TEST (LSTR,         "x",           0,  0),     
-    TEST (LSTR,         "xxx",        10, 10),    
-    TEST (LSTR,         "axa",        10, 10),     
-    TEST ("abc",        LSTR,          2, -1),    
-    TEST ("xxxxxxxxxx", LSTR,          0,  0),   
+    //    |             |              |     +--- 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",         "\0",          0,    0),   
+    TEST ("\0",         "\0",          1, NPOS),    
+    TEST ("\0",         "a",           0, NPOS),    
+
+    TEST ("bbcdefghij", "a",           0, NPOS),    
+    TEST ("abcdefghij", "a",           0,    0),   
+    TEST ("abcdefghij", "a",           2, NPOS),    
+    TEST ("abcdefghij", "f",           2,    5),   
+    TEST ("abcdefghij", "f",           7, NPOS),    
+    TEST ("abcdefghij", "j",           9,    9),  
+
+    TEST ("edfcbbhjig", "cba",         0,    3),    
+    TEST ("edfcbahjig", "cba",         4,    4),     
+    TEST ("edfcbahjig", "cba",         6, NPOS),    
+    TEST ("edfcbahcba", "cba",         9,    9),       
+    TEST ("cbacbahjig", "cba",         7, NPOS),    
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,    1),    
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,    4),    
+    TEST ("e\0cb\0\0g", "cbe",         0,    0),     
+    TEST ("\0cb\0\0ge", "\0\0ge",      0,    0),  
+    TEST ("\0cb\0\0ge", "cb\0",        6, NPOS),     
+    TEST ("e\0gbg\0\0", "bg",          1,    2),   
+    TEST ("e\0gbg\0\0", "\0bg",        5,    5), 
+    TEST ("e\0dg\0\0a", "cba",         0,    6),    
+    TEST ("a\0b",       "e\0gbg\0\0",  0,    1),    
+    TEST ("a\0b",       "eb\0gg\0\0",  1,    1), 
+    TEST ("a\0b",       "e\0gg\0\0b",  2,    2),
+    TEST ("a\0b",       "e\0gg\0\0a",  3, NPOS),
+
+    TEST ("bcbedfbjih", "a",           0, NPOS),    
+    TEST ("bcaedfajih", "a",           1,    2),     
+    TEST ("bcedfaajih", "a",           6,    6),    
+    TEST ("bcaaedfaji", "a",           5,    7),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0,    0),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4,    4),    
+    TEST ("aaaaabaaaa", "cccccccccb",  1,    5),   
+    TEST ("aabaabaaaa", "cccccccccb",  0,    2),  
+    TEST ("aabaabaaaa", "cccccccccb",  6, NPOS), 
+    TEST ("bbb",        "aaaaaaaaba",  2,    2),  
+    TEST ("bab",        "aaaaaaaaba",  0,    0),
+    TEST ("bbb",        "aaaaaaaaaa",  0, NPOS),     
+
+    TEST (LSTR,         "",            0, NPOS),    
+    TEST (LSTR,         "a",           0, NPOS),     
+    TEST (LSTR,         "x",           0,    0),     
+    TEST (LSTR,         "xxx",        10,   10),    
+    TEST (LSTR,         "axa",        10,   10),     
+    TEST ("abc",        LSTR,          2, NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,          0,    0),   
 
     TEST (LSTR,         "xxx",  LLEN - 4, LLEN - 4), 
-    TEST (LSTR,         "xxx",  LLEN - 1, -1),     
+    TEST (LSTR,         "xxx",  LLEN - 1, NPOS),     
 
-    TEST ("abcdefghij", 0,             0,  0),    
-    TEST ("abcdefghij", 0,             1,  1),   
-    TEST ("\0cb\0\0ge", 0,             5,  5),    
-    TEST ("\0cb\0\0ge", 0,             4,  4),  
-    TEST (LSTR,         0,             0,  0),  
-    TEST (LSTR,         0,             7,  7),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10, -1),   
-    TEST ("abcdefghij", "cba",        10, -1), 
+    TEST ("abcdefghij", 0,             0,    0),    
+    TEST ("abcdefghij", 0,             1,    1),   
+    TEST ("\0cb\0\0ge", 0,             5,    5),    
+    TEST ("\0cb\0\0ge", 0,             4,    4),  
+    TEST (LSTR,         0,             0,    0),  
+    TEST (LSTR,         0,             7,    7),    
+
+    TEST ("",           "",            1, NPOS),  
+    TEST ("abcdefghij", "abc",        10, NPOS),   
+    TEST ("abcdefghij", "cba",        10, NPOS), 
 
-    TEST ("last test",  "test",        0,  2)     
+    TEST ("last test",  "test",        0,    2)     
 };
 
 /**************************************************************************/
@@ -510,35 +511,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',  0),  
-    TEST ("\0",          'a', -1),   
-
-    TEST ("e\0cb\0\0g", '\0',  1),    
-    TEST ("e\0cb\0\0g",  'b',  3),    
-    TEST ("e\0cb\0\0g",  'a', -1),   
-    TEST ("\0cbge\0\0", '\0',  0),   
-    TEST ("\0cbge\0\0",  'b',  2),   
-    TEST ("\0cbge\0\0",  'a', -1),   
-
-    TEST (LSTR,          'x',  0),  
-    TEST (LSTR,         '\0', -1),   
-    TEST (LSTR,          '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',    0),  
+    TEST ("\0",          'a', NPOS),   
+
+    TEST ("e\0cb\0\0g", '\0',    1),    
+    TEST ("e\0cb\0\0g",  'b',    3),    
+    TEST ("e\0cb\0\0g",  'a', NPOS),   
+    TEST ("\0cbge\0\0", '\0',    0),   
+    TEST ("\0cbge\0\0",  'b',    2),   
+    TEST ("\0cbge\0\0",  'a', NPOS),   
+
+    TEST (LSTR,          'x',    0),  
+    TEST (LSTR,         '\0', NPOS),   
+    TEST (LSTR,          'a', NPOS),
 
-    TEST ("last test",   't',  3)    
+    TEST ("last test",   't',    3)    
 };
 
 /**************************************************************************/
@@ -550,47 +551,47 @@
 #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_first_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, -1),    
-    TEST ("\0",          'a',  0, -1),   
-    TEST ("\0\0",       '\0',  1,  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',  2,  4),    
-    TEST ("e\0cb\0\0g", '\0',  6, -1),    
-    TEST ("e\0cb\0\0g",  'b',  1,  3),    
-    TEST ("e\0cb\0\0g",  'b',  4, -1),    
-    TEST ("e\0cb\0\0g",  'a',  0, -1),   
-    TEST ("\0cbge\0\0", '\0',  0,  0),   
-    TEST ("\0cbge\0\0", '\0',  1,  5),  
-    TEST ("\0cbge\0\0", '\0',  9, -1),    
-    TEST ("\0cbge\0\0",  'b',  0,  2),  
-    TEST ("\0bgeb\0\0",  'b',  2,  4),   
-    TEST ("\0cbge\0\0",  'a',  1, -1),    
-
-    TEST (LSTR,          'x',  0,  0),   
-    TEST (LSTR,          'x',  5,  5),   
-    TEST (LSTR,         '\0',  0, -1),    
-    TEST (LSTR,          'a',  3, -1),     
-    TEST (LSTR,          'x', LLEN - 1, -1),
+    //    |              |     |     +--- expected result  
+    //    |              |     |     |                              
+    //    |              |     |     |               
+    //    V              V     V     V                   
+    TEST ("ab",          'a',  0,    0),    
+
+    TEST ("",            'a',  0, NPOS),   
+    TEST ("",           '\0',  0, NPOS),    
+
+    TEST ("\0",         '\0',  1, NPOS),    
+    TEST ("\0",          'a',  0, NPOS),   
+    TEST ("\0\0",       '\0',  1,    1),    
+    TEST ("\0\0",        'a',  3, NPOS),   
+    TEST ("\0\0",       '\0',  3, NPOS),    
+
+    TEST ("e\0cb\0\0g", '\0',  1,    1),    
+    TEST ("e\0cb\0\0g", '\0',  2,    4),    
+    TEST ("e\0cb\0\0g", '\0',  6, NPOS),    
+    TEST ("e\0cb\0\0g",  'b',  1,    3),    
+    TEST ("e\0cb\0\0g",  'b',  4, NPOS),    
+    TEST ("e\0cb\0\0g",  'a',  0, NPOS),   
+    TEST ("\0cbge\0\0", '\0',  0,    0),   
+    TEST ("\0cbge\0\0", '\0',  1,    5),  
+    TEST ("\0cbge\0\0", '\0',  9, NPOS),    
+    TEST ("\0cbge\0\0",  'b',  0,    2),  
+    TEST ("\0bgeb\0\0",  'b',  2,    4),   
+    TEST ("\0cbge\0\0",  'a',  1, NPOS),    
+
+    TEST (LSTR,          'x',  0,    0),   
+    TEST (LSTR,          'x',  5,    5),   
+    TEST (LSTR,         '\0',  0, NPOS),    
+    TEST (LSTR,          'a',  3, NPOS),     
+    TEST (LSTR,          'x', LLEN - 1, NPOS),
     TEST (LSTR,          'x', LLEN - 2, LLEN - 2),
 
-    TEST ("last test",   't',  0,  3)      
+    TEST ("last test",   't',  0,    3)      
 };
 
 /**************************************************************************/
@@ -614,7 +615,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 ();
@@ -688,7 +689,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);
     }
 

Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp?rev=398878&r1=398877&r2=398878&view=diff
==============================================================================
--- 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 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,63 +62,63 @@
 #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",         "c",           1),   
-
-    TEST ("",           "",           -1),   
-    TEST ("",           "\0",         -1),    
-    TEST ("",           "a",          -1),   
-
-    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",        -1),  
-
-    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", -1),     
-    TEST ("aaaaabaaaa", "ccccccccca",  5),   
-    TEST ("aabaabaaaa", "ccccccccca",  5),
-    TEST ("bbb",        "aaaaaaaaba", -1),        
-    TEST ("bbb",        "aaaaaaaaaa",  2), 
-    TEST ("abcdefghij", "jihgfedcba", -1),
-
-    TEST (LSTR,         "",     LLEN - 2),     
-    TEST (LSTR,         "a",    LLEN - 2),  
-    TEST (LSTR,         "x",          -1),    
-    TEST (LSTR,         "xxx",        -1),    
-    TEST (LSTR,         "aax",        -1),   
-    TEST ("abc",        LSTR,          2),    
-    TEST ("xxxxxxxxxx", LSTR,         -1),  
-
-    TEST ("abcdefghij", 0,            -1),      
-    TEST ("\0cb\0\0ge", 0,             6),       
-    TEST (LSTR,         0,            -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 ("aabaabaaaa", "ccccccccca",    5),
+    TEST ("bbb",        "aaaaaaaaba", NPOS),        
+    TEST ("bbb",        "aaaaaaaaaa",    2), 
+    TEST ("abcdefghij", "jihgfedcba", NPOS),
+
+    TEST (LSTR,         "",       LLEN - 2),     
+    TEST (LSTR,         "a",      LLEN - 2),  
+    TEST (LSTR,         "x",          NPOS),    
+    TEST (LSTR,         "xxx",        NPOS),    
+    TEST (LSTR,         "aax",        NPOS),   
+    TEST ("abc",        LSTR,            2),    
+    TEST ("xxxxxxxxxx", LSTR,         NPOS),  
+
+    TEST ("abcdefghij", 0,            NPOS),      
+    TEST ("\0cb\0\0ge", 0,               6),       
+    TEST (LSTR,         0,            NPOS),  
 
-    TEST ("last test",  "test",        4)       
+    TEST ("last test",  "test",          4)       
 };
 
 /**************************************************************************/
@@ -129,65 +130,65 @@
 #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",         "c",           1),   
-
-    TEST ("",           "",           -1),   
-    TEST ("",           "\0",         -1),    
-    TEST ("",           "a",          -1),   
-
-    TEST ("\0",         "",            0),    
-    TEST ("\0",         "\0",         -1),  
-    TEST ("\0\0",       "\0",         -1),
-    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",        -1),  
-
-    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", -1), 
-    TEST ("\0ab",       "abcdefghij",  0),  
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa", -1),     
-    TEST ("aaaaabaaaa", "ccccccccca",  5),   
-    TEST ("aabaabaaaa", "ccccccccca",  5),
-    TEST ("bbb",        "aaaaaaaaba", -1),        
-    TEST ("bbb",        "aaaaaaaaaa",  2), 
-    TEST ("abcdefghij", "jihgfedcba", -1),
-
-    TEST (LSTR,         "",     LLEN - 2),     
-    TEST (LSTR,         "a",    LLEN - 2),  
-    TEST (LSTR,         "x",          -1),    
-    TEST (LSTR,         "xxx",        -1),    
-    TEST (LSTR,         "aax",        -1),   
-    TEST ("abc",        LSTR,          2),    
-    TEST ("xxxxxxxxxx", LSTR,         -1),  
-
-    TEST ("abcdefghij", 0,            -1),      
-    TEST ("\0cb\0\0ge", 0,            -1),       
-    TEST (LSTR,         0,            -1),  
+    //    |             |                +----- 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",       "\0",         NPOS),
+    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 ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),     
+    TEST ("aaaaabaaaa", "ccccccccca",    5),   
+    TEST ("aabaabaaaa", "ccccccccca",    5),
+    TEST ("bbb",        "aaaaaaaaba", NPOS),        
+    TEST ("bbb",        "aaaaaaaaaa",    2), 
+    TEST ("abcdefghij", "jihgfedcba", NPOS),
+
+    TEST (LSTR,         "",       LLEN - 2),     
+    TEST (LSTR,         "a",      LLEN - 2),  
+    TEST (LSTR,         "x",          NPOS),    
+    TEST (LSTR,         "xxx",        NPOS),    
+    TEST (LSTR,         "aax",        NPOS),   
+    TEST ("abc",        LSTR,            2),    
+    TEST ("xxxxxxxxxx", LSTR,         NPOS),  
+
+    TEST ("abcdefghij", 0,            NPOS),      
+    TEST ("\0cb\0\0ge", 0,            NPOS),       
+    TEST (LSTR,         0,            NPOS),  
 
-    TEST ("last test",  "test",        4)      
+    TEST ("last test",  "test",          4)      
 };
 
 /**************************************************************************/
@@ -199,89 +200,89 @@
 #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_not_of() off argument
-    //    |            |               |   +-- expected result  
-    //    |            |               |   |                             
-    //    |            |               |   |             
-    //    V            V               V   V                 
-    TEST ("ab",        "c",            0,  0),   
-
-    TEST ("",           "",            0, -1),    
-    TEST ("",           "\0",          0, -1),    
-    TEST ("",           "a",           0, -1),    
-
-    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 ("bcdefghija", "a",           9,  8),
-    TEST ("bbcdefghij", "a",           0,  0),
-    TEST ("bcadefghij", "a",           2,  1),    
-    TEST ("aaadefghij", "a",           2, -1),   
-    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, -1), 
-    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, -1),     
-    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 ("ab\0",       "ba\0d\0\0a",  1, -1),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, -1),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4, -1),    
-    TEST ("aaaaabaaaa", "ccccccccca",  8,  5),   
-    TEST ("aabaabaaaa", "ccccccccca",  9,  5),  
-    TEST ("aabaabaaaa", "ccccccccca",  3,  2), 
-    TEST ("bbb",        "aaaaaaaaba",  2, -1),  
-    TEST ("cab",        "aaaaaaaaba",  0,  0),
-    TEST ("bbb",        "aaaaaaaaaa",  3,  2),      
+    //    |            |               |     +-- 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 ("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 ("\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 ("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 ("cab",        "aaaaaaaaba",  0,    0),
+    TEST ("bbb",        "aaaaaaaaaa",  3,    2),      
 
     TEST (LSTR,         "",     LLEN - 1, LLEN - 2),    
     TEST (LSTR,         "a",    LLEN - 1, LLEN - 2),     
-    TEST (LSTR,         "x",    LLEN - 1, -1),   
-    TEST (LSTR,         "xxx",  LLEN - 2, -1),
-    TEST (LSTR,         "xxx",         0, -1),
-    TEST (LSTR,         "xxx", LLEN - 10, -1),    
-    TEST (LSTR,         "aax", LLEN - 10, -1),     
-    TEST ("abc",        LSTR,          2,  2),    
-    TEST ("xxxxxxxxxx", LSTR,          6, -1),   
-    TEST ("xxxxaxxxxx", LSTR,          9,  4),
-
-    TEST (LSTR,         "xxx",         3, -1), 
-    TEST (LSTR,         "xxx",         2, -1),     
-
-    TEST ("abcdefghij", 0,             0, -1),    
-    TEST ("abcdefghij", 0,             9, -1),   
-    TEST ("\0cb\0\0ge", 0,             5,  5),    
-    TEST (LSTR,         0,             0, -1),  
-    TEST (LSTR,         0,             1, -1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("defghijabc", "abc",        15,  6),   
-    TEST ("defgabcabc", "cba",        15,  3), 
+    TEST (LSTR,         "x",    LLEN - 1, NPOS),   
+    TEST (LSTR,         "xxx",  LLEN - 2, NPOS),
+    TEST (LSTR,         "xxx",         0, NPOS),
+    TEST (LSTR,         "xxx", LLEN - 10, NPOS),    
+    TEST (LSTR,         "aax", LLEN - 10, NPOS),     
+    TEST ("abc",        LSTR,          2,    2),    
+    TEST ("xxxxxxxxxx", LSTR,          6, NPOS),   
+    TEST ("xxxxaxxxxx", LSTR,          9,    4),
+
+    TEST (LSTR,         "xxx",         3, NPOS), 
+    TEST (LSTR,         "xxx",         2, NPOS),     
+
+    TEST ("abcdefghij", 0,             0, NPOS),    
+    TEST ("abcdefghij", 0,             9, NPOS),   
+    TEST ("\0cb\0\0ge", 0,             5,    5),    
+    TEST (LSTR,         0,             0, NPOS),  
+    TEST (LSTR,         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)      
 };
 
 /**************************************************************************/
@@ -292,119 +293,119 @@
 
 #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 }
+    { __LINE__, off, size, NPOS, -1, -1, str, sizeof str - 1, arg,      \
+      sizeof arg - 1, 0, res, bthrow }
 
     //    +----------------------------------- 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             
-    TEST ("ab",        "c",            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,  0,       0),
-    TEST ("\0",         "\0",          0,  1, -1,       0),
-    TEST ("\0",         "\0",          1,  1, -1,       0),
-    TEST ("\0\0",       "\0\0",        1,  1, -1,       0),
-    TEST ("\0",         "a",           0,  1,  0,       0),
-    TEST ("a",          "\0",          0,  1,  0,       0),
-
-    TEST ("adfcbbhjig", "cba",         0,  3, -1,       0),
-    TEST ("bdfcbbhjig", "cba",         0,  2, -1,       0),
-    TEST ("edfhjabcbb", "cba",         9,  2,  5,       0),
-    TEST ("edacbdcbag", "cba",         8,  3,  5,       0),
-    TEST ("edfcbaabcg", "cba",         8,  3,  2,       0),
-    TEST ("cccfehjigb", "cba",         2,  1, -1,       0),
-    TEST ("edfcbahcba", "cba",         9,  3,  6,       0),
-    TEST ("edfcbehcba", "cab",         9,  2,  8,       0),
-    TEST ("edfcbacbah", "cba",         9,  3,  9,       0),
-    TEST ("cbacbahjig", "cba",         5,  3, -1,       0),
-    TEST ("accacbahji", "cba",         2,  1,  0,       0),
-    TEST ("cbacbaccdg", "cba",         7,  1,  5,       0),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      6,  4,  2,       0),
-    TEST ("eg\0b\0\0g", "b\0\0g",      7,  4,  0,       0),
-    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,  4,       0),
-    TEST ("g\0b\0\0b\0","b\0\0g",      7,  2,  0,       0),
-    TEST ("\0bg\0\0b\0","b\0\0g",      2,  2,  2,       0),
-    TEST ("\0b\0\0b\0g","b\0g\0",      7,  3, -1,       0),
-    TEST ("e\0cbg\0\0", "ecb",         7,  2,  6,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4,  2,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      2,  0,  2,       0),
-    TEST ("\0cb\0\0ge", "cb\0",        4,  3, -1,       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 ("ba\0",       "e\0gg\0\0a",  3,  7,  0,       0),
-    TEST ("a\0b",       "e\0gg\0\0a",  0,  7, -1,       0),
-    TEST ("a\0b",       "eb\0gg\0\0",  1,  3,  0,       0), 
-
-    TEST ("e\0a\0",     "e\0a\0\0",    2,  4, -1,       0),
-    TEST ("e\0a\0",     "e\0a\0\0",    3,  5, -1,       0),
-    TEST ("ee\0a\0",    "b\0c\0\0",    3,  4,  3,       0),
-    TEST ("e\0\0cb",    "fdbcb\0a",    3,  5,  2,       0),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, 10, -1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  8, 10, -1,       0),
-    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 ("bbb",        "aaaaaaaaab",  1,  9,  1,       0),
-    TEST ("bab",        "aaaaaaaaba",  0,  0,  0,       0),
-    TEST ("bab",        "ccccccccba",  1, 10, -1,       0),
-    TEST ("abcdefghij", "jihgfedcba",  9, 10, -1,       0),
-    TEST ("abcdefghij", "jihgfedcba",  9,  9,  0,       0),
-
-    TEST (LSTR,         "",     LLEN - 1,  0, LLEN - 2, 0),
-    TEST (LSTR,         "a",    LLEN - 1,  1, LLEN - 2, 0),
-    TEST (LSTR,         "x",    LLEN - 1,  1, -1,       0),
-    TEST (LSTR,         "xxx",  LLEN - 9,  3, -1,       0),
-    TEST (LSTR,         "aax",  LLEN - 9,  2, LLEN - 9, 0),
-    TEST ("abc",        LSTR,          2, 10,  2,       0),
-    TEST ("xxxxxxxxxx", LSTR,          9, LLEN - 1, -1, 0),
-    TEST ("xxxxxxxxxx", LSTR,          2,  4, -1,       0),
-
-    TEST (LSTR,         "xxx",  LLEN - 4,  3, -1,       0),
-    TEST (LSTR,         "xxx",  LLEN - 3,  0, LLEN - 3, 0),
-
-    TEST ("abcdefghij", 0,             9, 10, -1,       0),
-    TEST ("abcdefghij", 0,             8,  6,  8,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  7, -1,       0),
-    TEST ("\0cb\0ge\0", 0,             6,  1,  5,       0),
-    TEST ("\0c\0eg\0c", 0,             6,  2,  4,       0),
-    TEST (LSTR,         0,             0, LLEN - 1, -1, 0),
-    TEST (LSTR,         0,             1, LLEN - 1, -1, 0),
-    TEST (LSTR,         0,      LLEN - 6,  0, LLEN - 6, 0),
-
-    TEST ("",           "",            1,  0, -1,       0),
-    TEST ("defghijabc", "abc",        15,  3,  6,       0),
-    TEST ("defghijabc", "cba",        15,  1,  8,       0),
+    //    |            |               |   |     +-- 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),
+    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,    0,       0),
+    TEST ("\0",         "\0",          0,  1, NPOS,       0),
+    TEST ("\0",         "\0",          1,  1, NPOS,       0),
+    TEST ("\0\0",       "\0\0",        1,  1, NPOS,       0),
+    TEST ("\0",         "a",           0,  1,    0,       0),
+    TEST ("a",          "\0",          0,  1,    0,       0),
+
+    TEST ("adfcbbhjig", "cba",         0,  3, NPOS,       0),
+    TEST ("bdfcbbhjig", "cba",         0,  2, NPOS,       0),
+    TEST ("edfhjabcbb", "cba",         9,  2,    5,       0),
+    TEST ("edacbdcbag", "cba",         8,  3,    5,       0),
+    TEST ("edfcbaabcg", "cba",         8,  3,    2,       0),
+    TEST ("cccfehjigb", "cba",         2,  1, NPOS,       0),
+    TEST ("edfcbahcba", "cba",         9,  3,    6,       0),
+    TEST ("edfcbehcba", "cab",         9,  2,    8,       0),
+    TEST ("edfcbacbah", "cba",         9,  3,    9,       0),
+    TEST ("cbacbahjig", "cba",         5,  3, NPOS,       0),
+    TEST ("accacbahji", "cba",         2,  1,    0,       0),
+    TEST ("cbacbaccdg", "cba",         7,  1,    5,       0),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      6,  4,    2,       0),
+    TEST ("eg\0b\0\0g", "b\0\0g",      7,  4,    0,       0),
+    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,    4,       0),
+    TEST ("g\0b\0\0b\0","b\0\0g",      7,  2,    0,       0),
+    TEST ("\0bg\0\0b\0","b\0\0g",      2,  2,    2,       0),
+    TEST ("\0b\0\0b\0g","b\0g\0",      7,  3, NPOS,       0),
+    TEST ("e\0cbg\0\0", "ecb",         7,  2,    6,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4,    2,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      2,  0,    2,       0),
+    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 ("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 ("e\0a\0",     "e\0a\0\0",    2,  4, NPOS,       0),
+    TEST ("e\0a\0",     "e\0a\0\0",    3,  5, NPOS,       0),
+    TEST ("ee\0a\0",    "b\0c\0\0",    3,  4,    3,       0),
+    TEST ("e\0\0cb",    "fdbcb\0a",    3,  5,    2,       0),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, 10, NPOS,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  8, 10, NPOS,       0),
+    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 ("bbb",        "aaaaaaaaab",  1,  9,    1,       0),
+    TEST ("bab",        "aaaaaaaaba",  0,  0,    0,       0),
+    TEST ("bab",        "ccccccccba",  1, 10, NPOS,       0),
+    TEST ("abcdefghij", "jihgfedcba",  9, 10, NPOS,       0),
+    TEST ("abcdefghij", "jihgfedcba",  9,  9,    0,       0),
+
+    TEST (LSTR,         "",     LLEN - 1,  0, LLEN - 2,   0),
+    TEST (LSTR,         "a",    LLEN - 1,  1, LLEN - 2,   0),
+    TEST (LSTR,         "x",    LLEN - 1,  1, NPOS,       0),
+    TEST (LSTR,         "xxx",  LLEN - 9,  3, NPOS,       0),
+    TEST (LSTR,         "aax",  LLEN - 9,  2, LLEN - 9,   0),
+    TEST ("abc",        LSTR,          2, 10,    2,       0),
+    TEST ("xxxxxxxxxx", LSTR,          9, LLEN - 1, NPOS, 0),
+    TEST ("xxxxxxxxxx", LSTR,          2,  4, NPOS,       0),
+
+    TEST (LSTR,         "xxx",  LLEN - 4,  3, NPOS,       0),
+    TEST (LSTR,         "xxx",  LLEN - 3,  0, LLEN - 3,   0),
+
+    TEST ("abcdefghij", 0,             9, 10, NPOS,       0),
+    TEST ("abcdefghij", 0,             8,  6,    8,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  7, NPOS,       0),
+    TEST ("\0cb\0ge\0", 0,             6,  1,    5,       0),
+    TEST ("\0c\0eg\0c", 0,             6,  2,    4,       0),
+    TEST (LSTR,         0,             0, LLEN - 1, NPOS, 0),
+    TEST (LSTR,         0,             1, LLEN - 1, NPOS, 0),
+    TEST (LSTR,         0,      LLEN - 6,  0, LLEN - 6,   0),
+
+    TEST ("",           "",            1,  0, NPOS,       0),
+    TEST ("defghijabc", "abc",        15,  3,    6,       0),
+    TEST ("defghijabc", "cba",        15,  1,    8,       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,  4,       0)
+    TEST ("last test", "test",         9,  4,    4,       0)
 };
 
 /**************************************************************************/
@@ -416,91 +417,91 @@
 #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_not_of() off argument
-    //    |             |              |   +-- expected result 
-    //    |             |              |   |                          
-    //    |             |              |   |           
-    //    V             V              V   V                
-    TEST ("ab",         "c",           1,  1),     
-
-    TEST ("",           "",            0, -1),    
-    TEST ("",           "\0",          0, -1),    
-    TEST ("",           "a",           0, -1),    
-
-    TEST ("\0",         "",            0,  0),  
-    TEST ("\0",         "",            1,  0), 
-    TEST ("\0",         "\0",          0, -1),   
-    TEST ("\0",         "\0",          1, -1),    
-    TEST ("\0\0",       "\0",          1, -1),
-    TEST ("\0",         "a",           0,  0),  
-    TEST ("a",          "\0",          1,  0), 
-
-    TEST ("bbcdefghij", "a",           9,  9),    
-    TEST ("bcdefghija", "a",           9,  8),
-    TEST ("bbcdefghij", "a",           0,  0),
-    TEST ("bcadefghij", "a",           2,  1),    
-    TEST ("aaadefghij", "a",           2, -1),   
-    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, -1), 
-    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, -1),     
-    TEST ("\0cb\0\0ge", "cb\0",        1, -1),
-    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, -1), 
-    TEST ("ab\0",       "ba\0d\0\0a",  2, -1),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  9, -1),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  4, -1),    
-    TEST ("aaaaabaaaa", "ccccccccca",  8,  5),   
-    TEST ("aabaabaaaa", "ccccccccca",  9,  5),  
-    TEST ("aabaabaaaa", "ccccccccca",  3,  2), 
-    TEST ("bbb",        "aaaaaaaaba",  2, -1),  
-    TEST ("cab",        "aaaaaaaaba",  0,  0),
-    TEST ("bbb",        "aaaaaaaaaa",  3,  2),      
+    //    |             |              |     +-- 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 ("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 ("\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 ("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 ("cab",        "aaaaaaaaba",  0,    0),
+    TEST ("bbb",        "aaaaaaaaaa",  3,    2),      
 
     TEST (LSTR,         "",     LLEN - 1, LLEN - 2),    
     TEST (LSTR,         "a",    LLEN - 1, LLEN - 2),     
-    TEST (LSTR,         "x",    LLEN - 1, -1),   
-    TEST (LSTR,         "xxx",  LLEN - 2, -1),
-    TEST (LSTR,         "xxx",         0, -1),
-    TEST (LSTR,         "xxx", LLEN - 10, -1),    
-    TEST (LSTR,         "aax", LLEN - 10, -1),     
-    TEST ("abc",        LSTR,          2,  2),    
-    TEST ("xxxxxxxxxx", LSTR,          6, -1),   
-    TEST ("xxxxaxxxxx", LSTR,          9,  4),
-
-    TEST (LSTR,         "xxx",         3, -1), 
-    TEST (LSTR,         "xxx",         2, -1),     
-
-    TEST ("abcdefghij", 0,             0, -1),    
-    TEST ("abcdefghij", 0,             9, -1),   
-    TEST ("\0cb\0\0ge", 0,             5, -1),    
-    TEST (LSTR,         0,             0, -1),  
-    TEST (LSTR,         0,             1, -1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("defghijabc", "abc",        15,  6),   
-    TEST ("defgabcabc", "cba",        15,  3), 
+    TEST (LSTR,         "x",    LLEN - 1, NPOS),   
+    TEST (LSTR,         "xxx",  LLEN - 2, NPOS),
+    TEST (LSTR,         "xxx",         0, NPOS),
+    TEST (LSTR,         "xxx", LLEN - 10, NPOS),    
+    TEST (LSTR,         "aax", LLEN - 10, NPOS),     
+    TEST ("abc",        LSTR,          2,    2),    
+    TEST ("xxxxxxxxxx", LSTR,          6, NPOS),   
+    TEST ("xxxxaxxxxx", LSTR,          9,    4),
+
+    TEST (LSTR,         "xxx",         3, NPOS), 
+    TEST (LSTR,         "xxx",         2, NPOS),     
+
+    TEST ("abcdefghij", 0,             0, NPOS),    
+    TEST ("abcdefghij", 0,             9, NPOS),   
+    TEST ("\0cb\0\0ge", 0,             5, NPOS),    
+    TEST (LSTR,         0,             0, NPOS),  
+    TEST (LSTR,         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)     
 };
 
 /**************************************************************************/
@@ -512,37 +513,37 @@
 #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",          'c',  1),   
-
-    TEST ("",            'a', -1),  
-    TEST ("",           '\0', -1),   
-
-    TEST ("\0",         '\0', -1),   
-    TEST ("\0\0",       '\0', -1),  
-    TEST ("\0",          'a',  0),  
-    TEST ("a\0",        '\0',  0),  
-
-    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', -1), 
-    TEST ("\0aaaaaaaa",  'a',  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\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 ("\0aaaaaaaa",  'a',    0),
 
-    TEST (LSTR,          'x', -1),  
+    TEST (LSTR,          'x', NPOS),  
     TEST (LSTR,         '\0', LLEN - 2),   
     TEST (LSTR,          'a', LLEN - 2), 
 
-    TEST ("last test",   't',  7)    
+    TEST ("last test",   't',    7)    
 };
 
 /**************************************************************************/
@@ -554,45 +555,45 @@
 #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_not_of() off argument
-    //    |              |     |   +----- expected result  
-    //    |              |     |   |                              
-    //    |              |     |   |               
-    //    V              V     V   V                   
-    TEST ("ab",          'c',  1,  1),    
-
-    TEST ("",            'a',  0, -1),   
-    TEST ("",           '\0',  0, -1),    
-
-    TEST ("\0",         '\0',  1, -1),    
-    TEST ("\0",          'a',  0,  0),   
-    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,  0),    
-    TEST ("e\0cb\0\0g", '\0',  5,  3),    
-    TEST ("\0ecb\0\0g", '\0',  0, -1),    
-    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, -1),   
-    TEST ("\0cbee\0\0", '\0',  6,  4),  
-    TEST ("\0cb\0\0\0", '\0',  9,  2),
-    TEST ("aaaaaaaaaa",  'a',  6, -1), 
-    TEST ("\0aaaaaaaa",  'a',  6,  0),
+    //    |              |     |     +--- 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 ("\0aaaaaaaa",  'a',  6,    0),
 
-    TEST (LSTR,          'x',  0, -1),
-    TEST (LSTR,          'x', LLEN - 1, -1),      
+    TEST (LSTR,          'x',  0, NPOS),
+    TEST (LSTR,          'x', LLEN - 1, NPOS),      
     TEST (LSTR,         '\0', LLEN - 1, LLEN - 2),    
     TEST (LSTR,          'a', LLEN - 3, LLEN - 3),     
-    TEST (LSTR,          'x', LLEN + 9, -1),
+    TEST (LSTR,          'x', LLEN + 9, NPOS),
 
-    TEST ("last test",   't',  9,  7)      
+    TEST ("last test",   't',  9,    7)      
 };
 
 /**************************************************************************/
@@ -616,7 +617,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 ();
@@ -690,7 +691,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