aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits')
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc112
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc41
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc40
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc40
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc22
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc24
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc24
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc22
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc22
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc174
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc112
-rw-r--r--gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc41
12 files changed, 674 insertions, 0 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc
new file mode 100644
index 000000000..55c99a02e
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/1.cc
@@ -0,0 +1,112 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2009
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.1.1 Characher traits requirements
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ const std::string str_01("zuma beach");
+ const std::string str_02("montara and ocean beach");
+
+ // 21.1.1 character traits requirements
+
+ // Key for decoding what function signatures really mean:
+ // X == char_traits<_CharT>
+ // [c,d] == _CharT
+ // [p,q] == const _CharT*
+ // s == _CharT*
+ // [n,i,j] == size_t
+ // f == X::int_type
+ // pos == X::pos_type
+ // state == X::state_type
+
+ // void X::assign(char c, char d)
+ // assigns c = d;
+ char c1 = 'z';
+ char c2 = 'u';
+ VERIFY( c1 != c2 );
+ std::char_traits<char>::assign(c1,c2);
+ VERIFY( c1 == 'u' );
+
+ // char* X::move(char* s, const char* p, size_t n)
+ // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
+ // 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";
+ 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];
+ c2 = str_lit1[0];
+ char c3 = array2[1];
+ char c4 = str_lit1[1];
+ std::char_traits<char>::move(array2, str_lit1, 0);
+ VERIFY( array2[0] == c1 );
+ VERIFY( str_lit1[0] == c2 );
+ std::char_traits<char>::move(array2, str_lit1, 1);
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c3 );
+ VERIFY( str_lit1[1] == c4 );
+ std::char_traits<char>::move(array2, str_lit1, 2);
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c4 );
+ VERIFY( str_lit1[1] == c4 );
+
+ char* pc1 = array1 + 1;
+ c1 = pc1[0];
+ c2 = array1[0];
+ VERIFY( c1 != c2 );
+ char* pc2 = std::char_traits<char>::move(array1, pc1, 0);
+ c3 = pc1[0];
+ c4 = array1[0];
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == c4 );
+ VERIFY( pc2 == array1 );
+
+ c1 = pc1[0];
+ c2 = array1[0];
+ char* pc3 = pc1;
+ pc2 = std::char_traits<char>::move(array1, pc1, 10);
+ c3 = pc1[0];
+ c4 = array1[0];
+ VERIFY( c1 != c3 ); // underlying char array changed.
+ VERIFY( c4 != c3 );
+ VERIFY( pc2 == array1 );
+ VERIFY( pc3 == pc1 ); // but pointers o-tay
+ c1 = *(str_01.data());
+ c2 = array1[0];
+ VERIFY( c1 != c2 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc
new file mode 100644
index 000000000..7cec4d244
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// 2001-02-11 gdr
+// Origin: Craig Rodrigues <rodrigc@mediaone.net>
+
+// Copyright (C) 2001, 2003, 2007, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.1.2: char_traits typedefs
+
+#include <string>
+
+int main()
+{
+ // Check for required typedefs.
+ typedef std::char_traits<char> test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::int_type int_type;
+ typedef test_type::off_type off_type;
+ typedef test_type::pos_type pos_type;
+ typedef test_type::state_type state_type;
+
+ // 21.1.3: char_traits<char>::int_type == int
+ test_type::int_type* p = 0;
+ int* q __attribute__((unused)) = p;
+
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc
new file mode 100644
index 000000000..23c875dba
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char16_t/typedefs.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <cstdint>
+
+int main()
+{
+ // Check for required typedefs.
+ typedef std::char_traits<char16_t> test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::int_type int_type;
+ typedef test_type::off_type off_type;
+ typedef test_type::pos_type pos_type;
+ typedef test_type::state_type state_type;
+
+ // char_traits<char16_t>::int_type == uint_least16_t
+ test_type::int_type* p = 0;
+ std::uint_least16_t* q __attribute__((unused)) = p;
+
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc
new file mode 100644
index 000000000..42a883f57
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char32_t/typedefs.cc
@@ -0,0 +1,40 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <cstdint>
+
+int main()
+{
+ // Check for required typedefs.
+ typedef std::char_traits<char32_t> test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::int_type int_type;
+ typedef test_type::off_type off_type;
+ typedef test_type::pos_type pos_type;
+ typedef test_type::state_type state_type;
+
+ // char_traits<char16_t>::int_type == uint_least32_t
+ test_type::int_type* p = 0;
+ std::uint_least32_t* q __attribute__((unused)) = p;
+
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc
new file mode 100644
index 000000000..fc58bda90
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char/1.cc
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+
+template class std::char_traits<char>;
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc
new file mode 100644
index 000000000..830640cd2
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char16_t/1.cc
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+
+template class std::char_traits<char16_t>;
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc
new file mode 100644
index 000000000..a6f66ff38
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/char32_t/1.cc
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-cstdint "" }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+
+template class std::char_traits<char32_t>;
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc
new file mode 100644
index 000000000..1909373f2
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/short/1.cc
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+
+template class std::char_traits<short>;
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc
new file mode 100644
index 000000000..e1a4e67f5
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/explicit_instantiation/wchar_t/1.cc
@@ -0,0 +1,22 @@
+// { dg-do compile }
+
+// Copyright (C) 2008, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+
+template class std::char_traits<wchar_t>;
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc
new file mode 100644
index 000000000..3f47f9f48
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc
@@ -0,0 +1,174 @@
+// 1999-06-03 bkoz
+// 2003-07-22 Matt Austern
+
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.1.1 Character traits requirements
+// Make sure we can instantiate char_traits and basic_string for
+// charT = 'short', and make sure the char_traits memeber functions
+// satisfy the requirements of 21.1.1.
+
+#include <string>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+void test02(void)
+{
+ typedef short char_type;
+ bool test __attribute__((unused)) = true;
+
+ // 21.1.1 character traits requirements
+
+ // Key for decoding what function signatures really mean:
+ // X == char_traits<_CharT>
+ // [c,d] == _CharT
+ // [p,q] == const _CharT*
+ // s == _CharT*
+ // [n,i,j] == size_t
+ // f == X::int_type
+ // pos == X::pos_type
+ // state == X::state_type
+
+ // void X::assign(char_type c, char_type d)
+ // assigns c = d;
+ char_type c1 = 'z';
+ char_type c2 = 'u';
+ VERIFY( c1 != c2 );
+ std::char_traits<char_type>::assign(c1,c2);
+ VERIFY( c1 == 'u' );
+
+ // bool X::eq(char_type c, char_type d)
+ c1 = 'z';
+ c2 = 'u';
+ VERIFY ( !std::char_traits<char_type>::eq(c1, c2) );
+ VERIFY ( std::char_traits<char_type>::eq(c1, c1) );
+ VERIFY ( std::char_traits<char_type>::eq(c2, c2) );
+
+ // bool X::lt(char_type c, char_type d)
+ c1 = 'z';
+ c2 = 'u';
+ VERIFY ( std::char_traits<char_type>::lt(c2, c1) );
+ VERIFY ( !std::char_traits<char_type>::lt(c1, c2) );
+ VERIFY ( !std::char_traits<char_type>::lt(c1, c1) );
+ VERIFY ( !std::char_traits<char_type>::lt(c2, c2) );
+
+ // char_type* X::move(char_type* s, const char_type* p, size_t n)
+ // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
+ // correctly even where p is in [s, s + n), and yields s.
+ char_type array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h', 0};
+ const std::basic_string<char_type> str_01(array1 + 0, array1 + 10);
+
+ const char_type str_lit1[] = {'m', 'o', 'n', 't', 'a', 'r', 'a', ' ', 'a', 'n', 'd', ' ', 'o', 'c', 'e', 'a', 'n', ' ', 'b', 'e', 'a', 'c', 'h', 0};
+
+ int len = sizeof(str_lit1)/sizeof(char_type) + sizeof(array1)/sizeof(char_type) - 1;
+ // two terminating chars
+ char_type array3[] = {'b', 'o', 'r', 'a', 'c', 'a', 'y', ',', ' ', 'p', 'h', 'i', 'l', 'i', 'p', 'p', 'i', 'n', 'e', 's', 0};
+ char_type array2[len];
+ std::char_traits<char_type>::copy(array2, array3, len);
+
+ VERIFY( str_lit1[0] == 'm' );
+ c1 = array2[0];
+ c2 = str_lit1[0];
+ char_type c3 = array2[1];
+ char_type c4 = str_lit1[1];
+ std::char_traits<char_type>::move(array2, str_lit1, 0);
+ VERIFY( array2[0] == c1 );
+ VERIFY( str_lit1[0] == c2 );
+ std::char_traits<char_type>::move(array2, str_lit1, 1);
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c3 );
+ VERIFY( str_lit1[1] == c4 );
+ std::char_traits<char_type>::move(array2, str_lit1, 2);
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c4 );
+ VERIFY( str_lit1[1] == c4 );
+
+ char_type* pc1 = array1 + 1;
+ c1 = pc1[0];
+ c2 = array1[0];
+ VERIFY( c1 != c2 );
+ char_type* pc2 = std::char_traits<char_type>::move(array1, pc1, 0);
+ c3 = pc1[0];
+ c4 = array1[0];
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == c4 );
+ VERIFY( pc2 == array1 );
+
+ c1 = pc1[0];
+ c2 = array1[0];
+ char_type* pc3 = pc1;
+ pc2 = std::char_traits<char_type>::move(array1, pc1, 10);
+ c3 = pc1[0];
+ c4 = array1[0];
+ VERIFY( c1 != c3 ); // underlying char_type array changed.
+ VERIFY( c4 != c3 );
+ VERIFY( pc2 == array1 );
+ VERIFY( pc3 == pc1 ); // but pointers o-tay
+ c1 = *(str_01.data());
+ c2 = array1[0];
+ VERIFY( c1 != c2 );
+
+ // size_t X::length(const char_type* p)
+ len = std::char_traits<char_type>::length(str_lit1);
+ VERIFY( len == sizeof(str_lit1) / sizeof(char_type) - 1 );
+
+ // const char_type* X::find(const char_type* s, size_t n, char_type c)
+ const int N4 = sizeof(str_lit1) / sizeof(char_type);
+ const char_type* pc4 = std::char_traits<char_type>::find(str_lit1, N4, 'a');
+ VERIFY( pc4 != 0 );
+ VERIFY( *pc4 == 'a' );
+
+ pc4 = std::char_traits<char_type>::find(str_lit1, N4, 0x0a73);
+ VERIFY( pc4 == 0 );
+
+ // char_type* X::assign(char_type* s, size_t n, char_type c)
+ len = sizeof(array2) / sizeof(char_type);
+ std::memset(array2, 0xaf, len * sizeof(char_type));
+ VERIFY( array2[0] != 0x15a8 );
+
+ pc1 = std::char_traits<char_type>::assign (array2, len, 0x15a8);
+ VERIFY( pc1 == array2 );
+ for (int i = 0; i < len; ++i)
+ VERIFY( array2[i] == 0x15a8 );
+
+ // char_type* X::copy(char_type* s, const char_type* p, size_t n)
+ int n1 = sizeof(str_lit1) / sizeof(char_type);
+ pc1 = std::char_traits<char_type>::copy(array2, str_lit1, n1);
+ len = std::char_traits<char_type>::length(array2);
+ VERIFY( len == n1 - 1 );
+ for (int i = 0; i < len; ++i)
+ VERIFY( str_lit1[i] == array2[i] );
+
+ // int X::compare(const char_type* p, const char_type* q, size_t n)
+ const char_type* pconst1 = str_01.data();
+ const char_type* pconst2 = str_lit1;
+
+ VERIFY( std::char_traits<char_type>::compare(pconst1, pconst2, 10) > 0 );
+ VERIFY( std::char_traits<char_type>::compare(pconst2, pconst1, 10) < 0 );
+ VERIFY( std::char_traits<char_type>::compare(pconst1, pconst1, 10) == 0 );
+ VERIFY( std::char_traits<char_type>::compare(pconst2, pconst2, 10) == 0 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc
new file mode 100644
index 000000000..bc6ae61a9
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/1.cc
@@ -0,0 +1,112 @@
+// 1999-06-03 bkoz
+
+// Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2009
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.1.1 Characher traits requirements
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void test02(void)
+{
+ bool test __attribute__((unused)) = true;
+ const std::wstring str_01(L"zuma beach");
+ const std::wstring str_02(L"montara and ocean beach");
+
+ // 21.1.1 character traits requirements
+
+ // Key for decoding what function signatures really mean:
+ // X == char_traits<_CharT>
+ // [c,d] == _CharT
+ // [p,q] == const _CharT*
+ // s == _CharT*
+ // [n,i,j] == size_t
+ // f == X::int_type
+ // pos == X::pos_type
+ // state == X::state_type
+
+ // void X::assign(wchar_t c, wchar_t d)
+ // assigns c = d;
+ wchar_t c1 = L'z';
+ wchar_t c2 = L'u';
+ VERIFY( c1 != c2 );
+ std::char_traits<wchar_t>::assign(c1,c2);
+ VERIFY( c1 == L'u' );
+
+ // char* X::move(char* s, const char* p, size_t n)
+ // for each i in [0,n) performs X::assign(s[i], p[i]). Copies
+ // 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";
+ 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];
+ c2 = str_lit1[0];
+ wchar_t c3 = array2[1];
+ wchar_t c4 = str_lit1[1];
+ std::char_traits<wchar_t>::move(array2, str_lit1, 0);
+ VERIFY( array2[0] == c1 );
+ VERIFY( str_lit1[0] == c2 );
+ std::char_traits<wchar_t>::move(array2, str_lit1, 1);
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c3 );
+ VERIFY( str_lit1[1] == c4 );
+ std::char_traits<wchar_t>::move(array2, str_lit1, 2);
+ VERIFY( array2[0] == c2 );
+ VERIFY( str_lit1[0] == c2 );
+ VERIFY( array2[1] == c4 );
+ VERIFY( str_lit1[1] == c4 );
+
+ wchar_t* pc1 = array1 + 1;
+ c1 = pc1[0];
+ c2 = array1[0];
+ VERIFY( c1 != c2 );
+ wchar_t* pc2 = std::char_traits<wchar_t>::move(array1, pc1, 0);
+ c3 = pc1[0];
+ c4 = array1[0];
+ VERIFY( c1 == c3 );
+ VERIFY( c2 == c4 );
+ VERIFY( pc2 == array1 );
+
+ c1 = pc1[0];
+ c2 = array1[0];
+ wchar_t* pc3 = pc1;
+ pc2 = std::char_traits<wchar_t>::move(array1, pc1, 10);
+ c3 = pc1[0];
+ c4 = array1[0];
+ VERIFY( c1 != c3 ); // underlying wchar_t array changed.
+ VERIFY( c4 != c3 );
+ VERIFY( pc2 == array1 );
+ VERIFY( pc3 == pc1 ); // but pointers o-tay
+ c1 = *(str_01.data());
+ c2 = array1[0];
+ VERIFY( c1 != c2 );
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
diff --git a/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc
new file mode 100644
index 000000000..56ec41176
--- /dev/null
+++ b/gcc-4.4.3/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc
@@ -0,0 +1,41 @@
+// { dg-do compile }
+// 2001-02-11 gdr
+// Origin: Craig Rodrigues <rodrigc@mediaone.net>
+
+// Copyright (C) 2001, 2003, 2007, 2009 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.1.2: char_traits typedefs
+
+#include <string>
+
+int main()
+{
+ // Check for required typedefs.
+ typedef std::char_traits<wchar_t> test_type;
+ typedef test_type::char_type char_type;
+ typedef test_type::int_type int_type;
+ typedef test_type::off_type off_type;
+ typedef test_type::pos_type pos_type;
+ typedef test_type::state_type state_type;
+
+ // 21.1.3: char_traits<wchar_t>::int_type == wint_t
+ test_type::int_type* p = 0;
+ wint_t* q __attribute__((unused)) = p;
+
+ return 0;
+}