PageRenderTime 48ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 49 lines | 42 code | 7 blank | 0 comment | 20 complexity | 5ec602239ed8a126d379d21e1dc86071 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import li_boost_shared_ptr_template.*;
  2. public class li_boost_shared_ptr_template_runme {
  3. static {
  4. try {
  5. System.loadLibrary("li_boost_shared_ptr_template");
  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[]) {
  12. {
  13. BaseINTEGER b = new BaseINTEGER();
  14. DerivedINTEGER d = new DerivedINTEGER();
  15. if (b.bar() != 1)
  16. throw new RuntimeException("test 1");
  17. if (d.bar() != 2)
  18. throw new RuntimeException("test 2");
  19. if (li_boost_shared_ptr_template.bar_getter(b) != 1)
  20. throw new RuntimeException("test 3");
  21. if (li_boost_shared_ptr_template.bar_getter(d) != 2)
  22. throw new RuntimeException("test 4");
  23. }
  24. {
  25. BaseDefaultInt b = new BaseDefaultInt();
  26. DerivedDefaultInt d = new DerivedDefaultInt();
  27. DerivedDefaultInt2 d2 = new DerivedDefaultInt2();
  28. if (b.bar2() != 3)
  29. throw new RuntimeException("test 5");
  30. if (d.bar2() != 4)
  31. throw new RuntimeException("test 6");
  32. if (d2.bar2() != 4)
  33. throw new RuntimeException("test 6");
  34. if (li_boost_shared_ptr_template.bar2_getter(b) != 3)
  35. throw new RuntimeException("test 7");
  36. if (li_boost_shared_ptr_template.bar2_getter(d) != 4)
  37. throw new RuntimeException("test 8");
  38. if (li_boost_shared_ptr_template.bar2_getter(d2) != 4)
  39. throw new RuntimeException("test 8");
  40. }
  41. }
  42. }