2004-09-02 15:41:37 +00:00
|
|
|
|
2006-11-20 18:02:17 +00:00
|
|
|
// Copyright Aleksey Gurtovoy 2001-2006
|
2004-09-02 15:41:37 +00:00
|
|
|
//
|
|
|
|
|
// 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)
|
|
|
|
|
//
|
|
|
|
|
// See http://www.boost.org/libs/mpl for documentation.
|
|
|
|
|
|
2008-10-10 09:21:07 +00:00
|
|
|
// $Id$
|
2004-09-02 15:41:37 +00:00
|
|
|
// $Date$
|
|
|
|
|
// $Revision$
|
|
|
|
|
|
|
|
|
|
#include <boost/mpl/next_prior.hpp>
|
2014-09-19 18:55:00 -06:00
|
|
|
#include <boost/mpl/aux_/test.hpp>
|
2004-09-02 15:41:37 +00:00
|
|
|
#include <boost/mpl/aux_/config/workaround.hpp>
|
|
|
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
2020-04-12 12:48:24 -04:00
|
|
|
#if !BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600)
|
2004-09-02 15:41:37 +00:00
|
|
|
# define INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \
|
2006-02-20 15:45:40 +00:00
|
|
|
BOOST_TEST(( WRAPPER(T,i)() == i )); \
|
|
|
|
|
BOOST_TEST(( WRAPPER(T,i)::value == i )); \
|
2004-09-02 15:41:37 +00:00
|
|
|
/**/
|
|
|
|
|
#else
|
|
|
|
|
# define INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \
|
2006-02-20 15:45:40 +00:00
|
|
|
BOOST_TEST(( WRAPPER(T,i)::value == i )); \
|
2004-09-02 15:41:37 +00:00
|
|
|
/**/
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-05-16 02:38:50 -04:00
|
|
|
#if defined(BOOST_NO_CXX11_CONSTEXPR)
|
|
|
|
|
#define CONSTEXPR_INTEGRAL_TEST(T, i)
|
|
|
|
|
#else
|
|
|
|
|
#define CONSTEXPR_INTEGRAL_TEST(T, i) { static_assert(T() == i, "Constexpr for integral constant failed"); }
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-04-12 12:48:24 -04:00
|
|
|
#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x582))
|
2006-11-20 18:02:17 +00:00
|
|
|
// agurt 20/nov/06: see http://article.gmane.org/gmane.comp.lib.boost.devel/151065
|
|
|
|
|
#define INTEGRAL_WRAPPER_TEST(unused1, i, T) \
|
|
|
|
|
{ \
|
|
|
|
|
typedef WRAPPER(T,i) borland_tested_type; \
|
|
|
|
|
{ typedef is_same< borland_tested_type::value_type, T > borland_test_type; \
|
|
|
|
|
MPL_ASSERT(( borland_test_type )); } \
|
|
|
|
|
{ MPL_ASSERT(( is_same< borland_tested_type::type, WRAPPER(T,i) > )); } \
|
|
|
|
|
{ MPL_ASSERT(( is_same< next< borland_tested_type >::type, WRAPPER(T,i+1) > )); } \
|
|
|
|
|
{ MPL_ASSERT(( is_same< prior< borland_tested_type >::type, WRAPPER(T,i-1) > )); } \
|
|
|
|
|
{ MPL_ASSERT_RELATION( (borland_tested_type::value), ==, i ); } \
|
2014-05-16 02:38:50 -04:00
|
|
|
CONSTEXPR_INTEGRAL_TEST(borland_tested_type, i) \
|
2006-11-20 18:02:17 +00:00
|
|
|
INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \
|
|
|
|
|
} \
|
|
|
|
|
/**/
|
|
|
|
|
#else
|
2004-09-02 15:41:37 +00:00
|
|
|
#define INTEGRAL_WRAPPER_TEST(unused1, i, T) \
|
|
|
|
|
{ MPL_ASSERT(( is_same< WRAPPER(T,i)::value_type, T > )); } \
|
|
|
|
|
{ MPL_ASSERT(( is_same< WRAPPER(T,i)::type, WRAPPER(T,i) > )); } \
|
|
|
|
|
{ MPL_ASSERT(( is_same< next< WRAPPER(T,i) >::type, WRAPPER(T,i+1) > )); } \
|
|
|
|
|
{ MPL_ASSERT(( is_same< prior< WRAPPER(T,i) >::type, WRAPPER(T,i-1) > )); } \
|
|
|
|
|
{ MPL_ASSERT_RELATION( (WRAPPER(T,i)::value), ==, i ); } \
|
2014-05-16 02:38:50 -04:00
|
|
|
CONSTEXPR_INTEGRAL_TEST(WRAPPER(T,i), i) \
|
2004-09-02 15:41:37 +00:00
|
|
|
INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \
|
|
|
|
|
/**/
|
2006-11-20 18:02:17 +00:00
|
|
|
#endif
|
|
|
|
|
|