stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r397030 - in /incubator/stdcxx/trunk/tests: include/21.strings.h src/21.strings.cpp
Date Wed, 26 Apr 2006 00:33:18 GMT
Author: sebor
Date: Tue Apr 25 17:33:10 2006
New Revision: 397030

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

	* 21.strings.h (TEST_DISPATCH): Handled all enumerations
	in conditionals.
	* 21.strings.cpp (_rw_run_test): Corrected the use of indices
	in nested loops.
	Added file and line information to rw_note() invocations for
	context.
	Set _rw_no_exceptions and _rw_no_exception_safety in response
	to the _RWSTD_NO_EXCEPTIONS macro being #defined.
	Set _rw_opt_no_char_types [1] in response to _RWSTD_NO_WCHAR_T
	being #defined.

Modified:
    incubator/stdcxx/trunk/tests/include/21.strings.h
    incubator/stdcxx/trunk/tests/src/21.strings.cpp

Modified: incubator/stdcxx/trunk/tests/include/21.strings.h
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/21.strings.h?rev=397030&r1=397029&r2=397030&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/21.strings.h (original)
+++ incubator/stdcxx/trunk/tests/include/21.strings.h Tue Apr 25 17:33:10 2006
@@ -266,9 +266,12 @@
         if (StringMembers::Char == memfun.char_id_)             \
             fname (char (), (std::char_traits<char>*)0,         \
                    memfun.which_, tcase);                       \
-        else                                                    \
+        else if (StringMembers::WChar == memfun.char_id_)       \
             fname (wchar_t (), (std::char_traits<wchar_t>*)0,   \
                    memfun.which_, tcase);                       \
+        else                                                    \
+            rw_note (0, 0, 0,                                   \
+                     "%{$CLASS} tests not implemented");        \
     }                                                           \
     else {                                                      \
        if (StringMembers::Char == memfun.char_id_)              \
@@ -289,14 +292,22 @@
         if (StringMembers::Char == memfun.char_id_)             \
             fname (char (), (std::char_traits<char>*)0,         \
                    memfun.which_, tcase);                       \
+        else if (StringMembers::WChar == memfun.char_id_)       \
+            RW_ASSERT (!"logic error: wchar_t disabled");       \
+        else                                                    \
+            rw_note (0, 0, 0,                                   \
+                     "%{$CLASS} tests not implemented");        \
+        }                                                       \
     }                                                           \
     else {                                                      \
-       if (StringMembers::Char == memfun.char_id_)              \
-           fname (char (), (UserTraits<char>*)0,                \
-                  memfun.which_, tcase);                        \
-       else if (StringMembers::UChar == memfun.char_id_)        \
-           fname (UserChar (), (UserTraits<UserChar>*)0,        \
-                  memfun.which_, tcase);                        \
+        if (StringMembers::Char == memfun.char_id_)             \
+            fname (char (), (UserTraits<char>*)0,               \
+                   memfun.which_, tcase);                       \
+        else if (StringMembers::WChar == memfun.char_id_)       \
+             RW_ASSERT (!"logic error: wchar_t disabled");      \
+        else if (StringMembers::UChar == memfun.char_id_)       \
+            fname (UserChar (), (UserTraits<UserChar>*)0,       \
+                   memfun.which_, tcase);                       \
     }                                                           \
     (void)0
 

Modified: incubator/stdcxx/trunk/tests/src/21.strings.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/21.strings.cpp?rev=397030&r1=397029&r2=397030&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/21.strings.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/21.strings.cpp Tue Apr 25 17:33:10 2006
@@ -430,6 +430,27 @@
 static int
 _rw_run_test (int, char*[])
 {
+#ifdef _RWSTD_NO_EXCEPTIONS
+
+    rw_note (0, 0, 0, "exception tests disabled (macro "
+             "_RWSTD_NO_EXCEPTIONS #defined)");
+
+    // disable all exception tests and avoid further notes
+    _rw_no_exceptions       = 2;
+    _rw_no_exception_safety = 2;
+
+#endif   // _RWSTD_NO_EXCEPTIONS
+
+#ifdef _RWSTD_NO_WCHAR_T
+
+    rw_note (0, 0, 0, "wchar_t tests disabled (macro "
+             "_RWSTD_NO_WCHAR_T #defined)");
+
+    // disable wchar_t tests and avoid further notes
+    _rw_opt_no_char_types [1] = 2;
+
+#endif   // _RWSTD_NO_WCHAR_T
+
     if ('\0' == StringMembers::long_string [0]) {
         // initialize long_string
         for (size_t i = 0; i != sizeof StringMembers::long_string - 1; ++i)
@@ -460,7 +481,7 @@
 
         if (_rw_opt_no_char_types [i]) {
             // issue only the first note
-            rw_note (1 < _rw_opt_no_char_types [i]++, 0, 0,
+            rw_note (1 < _rw_opt_no_char_types [i]++, __FILE__, __LINE__,
                      "%s tests disabled", _rw_char_names [i]);
             continue;
         }
@@ -468,20 +489,27 @@
         // exercise all specializations on Traits before those on charT
         for (size_t j = 0; traits_types [j]; ++j) {
 
-            if (_rw_opt_no_traits_types [i]) {
+            if (0 == j && StringMembers::UChar == char_types [i]) {
+                // std::char_traits can only be instantiated on
+                // char and wchar_t, only UserTraits may be used
+                // with UserChar
+                continue;
+            }
+
+            if (_rw_opt_no_traits_types [j]) {
                 // issue only the first note
-                rw_note (1 < _rw_opt_no_traits_types [i]++, 0, 0,
-                         "%s tests disabled", _rw_traits_names [i]);
+                rw_note (1 < _rw_opt_no_traits_types [j]++, __FILE__, __LINE__,
+                         "%s tests disabled", _rw_traits_names [j]);
                 continue;
             }
 
             for (size_t k = 0; alloc_types [k]; ++k) {
 
-                if (_rw_opt_no_alloc_types [i]) {
+                if (_rw_opt_no_alloc_types [k]) {
                     // issue only the first note
-                    rw_note (1 < _rw_opt_no_alloc_types [i]++, 0, 0,
-                             "%s tests disabled",
-                             _rw_alloc_names [i]);
+                    rw_note (1 < _rw_opt_no_alloc_types [k]++, __FILE__,
+                             __LINE__, "%s tests disabled",
+                             _rw_alloc_names [k]);
                     continue;
                 }
 
@@ -513,7 +541,7 @@
                     // check if tests of the function overload
                     // have been disabled
                     if (_rw_opt_memfun_disabled [siginx]) {
-                        rw_note (0, 0, 0,
+                        rw_note (0, __FILE__, __LINE__,
                                  "%{$CLASS}::%{$FUNCSIG} tests disabled");
                         continue;
                     }
@@ -534,7 +562,8 @@
                             && _rw_opt_no_exception_safety) {
 
                             // issue only the first note
-                            rw_note (1 < _rw_opt_no_exception_safety++, 0, 0,
+                            rw_note (1 < _rw_opt_no_exception_safety++,
+                                     __FILE__, __LINE__,
                                      "exception safety tests disabled");
                             continue;
                         }
@@ -546,7 +575,8 @@
                         if (tcase.bthrow && _rw_opt_no_exceptions) {
 
                             // issue only the first note
-                            rw_note (1 < _rw_opt_no_exceptions++, 0, 0,
+                            rw_note (1 < _rw_opt_no_exceptions++,
+                                     __FILE__, __LINE__,
                                      "exception tests disabled");
                             continue;
                         }
@@ -563,7 +593,8 @@
                             _rw_test_callback (memfun, tcase);
                         }
                         else
-                            rw_note (0, 0, 0, "test on line %d disabled",
+                            rw_note (0, __FILE__, tcase.line,
+                                     "test on line %d disabled",
                                      tcase.line);
                     }
                 }
@@ -589,13 +620,6 @@
     _rw_test_callback     = test_callback;
     _rw_string_tests      = tests;
     _rw_string_test_count = test_count;
-
-#ifdef _RWSTD_NO_EXCEPTIONS
-
-    _rw_no_exceptions       = 1;
-    _rw_no_exception_safety = 1;
-
-#endif   // _RWSTD_NO_EXCEPTIONS
 
     return rw_test (argc, argv, file, clause,
                     0,   // comment



Mime
View raw message