OSDN Git Service

2009-11-11 Paolo Carlini <paolo.carlini@oracle.com>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / 21_strings / basic_string / numeric_conversions / char / dr1261.cc
1 // { dg-options "-std=gnu++0x" }
2 // { dg-require-string-conversions "" }
3
4 // 2009-11-11  Paolo Carlini  <paolo.carlini@oracle.com>
5
6 // Copyright (C) 2009 Free Software Foundation, Inc.
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
11 // Free Software Foundation; either version 2, or (at your option)
12 // any later version.
13
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.
18
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING.  If not, write to the Free
21 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 // USA.
23
24 #include <string>
25 #include <testsuite_hooks.h>
26
27 // DR 1261. Insufficient overloads for to_string / to_wstring
28 void test01()
29 {
30   bool test __attribute__((unused)) = true;
31   using namespace std;
32
33   const string one(to_string(-2));
34   VERIFY( one == "-2" );
35
36   const string two(to_string(10u));
37   VERIFY( two == "10" );
38
39   const string three(to_string(2l));
40   VERIFY( three == "2" );
41
42   const string four(to_string(3000ul));
43   VERIFY( four == "3000" );
44
45   const string five(to_string(7ll));
46   VERIFY( five == "7" );
47
48   const string six(to_string(400ull));
49   VERIFY( six == "400" );
50
51   const string seven(to_string(-1.0F));
52   VERIFY( seven == "-1.000000" );
53
54   const string eight(to_string(2.0));
55   VERIFY( eight == "2.000000" );
56
57   const string nine(to_string(-4.0L));
58   VERIFY( nine == "-4.000000" );
59 }
60
61 int main()
62 {
63   test01();
64   return 0;
65 }