diff options
author | Jing Yu <jingyu@google.com> | 2009-11-05 15:11:04 -0800 |
---|---|---|
committer | Jing Yu <jingyu@google.com> | 2009-11-05 15:11:04 -0800 |
commit | df62c1c110e8532b995b23540b7e3695729c0779 (patch) | |
tree | dbbd4cbdb50ac38011e058a2533ee4c3168b0205 /gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics | |
parent | 8d401cf711539af5a2f78d12447341d774892618 (diff) | |
download | toolchain_gcc-df62c1c110e8532b995b23540b7e3695729c0779.tar.gz toolchain_gcc-df62c1c110e8532b995b23540b7e3695729c0779.tar.bz2 toolchain_gcc-df62c1c110e8532b995b23540b7e3695729c0779.zip |
Check in gcc sources for prebuilt toolchains in Eclair.
Diffstat (limited to 'gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics')
14 files changed, 634 insertions, 0 deletions
diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/cassert/macros.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/cassert/macros.cc new file mode 100644 index 000000000..822414c7c --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/cassert/macros.cc @@ -0,0 +1,28 @@ +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cassert> + +namespace gnu +{ +#ifndef assert + #error "assert_must_be_a_macro" +#endif +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/cerrno/macros.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/cerrno/macros.cc new file mode 100644 index 000000000..98fd0f132 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/cerrno/macros.cc @@ -0,0 +1,36 @@ +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cerrno> + +namespace gnu +{ +#ifndef EDOM + #error "EDOM_must_be_a_macro" +#endif + +#ifndef ERANGE + #error "ERANGE_must_be_a_macro" +#endif + +#ifndef errno + #error "errno_must_be_a_macro" +#endif +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/stdexcept/synopsis.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/stdexcept/synopsis.cc new file mode 100644 index 000000000..6be26e0e1 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/stdexcept/synopsis.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdexcept> + +namespace std { + class logic_error; + class domain_error; + class invalid_argument; + class length_error; + class out_of_range; + class runtime_error; + class range_error; + class overflow_error; + class underflow_error; +} + diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/stdexcept/types_std.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/stdexcept/types_std.cc new file mode 100644 index 000000000..160c69115 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/headers/stdexcept/types_std.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdexcept> + +namespace gnu +{ + typedef std::logic_error t1; + typedef std::domain_error t2; + typedef std::invalid_argument t3; + typedef std::length_error t4; + typedef std::out_of_range t5; + typedef std::runtime_error t6; + typedef std::range_error t7; + typedef std::overflow_error t8; + typedef std::underflow_error t9; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc new file mode 100644 index 000000000..5c936e27f --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc @@ -0,0 +1,30 @@ +// { dg-do run { xfail *-*-* } } +// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdexcept> +#include <testsuite_api.h> + +int main() +{ + typedef std::logic_error test_type; + __gnu_test::diamond_derivation<test_type, false>::test(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-1.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-1.cc new file mode 100644 index 000000000..d5e36d2df --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-1.cc @@ -0,0 +1,59 @@ +// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <stdexcept> +#include <cstring> +#include <testsuite_hooks.h> + +// libstdc++/1972 +void test01() +{ + bool test __attribute__((unused)) = true; + std::string s("lack of sunlight, no water error"); + + // 1 + std::logic_error obj1 = std::logic_error(s); + + // 2 + std::logic_error obj2(s); + + VERIFY( std::strcmp(obj1.what(), s.data()) == 0 ); + VERIFY( std::strcmp(obj2.what(), s.data()) == 0 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + std::string s("lack of sunlight error"); + std::domain_error x(s); + + VERIFY( std::strcmp(x.what(), s.data()) == 0 ); +} + +int main(void) +{ + test01(); + test02(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-2.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-2.cc new file mode 100644 index 000000000..030b5e8f6 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-2.cc @@ -0,0 +1,51 @@ +// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <stdexcept> +#include <cstring> +#include <testsuite_hooks.h> + +// libstdc++/2089 +class fuzzy_logic : public std::logic_error +{ +public: + fuzzy_logic() : std::logic_error("whoa") { } +}; + +void test03() +{ + bool test __attribute__((unused)) = true; + try + { throw fuzzy_logic(); } + catch(const fuzzy_logic& obj) + { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); } + catch(...) + { VERIFY( false ); } +} + +int main(void) +{ + test03(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc new file mode 100644 index 000000000..4dbad0d27 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <stdexcept> +#include <cstring> +#include <testsuite_hooks.h> + +// test copy ctors, assignment operators, and persistence of member string data +// libstdc++/1972 +// via Greg Bumgardner <bumgard@roguewave.com> +void allocate_on_stack(void) +{ + const size_t num = 512; + __extension__ char array[num]; + for (size_t i = 0; i < num; i++) + array[i]=0; +} + +void test04() +{ + bool test __attribute__((unused)) = true; + const std::string s("CA ISO emergency once again:immediate power down"); + const char* strlit1 = "wish I lived in Palo Alto"; + const char* strlit2 = "...or Santa Barbara"; + std::logic_error obj1(s); + + // block 01 + { + const std::string s2(strlit1); + std::logic_error obj2(s2); + obj1 = obj2; + } + allocate_on_stack(); + VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); + + // block 02 + { + const std::string s3(strlit2); + std::logic_error obj3 = std::logic_error(s3); + obj1 = obj3; + } + allocate_on_stack(); + VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); +} + +int main(void) +{ + test04(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc new file mode 100644 index 000000000..681e2a364 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc @@ -0,0 +1,41 @@ +// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstring> +#include <string> +#include <stdexcept> +#include <testsuite_hooks.h> + +// Can construct and return 10k character error string. +void test01() +{ + typedef std::logic_error test_type; + + bool test __attribute__((unused)) = true; + const std::string xxx(10000, 'x'); + test_type t(xxx); + VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); +} + +int main(void) +{ + test01(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc new file mode 100644 index 000000000..86d5bb5ed --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc @@ -0,0 +1,30 @@ +// { dg-do run { xfail *-*-* } } +// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdexcept> +#include <testsuite_api.h> + +int main() +{ + typedef std::runtime_error test_type; + __gnu_test::diamond_derivation<test_type, false>::test(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-1.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-1.cc new file mode 100644 index 000000000..a46a421db --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-1.cc @@ -0,0 +1,59 @@ +// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <stdexcept> +#include <cstring> +#include <testsuite_hooks.h> + +// libstdc++/1972 +void test01() +{ + bool test __attribute__((unused)) = true; + std::string s("lack of sunlight, no water error"); + + // 1 + std::runtime_error obj1 = std::runtime_error(s); + + // 2 + std::runtime_error obj2(s); + + VERIFY( std::strcmp(obj1.what(), s.data()) == 0 ); + VERIFY( std::strcmp(obj2.what(), s.data()) == 0 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + std::string s("lack of sunlight error"); + std::range_error x(s); + + VERIFY( std::strcmp(x.what(), s.data()) == 0 ); +} + +int main(void) +{ + test01(); + test02(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-2.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-2.cc new file mode 100644 index 000000000..779c1f518 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-2.cc @@ -0,0 +1,51 @@ +// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <stdexcept> +#include <cstring> +#include <testsuite_hooks.h> + +// libstdc++/2089 +class fuzzy_logic : public std::runtime_error +{ +public: + fuzzy_logic() : std::runtime_error("whoa") { } +}; + +void test03() +{ + bool test __attribute__((unused)) = true; + try + { throw fuzzy_logic(); } + catch(const fuzzy_logic& obj) + { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); } + catch(...) + { VERIFY( false ); } +} + +int main(void) +{ + test03(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc new file mode 100644 index 000000000..63cb48163 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc @@ -0,0 +1,71 @@ +// 2001-02-26 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <stdexcept> +#include <cstring> +#include <testsuite_hooks.h> + +// test copy ctors, assignment operators, and persistence of member string data +// libstdc++/1972 +// via Greg Bumgardner <bumgard@roguewave.com> +void allocate_on_stack(void) +{ + const size_t num = 512; + __extension__ char array[num]; + for (size_t i = 0; i < num; i++) + array[i]=0; +} + +void test04() +{ + bool test __attribute__((unused)) = true; + const std::string s("CA ISO emergency once again:immediate power down"); + const char* strlit1 = "wish I lived in Palo Alto"; + const char* strlit2 = "...or Santa Barbara"; + std::runtime_error obj1(s); + + // block 01 + { + const std::string s2(strlit1); + std::runtime_error obj2(s2); + obj1 = obj2; + } + allocate_on_stack(); + VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); + + // block 02 + { + const std::string s3(strlit2); + std::runtime_error obj3 = std::runtime_error(s3); + obj1 = obj3; + } + allocate_on_stack(); + VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); +} + +int main(void) +{ + test04(); + return 0; +} diff --git a/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc new file mode 100644 index 000000000..c0ce964f6 --- /dev/null +++ b/gcc-4.3.1/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc @@ -0,0 +1,41 @@ +// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstring> +#include <string> +#include <stdexcept> +#include <testsuite_hooks.h> + +// Can construct and return 10k character error string. +void test01() +{ + typedef std::runtime_error test_type; + + bool test __attribute__((unused)) = true; + const std::string xxx(10000, 'x'); + test_type t(xxx); + VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); +} + +int main(void) +{ + test01(); + return 0; +} |