/branches/yziquel-ocaml/Examples/test-suite/java/pointer_reference_runme.java

# · Java · 23 lines · 19 code · 4 blank · 0 comment · 4 complexity · 894852d47d1b8a4826ad80f42a8d496c MD5 · raw file

  1. import pointer_reference.*;
  2. public class pointer_reference_runme {
  3. static {
  4. try {
  5. System.loadLibrary("pointer_reference");
  6. } catch (UnsatisfiedLinkError e) {
  7. 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);
  8. System.exit(1);
  9. }
  10. }
  11. public static void main(String argv[]) throws Throwable
  12. {
  13. Struct s = pointer_reference.get();
  14. if (s.getValue() != 10) throw new RuntimeException("get test failed");
  15. Struct ss = new Struct(20);
  16. pointer_reference.set(ss);
  17. if (Struct.getInstance().getValue() != 20) throw new RuntimeException("set test failed");
  18. }
  19. }