PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 35 lines | 28 code | 7 blank | 0 comment | 7 complexity | 6154ff4d67ee13a44ae9fd26f7bdfef7 MD5 | raw file
 1import array_member.*;
 2
 3public class array_member_runme {
 4  static {
 5    try {
 6        System.loadLibrary("array_member");
 7    } catch (UnsatisfiedLinkError e) {
 8      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);
 9      System.exit(1);
10    }
11  }
12
13  public static void main(String argv[]) 
14  {
15      Foo f = new Foo();
16      f.setData(array_member.getGlobal_data());
17
18      for (int i=0; i<8; i++) {
19          if (array_member.get_value(f.getData(),i) != array_member.get_value(array_member.getGlobal_data(),i))
20              throw new RuntimeException("Bad array assignment");
21      }
22
23      for (int i=0; i<8; i++) {
24          array_member.set_value(f.getData(),i,-i);
25      }
26
27      array_member.setGlobal_data(f.getData());
28
29      for (int i=0; i<8; i++) {
30          if (array_member.get_value(f.getData(),i) != array_member.get_value(array_member.getGlobal_data(),i))
31              throw new RuntimeException("Bad array assignment");
32      }
33  }
34}
35