$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r63820 - in sandbox/SOC/2010/bits_and_ints: boost/integer libs/integer/test
From: muriloufg_at_[hidden]
Date: 2010-07-10 12:50:34
Author: murilov
Date: 2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
New Revision: 63820
URL: http://svn.boost.org/trac/boost/changeset/63820
Log:
Now all tests compile without warnings on darwin compiler
Added:
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/isign_test.cpp   (contents, props changed)
Text files modified: 
   sandbox/SOC/2010/bits_and_ints/boost/integer/bit_utils.hpp                    |     3 ++-                                     
   sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp          |     2 +-                                      
   sandbox/SOC/2010/bits_and_ints/boost/integer/is_integral_constant.hpp         |    21 +++++++++++++++------                   
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2                   |    35 ++++++++++++++++++-----------------     
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/clear_least_bit_set_test.cpp |     6 +++---                                  
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp         |     6 +++---                                  
   sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_test.cpp                |    12 ++++++------                            
   7 files changed, 48 insertions(+), 37 deletions(-)
Modified: sandbox/SOC/2010/bits_and_ints/boost/integer/bit_utils.hpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/boost/integer/bit_utils.hpp	(original)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/bit_utils.hpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -16,7 +16,8 @@
 /*
  *	Some utilities to handle integers.
  */
-namespace boost {
+namespace boost
+{
         
 template <typename T>
 inline T set_bit(T data, unsigned char pos)
Modified: sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp	(original)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -26,7 +26,7 @@
 {
         return (value & (value - 1));
 } //clear_least_bit_set
-
+	
 } //boost
 
 #endif
Modified: sandbox/SOC/2010/bits_and_ints/boost/integer/is_integral_constant.hpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/boost/integer/is_integral_constant.hpp	(original)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/is_integral_constant.hpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -26,24 +26,33 @@
 
 namespace mpl {
 
+//~ template <typename IC>
+//~ struct is_integral_constant : false_ {};
+
+    
+//~ namespace detail {
 BOOST_MPL_HAS_XXX_TRAIT_DEF(tag)
 BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
-BOOST_MPL_HAS_XXX_TRAIT_DEF(value)
+//~ BOOST_MPL_HAS_XXX_TRAIT_DEF(value)
 BOOST_MPL_HAS_XXX_TRAIT_DEF(type)
-
+//~ }
 template <typename IC>
 struct is_integral_constant : and_<
                 and_< has_tag<IC>, is_same<typename IC::tag, integral_c_tag> >,
                 and_< has_value_type<IC>, is_integral<typename IC::value_type> >,
-		//has_value<IC>,
-		has_type<IC>,
-		true_
+		//detail_has_value<IC>,
+		has_type<IC>
 	>
 {};
 
+    
+    
+template <typename T, T value>
+struct is_integral_constant<integral_c<T,value> > : true_ {};
+    
 }
 
 
 } // boost
 
-#endif
\ No newline at end of file
+#endif
Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2	(original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/Jamfile.v2	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -4,17 +4,17 @@
 
 import testing ;
 
-project : requirements <warnings>all <toolset>gcc:<cxxflags>-Wextra ;
+project : requirements <warnings>all <toolset>darwin:<cxxflags>-Wextra <toolset>darwin:<cxxflags>-Wno-long-long <toolset>gcc:<cxxflags>-Wextra <toolset>gcc:<cxxflags>-Wno-long-long ;
 
 test-suite integer
-    : 
-        [ run cstdint_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long ]
-        [ run cstdint_test2.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 <toolset>darwin:<cxxflags>-Wno-long-long <toolset>sun:<cxxflags>"-Qoption ccfe -tmpldepth=128" ]
-        [ run integer_mask_test.cpp ]
-        [ run static_log2_test.cpp ]
-        [ run static_min_max_test.cpp ]
+	:
+		[ run cstdint_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long ]
+		[ run cstdint_test2.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 <toolset>darwin:<cxxflags>-Wno-long-long <toolset>sun:<cxxflags>"-Qoption ccfe -tmpldepth=128" ]
+		[ run integer_mask_test.cpp ]
+		[ run static_log2_test.cpp ]
+		[ run static_min_max_test.cpp ]
                 [ run sign_extend_test.cpp ]
                 [ run bit_reversal_test.cpp ]
                 [ run sign_test.cpp ]
@@ -25,11 +25,12 @@
                 [ run count_trailing_zeros_test.cpp ]
                 [ run clear_least_bit_set_test.cpp ]
                 [ run safe_avg_test.cpp ]
-        [ compile cstdint_include_test.cpp ]
-        [ compile integer_traits_include_test.cpp ]
-        [ compile integer_include_test.cpp ]
-        [ compile integer_mask_include_test.cpp ]
-        [ compile static_log2_include_test.cpp ]
-        [ compile static_min_max_include_test.cpp ]
-        [ compile integer_fwd_include_test.cpp ]
-    ;
+		[ run isign_test.cpp ]
+		[ compile cstdint_include_test.cpp ]
+		[ compile integer_traits_include_test.cpp ]
+		[ compile integer_include_test.cpp ]
+		[ compile integer_mask_include_test.cpp ]
+		[ compile static_log2_include_test.cpp ]
+		[ compile static_min_max_include_test.cpp ]
+		[ compile integer_fwd_include_test.cpp ]
+	;
Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/clear_least_bit_set_test.cpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/clear_least_bit_set_test.cpp	(original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/clear_least_bit_set_test.cpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -34,14 +34,14 @@
         CLEAR_LEAST_BIT_SET_TEST(0xAA, 0xA8);
         CLEAR_LEAST_BIT_SET_TEST(0xFFFF, 0xFFFE);
         CLEAR_LEAST_BIT_SET_TEST(0xF0A0, 0xF080);
-	CLEAR_LEAST_BIT_SET_TEST(0xFFFFFFFF, 0xFFFFFFFE);
+	CLEAR_LEAST_BIT_SET_TEST(0xFFFFFFF, 0xFFFFFFE);
         CLEAR_LEAST_BIT_SET_TEST(0x55555555, 0x55555554);
-	CLEAR_LEAST_BIT_SET_TEST(0xBABEBEEF, 0xBABEBEEE);
+	CLEAR_LEAST_BIT_SET_TEST(0x1ABEBEEF, 0x1ABEBEEE);
         CLEAR_LEAST_BIT_SET_TEST(0xFF800, 0xFF000);
         CLEAR_LEAST_BIT_SET_TEST(0x800, 0);
         CLEAR_LEAST_BIT_SET_TEST(0x123800, 0x123000);
         CLEAR_LEAST_BIT_SET_TEST(0x33800, 0x33000);
-	CLEAR_LEAST_BIT_SET_TEST(0x82000000, 0x80000000);
+	CLEAR_LEAST_BIT_SET_TEST(0x42000000, 0x40000000);
         
         return boost::report_errors();
 }
\ No newline at end of file
Added: sandbox/SOC/2010/bits_and_ints/libs/integer/test/isign_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/isign_test.cpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -0,0 +1,41 @@
+//  Boost safe_avg_test.hpp test program  --------------------------------------//
+
+//  (C) Copyright Murilo Adriano Vasconcelos 2010.
+//  Distributed under the Boost Software License, Version 1.0. (See
+//  accompanying file LICENSE_1_0.txt or copy at
+//  http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/integer/isign.hpp>
+#include <boost/integer/static_isign.hpp>
+#include <boost/mpl/integral_c.hpp>
+
+#include <iostream> 
+
+#define ISIGN_TEST(x, y, z) \
+BOOST_TEST((::boost::isign(x, y) == z)); \
+BOOST_TEST(((::boost::mpl::isign< ::boost::mpl::integral_c<int, x>, ::boost::mpl::integral_c<int, y> >::value) == z))
+
+
+// Main testing function
+int main(int, char* [])
+{    
+	std::cout << "Doing tests on safe_avg functions." << std::endl;
+	
+	ISIGN_TEST(0, 0, 0);
+	ISIGN_TEST(0, 1, 0);
+	ISIGN_TEST(0, -1, 0);
+	ISIGN_TEST(1, 1, 1);
+	ISIGN_TEST(1, -1, -1);
+	ISIGN_TEST(-1, 1, 1);
+	ISIGN_TEST(-1, -1, -1);
+	ISIGN_TEST(123987, 1000, 123987);
+	ISIGN_TEST(-123987, 1000, 123987);
+	ISIGN_TEST(123987, -1000, -123987);
+	ISIGN_TEST(-123987, -1000, -123987);
+	ISIGN_TEST(9883230, -7632945, -9883230);
+	ISIGN_TEST(-7632945, 9883230, 7632945);
+	ISIGN_TEST(7632945, -9883230, -7632945);
+	
+	return boost::report_errors();
+}
Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp	(original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_extend_test.cpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -63,9 +63,9 @@
         SIGN_EXTEND_TEST(0x7FFFFFFF, 31, -1);
         
 #ifndef BOOST_NO_INT64_T
-	SIGN_EXTEND_TEST(0x7FFFFFFFFF, 39, 0xFFFFFFFFFFFFFFFF);
-	SIGN_EXTEND_TEST(0x1000000000000000, 63, 0x1000000000000000);
-	SIGN_EXTEND_TEST(0x7FFFFFFFFFFFFFFF, 63, (uint64_t)-0x1);
+	SIGN_EXTEND_TEST(0x7FFFFFFFFFLL, 39, -0x1LL);
+	SIGN_EXTEND_TEST(0x1000000000000000LL, 63, 0x1000000000000000LL);
+	SIGN_EXTEND_TEST(0x7FFFFFFFFFFFFFFFLL, 63, -0x1LL);
 #endif
         
         return boost::report_errors();
Modified: sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_test.cpp
==============================================================================
--- sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_test.cpp	(original)
+++ sandbox/SOC/2010/bits_and_ints/libs/integer/test/sign_test.cpp	2010-07-10 12:50:32 EDT (Sat, 10 Jul 2010)
@@ -60,20 +60,20 @@
 
 #ifndef BOOST_NO_INT64_T
         
-	STATIC_SIGN_TEST(int64_t, -10000000000, -1);
-	STATIC_SIGN_TEST(int64_t, -20000000000, -1);
+	STATIC_SIGN_TEST(int64_t, -10000000000LL, -1);
+	STATIC_SIGN_TEST(int64_t, -20000000000LL, -1);
         STATIC_SIGN_TEST(int64_t, -1, -1);
         STATIC_SIGN_TEST(int64_t, 1, 1);
-	STATIC_SIGN_TEST(int64_t, 10000000000, 1);
-	STATIC_SIGN_TEST(int64_t, 12312300000, 1);
+	STATIC_SIGN_TEST(int64_t, 10000000000LL, 1);
+	STATIC_SIGN_TEST(int64_t, 12312300000LL, 1);
         STATIC_SIGN_TEST(int64_t, 0, 0);	
         
         // 64-bit tests
-	for (int64_t i = -10000002000; i != -10000000000; ++i) {
+	for (int64_t i = -10000002000LL; i != -10000000000LL; ++i) {
                 SIGN_TEST(i, -1);
         }
         
-	for (int64_t i = 11000000000; i != 11000002000; ++i) {
+	for (int64_t i = 11000000000LL; i != 11000002000LL; ++i) {
                 SIGN_TEST(i, 1);
         }