PageRenderTime 23ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 27 lines | 23 code | 4 blank | 0 comment | 2 complexity | a7791806cd1bf97b1a22f3824b6cb5ce MD5 | raw file
 1import li_boost_shared_ptr_bits.*;
 2
 3public class li_boost_shared_ptr_bits_runme {
 4  static {
 5    try {
 6        System.loadLibrary("li_boost_shared_ptr_bits");
 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    VectorIntHolder v = new VectorIntHolder();
16    v.add(new IntHolder(11));
17    v.add(new IntHolder(22));
18    v.add(new IntHolder(33));
19
20    int sum = li_boost_shared_ptr_bits.sum(v);
21    if (sum != 66)
22      throw new RuntimeException("sum is wrong");
23
24    HiddenDestructor hidden = HiddenDestructor.create();
25    hidden.delete();
26  }
27}