Add more runtime typedef_classforward_same_name runtime testing

This commit is contained in:
William S Fulton 2017-12-31 16:25:55 +00:00
parent 3617e22fda
commit ce6960de92
3 changed files with 27 additions and 6 deletions

View File

@ -15,8 +15,12 @@ public class typedef_classforward_same_name_runme {
public static void main(String argv[]) {
Foo foo = new Foo();
foo.setX(5);
if (typedef_classforward_same_name.extract(foo) == 5) {
// All good!
}
if (typedef_classforward_same_name.extractFoo(foo) != 5)
throw new RuntimeException("unexpected value");
Boo boo = new Boo();
boo.setX(5);
if (typedef_classforward_same_name.extractBoo(boo) != 5)
throw new RuntimeException("unexpected value");
}
}
}

View File

@ -0,0 +1,11 @@
from typedef_classforward_same_name import *
foo = Foo()
foo.x = 5
if extractFoo(foo) != 5:
raise RuntimeError("unexpected value")
boo = Boo()
boo.x = 5
if extractBoo(boo) != 5:
raise RuntimeError("unexpected value")

View File

@ -5,5 +5,11 @@ typedef struct Foo Foo;
struct Foo {
int x;
};
int extract(Foo* foo) { return foo->x; }
%}
int extractFoo(Foo* foo) { return foo->x; }
struct Boo {
int x;
};
typedef struct Boo Boo;
int extractBoo(Boo* boo) { return boo->x; }
%}