From: Lawrence Lim Date: Wed, 24 Aug 2005 20:31:01 +0000 (+0000) Subject: re PR libstdc++/23550 (char_traits requirements/1.cc test bad math) X-Git-Tag: releases/gcc-3.4.5~242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=655bae5765e39330153dfcc5137fa2dec78ca2c4;p=thirdparty%2Fgcc.git re PR libstdc++/23550 (char_traits requirements/1.cc test bad math) 2005-08-24 Lawrence Lim Jakub Jelinek Benjamin Kosnik PR libstdc++/23550 * testsuite/21_strings/char_traits/requirements/char/1.cc (test01): Simplify counting. * testsuite/21_strings/char_traits/requirements/wchar_t/1.cc (test02): Same. Co-Authored-By: Benjamin Kosnik Co-Authored-By: Jakub Jelinek From-SVN: r103453 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6e645d79c149..6ac703c3d38b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2005-08-24 Lawrence Lim + Jakub Jelinek + Benjamin Kosnik + + PR libstdc++/23550 + * testsuite/21_strings/char_traits/requirements/char/1.cc + (test01): Simplify counting. + * testsuite/21_strings/char_traits/requirements/wchar_t/1.cc + (test02): Same. + 2005-07-18 Paolo Carlini Nathan Myers diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc index 15500b0dce2f..c3848734aeda 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc @@ -1,6 +1,7 @@ // 1999-06-03 bkoz -// Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -32,12 +33,12 @@ void test01(void) // 21.1.1 character traits requirements // Key for decoding what function signatures really mean: - // X == char_traits<_CharT> + // X == char_traits<_CharT> // [c,d] == _CharT // [p,q] == const _CharT* - // s == _CharT* + // s == _CharT* // [n,i,j] == size_t - // f == X::int_type + // f == X::int_type // pos == X::pos_type // state == X::state_type @@ -54,9 +55,11 @@ void test01(void) // correctly even where p is in [s, s + n), and yields s. char array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h', 0}; const char str_lit1[] = "montara and ocean beach"; - int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars - char array2[len]; - std::char_traits::copy(array2, "boracay, philippines", len); + const char str_lit2[] = "boracay, philippines"; + const int len1 = sizeof(str_lit1)/sizeof(char); + const int len2 = sizeof(str_lit2)/sizeof(char); + char array2[len1 + len2 - 1]; // two terminating chars + std::char_traits::copy(array2, str_lit2, len2); VERIFY( str_lit1[0] == 'm' ); c1 = array2[0]; diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc index d7582ca4cc10..f52cfaf49978 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc @@ -1,6 +1,7 @@ // 1999-06-03 bkoz -// Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -54,9 +55,11 @@ void test02(void) // correctly even where p is in [s, s + n), and yields s. wchar_t array1[] = {L'z', L'u', L'm', L'a', L' ', L'b', L'e', L'a', L'c', L'h', 0}; const wchar_t str_lit1[] = L"montara and ocean beach"; - int len = sizeof(str_lit1) + sizeof(array1) - 1; // two terminating chars - wchar_t array2[len]; - std::char_traits::copy(array2, L"boracay, philippines", len); + const wchar_t str_lit2[] = L"boracay, philippines"; + const int len1 = sizeof(str_lit1)/sizeof(wchar_t); + const int len2 = sizeof(str_lit2)/sizeof(wchar_t); + wchar_t array2[len1 + len2 - 1]; // two terminating chars + std::char_traits::copy(array2, str_lit2, len2); VERIFY( str_lit1[0] == 'm' ); c1 = array2[0];