summaryrefslogtreecommitdiff
path: root/Examples/test-suite/java/varargs_runme.java
blob: e8b485db9e492fe13d952e235abc322653479c73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// varargs test

import varargs.*;

public class varargs_runme {

  static {
    try {
	System.loadLibrary("varargs");
    } catch (UnsatisfiedLinkError e) {
      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);
      System.exit(1);
    }
  }

  public static void main(String argv[]) {

    if (!varargs.test("Hello").equals("Hello"))
      throw new RuntimeException("Failed");

    Foo f = new Foo("BuonGiorno", 1);
    if (!f.getStr().equals("BuonGiorno"))
      throw new RuntimeException("Failed");

    f = new Foo("Greetings");
    if (!f.getStr().equals("Greetings"))
      throw new RuntimeException("Failed");
        
    if (!f.test("Hello").equals("Hello"))
      throw new RuntimeException("Failed");

    if (!Foo.statictest("Grussen", 1).equals("Grussen"))
      throw new RuntimeException("Failed");
  }
}