Author: sebor
Date: Thu Apr 17 11:42:12 2008
New Revision: 649223

URL: http://svn.apache.org/viewvc?rev=649223&view=rev
Log:
2008-04-17  Martin Sebor  <[EMAIL PROTECTED]>

        * tests/localization/22.locale.ctype.narrow.cpp: Corrected comments.
        (test_narrow_widen): Used rw_info() to write out the name of each
        tested locale.
        (test_libstd): New function/placeholder to exercise our standalone
        implementation of locale (independent of libc).
        (run_test<charT>): Called test_libstd().        
        (run_test): Used the set of locales specified on the command line
        instead of the hardcoded pattern.
        Added an _RWSTD_NO_WCHAR_T guard.
        (main): Used the rw_opt_setlocales handler.

Modified:
    stdcxx/trunk/tests/localization/22.locale.ctype.narrow.cpp

Modified: stdcxx/trunk/tests/localization/22.locale.ctype.narrow.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.ctype.narrow.cpp?rev=649223&r1=649222&r2=649223&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.ctype.narrow.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.ctype.narrow.cpp Thu Apr 17 
11:42:12 2008
@@ -1,6 +1,7 @@
 /***************************************************************************
  *
- * 22.locale.ctype.cpp -  Tests exercising the narrow() and widen() ctype facet
+ * 22.locale.ctype.narrow.cpp - tests exercising the narrow() and widen()
+ *                              member functions of the ctype facet
  *
  * $Id$
  *
@@ -22,14 +23,14 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  *
  **************************************************************************/
 
-// DESCRIPTION: test iterates over the locales installed on a machine,
-//              calling the C character classification functions and
-//              their C++ counterpart(s), comparing the results of
-//              the calls against one another.
+// DESCRIPTION: The test iterates over a subset of locales installed
+// on a machine, calling the C character classification functions and
+// their C++ counterpart(s), comparing the results of the calls against
+// one another.
 
 
 #include <rw/_defs.h>
@@ -203,7 +204,7 @@
     return ch;
 }
 
-// cond1() verifies condition [1] in Test::test_narrow_widen()
+// cond1() verifies condition [1] in test_narrow_widen()
 // below using libc functions
 bool cond1 (std::ctype_base::mask mask, char ch, const char *locname)
 {
@@ -244,7 +245,7 @@
 }
 
 
-// cond3() overloads verify condition [3] in Test::test_narrow_widen()
+// cond3() overloads verify condition [3] in test_narrow_widen()
 // below using libc functions
 bool cond3 (std::ctype_base::mask, char, const char*)
 {
@@ -539,6 +540,10 @@
                        c_locname, curlocname);
         }
 
+        if (0 == i)
+            rw_info (0, 0, __LINE__, "std::ctype<%s> in locale(%#s)",
+                     cname, locname);
+
         const char  c  = char (i);
         const charT ch = charT (i);
 
@@ -653,6 +658,7 @@
 
 /**************************************************************************/
 
+// exercise the behavior of the libc-based C++ locale implementation
 template <class charT>
 void test_libc (charT, const char *cname)
 {
@@ -661,6 +667,17 @@
 
 /**************************************************************************/
 
+// exercise the behavior of our own C++ locale implementation
+template <class charT>
+void test_libstd (charT, const char *cname)
+{
+    rw_warn (0, 0, __LINE__,
+             "stdcxx implementation of std::ctype<%s> not exercised",
+             cname);
+}
+
+/**************************************************************************/
+
 template <class charT>
 void run_test (charT, const char *cname)
 {
@@ -670,7 +687,11 @@
         _STD_USE_FACET (std::ctype_byname<charT>, std::locale ());
     }
 
+    // exercise the behavior of the libc-based C++ locale implementation
     test_libc (charT (), cname);
+
+    // exercise the behavior of our own C++ locale implementation
+    test_libstd (charT (), cname);
 }
 
 /**************************************************************************/
@@ -678,9 +699,20 @@
 static int
 run_test (int, char**)
 {
+    // set the global locale_list pointer to point to the array
+    // of NUL-separated locale names set on the command line via
+    // the --locales=... option, if specified, or to 0 (in which
+    // case we'll generate our own list)
+    locale_list = rw_opt_locales;
+
     run_test (char (), "char");
+
+#ifndef _RWSTD_NO_WCHAR_T
+
     run_test (wchar_t (), "wchar_t");
 
+#endif   // _RWSTD_NO_WCHAR_T
+
     return 0;
 }
 
@@ -690,8 +722,9 @@
 {
     return rw_test (argc, argv, __FILE__,
                     "lib.category.ctype",
-                    0 /* no comment */,
+                    "narrow and widen",
                     run_test,
-                    "",
+                    "|-locales= ",
+                    &rw_opt_setlocales,
                     (void*)0   /* sentinel */);
 }


Reply via email to