PageRenderTime 23ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Java | 63 lines | 39 code | 18 blank | 6 comment | 22 complexity | a5a8d457affae545ecaabc713f7d2c75 MD5 | raw file
 1
 2import overload_complicated.*;
 3
 4public class overload_complicated_runme {
 5
 6  static {
 7    try {
 8        System.loadLibrary("overload_complicated");
 9    } catch (UnsatisfiedLinkError e) {
10      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);
11      System.exit(1);
12    }
13  }
14
15  public static void main(String argv[]) 
16  {
17      SWIGTYPE_p_int pInt = null;
18
19      // Check the correct constructors are available
20      Pop p = new Pop(pInt);
21
22      p = new Pop(pInt, false);
23
24      // Check overloaded in const only and pointers/references which target languages cannot disambiguate
25      if (p.hip(false) != 701)
26        throw new RuntimeException("Test 1 failed");
27
28      if (p.hip(pInt) != 702)
29        throw new RuntimeException("Test 2 failed");
30
31      // Reverse the order for the above
32      if (p.hop(pInt) != 805)
33        throw new RuntimeException("Test 3 failed");
34
35      if (p.hop(false) != 801)
36        throw new RuntimeException("Test 4 failed");
37
38      // Few more variations and order shuffled
39      if (p.pop(false) != 901)
40        throw new RuntimeException("Test 5 failed");
41
42      if (p.pop(pInt) != 902)
43        throw new RuntimeException("Test 6 failed");
44
45      if (p.pop() != 905)
46        throw new RuntimeException("Test 7 failed");
47
48      // Overload on const only
49      if (p.bop(pInt) != 1001)
50        throw new RuntimeException("Test 8 failed");
51
52      if (p.bip(pInt) != 2001)
53        throw new RuntimeException("Test 9 failed");
54
55      // Globals
56      if (overload_complicated.muzak(false) != 3001)
57        throw new RuntimeException("Test 10 failed");
58
59      if (overload_complicated.muzak(pInt) != 3002)
60        throw new RuntimeException("Test 11 failed");
61  }
62}
63