]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/wchar_t/dr1261.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 21_strings / basic_string / numeric_conversions / wchar_t / dr1261.cc
CommitLineData
52066eae 1// { dg-do run { target c++11 } }
a4ecd144
PC
2// { dg-require-string-conversions "" }
3
4// 2009-11-11 Paolo Carlini <paolo.carlini@oracle.com>
5
99dee823 6// Copyright (C) 2009-2021 Free Software Foundation, Inc.
a4ecd144
PC
7//
8// This file is part of the GNU ISO C++ Library. This library is free
9// software; you can redistribute it and/or modify it under the
10// terms of the GNU General Public License as published by the
4bee90f7 11// Free Software Foundation; either version 3, or (at your option)
a4ecd144 12// any later version.
4bee90f7 13//
a4ecd144
PC
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License for more details.
4bee90f7 18//
a4ecd144 19// You should have received a copy of the GNU General Public License along
4bee90f7
PC
20// with this library; see the file COPYING3. If not see
21// <http://www.gnu.org/licenses/>.
a4ecd144
PC
22
23#include <string>
24#include <testsuite_hooks.h>
25
26// DR 1261. Insufficient overloads for to_string / to_wstring
27void test01()
28{
a4ecd144
PC
29 using namespace std;
30
31 const wstring one(to_wstring(-2));
32 VERIFY( one == L"-2" );
33
34 const wstring two(to_wstring(10u));
35 VERIFY( two == L"10" );
36
37 const wstring three(to_wstring(2l));
38 VERIFY( three == L"2" );
39
40 const wstring four(to_wstring(3000ul));
41 VERIFY( four == L"3000" );
42
43 const wstring five(to_wstring(7ll));
44 VERIFY( five == L"7" );
45
46 const wstring six(to_wstring(400ull));
47 VERIFY( six == L"400" );
48
49 const wstring seven(to_wstring(-1.0F));
50 VERIFY( seven == L"-1.000000" );
51
52 const wstring eight(to_wstring(2.0));
53 VERIFY( eight == L"2.000000" );
54
55 const wstring nine(to_wstring(-4.0L));
56 VERIFY( nine == L"-4.000000" );
57}
58
59int main()
60{
61 test01();
62 return 0;
63}