diff options
author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-24 20:29:27 +0000 |
---|---|---|
committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-24 20:29:27 +0000 |
commit | 80c37f4af9d5f180e4281c27ab8c79197dc15716 (patch) | |
tree | fe2c518ff720a6dc13057bf73b9bda7da0fb23c9 /libstdc++-v3/testsuite | |
parent | fbf0ba359d53a43a55f5e65171b9ea318949f602 (diff) | |
download | gcc-80c37f4af9d5f180e4281c27ab8c79197dc15716.tar.gz |
2005-08-24 Lawrence Lim <llim@redhat.com>
Jakub Jelinek <jakub@redhat.com>
Benjamin Kosnik <bkoz@redhat.com>
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103451 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc | 17 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc | 17 |
2 files changed, 20 insertions, 14 deletions
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 86d0d1665de..d040d775712 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<char>::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<char>::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 7d26fec1719..3a8a20cf88d 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 @@ -32,12 +33,12 @@ void test02(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 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<wchar_t>::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<wchar_t>::copy(array2, str_lit2, len2); VERIFY( str_lit1[0] == 'm' ); c1 = array2[0]; |