1exec("swigtest.start", -1);
2
3checkequal(anonymous(), 7771, "anonymous()");
4checkequal(anonymous(1234), 1234, "anonymous(1234)");
5
6checkequal(booltest(), %T, "booltest()");
7checkequal(booltest(%T), %T, "booltest(%T)");
8checkequal(booltest(%F), %F, "booltest(%T)");
9
10ec = new_EnumClass();
11checkequal(EnumClass_blah(ec), %T, "EnumClass_blah(ec)");
12
13checkequal(casts1(), [], "casts1()");
14checkequal(casts1("Ciao"), "Ciao", "casts1(""Ciao"")");
15checkequal(casts2(), "Hello", "casts2()");
16checkequal(chartest1(), 'x', "chartest1()");
17checkequal(chartest2(), '', "chartest2()");
18checkequal(chartest1('y'), 'y', "chartest1(''y'')");
19checkequal(reftest1(), 42, "reftest1()");
20checkequal(reftest1(400), 400, "reftest1(400)");
21checkequal(reftest2(), "hello", "reftest2()");
22
23// Rename
24f = new_Foo();
25Foo_newname(f);
26Foo_newname(f, 10);
27Foo_renamed3arg(f, 10, 10.0);
28Foo_renamed2arg(f, 10);
29Foo_renamed1arg(f);
30delete_Foo(f);
31
32// Static functions
33checkequal(Statics_staticmethod(), 10+20+30, "Statics_staticmethod()");
34checkequal(Statics_staticmethod(100), 100+20+30, "Statics_staticmethod(100)");
35checkequal(Statics_staticmethod(100, 200, 300), 100+200+300, "Statics_staticmethod(100, 200, 300)");
36
37tricky = new_Tricky();
38checkequal(Tricky_privatedefault(tricky), 200, "Tricky_privatedefault(tricky)");
39checkequal(Tricky_protectedint(tricky), 2000, "Tricky_protectedint(tricky)");
40checkequal(Tricky_protecteddouble(tricky), 987.654, "Tricky_protecteddouble(tricky)");
41checkequal(Tricky_functiondefault(tricky), 500, "Tricky_functiondefault(tricky)");
42checkequal(Tricky_contrived(tricky), 'X', "Tricky_contrived(tricky)");
43delete_Tricky(tricky);
44
45// Default argument is a constructor
46k = constructorcall();
47checkequal(Klass_val_get(k), -1, "Klass_constructorcall()");
48delete_Klass(k);
49k = constructorcall(new_Klass(2222));
50checkequal(Klass_val_get(k), 2222, "Klass_constructorcall(new Klass(2222)");
51delete_Klass(k);
52k = constructorcall(new_Klass());
53checkequal(Klass_val_get(k), -1, "Klass_constructorcall(new_Klass()");
54delete_Klass(k);
55
56// Const methods
57cm = new_ConstMethods();
58checkequal(ConstMethods_coo(cm), 20, "ConstMethods_coo()");
59checkequal(ConstMethods_coo(cm, 1.0), 20, "ConstMethods_coo(1.0)");
60
61// C linkage (extern "C")
62checkequal(cfunc1(1), 2, "cfunc1(1)");
63checkequal(cfunc2(1), 3, "cfunc2(1)");
64checkequal(cfunc3(1), 4, "cfunc3(1)");
65
66exec("swigtest.quit", -1);
67
68