PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 36 lines | 27 code | 9 blank | 0 comment | 20 complexity | 19c9128b5f1fd6d3414d0652ea062521 MD5 | raw file
 1import apply_signed_char.*;
 2
 3public class apply_signed_char_runme {
 4
 5  static {
 6    try {
 7	System.loadLibrary("apply_signed_char");
 8    } catch (UnsatisfiedLinkError e) {
 9      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);
10      System.exit(1);
11    }
12  }
13
14  public static void main(String argv[]) {
15    byte smallnum = -127;
16    if (apply_signed_char.CharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
17    if (apply_signed_char.CCharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
18    if (apply_signed_char.CCharRefFunction(smallnum) != smallnum) throw new RuntimeException("failed");
19
20    apply_signed_char.setGlobalchar(smallnum);
21    if (apply_signed_char.getGlobalchar() != smallnum) throw new RuntimeException("failed");
22    if (apply_signed_char.getGlobalconstchar() != -110) throw new RuntimeException("failed");
23
24    DirectorTest d = new DirectorTest();
25    if (d.CharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
26    if (d.CCharValFunction(smallnum) != smallnum) throw new RuntimeException("failed");
27    if (d.CCharRefFunction(smallnum) != smallnum) throw new RuntimeException("failed");
28
29    d.setMemberchar(smallnum);
30    if (d.getMemberchar() != smallnum) throw new RuntimeException("failed");
31    if (d.getMemberconstchar() != -112) throw new RuntimeException("failed");
32
33  }
34}
35
36