|
| 1 | +#include <boost/python/converter/arg_to_python.hpp> |
| 2 | +#include <boost/python/type_id.hpp> |
| 3 | +#include <boost/python/handle.hpp> |
| 4 | +#include <boost/python/object.hpp> |
| 5 | +#include <iostream> |
| 6 | + |
| 7 | +// gcc 2.95.x and MIPSpro 7.3.1.3 linker seem to demand this definition |
| 8 | +#if ((defined(__GNUC__) && __GNUC__ < 3)) \ |
| 9 | + || (defined(__sgi) && defined(__EDG_VERSION__) && (__EDG_VERSION__ == 238)) |
| 10 | +namespace boost { namespace python { |
| 11 | +BOOST_PYTHON_DECL bool handle_exception_impl(function0<void>) |
| 12 | +{ |
| 13 | + return true; |
| 14 | +} |
| 15 | +}} |
| 16 | +#endif |
| 17 | + |
| 18 | +int result; |
| 19 | + |
| 20 | +#define ASSERT_SAME(T1,T2) \ |
| 21 | + if (!is_same< T1, T2 >::value) { \ |
| 22 | + std::cout << "*********************\n"; \ |
| 23 | + std::cout << python::type_id< T1 >() << " != " << python::type_id< T2 >() << "\n"; \ |
| 24 | + std::cout << "*********************\n"; \ |
| 25 | + result = 1; \ |
| 26 | + } |
| 27 | + |
| 28 | +int main() |
| 29 | +{ |
| 30 | + using namespace boost::python::converter::detail; |
| 31 | + using namespace boost::python::converter; |
| 32 | + using namespace boost::python; |
| 33 | + using namespace boost; |
| 34 | + |
| 35 | + |
| 36 | + ASSERT_SAME( |
| 37 | + select_arg_to_python<int>::type, value_arg_to_python<int> |
| 38 | + ); |
| 39 | + |
| 40 | + ASSERT_SAME( |
| 41 | + select_arg_to_python<reference_wrapper<int> >::type, reference_arg_to_python<int> |
| 42 | + ); |
| 43 | + |
| 44 | + ASSERT_SAME( |
| 45 | + select_arg_to_python<pointer_wrapper<int> >::type, pointer_shallow_arg_to_python<int> |
| 46 | + ); |
| 47 | + |
| 48 | + ASSERT_SAME( |
| 49 | + select_arg_to_python<int*>::type, pointer_deep_arg_to_python<int*> |
| 50 | + ); |
| 51 | + |
| 52 | + ASSERT_SAME( |
| 53 | + select_arg_to_python<handle<> >::type, object_manager_arg_to_python<handle<> > |
| 54 | + ); |
| 55 | + |
| 56 | + ASSERT_SAME( |
| 57 | + select_arg_to_python<object>::type, object_manager_arg_to_python<object> |
| 58 | + ); |
| 59 | + |
| 60 | + ASSERT_SAME( |
| 61 | + select_arg_to_python<char[20]>::type, arg_to_python<char const*> |
| 62 | + ); |
| 63 | + |
| 64 | + return result; |
| 65 | +} |
0 commit comments