PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

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

#
Java | 63 lines | 39 code | 18 blank | 6 comment | 22 complexity | a5a8d457affae545ecaabc713f7d2c75 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. import overload_complicated.*;
  2. public class overload_complicated_runme {
  3. static {
  4. try {
  5. System.loadLibrary("overload_complicated");
  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. SWIGTYPE_p_int pInt = null;
  14. // Check the correct constructors are available
  15. Pop p = new Pop(pInt);
  16. p = new Pop(pInt, false);
  17. // Check overloaded in const only and pointers/references which target languages cannot disambiguate
  18. if (p.hip(false) != 701)
  19. throw new RuntimeException("Test 1 failed");
  20. if (p.hip(pInt) != 702)
  21. throw new RuntimeException("Test 2 failed");
  22. // Reverse the order for the above
  23. if (p.hop(pInt) != 805)
  24. throw new RuntimeException("Test 3 failed");
  25. if (p.hop(false) != 801)
  26. throw new RuntimeException("Test 4 failed");
  27. // Few more variations and order shuffled
  28. if (p.pop(false) != 901)
  29. throw new RuntimeException("Test 5 failed");
  30. if (p.pop(pInt) != 902)
  31. throw new RuntimeException("Test 6 failed");
  32. if (p.pop() != 905)
  33. throw new RuntimeException("Test 7 failed");
  34. // Overload on const only
  35. if (p.bop(pInt) != 1001)
  36. throw new RuntimeException("Test 8 failed");
  37. if (p.bip(pInt) != 2001)
  38. throw new RuntimeException("Test 9 failed");
  39. // Globals
  40. if (overload_complicated.muzak(false) != 3001)
  41. throw new RuntimeException("Test 10 failed");
  42. if (overload_complicated.muzak(pInt) != 3002)
  43. throw new RuntimeException("Test 11 failed");
  44. }
  45. }