Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 18566 invoked from network); 15 Jan 2006 21:59:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Jan 2006 21:59:15 -0000 Received: (qmail 15674 invoked by uid 500); 15 Jan 2006 21:59:15 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 15653 invoked by uid 500); 15 Jan 2006 21:59:14 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 15642 invoked by uid 500); 15 Jan 2006 21:59:14 -0000 Delivered-To: apmail-incubator-stdcxx-cvs@incubator.apache.org Received: (qmail 15639 invoked by uid 99); 15 Jan 2006 21:59:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 15 Jan 2006 13:59:14 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 15 Jan 2006 13:59:14 -0800 Received: (qmail 18455 invoked by uid 65534); 15 Jan 2006 21:58:53 -0000 Message-ID: <20060115215853.18453.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r369267 - /incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp Date: Sun, 15 Jan 2006 21:58:53 -0000 To: stdcxx-cvs@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sebor Date: Sun Jan 15 13:58:50 2006 New Revision: 369267 URL: http://svn.apache.org/viewcvs?rev=369267&view=rev Log: 2006-01-15 Martin Sebor * cwctype.cpp (test_types): New function testing the presence of wint_t, wctrans_t, and wctype_t in namespace std. Modified: incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp Modified: incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp?rev=369267&r1=369266&r2=369267&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp (original) +++ incubator/stdcxx/trunk/tests/strings/21.cwctype.cpp Sun Jan 15 13:58:50 2006 @@ -112,6 +112,85 @@ /**************************************************************************/ +#ifndef _RWSTD_NO_NAMESPACE + +// check types + +namespace Fallback { + typedef char wint_t [1234]; + typedef char wctrans_t [1235]; + typedef char wctype_t [1236]; +} // Namespace Fallback + +namespace std { + +// define test functions in namespace std to detect the presece +// or absence of the required types + +bool wint_t_defined () +{ + using namespace Fallback; + + return sizeof (wint_t) != sizeof (Fallback::wint_t); +} + +bool wctrans_t_defined () +{ + using namespace Fallback; + + return sizeof (wctrans_t) != sizeof (Fallback::wctrans_t); +} + +bool wctype_t_defined () +{ + using namespace Fallback; + return sizeof (wctype_t) != sizeof (Fallback::wctype_t); +} + +} // namespace std + +const char std_name[] = "std"; + +static void +test_types () +{ + rw_info (0, 0, 0, + "types %s::wint_t, %1$s::wctrans_t, and %1$s::wctype_t", + std_name); + + rw_assert (std::wint_t_defined (), 0, 0, + "$s::wint_t not defined", std_name); + + // TO DO: exercise wint_t requirements + + rw_assert (std::wctrans_t_defined (), 0, 0, + "%s::wctrans_t not defined", std_name); + + // TO DO: exercise wctrans_t requirements (must be a scalar type) + + rw_assert (std::wctype_t_defined (), 0, 0, + "%s::wctype_t not defined", std_name); + + // TO DO: exercise wctype_t requirements (must be a scalar type) +} + +#else // if defined (_RWSTD_NO_NAMESPACE) + +const char std_name[] = ""; + +static void +test_types () +{ + rw_info (0, 0, 0, + "types %s::wint_t, %1s::wctrans_t, and %1s::wctype_t", std_name); + + rw_note (0, 0, 0, "_RWSTD_NO_NAMESPACE defined, cannot test"); +} + +#endif // _RWSTD_NO_NAMESPACE + +/**************************************************************************/ + // define function template overloads for the functions with // the same name to detect whether the C versions are declared or not #define TEST_FUNCTION(name) \ @@ -657,30 +736,32 @@ rw_assert (weof_defined, 0, 0, "macro WEOF unexpectedly not #defined"); ////////////////////////////////////////////////////////////////// - rw_warn (0, 0, 0, "types wctrans_t and wctype_t not exercised"); + test_types (); ////////////////////////////////////////////////////////////////// // verify that each function is defined -#define TEST(function) \ - do { \ - rw_info (0, 0, 0, "%s(std::wint_t) definition", #function); \ - function (std::wint_t (function_called = 1)); \ - rw_assert (1 == function_called, 0, __LINE__, \ - "%s (std::wint_t) not defined", #function); \ +#define TEST(function) \ + do { \ + rw_info (0, 0, 0, "%s::%s (%s::wint_t) definition", \ + std_name, #function, std_name); \ + std::function (std::wint_t (function_called = 1)); \ + rw_assert (1 == function_called, 0, __LINE__, \ + "%s::%s (%s::wint_t) not defined", \ + std_name, #function, std_name); \ } while (0) - TEST (std::iswalnum); - TEST (std::iswalpha); - TEST (std::iswcntrl); - TEST (std::iswdigit); - TEST (std::iswgraph); - TEST (std::iswlower); - TEST (std::iswprint); - TEST (std::iswpunct); - TEST (std::iswupper); - TEST (std::iswxdigit); - TEST (std::towlower); - TEST (std::towupper); + TEST (iswalnum); + TEST (iswalpha); + TEST (iswcntrl); + TEST (iswdigit); + TEST (iswgraph); + TEST (iswlower); + TEST (iswprint); + TEST (iswpunct); + TEST (iswupper); + TEST (iswxdigit); + TEST (towlower); + TEST (towupper); ////////////////////////////////////////////////////////////////// if (rw_opt_no_behavior)