Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 14687 invoked from network); 18 Apr 2008 20:04:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Apr 2008 20:04:45 -0000 Received: (qmail 99256 invoked by uid 500); 18 Apr 2008 20:04:46 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 99240 invoked by uid 500); 18 Apr 2008 20:04:46 -0000 Mailing-List: contact commits-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list commits@stdcxx.apache.org Received: (qmail 99231 invoked by uid 99); 18 Apr 2008 20:04:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 13:04:46 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 20:04:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3A3861A9832; Fri, 18 Apr 2008 13:04:24 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r649673 - /stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp Date: Fri, 18 Apr 2008 20:04:23 -0000 To: commits@stdcxx.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080418200424.3A3861A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebor Date: Fri Apr 18 13:04:21 2008 New Revision: 649673 URL: http://svn.apache.org/viewvc?rev=649673&view=rev Log: 2008-04-18 Martin Sebor STDCXX-812 * tests/localization/22.locale.num.get.mt.cpp [_RWSTD_OS_HP_UX || _ILP32] (rw_opt_nlocales): Decreased from the default to 10 in order to work around an HP-UX inefficiency, and renamed to opt_nlocales to avoid inappropriately using rwtest convention. STDCXX-886 * tests/localization/22.locale.num.get.mt.cpp (thread_func): Avoided appending NUL characters to the input sequence to prevent failures in locales where the C++ thoudsands_sep is the NUL character. (test_get_data): Renamed function argument to match its type. Modified: stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp Modified: stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp?rev=649673&r1=649672&r2=649673&view=diff ============================================================================== --- stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp (original) +++ stdcxx/trunk/tests/localization/22.locale.num.get.mt.cpp Fri Apr 18 13:04:21 2008 @@ -47,8 +47,18 @@ // the number of times each thread should iterate int rw_opt_nloops = MAX_LOOPS; +#if !defined (_RWSTD_OS_HP_UX) || defined (_ILP32) + // number of locales to use -int rw_opt_nlocales = MAX_THREADS; +int opt_nlocales = MAX_THREADS; + +#else // HP-UX in LP64 mode + +// work around an inefficiency (small cache size?) on HP-UX +// in LP64 mode (see STDCXX-812) +int opt_nlocales = 10; + +#endif // HP-UX 32/64 bit mode // should all threads share the same set of locale objects instead // of creating their own? @@ -214,7 +224,7 @@ template void test_get_data (const MyNumData &data, - const std::num_get &np, + const std::num_get &ng, const std::istreambuf_iterator &iter, const std::istreambuf_iterator &end, std::basic_ios &io) @@ -225,7 +235,7 @@ case MyNumData::put_bool: { const bool expected = data.value_ < 1.f; bool checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -233,7 +243,7 @@ case MyNumData::put_long: { const long expected = (long)data.value_; long checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -241,7 +251,7 @@ case MyNumData::put_ulong: { const unsigned long expected = (unsigned long)data.value_; unsigned long checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -252,7 +262,7 @@ case MyNumData::put_llong: { const _RWSTD_LONG_LONG expected = (_RWSTD_LONG_LONG)data.value_; _RWSTD_LONG_LONG checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -261,7 +271,7 @@ const unsigned _RWSTD_LONG_LONG expected = (unsigned _RWSTD_LONG_LONG)data.value_; unsigned _RWSTD_LONG_LONG checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -272,7 +282,7 @@ case MyNumData::put_dbl: { const double expected = (double)data.value_; double checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -283,7 +293,7 @@ case MyNumData::put_ldbl: { const long double expected = (long double)data.value_; long double checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -294,7 +304,7 @@ case MyNumData::put_ptr: { const void* expected = (const void*)&data.value_; void* checked; - np.get (iter, end, io, state, checked); + ng.get (iter, end, io, state, checked); RW_ASSERT (! (state & std::ios_base::failbit)); RW_ASSERT (checked == expected); } @@ -316,13 +326,15 @@ static void* thread_func (void*) { - MyIos > nio; - MyStreambuf > nsb; + typedef std::char_traits Traits; + MyIos nio; + MyStreambuf nsb; nio.rdbuf (&nsb); #ifndef _RWSTD_NO_WCHAR_T - MyIos > wio; - MyStreambuf > wsb; + typedef std::char_traits WTraits; + MyIos wio; + MyStreambuf wsb; wio.rdbuf (&wsb); #endif // _RWSTD_NO_WCHAR_T @@ -340,13 +352,13 @@ if (test_char) { // exercise the narrow char specialization of the facet - const std::num_get &np = + const std::num_get &ng = std::use_facet >(loc); nio.imbue (loc); - nsb.pubsetg (data.ncs_, RW_COUNT_OF (data.ncs_)); + nsb.pubsetg (data.ncs_, Traits::length (data.ncs_)); - test_get_data (data, np, + test_get_data (data, ng, std::istreambuf_iterator(&nsb), std::istreambuf_iterator(), nio); @@ -365,7 +377,7 @@ std::use_facet >(loc); wio.imbue (loc); - wsb.pubsetg (data.wcs_, RW_COUNT_OF (data.wcs_)); + wsb.pubsetg (data.wcs_, WTraits::length (data.wcs_)); test_get_data (data, wp, std::istreambuf_iterator(&wsb), @@ -464,7 +476,7 @@ "failed to create locale(%#s)", name); } - if (nlocales == maxinx || nlocales == std::size_t (rw_opt_nlocales)) + if (nlocales == maxinx || nlocales == std::size_t (opt_nlocales)) break; } @@ -554,7 +566,7 @@ &rw_opt_nloops, int (MAX_THREADS), &rw_opt_nthreads, - &rw_opt_nlocales, + &opt_nlocales, &rw_opt_setlocales, &rw_opt_shared_locale); }