PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Java | 33 lines | 19 code | 9 blank | 5 comment | 4 complexity | 16e76ec996caa4be8cbb8cbae312e5db MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // This is the ret_by_value runtime testcase. It checks that SWIG handles
  2. // return by value okay.
  3. import ret_by_value.*;
  4. public class ret_by_value_runme {
  5. static {
  6. try {
  7. System.loadLibrary("ret_by_value");
  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. public static void main(String argv[]) {
  14. // Get the test class. Note that this constructor will ensure that the memory created
  15. // in the wrapper is owned by the test class.
  16. test tst = ret_by_value.get_test();
  17. if (tst.getMyInt() != 100 || tst.getMyShort() != 200) {
  18. System.err.println("Runtime test failed. myInt=" + tst.getMyInt() + " myShort=" + tst.getMyShort());
  19. System.exit(1);
  20. }
  21. // Delete memory manually, it should not be deleted again by the test class finalizer
  22. tst.delete();
  23. }
  24. }