PageRenderTime 46ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

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

#
Java | 35 lines | 25 code | 9 blank | 1 comment | 5 complexity | 67f7b4760131c7537d758eaa4d5ae436 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. // varargs test
  2. import varargs.*;
  3. public class varargs_runme {
  4. static {
  5. try {
  6. System.loadLibrary("varargs");
  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. public static void main(String argv[]) {
  13. if (!varargs.test("Hello").equals("Hello"))
  14. throw new RuntimeException("Failed");
  15. Foo f = new Foo("BuonGiorno", 1);
  16. if (!f.getStr().equals("BuonGiorno"))
  17. throw new RuntimeException("Failed");
  18. f = new Foo("Greetings");
  19. if (!f.getStr().equals("Greetings"))
  20. throw new RuntimeException("Failed");
  21. if (!f.test("Hello").equals("Hello"))
  22. throw new RuntimeException("Failed");
  23. if (!Foo.statictest("Grussen", 1).equals("Grussen"))
  24. throw new RuntimeException("Failed");
  25. }
  26. }