diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-12 20:23:30 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-12 20:23:30 +0000 |
commit | 8bd3b18aca60edcd8e2e2d4d773b479b21a0dd3f (patch) | |
tree | 56e8da00ceec7f916bcb815c0648e9350da063eb /libstdc++-v3/testsuite | |
parent | fe39c28c61f00e574690364658d988abcc9979a7 (diff) |
2001-12-12 Philip Martin <philip@codematters.co.uk>
Ross Smith <r-smith@ihug.co.nz>
Paolo Carlini <pcarlini@unitus.it>
libstdc++/5045
* include/bits/std_limits.h (defines, numeric_limits<bool>::digits10):
Fix digits10 values for integral types.
* include/bits/locale_facets.tcc (num_get::do_get for integral types):
Tweak _M_extract_int call.
* testsuite/27_io/istream_extractor_arith.cc (test13, test12_aux):
Tweak overflowing number of digits.
* testsuite/18_support/numeric_limits.cc (test03): New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47947 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r-- | libstdc++-v3/testsuite/18_support/numeric_limits.cc | 24 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc | 4 |
2 files changed, 26 insertions, 2 deletions
diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits.cc b/libstdc++-v3/testsuite/18_support/numeric_limits.cc index 99450c6acd8..22c2a32d080 100644 --- a/libstdc++-v3/testsuite/18_support/numeric_limits.cc +++ b/libstdc++-v3/testsuite/18_support/numeric_limits.cc @@ -155,10 +155,34 @@ void test02() const bool* pb1 = &b_nl_type::traps; } +// libstdc++/5045 +bool test03() +{ + bool test = true; + + VERIFY( std::numeric_limits<bool>::digits10 == 0 ); + VERIFY( __glibcpp_s8_digits10 == 2 ); + VERIFY( __glibcpp_u8_digits10 == 2 ); + VERIFY( __glibcpp_s16_digits10 == 4 ); + VERIFY( __glibcpp_u16_digits10 == 4 ); + VERIFY( __glibcpp_s32_digits10 == 9 ); + VERIFY( __glibcpp_u32_digits10 == 9 ); + VERIFY( __glibcpp_s64_digits10 == 18 ); + VERIFY( __glibcpp_u64_digits10 == 19 ); + +#ifdef DEBUG_ASSERT + assert(test); +#endif + + return test; +} + + int main() { test01(); test02(); + test03(); test_extrema<char>(); test_extrema<signed char>(); diff --git a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc index 83b93025226..c3181391850 100644 --- a/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc +++ b/libstdc++-v3/testsuite/27_io/istream_extractor_arith.cc @@ -523,7 +523,7 @@ bool test12_aux(bool integer_type) int digits_overflow; if (integer_type) // This many digits will overflow integer types in base 10. - digits_overflow = std::numeric_limits<T>::digits10 + 1; + digits_overflow = std::numeric_limits<T>::digits10 + 2; else // This might do it, unsure. digits_overflow = std::numeric_limits<T>::max_exponent10 + 1; @@ -573,7 +573,7 @@ void test13() // 2 // quick test for failbit on maximum length extraction. int i; - int max_digits = numeric_limits<int>::digits10; + int max_digits = numeric_limits<int>::digits10 + 1; string digits; for (int j = 0; j < max_digits; ++j) digits += '1'; |