Re: [Boost-bugs] [Boost C++ Libraries] #2295: Inconsistent behavior when using 64 bit integer types

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2295: Inconsistent behavior when using 64 bit integer types
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-12-04 19:11:30


#2295: Inconsistent behavior when using 64 bit integer types
------------------------------------------------------+---------------------
  Reporter: Hrvoje PrgeÅ¡a <hrvoje.prgesa_at_[hidden]> | Owner: nasonov
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: lexical_cast
   Version: Boost 1.36.0 | Severity: Problem
Resolution: | Keywords: lexical_cast 64 uint64_t int64_t
------------------------------------------------------+---------------------

Comment(by anonymous):

 Replying to [comment:3 nasonov]:
> > Nevertheless, lexical_cast tests really should include tests for 64bit
 integer types.
>
> They do. Search for LCAST_TEST_LONGLONG in
>
 http://svn.boost.org/svn/boost/branches/release/libs/conversion/lexical_cast_test.cpp
>
 They do indeed. Didn't notice it before when I was looking.

> Though, I don't understand/remember why it uses __int64 rather than
 boost::long_long_type.
>
 The link you posted tests boost::long_long_type if BOOST_HAS_LONG_LONG is
 defined (and seems fall back on __int64 defending on few other defined).

> I should also add a test for boost::intmax_t type.
 May I suggest adding more tests that check conversion failure in the
 generic testing routines - there is currently not a single one failure
 test in them (and therefore not a single failure test for long long),
 there are only tests for around min, max, 0 and exp(10).

 Eg. for "test_conversion_from_integral_to_string" something like my second
 use case would fit nicely:
 typedef std::basic_string<CharT> string_type;
 for(i = 0; i <= 10; ++i)
 {
   string_type underflow_str = to_str<CharT>(limits::min()) +
 to_str<CharT>(i);
   BOOST_CHECK_THROW(lexical_cast<T>(underflow_str), bad_lexical_cast);

   string_type overflow_str = to_str<CharT>(limits::max()) +
 to_str<CharT>(i);
   BOOST_CHECK_THROW(lexical_cast<T>(overflow_str), bad_lexical_cast);
 }
 (this check overflow and underflow by appending digits, not by strictly
 increasing the min/max by +/-1, although that could also be done.)

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2295#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC