Merge branch 'fschlimb-templ_def_cache'
* fschlimb-templ_def_cache: Add template_default_cache runtime tests Fix template_default_cache testcase template_default_cache is a multi-module test using 2-level caching as suggested by @wsfulton account for explicitly qualified scopes adding test restricting chaching template default types
This commit is contained in:
commit
4c1152efcd
5 changed files with 90 additions and 10 deletions
|
|
@ -409,6 +409,7 @@ CPP_TEST_CASES += \
|
|||
template_default_arg_overloaded \
|
||||
template_default_arg_overloaded_extend \
|
||||
template_default_arg_virtual_destructor \
|
||||
template_default_cache \
|
||||
template_default_class_parms \
|
||||
template_default_class_parms_typedef \
|
||||
template_default_inherit \
|
||||
|
|
|
|||
18
Examples/test-suite/java/template_default_cache_runme.java
Normal file
18
Examples/test-suite/java/template_default_cache_runme.java
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import template_default_cache.*;
|
||||
|
||||
public class template_default_cache_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_default_cache");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
AModelPtr ap = template_default_cache.get_mp_a();
|
||||
BModelPtr bp = template_default_cache.get_mp_b();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
import template_default_cache
|
||||
|
||||
ap = template_default_cache.get_mp_a();
|
||||
bp = template_default_cache.get_mp_b();
|
||||
|
||||
if not isinstance(ap, template_default_cache.AModelPtr):
|
||||
raise RuntimeError("get_mp_a fail")
|
||||
if not isinstance(bp, template_default_cache.BModelPtr):
|
||||
raise RuntimeError("get_mp_b fail")
|
||||
35
Examples/test-suite/template_default_cache.i
Normal file
35
Examples/test-suite/template_default_cache.i
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
%module template_default_cache;
|
||||
|
||||
%inline %{
|
||||
namespace d {
|
||||
template< typename T > class d {};
|
||||
}
|
||||
%}
|
||||
|
||||
%ignore ns_a::iface1::Model;
|
||||
|
||||
%inline %{
|
||||
namespace ns_a {
|
||||
namespace iface1 {
|
||||
class Model {};
|
||||
typedef d::d<Model> ModelPtr;
|
||||
}
|
||||
using iface1::ModelPtr;
|
||||
}
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
namespace ns_b {
|
||||
namespace iface1 {
|
||||
class Model {
|
||||
public:
|
||||
ns_a::ModelPtr foo() { return ns_a::ModelPtr(); };
|
||||
};
|
||||
typedef d::d<Model> ModelPtr;
|
||||
ns_a::ModelPtr get_mp_a() { return ns_a::ModelPtr(); }
|
||||
ModelPtr get_mp_b() { return ModelPtr(); }
|
||||
}
|
||||
}
|
||||
%}
|
||||
%template(AModelPtr) d::d<ns_a::iface1::Model>;
|
||||
%template(BModelPtr) d::d<ns_b::iface1::Model>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue