PageRenderTime 23ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/java/director_enum_runme.java

#
Java | 54 lines | 44 code | 10 blank | 0 comment | 12 complexity | 53ed30b7e2eeac436db191c01cdaf6c4 MD5 | raw file
 1
 2import director_enum.*;
 3
 4public class director_enum_runme {
 5
 6  static {
 7    try {
 8      System.loadLibrary("director_enum");
 9    } catch (UnsatisfiedLinkError e) {
10      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);
11      System.exit(1);
12    }
13  }
14
15  public static void main(String argv[]) {
16
17      director_enum_MyFoo a = new director_enum_MyFoo();
18
19      if (a.ping(Hallo.awright) != Hallo.yo) {
20          throw new RuntimeException ( "a.ping()" );
21      }
22      if (a.ping_ref(Hallo.awright) != Hallo.hello) {
23          throw new RuntimeException ( "a.ping_ref()" );
24      }
25      if (a.ping_member_enum(Foo.Bye.adios) != Foo.Bye.aufwiedersehen) {
26          throw new RuntimeException ( "a.ping_member_enum()" );
27      }
28
29      Foo b = new Foo();
30
31      if (b.ping(Hallo.awright) != Hallo.awright) {
32          throw new RuntimeException ( "b.ping()" );
33      }
34      if (b.ping_ref(Hallo.awright) != Hallo.awright) {
35          throw new RuntimeException ( "b.ping_ref()" );
36      }
37      if (b.ping_member_enum(Foo.Bye.adios) != Foo.Bye.adios) {
38          throw new RuntimeException ( "b.ping_member_enum()" );
39      }
40  }
41}
42
43class director_enum_MyFoo extends Foo {
44    public Hallo say_hi(Hallo h) {
45        return Hallo.yo;
46    }
47    public Hallo say_hi_ref(Hallo h) {
48        return Hallo.hello;
49    }
50    public Foo.Bye say_bye(Foo.Bye b) {
51        return Foo.Bye.aufwiedersehen;
52    }
53}
54