stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant...@apache.org
Subject svn commit: r398878 [1/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
Author: antonp
Date: Tue May  2 02:32:36 2006
New Revision: 398878

URL: http://svn.apache.org/viewcvs?rev=398878&view=rev
Log:
2006-05-02  Anton Pevtsov  <antonp@moscow.vdiweb.com>

	* 21.string.find.cpp (NPOS): New constant added
	for convenience.
	(ptr_test_cases, str_test_cases): Updated according 
	to changes in TestCase structure.
	(test_find): res_len renamed to nres according to
	changes in the TestCase structure.
	* 21.string.rfind.cpp: Same
	* 21.string.find.first.of.cpp: Same
	* 21.string.find.last.of.cpp: Same
	* 21.string.find.first.not.of.cpp: Same
	* 21.string.find.last.not.of.cpp: Same


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

Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.find.cpp?rev=398878&r1=398877&r2=398878&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.cpp Tue May  2 02:32:36 2006
@@ -44,6 +44,8 @@
 /**************************************************************************/
 
 // for convenience and brevity
+#define NPOS      _RWSTD_SIZE_MAX
+
 #define LSTR      StringMembers::long_string
 #define LLEN      StringMembers::long_string_len
 
@@ -61,65 +63,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",         "a",           0),   
-
-    TEST ("",           "",            0),   
-    TEST ("",           "\0",          0),    
-    TEST ("",           "a",          -1),   
-
-    TEST ("\0",         "",            0),    
-    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",        -1),    
-    TEST ("edfcbahjig", "cba",         3),    
-    TEST ("edfcbahcba", "cba",         3),   
-    TEST ("cbacbahjig", "cba",         0),  
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      3),    
-    TEST ("e\0cb\0\0g", "ecb",        -1),    
-    TEST ("\0cb\0\0ge", "\0\0ge",      0),   
-    TEST ("\0cb\0\0ge", "cb\0",        1),   
-    TEST ("e\0cbg\0\0", "bg",          3),    
-    TEST ("e\0cbg\0\0", "cba",        -1),  
-
-    TEST ("bcbedfbjih", "a",          -1),   
-    TEST ("bcaedfajih", "a",           2),    
-    TEST ("bcedfaajih", "a",           5),    
-    TEST ("bcaaedfaji", "a",           2),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0),     
-    TEST ("aaaaabaaaa", "aaaaaaaaaa", -1),   
-    TEST ("aaaabaaaaa", "aaaaa",       5),     
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0),    
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa", -1),    
-
-    TEST (LSTR,         "",            0),     
-    TEST (LSTR,         "a",          -1),  
-    TEST (LSTR,         "x",           0),    
-    TEST (LSTR,         "xxx",         0),    
-    TEST (LSTR,         "xxa",        -1),   
-    TEST ("abc",        LSTR,         -1),    
-    TEST ("xxxxxxxxxx", 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 ("",           "",              0),   
+    TEST ("",           "\0",            0),    
+    TEST ("",           "a",          NPOS),   
+
+    TEST ("\0",         "",              0),    
+    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",        NPOS),    
+    TEST ("edfcbahjig", "cba",           3),    
+    TEST ("edfcbahcba", "cba",           3),   
+    TEST ("cbacbahjig", "cba",           0),  
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        3),    
+    TEST ("e\0cb\0\0g", "ecb",        NPOS),    
+    TEST ("\0cb\0\0ge", "\0\0ge",        0),   
+    TEST ("\0cb\0\0ge", "cb\0",          1),   
+    TEST ("e\0cbg\0\0", "bg",            3),    
+    TEST ("e\0cbg\0\0", "cba",        NPOS),  
+
+    TEST ("bcbedfbjih", "a",          NPOS),   
+    TEST ("bcaedfajih", "a",             2),    
+    TEST ("bcedfaajih", "a",             5),    
+    TEST ("bcaaedfaji", "a",             2),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),     
+    TEST ("aaaaabaaaa", "aaaaaaaaaa", NPOS),   
+    TEST ("aaaabaaaaa", "aaaaa",         5),     
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",     0),    
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa", NPOS),    
+
+    TEST (LSTR,         "",              0),     
+    TEST (LSTR,         "a",          NPOS),  
+    TEST (LSTR,         "x",             0),    
+    TEST (LSTR,         "xxx",           0),    
+    TEST (LSTR,         "xxa",        NPOS),   
+    TEST ("abc",        LSTR,         NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,         NPOS),  
+
+    TEST ("abcdefghij", 0,               0),      
+    TEST ("\0cb\0\0ge", 0,               0),       
+    TEST (LSTR,         0,               0),       
 
-    TEST ("last test",  "test",        5)       
+    TEST ("last test",  "test",          5)       
 };
 
 /**************************************************************************/
@@ -131,70 +133,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 ("",           "",            0),   
-    TEST ("",           "\0",         -1),   
-    TEST ("",           "a",          -1),  
-
-    TEST ("\0",         "",            0),    
-    TEST ("\0",         "\0",          0),   
-    TEST ("\0",         "\0\0",       -1),   
-    TEST ("\0",         "a",          -1),   
-    TEST ("\0a",        "a\0",        -1),   
-
-    TEST ("bbcdefghij", "a",          -1),    
-    TEST ("abcdefghij", "a",           0),   
-    TEST ("abcdefghij", "f",           5),   
-    TEST ("abcdefghij", "j",           9),   
-
-    TEST ("edfcbbhjig", "cba",        -1),   
-    TEST ("edfcbahjig", "cba",         3),    
-    TEST ("edfcbahcba", "cba",         3),  
-    TEST ("cbacbahjig", "cba",         0),   
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      3),    
-    TEST ("e\0cb\0\0g", "ecb",        -1),    
-    TEST ("\0cb\0\0ge", "\0\0ge",      3),  
-    TEST ("\0cb\0\0ge", "cb\0",        1),  
-    TEST ("\0cb\0\0ge", "cb\0a",      -1),    
-    TEST ("e\0cbg\0\0", "bg",          3),   
-    TEST ("e\0cbg\0\0", "\0\0",        5),  
-    TEST ("e\0cbg\0\0", "\0\0a",      -1),   
-    TEST ("e\0cbg\0\0", "cba",        -1),  
-
-    TEST ("bcbedfbjih", "a",          -1),    
-    TEST ("bcaedfajih", "a",           2),     
-    TEST ("bcedfaajih", "a",           5),   
-    TEST ("bcaaedfaji", "a",           2),    
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0),   
-    TEST ("aaaaabaaaa", "aaaaaaaaaa", -1),    
-    TEST ("aaaabaaaaa", "aaaaa",       5),  
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0),    
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa", -1),  
-
-    TEST (LSTR,         "",            0),    
-    TEST (LSTR,         "a",          -1),    
-    TEST (LSTR,         "x",           0),  
-    TEST (LSTR,         "xxx",         0),    
-    TEST (LSTR,         "xxa",        -1),    
-    TEST ("abc",        LSTR,         -1),   
-    TEST ("xxxxxxxxxx", 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 ("",           "",              0),   
+    TEST ("",           "\0",         NPOS),   
+    TEST ("",           "a",          NPOS),  
+
+    TEST ("\0",         "",              0),    
+    TEST ("\0",         "\0",            0),   
+    TEST ("\0",         "\0\0",       NPOS),   
+    TEST ("\0",         "a",          NPOS),   
+    TEST ("\0a",        "a\0",        NPOS),   
+
+    TEST ("bbcdefghij", "a",          NPOS),    
+    TEST ("abcdefghij", "a",             0),   
+    TEST ("abcdefghij", "f",             5),   
+    TEST ("abcdefghij", "j",             9),   
+
+    TEST ("edfcbbhjig", "cba",        NPOS),   
+    TEST ("edfcbahjig", "cba",           3),    
+    TEST ("edfcbahcba", "cba",           3),  
+    TEST ("cbacbahjig", "cba",           0),   
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        3),    
+    TEST ("e\0cb\0\0g", "ecb",        NPOS),    
+    TEST ("\0cb\0\0ge", "\0\0ge",        3),  
+    TEST ("\0cb\0\0ge", "cb\0",          1),  
+    TEST ("\0cb\0\0ge", "cb\0a",      NPOS),    
+    TEST ("e\0cbg\0\0", "bg",            3),   
+    TEST ("e\0cbg\0\0", "\0\0",          5),  
+    TEST ("e\0cbg\0\0", "\0\0a",      NPOS),   
+    TEST ("e\0cbg\0\0", "cba",        NPOS),  
+
+    TEST ("bcbedfbjih", "a",          NPOS),    
+    TEST ("bcaedfajih", "a",             2),     
+    TEST ("bcedfaajih", "a",             5),   
+    TEST ("bcaaedfaji", "a",             2),    
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",    0),   
+    TEST ("aaaaabaaaa", "aaaaaaaaaa", NPOS),    
+    TEST ("aaaabaaaaa", "aaaaa",         5),  
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",     0),    
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa", NPOS),  
+
+    TEST (LSTR,         "",              0),    
+    TEST (LSTR,         "a",          NPOS),    
+    TEST (LSTR,         "x",             0),  
+    TEST (LSTR,         "xxx",           0),    
+    TEST (LSTR,         "xxa",        NPOS),    
+    TEST ("abc",        LSTR,         NPOS),   
+    TEST ("xxxxxxxxxx", LSTR,         NPOS),    
+
+    TEST ("abcdefghij", 0,               0),    
+    TEST ("\0cb\0\0ge", 0,               0),    
+    TEST (LSTR,         0,               0),     
 
-    TEST ("last test",  "test",        5)      
+    TEST ("last test",  "test",          5)      
 };
 
 /**************************************************************************/
@@ -206,85 +208,85 @@
 #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() off argument 
-    //    |            |               |   +----- expected result  
-    //    |            |               |   |                             
-    //    |            |               |   |             
-    //    V            V               V   V                 
-    TEST ("ab",        "a",            0,  0),   
-
-    TEST ("",           "",            0,  0),    
-    TEST ("",           "\0",          0,  0),    
-    TEST ("",           "a",           0, -1),    
-
-    TEST ("\0",         "",            0,  0),    
-    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, -1),    
-    TEST ("edfcbahjig", "cba",         1,  3),     
-    TEST ("edfcbahjig", "cba",         4, -1),    
-    TEST ("edfcbahcba", "cba",         1,  3),    
-    TEST ("edfcbahcba", "cba",         5,  7),    
-    TEST ("cbacbahjig", "cba",         5, -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", "ecb",         0, -1),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  6),  
-    TEST ("\0cb\0\0ge", "cb\0",        1,  1),     
-    TEST ("e\0cbg\0\0", "bg",          1,  3),   
-    TEST ("e\0cbg\0\0", "cba",         0, -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",  1, -1),    
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, -1),    
-    TEST ("aaaabaaaaa", "aaaaa",       0,  5),    
-    TEST ("aaaabaaaaa", "aaaaa",       6, -1),   
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,  0),     
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,  1),   
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2, -1),    
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0, -1),    
-
-    TEST (LSTR,         "",            0,  0),    
-    TEST (LSTR,         "a",           0, -1),     
-    TEST (LSTR,         "x",           0,  0),     
-    TEST (LSTR,         "xxx",        10, 10),    
-    TEST (LSTR,         "xxa",        10, -1),     
-    TEST ("abc",        LSTR,          2, -1),    
-    TEST ("xxxxxxxxxx", LSTR,          0, -1),   
+    //    |            |               |      +-- expected result  
+    //    |            |               |      |                             
+    //    |            |               |      |             
+    //    V            V               V      V                 
+    TEST ("ab",        "a",            0,     0),   
+
+    TEST ("",           "",            0,     0),    
+    TEST ("",           "\0",          0,     0),    
+    TEST ("",           "a",           0,  NPOS),    
+
+    TEST ("\0",         "",            0,     0),    
+    TEST ("\0",         "\0",          0,     0),   
+    TEST ("\0",         "\0",          1,     1),    
+    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,  NPOS),    
+    TEST ("edfcbahjig", "cba",         1,     3),     
+    TEST ("edfcbahjig", "cba",         4,  NPOS),    
+    TEST ("edfcbahcba", "cba",         1,     3),    
+    TEST ("edfcbahcba", "cba",         5,     7),    
+    TEST ("cbacbahjig", "cba",         5,  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", "ecb",         0,  NPOS),     
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,     6),  
+    TEST ("\0cb\0\0ge", "cb\0",        1,     1),     
+    TEST ("e\0cbg\0\0", "bg",          1,     3),   
+    TEST ("e\0cbg\0\0", "cba",         0,  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",  1,  NPOS),    
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0,  NPOS),    
+    TEST ("aaaabaaaaa", "aaaaa",       0,     5),    
+    TEST ("aaaabaaaaa", "aaaaa",       6,  NPOS),   
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,     0),     
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,     1),   
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  NPOS),    
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0,  NPOS),    
+
+    TEST (LSTR,         "",            0,     0),    
+    TEST (LSTR,         "a",           0,  NPOS),     
+    TEST (LSTR,         "x",           0,     0),     
+    TEST (LSTR,         "xxx",        10,    10),    
+    TEST (LSTR,         "xxa",        10,  NPOS),     
+    TEST ("abc",        LSTR,          2,  NPOS),    
+    TEST ("xxxxxxxxxx", LSTR,          0,  NPOS),   
 
     TEST (LSTR,         "xxx",  LLEN - 4, LLEN - 4), 
-    TEST (LSTR,         "xxx",  LLEN - 3, -1),     
+    TEST (LSTR,         "xxx",  LLEN - 3,  NPOS),     
 
-    TEST ("abcdefghij", 0,             0,  0),    
-    TEST ("abcdefghij", 0,             1, -1),   
-    TEST ("\0cb\0\0ge", 0,             5,  5),    
-    TEST (LSTR,         0,             0,  0),  
-    TEST (LSTR,         0,             1, -1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10, -1),   
-    TEST ("abcdefghij", "cba",        10, -1),    
+    TEST ("abcdefghij", 0,             0,     0),    
+    TEST ("abcdefghij", 0,             1,  NPOS),   
+    TEST ("\0cb\0\0ge", 0,             5,     5),    
+    TEST (LSTR,         0,             0,     0),  
+    TEST (LSTR,         0,             1,  NPOS),    
+
+    TEST ("",           "",            1,  NPOS),  
+    TEST ("abcdefghij", "abc",        10,  NPOS),   
+    TEST ("abcdefghij", "cba",        10,  NPOS),    
 
-    TEST ("last test", "test",         0,  5)      
+    TEST ("last test", "test",         0,     5)      
 };
 
 /**************************************************************************/
@@ -296,111 +298,111 @@
 #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() off argument 
     //    |            |               |   +------ find() 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,  0,       0),
-    TEST ("",           "\0",          0,  0,  0,       0),
-    TEST ("",           "\0",          0,  1, -1,       0),
-    TEST ("",           "a",           0,  0,  0,       0),
-    TEST ("",           "a",           0,  1, -1,       0),
-
-    TEST ("\0",         "",            0,  0,  0,       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, -1,       0),
-    TEST ("edfcbbhjig", "cba",         0,  2,  3,       0),
-    TEST ("edfcbahjig", "cba",         1,  3,  3,       0),
-    TEST ("edfcbahjig", "cba",         4,  3, -1,       0),
-    TEST ("edfcbahjig", "cba",         4,  1, -1,       0),
-    TEST ("edfcbahcba", "cba",         1,  3,  3,       0),
-    TEST ("edfcbehcba", "cba",         1,  2,  3,       0),
-    TEST ("edfcbahcba", "cba",         5,  3,  7,       0),
-    TEST ("cbacbahjig", "cba",         5,  3, -1,       0),
-    TEST ("cbacbahjcg", "cba",         5,  1,  8,       0),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4,  3,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4, -1,       0),
-    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,  6,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      2,  2,  5,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      0,  2,  1,       0),
-    TEST ("\0b\0\0gb\0","b\0\0g",      0,  3,  1,       0),
-    TEST ("e\0cb\0\0g", "ecb",         0,  2, -1,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4, -1,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  0,  6,       0),
-    TEST ("\0cb\0\0ge", "cb\0",        1,  3,  1,       0),
-    TEST ("e\0cbg\0\0", "bg",          1,  2,  3,       0),
-    TEST ("e\0cbg\0\0", "cba",         0,  3, -1,       0),
-    TEST ("e\0cbg\0\0", "cba",         0,  2,  2,       0),
-
-    TEST ("e\0a\0",     "e\0a\0\0",    0,  4,  0,       0),
-    TEST ("e\0a\0",     "e\0a\0\0",    0,  5, -1,       0),
-    TEST ("ee\0a\0",    "e\0a\0\0",    1,  4,  1,       0),
-    TEST ("ee\0a\0",    "e\0a\0\0",    1,  5, -1,       0),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, 10,  0,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1, 10, -1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1,  9,  1,       0),
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, 10, -1,       0),
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,  4,  1,       0),
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  2,  4,  6,       0),
-    TEST ("aaaabaaaaa", "aaaaa",       0,  5,  5,       0),
-    TEST ("aaaabaaaaa", "aaaaa",       0,  4,  0,       0),
-    TEST ("aaaabaaaaa", "aaaaa",       6,  5, -1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,  9,  0,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,  9,  1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  9, -1,       0),
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  8,  2,       0),
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0, 10, -1,       0),
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0,  7,  0,       0),
-
-    TEST (LSTR,         "",            0,  0,  0,       0),
-    TEST (LSTR,         "a",           0,  1, -1,       0),
-    TEST (LSTR,         "x",           0,  1,  0,       0),
-    TEST (LSTR,         "xxx",        10,  3, 10,       0),
-    TEST (LSTR,         "xxa",        10,  3, -1,       0),
-    TEST (LSTR,         "xxa",        10,  2, 10,       0),
-    TEST ("abc",        LSTR,          2, 10, -1,       0),
-    TEST ("xxxxxxxxxx", LSTR,          0, LLEN - 1, -1, 0),
-    TEST ("xxxxxxxxxx", LSTR,          2,  4,  2,       0),
-
-    TEST (LSTR,         "xxx",  LLEN - 4,  3, LLEN - 4, 0),
-    TEST (LSTR,         "xxx",  LLEN - 3,  3, -1,       0),
-    TEST (LSTR,         "xxx",  LLEN - 3,  2, LLEN - 3, 0),
-
-    TEST ("abcdefghij", 0,             0,  9,  0,       0),
-    TEST ("abcdefghij", 0,             1,  9, -1,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  7, -1,       0),
-    TEST ("\0cb\0ge\0", 0,             6,  1,  6,       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 ("",           "",            1,  0, -1,       0),
-    TEST ("abcdefghij", "abc",        10,  3, -1,       0),
-    TEST ("abcdefghij", "cba",        10,  1, -1,       0),
-
-    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),
+    //    |            |               |   |     +-- 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,    0,       0),
+    TEST ("",           "\0",          0,  0,    0,       0),
+    TEST ("",           "\0",          0,  1, NPOS,       0),
+    TEST ("",           "a",           0,  0,    0,       0),
+    TEST ("",           "a",           0,  1, NPOS,       0),
+
+    TEST ("\0",         "",            0,  0,    0,       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, NPOS,       0),
+    TEST ("edfcbbhjig", "cba",         0,  2,    3,       0),
+    TEST ("edfcbahjig", "cba",         1,  3,    3,       0),
+    TEST ("edfcbahjig", "cba",         4,  3, NPOS,       0),
+    TEST ("edfcbahjig", "cba",         4,  1, NPOS,       0),
+    TEST ("edfcbahcba", "cba",         1,  3,    3,       0),
+    TEST ("edfcbehcba", "cba",         1,  2,    3,       0),
+    TEST ("edfcbahcba", "cba",         5,  3,    7,       0),
+    TEST ("cbacbahjig", "cba",         5,  3, NPOS,       0),
+    TEST ("cbacbahjcg", "cba",         5,  1,    8,       0),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4,    3,       0),
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4, NPOS,       0),
+    TEST ("e\0cb\0\0b", "b\0\0g",      4,  1,    6,       0),
+    TEST ("\0b\0\0gb\0","b\0\0g",      2,  2,    5,       0),
+    TEST ("\0b\0\0gb\0","b\0\0g",      0,  2,    1,       0),
+    TEST ("\0b\0\0gb\0","b\0\0g",      0,  3,    1,       0),
+    TEST ("e\0cb\0\0g", "ecb",         0,  2, NPOS,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  4, NPOS,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  0,    6,       0),
+    TEST ("\0cb\0\0ge", "cb\0",        1,  3,    1,       0),
+    TEST ("e\0cbg\0\0", "bg",          1,  2,    3,       0),
+    TEST ("e\0cbg\0\0", "cba",         0,  3, NPOS,       0),
+    TEST ("e\0cbg\0\0", "cba",         0,  2,    2,       0),
+
+    TEST ("e\0a\0",     "e\0a\0\0",    0,  4,    0,       0),
+    TEST ("e\0a\0",     "e\0a\0\0",    0,  5, NPOS,       0),
+    TEST ("ee\0a\0",    "e\0a\0\0",    1,  4,    1,       0),
+    TEST ("ee\0a\0",    "e\0a\0\0",    1,  5, NPOS,       0),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, 10,    0,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1, 10, NPOS,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  1,  9,    1,       0),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, 10, NPOS,       0),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,  4,    1,       0),
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  2,  4,    6,       0),
+    TEST ("aaaabaaaaa", "aaaaa",       0,  5,    5,       0),
+    TEST ("aaaabaaaaa", "aaaaa",       0,  4,    0,       0),
+    TEST ("aaaabaaaaa", "aaaaa",       6,  5, NPOS,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,  9,    0,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,  9,    1,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  9, NPOS,       0),
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2,  8,    2,       0),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0, 10, NPOS,       0),
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0,  7,    0,       0),
+
+    TEST (LSTR,         "",            0,  0,    0,       0),
+    TEST (LSTR,         "a",           0,  1, NPOS,       0),
+    TEST (LSTR,         "x",           0,  1,    0,       0),
+    TEST (LSTR,         "xxx",        10,  3,   10,       0),
+    TEST (LSTR,         "xxa",        10,  3, NPOS,       0),
+    TEST (LSTR,         "xxa",        10,  2,   10,       0),
+    TEST ("abc",        LSTR,          2, 10, NPOS,       0),
+    TEST ("xxxxxxxxxx", LSTR,          0, LLEN - 1, NPOS, 0),
+    TEST ("xxxxxxxxxx", LSTR,          2,  4,    2,       0),
+
+    TEST (LSTR,         "xxx",  LLEN - 4,  3, LLEN - 4,   0),
+    TEST (LSTR,         "xxx",  LLEN - 3,  3, NPOS,       0),
+    TEST (LSTR,         "xxx",  LLEN - 3,  2, LLEN - 3,   0),
+
+    TEST ("abcdefghij", 0,             0,  9,    0,       0),
+    TEST ("abcdefghij", 0,             1,  9, NPOS,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  7, NPOS,       0),
+    TEST ("\0cb\0ge\0", 0,             6,  1,    6,       0),
+    TEST (LSTR,         0,             0, LLEN - 1,  0,   0),
+    TEST (LSTR,         0,             1, LLEN - 1, NPOS, 0),
+    TEST (LSTR,         0,             5, LLEN - 6,  5,   0),
+
+    TEST ("",           "",            1,  0, NPOS,       0),
+    TEST ("abcdefghij", "abc",        10,  3, NPOS,       0),
+    TEST ("abcdefghij", "cba",        10,  1, NPOS,       0),
+
+    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 ("last test", "test",         0,  4,  5,       0)
+    TEST ("last test", "test",         0,  4,    5,       0)
 };
 
 /**************************************************************************/
@@ -412,89 +414,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() off argument
-    //    |             |              |   +------ expected result 
-    //    |             |              |   |                          
-    //    |             |              |   |           
-    //    V             V              V   V                
-    TEST ("ab",         "a",           0,  0),     
-
-    TEST ("",           "",            0,  0),     
-    TEST ("",           "\0",          0, -1),    
-    TEST ("",           "a",           0, -1),    
-
-    TEST ("\0",         "",            0,  0),    
-    TEST ("\0",         "\0",          0,  0),   
-    TEST ("\0",         "\0",          1, -1),    
-    TEST ("\0\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, -1),    
-    TEST ("edfcbahjig", "cba",         1,  3),    
-    TEST ("edfcbahjig", "cba",         4, -1),   
-    TEST ("edfcbahcba", "cba",         1,  3),   
-    TEST ("edfcbahcba", "cba",         5,  7),   
-    TEST ("cbacbahjig", "cba",         5, -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", "ecb",         0, -1),   
-    TEST ("\0cb\0\0ge", "\0\0ge",      6, -1),   
-    TEST ("\0cb\0\0ge", "\0\0ge",      1,  3),    
-    TEST ("\0cb\0\0ge", "cb\0",        1,  1),    
-    TEST ("\0cbg\0\0e", "cb\0",        1, -1),    
-    TEST ("e\0cbg\0\0", "bg",          1,  3),   
-    TEST ("e\0cbg\0\0", "cba",         0, -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",  1, -1),    
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, -1),    
-    TEST ("aaaabaaaaa", "aaaaa",       0,  5),    
-    TEST ("aaaabaaaaa", "aaaaa",       6, -1),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,  0),    
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,  1),   
-    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2, -1),   
-    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0, -1),    
-
-    TEST (LSTR,         "",            0,  0),    
-    TEST (LSTR,         "a",           0, -1),    
-    TEST (LSTR,         "x",           0,  0),   
-    TEST (LSTR,         "xxx",        10, 10),     
-    TEST (LSTR,         "xxa",        10, -1),    
-    TEST ("abc",        LSTR,          2, -1),   
-    TEST ("xxxxxxxxxx", LSTR,          0, -1),    
+    //    |             |              |     +---- expected result 
+    //    |             |              |     |                          
+    //    |             |              |     |           
+    //    V             V              V     V                
+    TEST ("ab",         "a",           0,    0),     
+
+    TEST ("",           "",            0,    0),     
+    TEST ("",           "\0",          0, NPOS),    
+    TEST ("",           "a",           0, NPOS),    
+
+    TEST ("\0",         "",            0,    0),    
+    TEST ("\0",         "\0",          0,    0),   
+    TEST ("\0",         "\0",          1, NPOS),    
+    TEST ("\0\0",       "\0",          1,    1),   
+    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, NPOS),    
+    TEST ("edfcbahjig", "cba",         1,    3),    
+    TEST ("edfcbahjig", "cba",         4, NPOS),   
+    TEST ("edfcbahcba", "cba",         1,    3),   
+    TEST ("edfcbahcba", "cba",         5,    7),   
+    TEST ("cbacbahjig", "cba",         5, 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", "ecb",         0, NPOS),   
+    TEST ("\0cb\0\0ge", "\0\0ge",      6, NPOS),   
+    TEST ("\0cb\0\0ge", "\0\0ge",      1,    3),    
+    TEST ("\0cb\0\0ge", "cb\0",        1,    1),    
+    TEST ("\0cbg\0\0e", "cb\0",        1, NPOS),    
+    TEST ("e\0cbg\0\0", "bg",          1,    3),   
+    TEST ("e\0cbg\0\0", "cba",         0, 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",  1, NPOS),    
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  0, NPOS),    
+    TEST ("aaaabaaaaa", "aaaaa",       0,    5),    
+    TEST ("aaaabaaaaa", "aaaaa",       6, NPOS),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   0,    0),    
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   1,    1),   
+    TEST ("aaaaaaaaaa", "aaaaaaaaa",   2, NPOS),   
+    TEST ("aaaaaaaaa",  "aaaaaaaaaa",  0, NPOS),    
+
+    TEST (LSTR,         "",            0,    0),    
+    TEST (LSTR,         "a",           0, NPOS),    
+    TEST (LSTR,         "x",           0,    0),   
+    TEST (LSTR,         "xxx",        10,   10),     
+    TEST (LSTR,         "xxa",        10, NPOS),    
+    TEST ("abc",        LSTR,          2, NPOS),   
+    TEST ("xxxxxxxxxx", LSTR,          0, NPOS),    
 
     TEST (LSTR,         "xxx",  LLEN - 4, LLEN - 4), 
-    TEST (LSTR,         "xxx",  LLEN - 3, -1),   
+    TEST (LSTR,         "xxx",  LLEN - 3, NPOS),   
 
-    TEST ("abcdefghij", 0,             0,  0),    
-    TEST ("abcdefghij", 0,             1, -1),   
-    TEST ("\0cb\0\0ge", 0,             5, -1),   
-    TEST ("\0cb\0\0ge", 0,             0,  0),    
-    TEST (LSTR,         0,             0,  0),    
-    TEST (LSTR,         0,             1, -1),   
-
-    TEST ("",           "",            1, -1),   
-    TEST ("abcdefghij", "abc",        10, -1),  
-    TEST ("abcdefghij", "cba",        10, -1),   
+    TEST ("abcdefghij", 0,             0,    0),    
+    TEST ("abcdefghij", 0,             1, NPOS),   
+    TEST ("\0cb\0\0ge", 0,             5, NPOS),   
+    TEST ("\0cb\0\0ge", 0,             0,    0),    
+    TEST (LSTR,         0,             0,    0),    
+    TEST (LSTR,         0,             1, NPOS),   
+
+    TEST ("",           "",            1, NPOS),   
+    TEST ("abcdefghij", "abc",        10, NPOS),  
+    TEST ("abcdefghij", "cba",        10, NPOS),   
 
-    TEST ("last test",  "test",        0,  5)     
+    TEST ("last test",  "test",        0,    5)     
 };
 
 /**************************************************************************/
@@ -506,35 +508,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)    
 };
 
 /**************************************************************************/
@@ -546,47 +548,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() 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)      
 };
 
 /**************************************************************************/
@@ -610,7 +612,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 ();
@@ -684,7 +686,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.first.not.of.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp?rev=398878&r1=398877&r2=398878&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.first.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",           0),   
-
-    TEST ("",           "",           -1),   
-    TEST ("",           "\0",         -1),    
-    TEST ("",           "a",          -1),   
-
-    TEST ("\0",         "",            0),    
-    TEST ("\0",         "\0",          0),   
-    TEST ("\0",         "a",           0),   
-
-    TEST ("bbcdefghij", "a",           0),    
-    TEST ("abcdefghij", "a",           1),  
-    TEST ("abcdefghij", "f",           0),   
-
-    TEST ("eaccbbhjig", "cba",         0),     
-    TEST ("ceabcbahca", "cba",         1),   
-    TEST ("bacbahjicg", "cba",         5),  
-    TEST ("abbcbacbca", "cba",        -1),
-    TEST ("bcbedfbjih", "abce",        4),   
-    TEST ("bcaedfajih", "aabced",      5),    
-    TEST ("bcedfaacdh", "abcdef",      9),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0),  
-    TEST ("e\0cb\0\0g", "cbe",         1),    
-    TEST ("\0cb\0\0ge", "\0\0ge",      0),   
-    TEST ("bcbc\0\0be", "b\0c",        1),   
-    TEST ("gbg\0\0e\0", "bg",          3),      
-    TEST ("a\0b",       "e\0gbg\0\0",  0),    
-    TEST ("b\0a",       "eb\0gg\0\0",  1), 
-    TEST ("ab\0",       "ab\0gg\0\0",  2),   
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa", -1),     
-    TEST ("aaaaabaaaa", "cccccccccb",  0),   
-    TEST ("aabaabaaaa", "aaaaaaaaab", -1),
-    TEST ("bbb",        "aaaaaaaaba", -1),        
-    TEST ("aab",        "aaaaaaaaaa",  2),    
-
-    TEST (LSTR,         "",            0),     
-    TEST (LSTR,         "a",           0),  
-    TEST (LSTR,         "x",          -1),       
-    TEST (LSTR,         "axa",        -1),   
-    TEST ("abc",        LSTR,          0),    
-    TEST ("xabc",       LSTR,          1),  
-
-    TEST ("abcdefghij", 0,            -1),      
-    TEST ("\0cb\0\0ge", 0,             0),       
-    TEST (LSTR,         0,            -1),
+    //    |             |                +---- expected result 
+    //    |             |                |                               
+    //    |             |                |                     
+    //    V             V                V        
+    TEST ("ab",         "c",             0),   
+
+    TEST ("",           "",           NPOS),   
+    TEST ("",           "\0",         NPOS),    
+    TEST ("",           "a",          NPOS),   
+
+    TEST ("\0",         "",              0),    
+    TEST ("\0",         "\0",            0),   
+    TEST ("\0",         "a",             0),   
+
+    TEST ("bbcdefghij", "a",             0),    
+    TEST ("abcdefghij", "a",             1),  
+    TEST ("abcdefghij", "f",             0),   
+
+    TEST ("eaccbbhjig", "cba",           0),     
+    TEST ("ceabcbahca", "cba",           1),   
+    TEST ("bacbahjicg", "cba",           5),  
+    TEST ("abbcbacbca", "cba",        NPOS),
+    TEST ("bcbedfbjih", "abce",          4),   
+    TEST ("bcaedfajih", "aabced",        5),    
+    TEST ("bcedfaacdh", "abcdef",        9),    
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        0),  
+    TEST ("e\0cb\0\0g", "cbe",           1),    
+    TEST ("\0cb\0\0ge", "\0\0ge",        0),   
+    TEST ("bcbc\0\0be", "b\0c",          1),   
+    TEST ("gbg\0\0e\0", "bg",            3),      
+    TEST ("a\0b",       "e\0gbg\0\0",    0),    
+    TEST ("b\0a",       "eb\0gg\0\0",    1), 
+    TEST ("ab\0",       "ab\0gg\0\0",    2),   
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),     
+    TEST ("aaaaabaaaa", "cccccccccb",    0),   
+    TEST ("aabaabaaaa", "aaaaaaaaab", NPOS),
+    TEST ("bbb",        "aaaaaaaaba", NPOS),        
+    TEST ("aab",        "aaaaaaaaaa",    2),    
+
+    TEST (LSTR,         "",              0),     
+    TEST (LSTR,         "a",             0),  
+    TEST (LSTR,         "x",          NPOS),       
+    TEST (LSTR,         "axa",        NPOS),   
+    TEST ("abc",        LSTR,            0),    
+    TEST ("xabc",       LSTR,            1),  
+
+    TEST ("abcdefghij", 0,            NPOS),      
+    TEST ("\0cb\0\0ge", 0,               0),       
+    TEST (LSTR,         0,            NPOS),
 
-    TEST ("last test",  "test",        0)       
+    TEST ("last test",  "test",          0)       
 };
 
 /**************************************************************************/
@@ -129,66 +130,66 @@
 #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",           0),   
-
-    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 ("bbcdefghij", "a",           0),    
-    TEST ("abcdefghij", "a",           1),  
-    TEST ("abcdefghij", "f",           0),   
-
-    TEST ("eaccbbhjig", "cba",         0),     
-    TEST ("ceabcbahca", "cba",         1),   
-    TEST ("bacbahjicg", "cba",         5),  
-    TEST ("abbcbacbca", "cba",        -1),
-    TEST ("bcbedfbjih", "abce",        4),   
-    TEST ("bcaedfajih", "aabced",      5),    
-    TEST ("bcedfaacdh", "abcdef",      9),    
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0),
-    TEST ("\0cb\0\0ge", "b\0\0g",      1),
-    TEST ("\0gb\0\0ge", "b\0\0g",      6),
-    TEST ("e\0cb\0\0g", "cbe",         1),    
-    TEST ("\0cb\0\0ge", "\0\0ge",      1),   
-    TEST ("bcbc\0\0bc", "b\0c",       -1),   
-    TEST ("gbg\0\0e\0", "bg",          3),      
-    TEST ("a\0b",       "e\0gbg\0\0",  0),    
-    TEST ("b\0a",       "eb\0gg\0\0",  2), 
-    TEST ("ab\0",       "ab\0gg\0\0", -1),   
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa", -1),     
-    TEST ("aaaaabaaaa", "cccccccccb",  0),   
-    TEST ("aabaabaaaa", "aaaaaaaaab", -1),
-    TEST ("bbb",        "aaaaaaaaba", -1),        
-    TEST ("aab",        "aaaaaaaaaa",  2),    
-
-    TEST (LSTR,         "",            0),     
-    TEST (LSTR,         "a",           0),  
-    TEST (LSTR,         "x",          -1),       
-    TEST (LSTR,         "axa",        -1),   
-    TEST ("abc",        LSTR,          0),    
-    TEST ("xabc",       LSTR,          1),  
-
-    TEST ("abcdefghij", 0,            -1),      
-    TEST ("\0cb\0\0ge", 0,            -1),       
-    TEST (LSTR,         0,            -1),
+    //    |             |                +----- expected result 
+    //    |             |                |                               
+    //    |             |                |                     
+    //    V             V                V        
+    TEST ("ab",         "c",             0),   
+
+    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 ("bbcdefghij", "a",             0),    
+    TEST ("abcdefghij", "a",             1),  
+    TEST ("abcdefghij", "f",             0),   
+
+    TEST ("eaccbbhjig", "cba",           0),     
+    TEST ("ceabcbahca", "cba",           1),   
+    TEST ("bacbahjicg", "cba",           5),  
+    TEST ("abbcbacbca", "cba",        NPOS),
+    TEST ("bcbedfbjih", "abce",          4),   
+    TEST ("bcaedfajih", "aabced",        5),    
+    TEST ("bcedfaacdh", "abcdef",        9),    
+
+    TEST ("e\0cb\0\0g", "b\0\0g",        0),
+    TEST ("\0cb\0\0ge", "b\0\0g",        1),
+    TEST ("\0gb\0\0ge", "b\0\0g",        6),
+    TEST ("e\0cb\0\0g", "cbe",           1),    
+    TEST ("\0cb\0\0ge", "\0\0ge",        1),   
+    TEST ("bcbc\0\0bc", "b\0c",       NPOS),   
+    TEST ("gbg\0\0e\0", "bg",            3),      
+    TEST ("a\0b",       "e\0gbg\0\0",    0),    
+    TEST ("b\0a",       "eb\0gg\0\0",    2), 
+    TEST ("ab\0",       "ab\0gg\0\0", NPOS),   
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa", NPOS),     
+    TEST ("aaaaabaaaa", "cccccccccb",    0),   
+    TEST ("aabaabaaaa", "aaaaaaaaab", NPOS),
+    TEST ("bbb",        "aaaaaaaaba", NPOS),        
+    TEST ("aab",        "aaaaaaaaaa",    2),    
+
+    TEST (LSTR,         "",              0),     
+    TEST (LSTR,         "a",             0),  
+    TEST (LSTR,         "x",          NPOS),       
+    TEST (LSTR,         "axa",        NPOS),   
+    TEST ("abc",        LSTR,            0),    
+    TEST ("xabc",       LSTR,            1),  
+
+    TEST ("abcdefghij", 0,            NPOS),      
+    TEST ("\0cb\0\0ge", 0,            NPOS),       
+    TEST (LSTR,         0,            NPOS),
 
-    TEST ("last test",  "test",        0)      
+    TEST ("last test",  "test",          0)      
 };
 
 /**************************************************************************/
@@ -200,82 +201,82 @@
 #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_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",         "\0",          0,  0),   
-    TEST ("\0",         "\0",          1, -1),    
-    TEST ("\0",         "a",           0,  0),    
-
-    TEST ("bbcdefghij", "a",           0,  0),    
-    TEST ("abcdefghij", "a",           0,  1),   
-    TEST ("bcaaaaaaaa", "a",           2, -1),    
-    TEST ("bcaaafaaaa", "a",           2,  5),      
-    TEST ("abcdefghij", "j",           9, -1),  
-
-    TEST ("cbbedfhjig", "cba",         0,  3),    
-    TEST ("edfcbahjig", "cba",         4,  6),     
-    TEST ("edfcbaaabc", "cba",         6, -1),    
-    TEST ("edfcbahcba", "cba",         9, -1),       
-    TEST ("cbacbabjig", "cbaig",       0,  7),    
-    TEST ("bcaedfajih", "aabced",      0,  5),    
-    TEST ("bcedfaacdh", "abcdef",      3,  9),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  0),    
-    TEST ("\0cbe\0\0g", "b\0\0g",      4,  4),    
-    TEST ("e\0cb\0\0g", "cbe",         0,  1),     
-    TEST ("\0cb\0\0ge", "\0\0ge",      0,  0),  
-    TEST ("\0cb\0\0ge", "cb\0",        6,  6),     
-    TEST ("e\0gbg\0\0", "bg",          2,  5),     
-    TEST ("a\0b",       "a\0gbg\0\0",  0,  1),    
-    TEST ("ab\0",       "ab\0gg\0\0",  1,  2), 
-    TEST ("a\0b",       "e\0gg\0\0a",  3, -1),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, -1),    
-    TEST ("aaabaaaaaa", "aaaaaaaaaa",  4, -1),    
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,  5),   
-    TEST ("aabaabaaaa", "aaaaaaaaaa",  0,  2),  
-    TEST ("aabaabaaaa", "aaaaaaaaaa",  3,  5), 
-    TEST ("aabaabaaaa", "aaaaaaaaab",  0, -1),
-    TEST ("cbb",        "aaaaaaaaba",  2, -1),  
-    TEST ("bac",        "aaaaaaaaba",  0,  2),
-    TEST ("baa",        "aaaaaaaaaa",  0,  0),     
-
-    TEST (LSTR,         "",            0,  0),    
-    TEST (LSTR,         "a",           0,  0),     
-    TEST (LSTR,         "x",           0, -1),     
-    TEST (LSTR,         "xxx",        10, -1),    
-    TEST (LSTR,         "axa",        10, -1),     
-    TEST ("abc",        LSTR,          2,  2),    
-    TEST ("xxxxxxxxxx", LSTR,          0, -1),   
-
-    TEST (LSTR,         "xxx",  LLEN - 4, -1), 
-    TEST (LSTR,         "xxx",  LLEN - 1, -1),     
-
-    TEST ("abcdefghij", 0,             0, -1),    
-    TEST ("abcdefghij", 0,             1, -1),   
-    TEST ("\0cb\0\0ge", 0,             5,  5),    
-    TEST (LSTR,         0,             0, -1),  
-    TEST (LSTR,         0,             7, -1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10, -1),   
-    TEST ("abcdefghij", "cba",        10, -1), 
+    //    |            |               |     +- 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",         "\0",          0,    0),   
+    TEST ("\0",         "\0",          1, NPOS),    
+    TEST ("\0",         "a",           0,    0),    
+
+    TEST ("bbcdefghij", "a",           0,    0),    
+    TEST ("abcdefghij", "a",           0,    1),   
+    TEST ("bcaaaaaaaa", "a",           2, NPOS),    
+    TEST ("bcaaafaaaa", "a",           2,    5),      
+    TEST ("abcdefghij", "j",           9, NPOS),  
+
+    TEST ("cbbedfhjig", "cba",         0,    3),    
+    TEST ("edfcbahjig", "cba",         4,    6),     
+    TEST ("edfcbaaabc", "cba",         6, NPOS),    
+    TEST ("edfcbahcba", "cba",         9, NPOS),       
+    TEST ("cbacbabjig", "cbaig",       0,    7),    
+    TEST ("bcaedfajih", "aabced",      0,    5),    
+    TEST ("bcedfaacdh", "abcdef",      3,    9),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,    0),    
+    TEST ("\0cbe\0\0g", "b\0\0g",      4,    4),    
+    TEST ("e\0cb\0\0g", "cbe",         0,    1),     
+    TEST ("\0cb\0\0ge", "\0\0ge",      0,    0),  
+    TEST ("\0cb\0\0ge", "cb\0",        6,    6),     
+    TEST ("e\0gbg\0\0", "bg",          2,    5),     
+    TEST ("a\0b",       "a\0gbg\0\0",  0,    1),    
+    TEST ("ab\0",       "ab\0gg\0\0",  1,    2), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3, NPOS),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, NPOS),    
+    TEST ("aaabaaaaaa", "aaaaaaaaaa",  4, NPOS),    
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,    5),   
+    TEST ("aabaabaaaa", "aaaaaaaaaa",  0,    2),  
+    TEST ("aabaabaaaa", "aaaaaaaaaa",  3,    5), 
+    TEST ("aabaabaaaa", "aaaaaaaaab",  0, NPOS),
+    TEST ("cbb",        "aaaaaaaaba",  2, NPOS),  
+    TEST ("bac",        "aaaaaaaaba",  0,    2),
+    TEST ("baa",        "aaaaaaaaaa",  0,    0),     
+
+    TEST (LSTR,         "",            0,    0),    
+    TEST (LSTR,         "a",           0,    0),     
+    TEST (LSTR,         "x",           0, NPOS),     
+    TEST (LSTR,         "xxx",        10, NPOS),    
+    TEST (LSTR,         "axa",        10, NPOS),     
+    TEST ("abc",        LSTR,          2,    2),    
+    TEST ("xxxxxxxxxx", LSTR,          0, NPOS),   
+
+    TEST (LSTR,         "xxx",  LLEN - 4, NPOS), 
+    TEST (LSTR,         "xxx",  LLEN - 1, NPOS),     
+
+    TEST ("abcdefghij", 0,             0, NPOS),    
+    TEST ("abcdefghij", 0,             1, NPOS),   
+    TEST ("\0cb\0\0ge", 0,             5,    5),    
+    TEST (LSTR,         0,             0, NPOS),  
+    TEST (LSTR,         0,             7, NPOS),    
+
+    TEST ("",           "",            1, NPOS),  
+    TEST ("abcdefghij", "abc",        10, NPOS),   
+    TEST ("abcdefghij", "cba",        10, NPOS), 
 
-    TEST ("last test", "test",         0,  0)      
+    TEST ("last test", "test",         0,    0)      
 };
 
 /**************************************************************************/
@@ -287,120 +288,120 @@
 #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_not_of() off argument
     //    |            |               |   +- find_first_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 ("cbbedfhjig", "cba",         0,  3,  3,       0),
-    TEST ("edfcbbhjig", "bac",         0,  2,  0,       0),
-    TEST ("edfcbahaib", "cba",         7,  3,  8,       0),
-    TEST ("edfcbahbcb", "cba",         7,  2, -1,       0),
-    TEST ("edfcbahbcb", "cba",         3,  2,  5,       0),
-    TEST ("edfcbahcba", "bac",         3,  3,  6,       0),
-    TEST ("edacbehcba", "abc",         2,  2,  3,       0),
-    TEST ("babcbahcba", "cba",         0,  3,  6,       0),
-    TEST ("hjigcbacba", "cba",         4,  3, -1,       0),
-    TEST ("cbacbcccbc", "cba",         5,  1,  8,       0),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4,  0,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4, -1,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,  1,  4,       0),
-    TEST ("e\0cb\0\0g", "b\0\0g",      4,  2,  6,       0),
-    TEST ("\0b\0\0gb\0","bg\0",        2,  2,  2,       0),
-    TEST ("\0b\0\0gb\0","bg\0",        0,  2,  0,       0),
-    TEST ("\0b\0\0gb\0","bg\0",        0,  3, -1,       0),
-    TEST ("e\0cb\0\0g", "a\0e",        0,  3,  2,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      7,  4, -1,       0),
-    TEST ("\0cb\0\0ge", "\0\0ge",      6,  0,  6,       0),
-    TEST ("a\0b",       "e\0gbg\0\0",  0,  1,  0,       0),    
-    TEST ("a\0b",       "ab\0gg\0\0",  1,  2,  1,       0), 
-    TEST ("a\0b",       "\0ba\0\0fe",  1,  2, -1,       0),
-    TEST ("a\0b",       "e\0gg\0\0a",  3,  6, -1,       0),
-    TEST ("a\0b",       "e\0gg\0\0a",  0,  7,  2,       0),
-    TEST ("\0baa",      "b\0g\0\0ac",  0,  4,  2,       0),
-
-    TEST ("e\0a\0",     "e\0a\0\0",    0,  4, -1,       0),
-    TEST ("\0\0ea",     "b\0c\0\0",    0,  5,  2,       0),
-    TEST ("ee\0b\0",    "e\0a\0b",     1,  4,  3,       0),
-    TEST ("be\0a\0",    "\0acefdg",    1,  5, -1,       0),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, 10, -1,       0),
-    TEST ("baaaaaaaaa", "aaaaaaaaaa",  1, 10, -1,       0),
-    TEST ("aaaaabaaaa", "cccccccccc",  0, 10,  0,       0),
-    TEST ("aaaaabaaaa", "aaaaaccbcc",  1,  4,  5,       0),
-    TEST ("aaaabaaaaa", "cccca",       0,  5,  4,       0),
-    TEST ("aabaabadca", "acaaacccab",  0,  5,  2,       0), 
-    TEST ("abcdefghij", "jihgfedcba",  0, 10, -1,       0), 
-    TEST ("abcdefghij", "jihgfedcba",  0,  9,  0,       0),
-    TEST ("bbb",        "aaaaaaaaba",  2,  2,  2,       0),  
-    TEST ("bbb",        "aaaaaaaaba",  0,  9, -1,       0),
-    TEST ("bab",        "baaaaaaaaa",  0,  0,  0,       0),
-    TEST ("bab",        "ccccccccba",  1, 10, -1,       0),
-
-    TEST (LSTR,         "",            0,  0,  0,       0),
-    TEST (LSTR,         "a",           0,  1,  0,       0),
-    TEST (LSTR,         "x",           0,  1, -1,       0),
-    TEST (LSTR,         "xxx",        10,  3, -1,       0),
-    TEST (LSTR,         "axx",        10,  1, 10,       0),
-    TEST (LSTR,         "xxa",        10,  0, 10,       0),
-    TEST (LSTR,         "xxa",        10,  1, -1,       0),
-    TEST ("abc",        LSTR,          2, 10,  2,       0),
-    TEST ("xxxxxxxxxx", LSTR,          0, LLEN - 1, -1, 0),
-    TEST ("xxxxxxxxxx", LSTR,          2,  4, -1,       0),
-    TEST ("xxxxxxxxxa", LSTR,          0,  4,  9,       0),
-
-    TEST (LSTR,         "xxx",  LLEN - 4,  3, -1,       0),
-    TEST (LSTR,         "xxx",  LLEN - 3,  0, LLEN - 3, 0),
-
-    TEST ("abcdefghij", 0,             0, 10, -1,       0),
-    TEST ("abcdefghij", 0,             1,  9,  9,       0),
-    TEST ("abcdefghij", 0,             0,  8,  8,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  7, -1,       0),
-    TEST ("\0cb\0\0ge", 0,             5,  5,  5,       0),
-    TEST ("\0cb\0\0cb", 0,             3,  5, -1,       0),
-    TEST ("\0cb\0ge\0", 0,             6,  1, -1,       0),
-    TEST (LSTR,         0,             0, LLEN - 1, -1, 0),
-    TEST (LSTR,         0,      LLEN - 1, LLEN - 1, -1, 0),
-    TEST (LSTR,         0,      LLEN - 2,  1, -1,       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",        "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 ("cbbedfhjig", "cba",         0,  3,    3,       0),
+    TEST ("edfcbbhjig", "bac",         0,  2,    0,       0),
+    TEST ("edfcbahaib", "cba",         7,  3,    8,       0),
+    TEST ("edfcbahbcb", "cba",         7,  2, NPOS,       0),
+    TEST ("edfcbahbcb", "cba",         3,  2,    5,       0),
+    TEST ("edfcbahcba", "bac",         3,  3,    6,       0),
+    TEST ("edacbehcba", "abc",         2,  2,    3,       0),
+    TEST ("babcbahcba", "cba",         0,  3,    6,       0),
+    TEST ("hjigcbacba", "cba",         4,  3, NPOS,       0),
+    TEST ("cbacbcccbc", "cba",         5,  1,    8,       0),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,  4,    0,       0),
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,  4, NPOS,       0),
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,  1,    4,       0),
+    TEST ("e\0cb\0\0g", "b\0\0g",      4,  2,    6,       0),
+    TEST ("\0b\0\0gb\0","bg\0",        2,  2,    2,       0),
+    TEST ("\0b\0\0gb\0","bg\0",        0,  2,    0,       0),
+    TEST ("\0b\0\0gb\0","bg\0",        0,  3, NPOS,       0),
+    TEST ("e\0cb\0\0g", "a\0e",        0,  3,    2,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      7,  4, NPOS,       0),
+    TEST ("\0cb\0\0ge", "\0\0ge",      6,  0,    6,       0),
+    TEST ("a\0b",       "e\0gbg\0\0",  0,  1,    0,       0),    
+    TEST ("a\0b",       "ab\0gg\0\0",  1,  2,    1,       0), 
+    TEST ("a\0b",       "\0ba\0\0fe",  1,  2, NPOS,       0),
+    TEST ("a\0b",       "e\0gg\0\0a",  3,  6, NPOS,       0),
+    TEST ("a\0b",       "e\0gg\0\0a",  0,  7,    2,       0),
+    TEST ("\0baa",      "b\0g\0\0ac",  0,  4,    2,       0),
+
+    TEST ("e\0a\0",     "e\0a\0\0",    0,  4, NPOS,       0),
+    TEST ("\0\0ea",     "b\0c\0\0",    0,  5,    2,       0),
+    TEST ("ee\0b\0",    "e\0a\0b",     1,  4,    3,       0),
+    TEST ("be\0a\0",    "\0acefdg",    1,  5, NPOS,       0),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, 10, NPOS,       0),
+    TEST ("baaaaaaaaa", "aaaaaaaaaa",  1, 10, NPOS,       0),
+    TEST ("aaaaabaaaa", "cccccccccc",  0, 10,    0,       0),
+    TEST ("aaaaabaaaa", "aaaaaccbcc",  1,  4,    5,       0),
+    TEST ("aaaabaaaaa", "cccca",       0,  5,    4,       0),
+    TEST ("aabaabadca", "acaaacccab",  0,  5,    2,       0), 
+    TEST ("abcdefghij", "jihgfedcba",  0, 10, NPOS,       0), 
+    TEST ("abcdefghij", "jihgfedcba",  0,  9,    0,       0),
+    TEST ("bbb",        "aaaaaaaaba",  2,  2,    2,       0),  
+    TEST ("bbb",        "aaaaaaaaba",  0,  9, NPOS,       0),
+    TEST ("bab",        "baaaaaaaaa",  0,  0,    0,       0),
+    TEST ("bab",        "ccccccccba",  1, 10, NPOS,       0),
+
+    TEST (LSTR,         "",            0,  0,    0,       0),
+    TEST (LSTR,         "a",           0,  1,    0,       0),
+    TEST (LSTR,         "x",           0,  1, NPOS,       0),
+    TEST (LSTR,         "xxx",        10,  3, NPOS,       0),
+    TEST (LSTR,         "axx",        10,  1,   10,       0),
+    TEST (LSTR,         "xxa",        10,  0,   10,       0),
+    TEST (LSTR,         "xxa",        10,  1, NPOS,       0),
+    TEST ("abc",        LSTR,          2, 10,    2,       0),
+    TEST ("xxxxxxxxxx", LSTR,          0, LLEN - 1, NPOS, 0),
+    TEST ("xxxxxxxxxx", LSTR,          2,  4, NPOS,       0),
+    TEST ("xxxxxxxxxa", LSTR,          0,  4,    9,       0),
+
+    TEST (LSTR,         "xxx",  LLEN - 4,  3, NPOS,       0),
+    TEST (LSTR,         "xxx",  LLEN - 3,  0, LLEN - 3,   0),
+
+    TEST ("abcdefghij", 0,             0, 10, NPOS,       0),
+    TEST ("abcdefghij", 0,             1,  9,    9,       0),
+    TEST ("abcdefghij", 0,             0,  8,    8,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  7, NPOS,       0),
+    TEST ("\0cb\0\0ge", 0,             5,  5,    5,       0),
+    TEST ("\0cb\0\0cb", 0,             3,  5, NPOS,       0),
+    TEST ("\0cb\0ge\0", 0,             6,  1, NPOS,       0),
+    TEST (LSTR,         0,             0, LLEN - 1, NPOS, 0),
+    TEST (LSTR,         0,      LLEN - 1, LLEN - 1, NPOS, 0),
+    TEST (LSTR,         0,      LLEN - 2,  1, NPOS,       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,  0,       0)
+    TEST ("last test", "test",         0,  4,    0,       0)
 };
 
 /**************************************************************************/
@@ -412,85 +413,85 @@
 #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_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",         "\0",          0, -1),   
-    TEST ("\0",         "\0",          1, -1), 
-    TEST ("\0\0",       "\0",          0, -1),  
-    TEST ("\0",         "a",           0,  0),    
-
-    TEST ("bbcdefghij", "a",           0,  0),    
-    TEST ("abcdefghij", "a",           0,  1),   
-    TEST ("bcaaaaaaaa", "a",           2, -1),    
-    TEST ("bcaaafaaaa", "a",           2,  5),      
-    TEST ("abcdefghij", "j",           9, -1),  
-
-    TEST ("cbbedfhjig", "cba",         0,  3),    
-    TEST ("edfcbahjig", "cba",         4,  6),     
-    TEST ("edfcbaaabc", "cba",         6, -1),    
-    TEST ("edfcbahcba", "cba",         9, -1),       
-    TEST ("cbacbabjig", "cbaig",       0,  7),    
-    TEST ("bcaedfajih", "aabced",      0,  5),    
-    TEST ("bcedfaacdh", "abcdef",      3,  9),
-
-    TEST ("e\0cb\0\0g", "b\0\0g",      0,  0),    
-    TEST ("\0cbe\0\0g", "b\0\0g",      4, -1),    
-    TEST ("e\0cb\0\0g", "cbe",         0,  1),     
-    TEST ("\0ge\0\0cb", "\0\0ge",      0,  5),  
-    TEST ("\0cb\0\0ge", "cb\0",        6,  6), 
-    TEST ("\0cb\0\0ce", "cb\0",        0,  6), 
-    TEST ("e\0gbg\0\0", "bg",          2,  5),
-    TEST ("a\0c",       "a\0gbg\0\0",  0,  2),
-    TEST ("a\0b",       "a\0gbg\0\0",  0, -1),    
-    TEST ("ab\0",       "ab\0gg\0\0",  1, -1), 
-    TEST ("a\0b",       "e\0gg\0\0a",  3, -1),
-
-    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, -1),    
-    TEST ("aaabaaaaaa", "aaaaaaaaaa",  4, -1),    
-    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,  5),   
-    TEST ("aabaabaaaa", "aaaaaaaaaa",  0,  2),  
-    TEST ("aabaabaaaa", "aaaaaaaaaa",  3,  5), 
-    TEST ("aabaabaaaa", "aaaaaaaaab",  0, -1),
-    TEST ("cbb",        "aaaaaaaaba",  2, -1),  
-    TEST ("bac",        "aaaaaaaaba",  0,  2),
-    TEST ("baa",        "aaaaaaaaaa",  0,  0),     
-
-    TEST (LSTR,         "",            0,  0),    
-    TEST (LSTR,         "a",           0,  0),     
-    TEST (LSTR,         "x",           0, -1),     
-    TEST (LSTR,         "xxx",        10, -1),    
-    TEST (LSTR,         "axa",        10, -1),     
-    TEST ("abc",        LSTR,          2,  2),    
-    TEST ("xxxxxxxxxx", LSTR,          0, -1),   
-
-    TEST (LSTR,         "xxx",  LLEN - 4, -1), 
-    TEST (LSTR,         "xxx",  LLEN - 1, -1),     
-
-    TEST ("abcdefghij", 0,             0, -1),    
-    TEST ("abcdefghij", 0,             1, -1),   
-    TEST ("\0cb\0\0ge", 0,             5, -1),    
-    TEST (LSTR,         0,             0, -1),  
-    TEST (LSTR,         0,             7, -1),    
-
-    TEST ("",           "",            1, -1),  
-    TEST ("abcdefghij", "abc",        10, -1),   
-    TEST ("abcdefghij", "cba",        10, -1), 
+    //    |             |              |     +- 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",         "\0",          0, NPOS),   
+    TEST ("\0",         "\0",          1, NPOS), 
+    TEST ("\0\0",       "\0",          0, NPOS),  
+    TEST ("\0",         "a",           0,    0),    
+
+    TEST ("bbcdefghij", "a",           0,    0),    
+    TEST ("abcdefghij", "a",           0,    1),   
+    TEST ("bcaaaaaaaa", "a",           2, NPOS),    
+    TEST ("bcaaafaaaa", "a",           2,    5),      
+    TEST ("abcdefghij", "j",           9, NPOS),  
+
+    TEST ("cbbedfhjig", "cba",         0,    3),    
+    TEST ("edfcbahjig", "cba",         4,    6),     
+    TEST ("edfcbaaabc", "cba",         6, NPOS),    
+    TEST ("edfcbahcba", "cba",         9, NPOS),       
+    TEST ("cbacbabjig", "cbaig",       0,    7),    
+    TEST ("bcaedfajih", "aabced",      0,    5),    
+    TEST ("bcedfaacdh", "abcdef",      3,    9),
+
+    TEST ("e\0cb\0\0g", "b\0\0g",      0,    0),    
+    TEST ("\0cbe\0\0g", "b\0\0g",      4, NPOS),    
+    TEST ("e\0cb\0\0g", "cbe",         0,    1),     
+    TEST ("\0ge\0\0cb", "\0\0ge",      0,    5),  
+    TEST ("\0cb\0\0ge", "cb\0",        6,    6), 
+    TEST ("\0cb\0\0ce", "cb\0",        0,    6), 
+    TEST ("e\0gbg\0\0", "bg",          2,    5),
+    TEST ("a\0c",       "a\0gbg\0\0",  0,    2),
+    TEST ("a\0b",       "a\0gbg\0\0",  0, NPOS),    
+    TEST ("ab\0",       "ab\0gg\0\0",  1, NPOS), 
+    TEST ("a\0b",       "e\0gg\0\0a",  3, NPOS),
+
+    TEST ("aaaaaaaaaa", "aaaaaaaaaa",  0, NPOS),    
+    TEST ("aaabaaaaaa", "aaaaaaaaaa",  4, NPOS),    
+    TEST ("aaaaabaaaa", "aaaaaaaaaa",  1,    5),   
+    TEST ("aabaabaaaa", "aaaaaaaaaa",  0,    2),  
+    TEST ("aabaabaaaa", "aaaaaaaaaa",  3,    5), 
+    TEST ("aabaabaaaa", "aaaaaaaaab",  0, NPOS),
+    TEST ("cbb",        "aaaaaaaaba",  2, NPOS),  
+    TEST ("bac",        "aaaaaaaaba",  0,    2),
+    TEST ("baa",        "aaaaaaaaaa",  0,    0),     
+
+    TEST (LSTR,         "",            0,    0),    
+    TEST (LSTR,         "a",           0,    0),     
+    TEST (LSTR,         "x",           0, NPOS),     
+    TEST (LSTR,         "xxx",        10, NPOS),    
+    TEST (LSTR,         "axa",        10, NPOS),     
+    TEST ("abc",        LSTR,          2,    2),    
+    TEST ("xxxxxxxxxx", LSTR,          0, NPOS),   
+
+    TEST (LSTR,         "xxx",  LLEN - 4, NPOS), 
+    TEST (LSTR,         "xxx",  LLEN - 1, NPOS),     
+
+    TEST ("abcdefghij", 0,             0, NPOS),    
+    TEST ("abcdefghij", 0,             1, NPOS),   
+    TEST ("\0cb\0\0ge", 0,             5, NPOS),    
+    TEST (LSTR,         0,             0, NPOS),  
+    TEST (LSTR,         0,             7, NPOS),    
+
+    TEST ("",           "",            1, NPOS),  
+    TEST ("abcdefghij", "abc",        10, NPOS),   
+    TEST ("abcdefghij", "cba",        10, NPOS), 
 
-    TEST ("last test",  "test",        0,  0)     
+    TEST ("last test",  "test",        0,    0)     
 };
 
 /**************************************************************************/
@@ -502,35 +503,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",          'c',  0),   
-
-    TEST ("",            'a', -1),  
-    TEST ("",           '\0', -1),   
-
-    TEST ("\0",         '\0', -1),   
-    TEST ("\0\0",       '\0', -1),  
-    TEST ("\0",          'a',  0),   
-    TEST ("a\0",         'a',  1),   
-
-    TEST ("e\0cb\0\0g", '\0',  0), 
-    TEST ("\0ecb\0\0g", '\0',  1),
-    TEST ("bbb\0cb\0e",  'b',  3),    
-    TEST ("\0ecb\0\0g",  'a',  0),   
-    TEST ("\0cbge\0\0", '\0',  1),    
-
-    TEST (LSTR,          'x', -1),  
-    TEST (LSTR,         '\0',  0),   
-    TEST (LSTR,          'a',  0),
+    //    |              |       +------ expected result  
+    //    |              |       |                           
+    //    |              |       |                
+    //    V              V       V                 
+    TEST ("ab",          'c',    0),   
+
+    TEST ("",            'a', NPOS),  
+    TEST ("",           '\0', NPOS),   
+
+    TEST ("\0",         '\0', NPOS),   
+    TEST ("\0\0",       '\0', NPOS),  
+    TEST ("\0",          'a',    0),   
+    TEST ("a\0",         'a',    1),   
+
+    TEST ("e\0cb\0\0g", '\0',    0), 
+    TEST ("\0ecb\0\0g", '\0',    1),
+    TEST ("bbb\0cb\0e",  'b',    3),    
+    TEST ("\0ecb\0\0g",  'a',    0),   
+    TEST ("\0cbge\0\0", '\0',    1),    
+
+    TEST (LSTR,          'x', NPOS),  
+    TEST (LSTR,         '\0',    0),   
+    TEST (LSTR,          'a',    0),
 
-    TEST ("last test",   't',  0)    
+    TEST ("last test",   't',    0)    
 };
 
 /**************************************************************************/
@@ -542,45 +543,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_first_not_of() off argument
-    //    |              |     |   +----- expected result  
-    //    |              |     |   |                              
-    //    |              |     |   |               
-    //    V              V     V   V                   
-    TEST ("ab",          'c',  0,  0),    
-
-    TEST ("",            'a',  0, -1),   
-    TEST ("",           '\0',  0, -1),    
-
-    TEST ("\0",         '\0',  1, -1),    
-    TEST ("\0",          'a',  0,  0),   
-    TEST ("\0\0",       '\0',  1, -1),    
-    TEST ("\0\0",        'a',  3, -1),  
-    TEST ("\0\0",        'a',  1,  1),
-    TEST ("\0\0",       '\0',  3, -1),    
-
-    TEST ("e\0cb\0\0g", '\0',  1,  2),    
-    TEST ("ecb\0\0\0g", '\0',  3,  6),    
-    TEST ("e\0cbg\0\0", '\0',  5, -1),    
-    TEST ("eb\0\0\0cg",  'b',  1,  2),    
-    TEST ("e\0\0\0bbb",  'b',  4, -1),    
-    TEST ("e\0cb\0\0g",  'a',  0,  0),   
-    TEST ("\0cbge\0\0", '\0',  0,  1),   
-    TEST ("\0\0\0cbge", '\0',  0,  3),  
-    TEST ("\0cbge\0\0", '\0',  9, -1),        
-
-    TEST (LSTR,          'x',  0, -1),   
-    TEST (LSTR,          'x',  5, -1),   
-    TEST (LSTR,         '\0',  0,  0),    
-    TEST (LSTR,          'a',  3,  3),     
-    TEST (LSTR,          'x', LLEN - 1, -1),
-    TEST (LSTR,          'x', LLEN - 2, -1),
+    //    |              |     |     +--- expected result  
+    //    |              |     |     |                              
+    //    |              |     |     |               
+    //    V              V     V     V                   
+    TEST ("ab",          'c',  0,    0),    
+
+    TEST ("",            'a',  0, NPOS),   
+    TEST ("",           '\0',  0, NPOS),    
+
+    TEST ("\0",         '\0',  1, NPOS),    
+    TEST ("\0",          'a',  0,    0),   
+    TEST ("\0\0",       '\0',  1, NPOS),    
+    TEST ("\0\0",        'a',  3, NPOS),  
+    TEST ("\0\0",        'a',  1,    1),
+    TEST ("\0\0",       '\0',  3, NPOS),    
+
+    TEST ("e\0cb\0\0g", '\0',  1,    2),    
+    TEST ("ecb\0\0\0g", '\0',  3,    6),    
+    TEST ("e\0cbg\0\0", '\0',  5, NPOS),    
+    TEST ("eb\0\0\0cg",  'b',  1,    2),    
+    TEST ("e\0\0\0bbb",  'b',  4, NPOS),    
+    TEST ("e\0cb\0\0g",  'a',  0,    0),   
+    TEST ("\0cbge\0\0", '\0',  0,    1),   
+    TEST ("\0\0\0cbge", '\0',  0,    3),  
+    TEST ("\0cbge\0\0", '\0',  9, NPOS),        
+
+    TEST (LSTR,          'x',  0, NPOS),   
+    TEST (LSTR,          'x',  5, NPOS),   
+    TEST (LSTR,         '\0',  0,    0),    
+    TEST (LSTR,          'a',  3,    3),     
+    TEST (LSTR,          'x', LLEN - 1, NPOS),
+    TEST (LSTR,          'x', LLEN - 2, NPOS),
 
-    TEST ("last test",   't',  0,  0)      
+    TEST ("last test",   't',  0,    0)      
 };
 
 /**************************************************************************/
@@ -604,7 +605,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 ();
@@ -678,7 +679,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