1 // { dg-options "-std=gnu++0x" }
2 // 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
4 // Copyright (C) 2008 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // 21.4 Numeric Conversions [string.conversions]
25 #include <testsuite_hooks.h>
30 #ifdef _GLIBCXX_USE_C99
32 bool test __attribute__((unused)) = true;
36 string one(to_string(ll1));
37 VERIFY( one == "-2" );
40 string two(to_string(ll2));
41 VERIFY( two == "10" );
43 unsigned long long ull1 = 2;
44 string three(to_string(ull1));
45 VERIFY( three == "2" );
47 unsigned long long ull2 = 3000;
48 string four(to_string(ull2));
49 VERIFY( four == "3000" );
51 long double ld1 = 2.0L;
52 string five(to_string(ld1));
53 VERIFY( five == "2.000000" );
55 long double ld2 = -4.0L;
56 string six(to_string(ld2));
57 VERIFY( six == "-4.000000" );