diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-29 22:11:04 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-29 22:11:04 +0000 |
commit | d601601a4f54f2afaf31845ae923944a345297ae (patch) | |
tree | e02b45d2e1a79d2ca32ec4f6fe9a9bd2199304bd /libstdc++-v3/testsuite | |
parent | 3d17956c710ee9db3e25b18b444f1f2ea3c85368 (diff) | |
download | ppe42-gcc-d601601a4f54f2afaf31845ae923944a345297ae.tar.gz ppe42-gcc-d601601a4f54f2afaf31845ae923944a345297ae.zip |
2004-07-29 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/14220
* include/bits/locale_facets.tcc (num_put<>::_M_insert_float):
Don't clip the precision passed down to __convert_from_v:
22.2.2.2.2 nowhere says so.
* testsuite/22_locale/num_put/put/char/14220.cc: New.
* testsuite/22_locale/num_put/put/wchar_t/14220.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/22_locale/num_put/put/char/14220.cc | 49 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/14220.cc | 49 |
2 files changed, 98 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/14220.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/14220.cc new file mode 100644 index 00000000000..ecaeec96d97 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/14220.cc @@ -0,0 +1,49 @@ +// 2004-04-30 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +// libstdc++/14220 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + ostringstream oss; + const num_put<char>& np = use_facet<num_put<char> >(oss.getloc()); + + const int precision = 1000; + + oss.precision(precision); + oss.setf(ios_base::fixed); + np.put(oss.rdbuf(), oss, '+', 1.0); + const string result = oss.str(); + VERIFY( result.size() == precision + 2 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/14220.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/14220.cc new file mode 100644 index 00000000000..1319e569df6 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/14220.cc @@ -0,0 +1,49 @@ +// 2004-04-30 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2004 Free Software Foundation +// +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +// libstdc++/14220 +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + wostringstream oss; + const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc()); + + const int precision = 1000; + + oss.precision(precision); + oss.setf(ios_base::fixed); + np.put(oss.rdbuf(), oss, L'+', 1.0); + const wstring result = oss.str(); + VERIFY( result.size() == precision + 2 ); +} + +int main() +{ + test01(); + return 0; +} |