diff options
author | Philip Martin <philip@codematters.co.uk> | 2001-12-12 20:23:30 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2001-12-12 20:23:30 +0000 |
commit | cb93dfb4a0007ac5c5f26b3094fd995708d8eeea (patch) | |
tree | 56e8da00ceec7f916bcb815c0648e9350da063eb /libstdc++-v3/testsuite | |
parent | 2bee6045244207d5fb97b9b0a96ffd69eb5b9b74 (diff) | |
download | gcc-cb93dfb4a0007ac5c5f26b3094fd995708d8eeea.zip gcc-cb93dfb4a0007ac5c5f26b3094fd995708d8eeea.tar.gz gcc-cb93dfb4a0007ac5c5f26b3094fd995708d8eeea.tar.bz2 |
Ross Smith <r-smith@ihug.co.nz> Paolo Carlini <pcarlini@unitus.it>
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.
Co-Authored-By: Paolo Carlini <pcarlini@unitus.it>
Co-Authored-By: Ross Smith <r-smith@ihug.co.nz>
From-SVN: r47947
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 99450c6..22c2a32 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 83b9302..c318139 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'; |