]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/21_strings/basic_string/numeric_conversions/char/to_string.cc
1 // { dg-options "-std=gnu++0x" }
2 // { dg-require-string-conversions "" }
4 // 2008-06-15 Paolo Carlini <paolo.carlini@oracle.com>
6 // Copyright (C) 2008 Free Software Foundation, Inc.
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)
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.
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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
24 // 21.4 Numeric Conversions [string.conversions]
27 #include <testsuite_hooks.h>
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" );