| 1 | |
|---|
| 2 | // Copyright Aleksey Gurtovoy 2001-2006 |
|---|
| 3 | // |
|---|
| 4 | // Distributed under the Boost Software License, Version 1.0. |
|---|
| 5 | // (See accompanying file LICENSE_1_0.txt or copy at |
|---|
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 7 | // |
|---|
| 8 | // See http://www.boost.org/libs/mpl for documentation. |
|---|
| 9 | |
|---|
| 10 | // $Source: /cvsroot/boost/boost/libs/mpl/test/integral_wrapper_test.hpp,v $ |
|---|
| 11 | // $Date: 2006/11/20 17:59:29 $ |
|---|
| 12 | // $Revision: 1.4.2.1 $ |
|---|
| 13 | |
|---|
| 14 | #include <boost/mpl/next_prior.hpp> |
|---|
| 15 | #include <boost/mpl/aux_/test.hpp> |
|---|
| 16 | #include <boost/mpl/aux_/config/workaround.hpp> |
|---|
| 17 | |
|---|
| 18 | #include <cassert> |
|---|
| 19 | |
|---|
| 20 | #if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) |
|---|
| 21 | # define INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ |
|---|
| 22 | BOOST_TEST(( WRAPPER(T,i)() == i )); \ |
|---|
| 23 | BOOST_TEST(( WRAPPER(T,i)::value == i )); \ |
|---|
| 24 | /**/ |
|---|
| 25 | #else |
|---|
| 26 | # define INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ |
|---|
| 27 | BOOST_TEST(( WRAPPER(T,i)::value == i )); \ |
|---|
| 28 | /**/ |
|---|
| 29 | #endif |
|---|
| 30 | |
|---|
| 31 | #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) |
|---|
| 32 | // agurt 20/nov/06: see http://article.gmane.org/gmane.comp.lib.boost.devel/151065 |
|---|
| 33 | #define INTEGRAL_WRAPPER_TEST(unused1, i, T) \ |
|---|
| 34 | { \ |
|---|
| 35 | typedef WRAPPER(T,i) borland_tested_type; \ |
|---|
| 36 | { typedef is_same< borland_tested_type::value_type, T > borland_test_type; \ |
|---|
| 37 | MPL_ASSERT(( borland_test_type )); } \ |
|---|
| 38 | { MPL_ASSERT(( is_same< borland_tested_type::type, WRAPPER(T,i) > )); } \ |
|---|
| 39 | { MPL_ASSERT(( is_same< next< borland_tested_type >::type, WRAPPER(T,i+1) > )); } \ |
|---|
| 40 | { MPL_ASSERT(( is_same< prior< borland_tested_type >::type, WRAPPER(T,i-1) > )); } \ |
|---|
| 41 | { MPL_ASSERT_RELATION( (borland_tested_type::value), ==, i ); } \ |
|---|
| 42 | INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ |
|---|
| 43 | } \ |
|---|
| 44 | /**/ |
|---|
| 45 | #else |
|---|
| 46 | #define INTEGRAL_WRAPPER_TEST(unused1, i, T) \ |
|---|
| 47 | { MPL_ASSERT(( is_same< WRAPPER(T,i)::value_type, T > )); } \ |
|---|
| 48 | { MPL_ASSERT(( is_same< WRAPPER(T,i)::type, WRAPPER(T,i) > )); } \ |
|---|
| 49 | { MPL_ASSERT(( is_same< next< WRAPPER(T,i) >::type, WRAPPER(T,i+1) > )); } \ |
|---|
| 50 | { MPL_ASSERT(( is_same< prior< WRAPPER(T,i) >::type, WRAPPER(T,i-1) > )); } \ |
|---|
| 51 | { MPL_ASSERT_RELATION( (WRAPPER(T,i)::value), ==, i ); } \ |
|---|
| 52 | INTEGRAL_WRAPPER_RUNTIME_TEST(i, T) \ |
|---|
| 53 | /**/ |
|---|
| 54 | #endif |
|---|
| 55 | |
|---|