Upstream version 1.3.40
[profile/ivi/swig.git] / Examples / test-suite / java / ignore_parameter_runme.java
1 // Runtime test checking the %typemap(ignore) macro
2
3 import ignore_parameter.*;
4
5 public class ignore_parameter_runme {
6   static {
7     try {
8         System.loadLibrary("ignore_parameter");
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       // Compilation will ensure the number of arguments and type are correct.
18       // Then check the return value is the same as the value given to the ignored parameter.
19       if (!ignore_parameter.jaguar(200, 0.0).equals("hello")) { System.err.println("Runtime Error in jaguar()");}
20       if (ignore_parameter.lotus("fast", 0.0) != 101) { System.err.println("Runtime Error in lotus()");}
21       if (ignore_parameter.tvr("fast", 200) != 8.8) { System.err.println("Runtime Error in tvr()");}
22       if (ignore_parameter.ferrari() != 101) { System.err.println("Runtime Error in ferrari()");}
23
24       SportsCars sc = new SportsCars();
25       if (!sc.daimler(200, 0.0).equals("hello")) { System.err.println("Runtime Error in daimler()");}
26       if (sc.astonmartin("fast", 0.0) != 101) { System.err.println("Runtime Error in astonmartin()");}
27       if (sc.bugatti("fast", 200) != 8.8) { System.err.println("Runtime Error in bugatti()");}
28       if (sc.lamborghini() != 101) { System.err.println("Runtime Error in lamborghini()");}
29
30       // Check constructors are also generated correctly
31       MiniCooper mc = new MiniCooper(200, 0.0);
32       MorrisMinor mm = new MorrisMinor("slow", 0.0);
33       FordAnglia fa = new FordAnglia("slow", 200);
34       AustinAllegro aa = new AustinAllegro();
35   }
36 }