summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t')
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/dr1261.cc64
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc140
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc140
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc205
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc168
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc117
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc168
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc155
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc155
-rw-r--r--libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc66
10 files changed, 1378 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/dr1261.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/dr1261.cc
new file mode 100644
index 000000000..e17cc5565
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/dr1261.cc
@@ -0,0 +1,64 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+
+// 2009-11-11 Paolo Carlini <paolo.carlini@oracle.com>
+
+// Copyright (C) 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 <testsuite_hooks.h>
+
+// DR 1261. Insufficient overloads for to_string / to_wstring
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ const wstring one(to_wstring(-2));
+ VERIFY( one == L"-2" );
+
+ const wstring two(to_wstring(10u));
+ VERIFY( two == L"10" );
+
+ const wstring three(to_wstring(2l));
+ VERIFY( three == L"2" );
+
+ const wstring four(to_wstring(3000ul));
+ VERIFY( four == L"3000" );
+
+ const wstring five(to_wstring(7ll));
+ VERIFY( five == L"7" );
+
+ const wstring six(to_wstring(400ull));
+ VERIFY( six == L"400" );
+
+ const wstring seven(to_wstring(-1.0F));
+ VERIFY( seven == L"-1.000000" );
+
+ const wstring eight(to_wstring(2.0));
+ VERIFY( eight == L"2.000000" );
+
+ const wstring nine(to_wstring(-4.0L));
+ VERIFY( nine == L"-4.000000" );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc
new file mode 100644
index 000000000..e18e7434d
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc
@@ -0,0 +1,140 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stod(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stod(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ double d1 = 0.0;
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"2.0a");
+ d1 = stod(one, &idx1);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( d1 == 2.0 );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(L"1e");
+ one.append(2 * numeric_limits<double>::max_exponent10, L'9');
+ d1 = stod(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( d1 == 2.0 );
+
+ try
+ {
+ long double ld0 = numeric_limits<double>::max() / 100.0;
+ wstring one(to_wstring(ld0));
+ stod(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+
+ if ((numeric_limits<long double>::max() / 10000.0L)
+ > numeric_limits<double>::max())
+ {
+ test = false;
+ d1 = -1.0;
+ try
+ {
+ long double ld1 = numeric_limits<double>::max();
+ ld1 *= 100.0;
+ wstring one(to_wstring(ld1));
+ d1 = stod(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( d1 == -1.0 );
+ }
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc
new file mode 100644
index 000000000..338aa5062
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc
@@ -0,0 +1,140 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stof(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stof(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ float f1 = 0.0f;
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"2.0a");
+ f1 = stof(one, &idx1);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( f1 == 2.0f );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(L"1e");
+ one.append(2 * numeric_limits<float>::max_exponent10, L'9');
+ f1 = stof(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( f1 == 2.0f );
+
+ try
+ {
+ long double ld0 = numeric_limits<float>::max() / 100.0;
+ wstring one(to_wstring(ld0));
+ stof(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+
+ if ((numeric_limits<long double>::max() / 10000.0L)
+ > numeric_limits<float>::max())
+ {
+ test = false;
+ f1 = -1.0f;
+ try
+ {
+ long double ld1 = numeric_limits<float>::max();
+ ld1 *= 100.0;
+ wstring one(to_wstring(ld1));
+ f1 = stof(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( f1 == -1.0f );
+ }
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc
new file mode 100644
index 000000000..6ab66e47c
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc
@@ -0,0 +1,205 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stoi(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stoi(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ int i1 = 0;
+ try
+ {
+ wstring one(L"a");
+ i1 = stoi(one, 0, 16);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( i1 == 10 );
+
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"78");
+ i1 = stoi(one, &idx1, 8);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( i1 == 7 );
+ VERIFY( idx1 = 1 );
+
+ try
+ {
+ wstring one(L"10112");
+ i1 = stoi(one, &idx1, 2);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( i1 == 11 );
+ VERIFY( idx1 == 4 );
+
+ try
+ {
+ wstring one(L"0XE");
+ i1 = stoi(one, &idx1, 0);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( i1 == 14 );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(1000, L'9');
+ i1 = stoi(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( i1 == 14 );
+
+ try
+ {
+ i1 = numeric_limits<int>::max();
+ wstring one(to_wstring((long long)i1));
+ i1 = stoi(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( i1 == numeric_limits<int>::max() );
+
+ try
+ {
+ i1 = numeric_limits<int>::min();
+ wstring one(to_wstring((long long)i1));
+ i1 = stoi(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( i1 == numeric_limits<int>::min() );
+
+ test = false;
+ i1 = 1;
+ try
+ {
+ long long ll0 = numeric_limits<int>::max();
+ ++ll0;
+ wstring one(to_wstring(ll0));
+ i1 = stoi(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( i1 == 1 );
+
+ test = false;
+ try
+ {
+ long long ll1 = numeric_limits<int>::min();
+ --ll1;
+ wstring one(to_wstring(ll1));
+ i1 = stoi(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( i1 == 1 );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc
new file mode 100644
index 000000000..eb74d1227
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc
@@ -0,0 +1,168 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stol(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stol(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ long l1 = 0;
+ try
+ {
+ wstring one(L"a");
+ l1 = stol(one, 0, 16);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( l1 == 10 );
+
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"78");
+ l1 = stol(one, &idx1, 8);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( l1 == 7 );
+ VERIFY( idx1 = 1 );
+
+ try
+ {
+ wstring one(L"10112");
+ l1 = stol(one, &idx1, 2);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( l1 == 11 );
+ VERIFY( idx1 == 4 );
+
+ try
+ {
+ wstring one(L"0XE");
+ l1 = stol(one, &idx1, 0);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( l1 == 14 );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(1000, L'9');
+ l1 = stol(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( l1 == 14 );
+
+ try
+ {
+ l1 = numeric_limits<long>::max();
+ wstring one(to_wstring((long long)l1));
+ l1 = stol(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( l1 == numeric_limits<long>::max() );
+
+ try
+ {
+ l1 = numeric_limits<long>::min();
+ wstring one(to_wstring((long long)l1));
+ l1 = stol(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( l1 == numeric_limits<long>::min() );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc
new file mode 100644
index 000000000..f99659341
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc
@@ -0,0 +1,117 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stold(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stold(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ long double ld1 = 0.0L;
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"2.0a");
+ ld1 = stold(one, &idx1);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ld1 == 2.0L );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(L"1e");
+ one.append(2 * numeric_limits<long double>::max_exponent10, L'9');
+ ld1 = stold(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( ld1 == 2.0L );
+
+ try
+ {
+ long double ld0 = numeric_limits<long double>::max() / 100.0L;
+ wstring one(to_wstring(ld0));
+ stold(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc
new file mode 100644
index 000000000..e954b13df
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc
@@ -0,0 +1,168 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stoll(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stoll(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ long long ll1 = 0;
+ try
+ {
+ wstring one(L"a");
+ ll1 = stoll(one, 0, 16);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ll1 == 10 );
+
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"78");
+ ll1 = stoll(one, &idx1, 8);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ll1 == 7 );
+ VERIFY( idx1 = 1 );
+
+ try
+ {
+ wstring one(L"10112");
+ ll1 = stoll(one, &idx1, 2);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ll1 == 11 );
+ VERIFY( idx1 == 4 );
+
+ try
+ {
+ wstring one(L"0XE");
+ ll1 = stoll(one, &idx1, 0);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ll1 == 14 );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(1000, L'9');
+ ll1 = stoll(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( ll1 == 14 );
+
+ try
+ {
+ ll1 = numeric_limits<long long>::max();
+ wstring one(to_wstring(ll1));
+ ll1 = stoll(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ll1 == numeric_limits<long long>::max() );
+
+ try
+ {
+ ll1 = numeric_limits<long long>::min();
+ wstring one(to_wstring(ll1));
+ ll1 = stoll(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ll1 == numeric_limits<long long>::min() );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc
new file mode 100644
index 000000000..b1edae4d1
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc
@@ -0,0 +1,155 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stoul(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stoul(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ unsigned long ul1 = 0;
+ try
+ {
+ wstring one(L"a");
+ ul1 = stoul(one, 0, 16);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ul1 == 10 );
+
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"78");
+ ul1 = stoul(one, &idx1, 8);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ul1 == 7 );
+ VERIFY( idx1 = 1 );
+
+ try
+ {
+ wstring one(L"10112");
+ ul1 = stoul(one, &idx1, 2);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ul1 == 11 );
+ VERIFY( idx1 == 4 );
+
+ try
+ {
+ wstring one(L"0XE");
+ ul1 = stoul(one, &idx1, 0);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ul1 == 14 );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(1000, L'9');
+ ul1 = stoul(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( ul1 == 14 );
+
+ try
+ {
+ ul1 = numeric_limits<unsigned long>::max();
+ wstring one(to_wstring((unsigned long long)ul1));
+ ul1 = stoul(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ul1 == numeric_limits<unsigned long>::max() );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc
new file mode 100644
index 000000000..c65683071
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc
@@ -0,0 +1,155 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <limits>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = false;
+ using namespace std;
+
+ try
+ {
+ wstring one;
+ stoull(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ test = false;
+ try
+ {
+ wstring one(L"a");
+ stoull(one);
+ }
+ catch(std::invalid_argument)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+
+ unsigned long long ull1 = 0;
+ try
+ {
+ wstring one(L"a");
+ ull1 = stoull(one, 0, 16);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ull1 == 10 );
+
+ size_t idx1 = 0;
+ try
+ {
+ wstring one(L"78");
+ ull1 = stoull(one, &idx1, 8);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ull1 == 7 );
+ VERIFY( idx1 = 1 );
+
+ try
+ {
+ wstring one(L"10112");
+ ull1 = stoull(one, &idx1, 2);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ull1 == 11 );
+ VERIFY( idx1 == 4 );
+
+ try
+ {
+ wstring one(L"0XE");
+ ull1 = stoull(one, &idx1, 0);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ull1 == 14 );
+ VERIFY( idx1 == 3 );
+
+ test = false;
+ try
+ {
+ wstring one(1000, L'9');
+ ull1 = stoull(one);
+ }
+ catch(std::out_of_range)
+ {
+ test = true;
+ }
+ catch(...)
+ {
+ }
+ VERIFY( test );
+ VERIFY( ull1 == 14 );
+
+ try
+ {
+ ull1 = numeric_limits<unsigned long long>::max();
+ wstring one(to_wstring(ull1));
+ ull1 = stoull(one);
+ }
+ catch(...)
+ {
+ test = false;
+ }
+ VERIFY( test );
+ VERIFY( ull1 == numeric_limits<unsigned long long>::max() );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc
new file mode 100644
index 000000000..31af58f05
--- /dev/null
+++ b/libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/to_wstring.cc
@@ -0,0 +1,66 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-string-conversions "" }
+// 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
+
+// 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/>.
+
+// 21.4 Numeric Conversions [string.conversions]
+
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+#ifdef _GLIBCXX_USE_C99
+
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ long long ll1 = -2;
+ wstring one(to_wstring(ll1));
+ VERIFY( one == L"-2" );
+
+ long long ll2 = 10;
+ wstring two(to_wstring(ll2));
+ VERIFY( two == L"10" );
+
+ unsigned long long ull1 = 2;
+ wstring three(to_wstring(ull1));
+ VERIFY( three == L"2" );
+
+ unsigned long long ull2 = 3000;
+ wstring four(to_wstring(ull2));
+ VERIFY( four == L"3000" );
+
+ long double ld1 = 2.0L;
+ wstring five(to_wstring(ld1));
+ VERIFY( five == L"2.000000" );
+
+ long double ld2 = -4.0L;
+ wstring six(to_wstring(ld2));
+ VERIFY( six == L"-4.000000" );
+
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}