diff options
Diffstat (limited to 'Examples/test-suite')
-rw-r--r-- | Examples/test-suite/common.mk | 5 | ||||
-rw-r--r-- | Examples/test-suite/namespace_class.i | 150 |
2 files changed, 153 insertions, 2 deletions
diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index db269e4cd..97828f3ce 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -46,8 +46,7 @@ LIBPREFIX = lib # Broken C++ test cases. (Can be run individually using make testcase.cpptest.) CPP_TEST_BROKEN += \ namespace_union \ - overload_complicated \ - smart_pointer_namespace2 + overload_complicated # Broken C test cases. (Can be run individually using make testcase.ctest.) C_TEST_BROKEN += \ @@ -157,6 +156,7 @@ CPP_TEST_CASES += \ name_cxx \ name_inherit \ name_warnings \ + namespace_class \ namespace_enum \ namespace_extend \ namespace_nested \ @@ -187,6 +187,7 @@ CPP_TEST_CASES += \ smart_pointer_multi \ smart_pointer_multi_typedef \ smart_pointer_namespace \ + smart_pointer_namespace2 \ smart_pointer_not \ smart_pointer_overload \ smart_pointer_protected \ diff --git a/Examples/test-suite/namespace_class.i b/Examples/test-suite/namespace_class.i new file mode 100644 index 000000000..77b6a8b9d --- /dev/null +++ b/Examples/test-suite/namespace_class.i @@ -0,0 +1,150 @@ +%module namespace_class + +%inline %{ + template<class T> void foobar(T t) {} + namespace test { + template<class T> void barfoo(T t) {} + } +%} + +%template(FooBarInt) ::foobar<int>; +%template(BarFooInt) test::barfoo<int>; + + +%inline %{ + + namespace test { + enum Hello { + Hi + }; + + struct Test; + + struct Bar { + Hello foo(Hello h) { + return h; + } + }; + + namespace hola { + struct Bor; + struct Foo; + struct Foobar; + template <class T> struct BarT { + }; + + template <class T> class FooT; + } + + template <class T> + class hola::FooT { + public: + Hello foo(Hello h) { + return h; + } + + T bar(T h) { + return h; + } + }; + + namespace hola { + template <> class FooT<double>; + template <> class FooT<int>; + } + + template <> + class hola::FooT<double> { + public: + double moo(double h) { + return h; + } + }; + + int a; + + struct hola::Foo : Bar { + Hello bar(Hello h) { + return h; + } + }; + } + + struct test::Test { + Hello foo(Hello h) { + return h; + } + }; + + struct test::hola::Bor { + Hello foo(Hello h) { + return h; + } + }; + + namespace test { + struct hola::Foobar : Bar { + Hello bar(Hello h) { + return h; + } + }; + } + + template <> + class test::hola::FooT<int> { + public: + int quack(int h) { + return h; + } + }; + +%} + + +namespace test +{ + namespace hola { + %template(FooT_i) FooT<int>; + } + + %template(FooT_H) hola::FooT<Hello>; +} + +%template(FooT_d) test::hola::FooT<double>; +%template(BarT_H) test::hola::BarT<test::Hello>; + +%inline %{ + + namespace hi { + namespace hello { + template <class T> struct PooT; + } + + namespace hello { + template <class T> struct PooT + { + }; + } + } +%} + +%template(Poo_i) hi::hello::PooT<int>; + +%inline %{ + + template <class T> struct BooT { + }; + + namespace test { + + typedef ::BooT<Hello> BooT_H; + } + +%} + +namespace test { + + %template(BooT_H) ::BooT<Hello>; +} +%template(BooT_i) ::BooT<int>; + |