incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anton Pevtsov <ant...@moscow.vdiweb.com>
Subject Re: Re: svn commit: r399504 - /incubator/stdcxx/trunk/tests/strings/21.string.find.cpp
Date Thu, 04 May 2006 14:01:18 GMT
Martin, I made few changes to this test. The difference file is
attached.
I think it is necessary to modify other find methods and compare method
to force them returning npos instead of the length_error exception
throwing.
What do you think about this?

Thanks,
Anton Pevtsov


-----Original Message-----
From: sebor@apache.org [mailto:sebor@apache.org] 
Sent: Thursday, May 04, 2006 04:44
To: stdcxx-commits@incubator.apache.org
Subject: svn commit: r399504 -
/incubator/stdcxx/trunk/tests/strings/21.string.find.cpp


Author: sebor
Date: Wed May  3 17:43:44 2006
New Revision: 399504

URL: http://svn.apache.org/viewcvs?rev=399504&view=rev
Log:
2006-05-03  Martin Sebor  <sebor@roguewave.com>

	* 21.string.find.cpp: Removed tests for length_error, added new
	test cases.

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

Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.st
ring.find.cpp?rev=399504&r1=399503&r2=399504&view=diff
========================================================================
======
--- incubator/stdcxx/trunk/tests/strings/21.string.find.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.cpp Wed May  3 
+++ 17:43:44 2006
@@ -22,33 +22,32 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- * 
+ *
 
************************************************************************
**/
 
 #include <string>       // for string
-#include <cstdlib>      // for free(), size_t
-#include <stdexcept>    // for length_error
+#include <cstddef>      // size_t
+#include <stdexcept>    // for exception, length_error
 
 #include <21.strings.h> // for StringMembers
 #include <driver.h>     // for rw_test()
 #include <rw_char.h>    // for rw_widen()
 
 
-#define Find(which)    StringMembers::find_ ## which
+/**********************************************************************
+****/
+
+// for convenience and brevity
+
+#define NPOS          _RWSTD_SIZE_MAX
+#define LSTR          StringMembers::long_string
+#define LLEN          StringMembers::long_string_len
+#define Find(which)   StringMembers::find_ ## which
 
 typedef StringMembers::OverloadId OverloadId;
 typedef StringMembers::TestCase   TestCase;
 typedef StringMembers::Test       Test;
 typedef StringMembers::Function   MemFun;
 
-/**********************************************************************
****/
-
-// for convenience and brevity
-#define NPOS      _RWSTD_SIZE_MAX
-
-#define LSTR      StringMembers::long_string
-#define LLEN      StringMembers::long_string_len
-
 static const char* const exceptions[] = {
     "unknown exception", "out_of_range", "length_error",
     "bad_alloc", "exception"
@@ -56,9 +55,10 @@
 
 
/***********************************************************************
***/
 
-// used to exercise 
+// used to exercise
 // find (const value_type*)
-static const TestCase ptr_test_cases [] = {
+static const TestCase
+ptr_test_cases [] = {
 
 #undef TEST
 #define TEST(str, arg, res)                                    \
@@ -67,143 +67,159 @@
 
     //    +----------------------------------- controlled sequence
     //    |             +--------------------- sequence to be found
-    //    |             |                +---- 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),       
+    //    |             |                +---- expected result
+    //    |             |                |
+    //    |             |                |
+    //    V             V                V
+    TEST ("",           "",              0),
+    TEST ("",           "a",          NPOS),
+    TEST ("",           "\0",            0),
+
+    TEST ("ab",         "a",             0),
+
+    TEST ("\0",         "",              0),
+    TEST ("\0",         "\0",            0),
+    TEST ("\0",         "a",          NPOS),
+
+    TEST ("aababcabcd", "",              0),
+    TEST ("aababcabcd", "a",             0),
+    TEST ("aababcabcd", "ab",            1),
+    TEST ("aababcabcd", "abc",           3),
+    TEST ("aababcabcd", "abcd",          6),
+    TEST ("aababcabcd", "abcde",      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)
 };
 
 
/***********************************************************************
[...]
***/


Mime
View raw message