]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/numeric/conversion/test/numeric_cast_traits_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / numeric / conversion / test / numeric_cast_traits_test.cpp
index f59cb6bc767a6fd88ee6c822bb11188f6fe8106e..e8ec10562dd08903b60b4ed09220bde8d5f1750f 100644 (file)
@@ -12,7 +12,8 @@
 #include <boost/mpl/for_each.hpp>
 #include <boost/mpl/vector.hpp>
 #include <boost/cstdint.hpp>
-#include <boost/test/minimal.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/static_assert.hpp>
 
 //! Define a simple custom number
 struct Double
@@ -314,15 +315,11 @@ namespace boost { namespace numeric {
 }}//namespace boost::numeric;
 
 #define BOOST_TEST_CATCH_CUSTOM_POSITIVE_OVERFLOW( CastCode ) \
-    try { CastCode; BOOST_CHECK( false ); }                   \
-    catch( custom::positive_overflow& ){}                     \
-    catch(...){ BOOST_CHECK( false ); }                       \
+    BOOST_TEST_THROWS( CastCode, custom::positive_overflow )
 /***/
 
 #define BOOST_TEST_CATCH_CUSTOM_NEGATIVE_OVERFLOW( CastCode ) \
-    try { CastCode; BOOST_CHECK( false ); }                   \
-    catch( custom::negative_overflow& ){}                     \
-    catch(...){ BOOST_CHECK( false ); }                       \
+    BOOST_TEST_THROWS( CastCode, custom::negative_overflow )
 /***/
 
 struct test_cast_traits
@@ -331,9 +328,9 @@ struct test_cast_traits
     void operator()(T) const
     {
         Double d = boost::numeric_cast<Double>( static_cast<T>(50) );
-        BOOST_CHECK( d.v == 50. );
+        BOOST_TEST( d.v == 50. );
         T v = boost::numeric_cast<T>( d );
-        BOOST_CHECK( v == 50 );
+        BOOST_TEST( v == 50 );
     }
 };
 
@@ -360,20 +357,20 @@ void test_numeric_cast_traits()
     //! Check overflow handler.
     Double d( 56.0 );
     BOOST_TEST_CATCH_CUSTOM_POSITIVE_OVERFLOW( d = boost::numeric_cast<Double>( 101 ) );
-    BOOST_CHECK( d.v == 56. );
+    BOOST_TEST( d.v == 56. );
     BOOST_TEST_CATCH_CUSTOM_NEGATIVE_OVERFLOW( d = boost::numeric_cast<Double>( -101 ) );
-    BOOST_CHECK( d.v == 56.);
+    BOOST_TEST( d.v == 56.);
 
     //! Check custom round policy.
     d = 5.9;
     int five = boost::numeric_cast<int>( d );
-    BOOST_CHECK( five == 5 );
+    BOOST_TEST( five == 5 );
 }
 
-int test_main( int argc, char * argv[] )
+int main()
 {
     test_numeric_cast_traits();
-    return 0;
+    return boost::report_errors();
 }
 
 #undef BOOST_TEST_CATCH_CUSTOM_POSITIVE_OVERFLOW