import source from 1.3.40
[external/swig.git] / Examples / test-suite / java / apply_signed_char_runme.java
1 import apply_signed_char.*;
2
3 public 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