aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
diff options
context:
space:
mode:
author(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-23 10:44:52 +0000
committer(no author) <(no author)@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-23 10:44:52 +0000
commit6abd87d44aa5fcaa3434ea73bea7d7d2c9fdec62 (patch)
treed99101b214fc164ef054c44145ad1418bdb937ca /libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
parentb2c70b118eacbf74cad603bd6ee927320f0f737b (diff)
This commit was manufactured by cvs2svn to create tagrtlopt-merge-20021023
'rtlopt-merge-20021023'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/tags/rtlopt-merge-20021023@58448 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc')
-rw-r--r--libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc b/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
index 4fbf25f2121..53fdd591b5b 100644
--- a/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
+++ b/libstdc++-v3/testsuite/22_locale/num_put_members_wchar_t.cc
@@ -325,6 +325,43 @@ void test04()
VERIFY( preLANG == postLANG );
}
}
+
+// Make sure that, in a locale that expects grouping, when showbase
+// is true, an hexadecimal or octal zero is correctly output (the case
+// of zero is special since there is no 0x, 0 respectively, prefix)
+void test05()
+{
+ using namespace std;
+ bool test = true;
+
+ // A locale that expects grouping.
+ locale loc_de("de_DE");
+
+ const wstring empty;
+ wstring result;
+
+ wostringstream oss;
+ oss.imbue(loc_de);
+ const num_put<wchar_t>& np = use_facet<num_put<wchar_t> >(oss.getloc());
+
+ long l = 0;
+
+ oss.str(empty);
+ oss.clear();
+ oss.setf(ios::showbase);
+ oss.setf(ios::hex, ios::basefield);
+ np.put(oss.rdbuf(), oss, L'+', l);
+ result = oss.str();
+ VERIFY( result == L"0" );
+
+ oss.str(empty);
+ oss.clear();
+ oss.setf(ios::showbase);
+ oss.setf(ios::oct, ios::basefield);
+ np.put(oss.rdbuf(), oss, L'+', l);
+ result = oss.str();
+ VERIFY( result == L"0" );
+}
#endif
int main()
@@ -334,6 +371,7 @@ int main()
test02();
test03();
test04();
+ test05();
#endif
return 0;
}