Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58029 - in trunk: boost libs/integer/test
From: john_at_[hidden]
Date: 2009-11-29 08:59:19


Author: johnmaddock
Date: 2009-11-29 08:59:18 EST (Sun, 29 Nov 2009)
New Revision: 58029
URL: http://svn.boost.org/trac/boost/changeset/58029

Log:
Change long long to boost::long_long_type etc.
Text files modified:
   trunk/boost/integer.hpp | 16 +++++---
   trunk/libs/integer/test/Jamfile.v2 | 4 +-
   trunk/libs/integer/test/integer_test.cpp | 68 ++++++++++++++++++++++-----------------
   3 files changed, 51 insertions(+), 37 deletions(-)

Modified: trunk/boost/integer.hpp
==============================================================================
--- trunk/boost/integer.hpp (original)
+++ trunk/boost/integer.hpp 2009-11-29 08:59:18 EST (Sun, 29 Nov 2009)
@@ -41,7 +41,11 @@
   // fast integers from least integers
   // int_fast_t<> works correctly for unsigned too, in spite of the name.
   template< typename LeastInt >
- struct int_fast_t { typedef LeastInt fast; }; // imps may specialize
+ struct int_fast_t
+ {
+ typedef LeastInt fast;
+ typedef fast type;
+ }; // imps may specialize
 
   namespace detail{
 
@@ -115,7 +119,7 @@
           (Bits-1 <= ::std::numeric_limits<short>::digits) +
           (Bits-1 <= ::std::numeric_limits<signed char>::digits)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
   };
 
   // unsigned
@@ -135,7 +139,7 @@
           (Bits <= ::std::numeric_limits<unsigned short>::digits) +
           (Bits <= ::std::numeric_limits<unsigned char>::digits)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
       // int_fast_t<> works correctly for unsigned too, in spite of the name.
   };
 
@@ -161,7 +165,7 @@
           (MaxValue <= ::boost::integer_traits<short>::const_max) +
           (MaxValue <= ::boost::integer_traits<signed char>::const_max)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
   };
 
 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
@@ -183,7 +187,7 @@
           (MinValue >= ::boost::integer_traits<short>::const_min) +
           (MinValue >= ::boost::integer_traits<signed char>::const_min)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
   };
 
   // unsigned
@@ -207,7 +211,7 @@
           (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
           (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
   };
 
 

Modified: trunk/libs/integer/test/Jamfile.v2
==============================================================================
--- trunk/libs/integer/test/Jamfile.v2 (original)
+++ trunk/libs/integer/test/Jamfile.v2 2009-11-29 08:59:18 EST (Sun, 29 Nov 2009)
@@ -7,9 +7,9 @@
 project : requirements <warnings>all <toolset>gcc:<cxxflags>-Wextra ;
 
 test-suite integer
- : [ run cstdint_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>gcc:<cxxflags>-Wno-type-limits ]
+ : [ run cstdint_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long ]
         [ run integer_traits_test.cpp ]
- [ run integer_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long ]
+ [ run integer_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long ]
         [ run integer_mask_test.cpp ]
         [ run static_log2_test.cpp ]
         [ run static_min_max_test.cpp ]

Modified: trunk/libs/integer/test/integer_test.cpp
==============================================================================
--- trunk/libs/integer/test/integer_test.cpp (original)
+++ trunk/libs/integer/test/integer_test.cpp 2009-11-29 08:59:18 EST (Sun, 29 Nov 2009)
@@ -50,8 +50,8 @@
 const char* get_name_of_type(long){ return "long"; }
 const char* get_name_of_type(unsigned long){ return "unsigned long"; }
 #ifdef BOOST_HAS_LONG_LONG
-const char* get_name_of_type(long long){ return "long long"; }
-const char* get_name_of_type(unsigned long long){ return "unsigned long long"; }
+const char* get_name_of_type(boost::long_long_type){ return "boost::long_long_type"; }
+const char* get_name_of_type(boost::ulong_long_type){ return "boost::ulong_long_type"; }
 #endif
 
 template <int Bits>
@@ -89,7 +89,7 @@
       || (sizeof(unsigned int) * CHAR_BIT == Bits)
       || (sizeof(unsigned long) * CHAR_BIT == Bits)
 #ifdef BOOST_HAS_LONG_LONG
- || (sizeof(unsigned long long) * CHAR_BIT == Bits)
+ || (sizeof(boost::ulong_long_type) * CHAR_BIT == Bits)
 #endif
>());
    //
@@ -165,8 +165,8 @@
    // Nothing to do here!!
 }
 
-template <class Traits, class Expected>
-void test_min_max_type(Expected val)
+template <class Traits, class Expected, class Value>
+void test_min_max_type(Value val)
 {
    typedef typename Traits::least least_type;
    typedef typename Traits::fast fast_type;
@@ -174,6 +174,16 @@
    BOOST_TEST(sizeof(fast_type) >= sizeof(least_type));
    BOOST_TEST((std::numeric_limits<least_type>::min)() <= val);
    BOOST_TEST((std::numeric_limits<least_type>::max)() >= val);
+
+ if(boost::detail::test_errors() != last_error_count)
+ {
+ last_error_count = boost::detail::test_errors();
+ std::cout << "Traits type is: " << typeid(Traits).name() << std::endl;
+ std::cout << "Least type is: " << get_name_of_type(least_type(0)) << std::endl;
+ std::cout << "Fast type is: " << get_name_of_type(fast_type(0)) << std::endl;
+ std::cout << "Expected type is: " << get_name_of_type(Expected(0)) << std::endl;
+ std::cout << "Required value is: " << val << std::endl;
+ }
 }
 
 // Test program
@@ -216,36 +226,36 @@
       test_min_max_type<boost::uint_value_t<ULONG_MAX>, unsigned long>(ULONG_MAX);
 #endif
 #if defined(BOOST_HAS_LONG_LONG) && (defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX))
- test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, long long>(LONG_MAX+1LL);
- test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, long long>(LONG_MIN-1LL);
- test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, unsigned long long>(ULONG_MAX+1uLL);
- test_min_max_type<boost::int_max_value_t<LLONG_MAX>, long long>(LLONG_MAX);
- test_min_max_type<boost::int_min_value_t<LLONG_MIN>, long long>(LLONG_MIN);
- test_min_max_type<boost::uint_value_t<ULLONG_MAX>, unsigned long long>(ULLONG_MAX);
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<LLONG_MAX>, boost::long_long_type>(LLONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LLONG_MIN>, boost::long_long_type>(LLONG_MIN);
+ test_min_max_type<boost::uint_value_t<ULLONG_MAX>, boost::ulong_long_type>(ULLONG_MAX);
 #endif
 #if defined(BOOST_HAS_LONG_LONG) && (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX))
- test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, long long>(LONG_MAX+1LL);
- test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, long long>(LONG_MIN-1LL);
- test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, unsigned long long>(ULONG_MAX+1uLL);
- test_min_max_type<boost::int_max_value_t<LONG_LONG_MAX>, long long>(LONG_LONG_MAX);
- test_min_max_type<boost::int_min_value_t<LONG_LONG_MIN>, long long>(LONG_LONG_MIN);
- test_min_max_type<boost::uint_value_t<ULONG_LONG_MAX>, unsigned long long>(ULONG_LONG_MAX);
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<LONG_LONG_MAX>, boost::long_long_type>(LONG_LONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LONG_LONG_MIN>, boost::long_long_type>(LONG_LONG_MIN);
+ test_min_max_type<boost::uint_value_t<ULONG_LONG_MAX>, boost::ulong_long_type>(ULONG_LONG_MAX);
 #endif
 #if defined(BOOST_HAS_LONG_LONG) && (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX))
- test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, long long>(LONG_MAX+1LL);
- test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, long long>(LONG_MIN-1LL);
- test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, unsigned long long>(ULONG_MAX+1uLL);
- test_min_max_type<boost::int_max_value_t<LONGLONG_MAX>, long long>(LONGLONG_MAX);
- test_min_max_type<boost::int_min_value_t<LONGLONG_MIN>, long long>(LONGLONG_MAX);
- test_min_max_type<boost::uint_value_t<ULONGLONG_MAX>, unsigned long long>(ULONGLONG_MAX);
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<LONGLONG_MAX>, boost::long_long_type>(LONGLONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LONGLONG_MIN>, boost::long_long_type>(LONGLONG_MAX);
+ test_min_max_type<boost::uint_value_t<ULONGLONG_MAX>, boost::ulong_long_type>(ULONGLONG_MAX);
 #endif
 #if defined(BOOST_HAS_LONG_LONG) && (defined(_ULLONG_MAX) && defined(_LLONG_MIN) && (_ULLONG_MAX != ULONG_MAX))
- test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, long long>(LONG_MAX+1LL);
- test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, long long>(LONG_MIN-1LL);
- test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, unsigned long long>(ULONG_MAX+1uLL);
- test_min_max_type<boost::int_max_value_t<_LLONG_MAX>, long long>(_LLONG_MAX);
- test_min_max_type<boost::int_min_value_t<_LLONG_MIN>, long long>(_LLONG_MIN);
- test_min_max_type<boost::uint_value_t<_ULLONG_MAX>, unsigned long long>(_ULLONG_MAX);
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<_LLONG_MAX>, boost::long_long_type>(_LLONG_MAX);
+ test_min_max_type<boost::int_min_value_t<_LLONG_MIN>, boost::long_long_type>(_LLONG_MIN);
+ test_min_max_type<boost::uint_value_t<_ULLONG_MAX>, boost::ulong_long_type>(_ULLONG_MAX);
 #endif
       return boost::report_errors();
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk