Add template_default_cache runtime tests

Also correct illegal C++ namespace names
This commit is contained in:
William S Fulton 2017-01-16 07:46:03 +00:00
parent 6f54a00db7
commit 6db71c690a
3 changed files with 34 additions and 7 deletions

View 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();
}
}

View File

@ -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")

View File

@ -6,10 +6,10 @@
}
%}
%ignore ns__a::iface1::Model;
%ignore ns_a::iface1::Model;
%inline %{
namespace ns__a {
namespace ns_a {
namespace iface1 {
class Model {};
typedef d::d<Model> ModelPtr;
@ -19,17 +19,17 @@ namespace ns__a {
%}
%inline %{
namespace ns__b {
namespace ns_b {
namespace iface1 {
class Model {
public:
ns__a::ModelPtr foo() { return ns__a::ModelPtr(); };
ns_a::ModelPtr foo() { return ns_a::ModelPtr(); };
};
typedef d::d<Model> ModelPtr;
ns__a::ModelPtr get_mp_a() { return ns__a::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>;
%template(AModelPtr) d::d<ns_a::iface1::Model>;
%template(BModelPtr) d::d<ns_b::iface1::Model>;