diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 4ab20575a..76504dd0f 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -405,11 +405,13 @@ CPP0X_TEST_CASES = \ cpp0x_raw_string_literals \ cpp0x_static_assert \ cpp0x_template_explicit \ - cpp0x_thread_local \ cpp0x_uniform_initialization \ - cpp0x_alternate_function_syntax + cpp0x_alternate_function_syntax \ + cpp0x_function_objects +# cpp0x_hash_types # not fully implemented yet # cpp0x_smart_pointers # not supported by standard library yet # cpp0x_constexpr # not supported by any compilers yet +# cpp0x_thread_local # not supported by any compilers yet # Broken C++0x test cases. CPP0X_TEST_BROKEN = diff --git a/Examples/test-suite/cpp0x_function_objects.i b/Examples/test-suite/cpp0x_function_objects.i new file mode 100644 index 000000000..f480addc7 --- /dev/null +++ b/Examples/test-suite/cpp0x_function_objects.i @@ -0,0 +1,18 @@ +/* This testcase checks whether Swig correctly parses function objects + and the templates for the functions (signature). + Function objects are objects which overload the operator() function. */ +%module cpp0x_function_objects + +%inline %{ +//function pF; // not supported yet by the compiler + +struct Test { + int value; + + void operator()(short x, short y) { + value=10; + } + +} test; +%} + diff --git a/Examples/test-suite/python/cpp0x_function_objects_runme.py b/Examples/test-suite/python/cpp0x_function_objects_runme.py new file mode 100644 index 000000000..edbd88e1c --- /dev/null +++ b/Examples/test-suite/python/cpp0x_function_objects_runme.py @@ -0,0 +1,12 @@ +import cpp0x_function_objects +import sys + +t = cpp0x_function_objects.Test() +if t.value != 0: + raise RuntimeError,"Runtime cpp0x_function_objects failed. t.value should be 0, but is", t.value + +t(1,2) # sets value + +if t.value != 10: + raise RuntimeError,"Runtime cpp0x_function_objects failed. t.value not changed - should be 10, but is", t.value +