Tests for C nested classes symbol table not being in global space
Tests for 55bda53145
This commit is contained in:
parent
55bda53145
commit
9b0e484b8a
3 changed files with 113 additions and 0 deletions
|
|
@ -602,6 +602,7 @@ C_TEST_CASES += \
|
|||
memberin_extend_c \
|
||||
name \
|
||||
nested \
|
||||
nested_extend_c \
|
||||
nested_structs \
|
||||
newobject2 \
|
||||
overload_extend \
|
||||
|
|
|
|||
38
Examples/test-suite/java/nested_extend_c_runme.java
Normal file
38
Examples/test-suite/java/nested_extend_c_runme.java
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import nested_extend_c.*;
|
||||
|
||||
public class nested_extend_c_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("nested_extend_c");
|
||||
} 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[]) throws Throwable
|
||||
{
|
||||
{
|
||||
hiA hi = new hiA();
|
||||
if (hi.hi_extend() != 'h')
|
||||
throw new RuntimeException("test failed");
|
||||
}
|
||||
{
|
||||
lowA low = new lowA();
|
||||
if (low.low_extend() != 99)
|
||||
throw new RuntimeException("test failed");
|
||||
}
|
||||
|
||||
{
|
||||
hiB hi = new hiB();
|
||||
if (hi.hi_extend() != 'h')
|
||||
throw new RuntimeException("test failed");
|
||||
}
|
||||
{
|
||||
lowB low = new lowB();
|
||||
if (low.low_extend() != 99)
|
||||
throw new RuntimeException("test failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
74
Examples/test-suite/nested_extend_c.i
Normal file
74
Examples/test-suite/nested_extend_c.i
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
%module nested_extend_c
|
||||
|
||||
%extend hiA {
|
||||
hiA() {
|
||||
union hiA *self = (union hiA *)malloc(sizeof(union hiA));
|
||||
self->c = 'h';
|
||||
return self;
|
||||
}
|
||||
char hi_extend() {
|
||||
return $self->c;
|
||||
}
|
||||
}
|
||||
%extend lowA {
|
||||
lowA() {
|
||||
struct lowA *self = (struct lowA *)malloc(sizeof(struct lowA));
|
||||
self->name = 0;
|
||||
self->num = 99;
|
||||
return self;
|
||||
}
|
||||
int low_extend() {
|
||||
return $self->num;
|
||||
}
|
||||
}
|
||||
|
||||
%extend hiB {
|
||||
hiB() {
|
||||
union hiB *self = (union hiB *)malloc(sizeof(union hiB));
|
||||
self->c = 'h';
|
||||
return self;
|
||||
}
|
||||
char hi_extend() {
|
||||
return $self->c;
|
||||
}
|
||||
}
|
||||
%extend lowB {
|
||||
lowB() {
|
||||
struct lowB *self = (struct lowB *)malloc(sizeof(struct lowB));
|
||||
self->name = 0;
|
||||
self->num = 99;
|
||||
return self;
|
||||
}
|
||||
int low_extend() {
|
||||
return $self->num;
|
||||
}
|
||||
}
|
||||
|
||||
%inline %{
|
||||
typedef struct NestedA {
|
||||
int a;
|
||||
union hiA {
|
||||
char c;
|
||||
int d;
|
||||
} hiA_instance;
|
||||
|
||||
struct lowA {
|
||||
char *name;
|
||||
int num;
|
||||
} lowA_instance;
|
||||
} NestedA;
|
||||
|
||||
typedef struct {
|
||||
int a;
|
||||
union hiB {
|
||||
char c;
|
||||
int d;
|
||||
} hiB_instance;
|
||||
|
||||
struct lowB {
|
||||
char *name;
|
||||
int num;
|
||||
} lowB_instance;
|
||||
} NestedB;
|
||||
%}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue