From e431318dc0ac0bd5338275155aeb124d97e95411 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 13 Jul 2002 15:16:50 +0000 Subject: [PATCH] Added some more tests [SVN r14437] --- test/Jamfile | 6 +++ test/callbacks.cpp | 1 + test/select_arg_to_python_test.cpp | 65 ++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 test/select_arg_to_python_test.cpp diff --git a/test/Jamfile b/test/Jamfile index e4cba386..77ff5c7c 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -116,6 +116,12 @@ run select_from_python_test.cpp ../src/converter/type_id.cpp : $(UNIT_TEST_PROPERTIES) ; +run select_arg_to_python_test.cpp ../src/converter/type_id.cpp + : # command-line args + : # input files + : $(UNIT_TEST_PROPERTIES) + ; + if $(TEST_EXPECTED_FAILURES) { compile-fail ./raw_pyobject_fail1.cpp : $(PYTHON_PROPERTIES) ; diff --git a/test/callbacks.cpp b/test/callbacks.cpp index 6be5a782..6e916367 100644 --- a/test/callbacks.cpp +++ b/test/callbacks.cpp @@ -14,6 +14,7 @@ #include using namespace boost::python; +BOOST_STATIC_ASSERT(converter::is_object_manager >::value); int apply_int_int(PyObject* f, int x) { diff --git a/test/select_arg_to_python_test.cpp b/test/select_arg_to_python_test.cpp new file mode 100644 index 00000000..df925a54 --- /dev/null +++ b/test/select_arg_to_python_test.cpp @@ -0,0 +1,65 @@ +#include +#include +#include +#include +#include + +// gcc 2.95.x and MIPSpro 7.3.1.3 linker seem to demand this definition +#if ((defined(__GNUC__) && __GNUC__ < 3)) \ + || (defined(__sgi) && defined(__EDG_VERSION__) && (__EDG_VERSION__ == 238)) +namespace boost { namespace python { +BOOST_PYTHON_DECL bool handle_exception_impl(function0) +{ + return true; +} +}} +#endif + +int result; + +#define ASSERT_SAME(T1,T2) \ + if (!is_same< T1, T2 >::value) { \ + std::cout << "*********************\n"; \ + std::cout << python::type_id< T1 >() << " != " << python::type_id< T2 >() << "\n"; \ + std::cout << "*********************\n"; \ + result = 1; \ + } + +int main() +{ + using namespace boost::python::converter::detail; + using namespace boost::python::converter; + using namespace boost::python; + using namespace boost; + + + ASSERT_SAME( + select_arg_to_python::type, value_arg_to_python + ); + + ASSERT_SAME( + select_arg_to_python >::type, reference_arg_to_python + ); + + ASSERT_SAME( + select_arg_to_python >::type, pointer_shallow_arg_to_python + ); + + ASSERT_SAME( + select_arg_to_python::type, pointer_deep_arg_to_python + ); + + ASSERT_SAME( + select_arg_to_python >::type, object_manager_arg_to_python > + ); + + ASSERT_SAME( + select_arg_to_python::type, object_manager_arg_to_python + ); + + ASSERT_SAME( + select_arg_to_python::type, arg_to_python + ); + + return result; +}