PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 7ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Java | 53 lines | 46 code | 7 blank | 0 comment | 1 complexity | fbba961cecbb231200d541255c6b1244 MD5 | raw file
 1
 2import special_variables.*;
 3
 4public class special_variables_runme {
 5
 6  static {
 7    try {
 8        System.loadLibrary("special_variables");
 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    verify(special_variables.ExceptionVars(1.0, 2.0),
18           "result = Space::exceptionvars(arg1,arg2);  Space::exceptionvars  ExceptionVars   Java_special_1variables_special_1variablesJNI_ExceptionVars");
19
20    verify(special_variables.overloadedmethod(),
21           "result = Space::overloadedmethod();  Space::overloadedmethod  overloadedmethod  __SWIG_1 Java_special_1variables_special_1variablesJNI_overloadedmethod_1_1SWIG_11");
22
23    verify(special_variables.overloadedmethod(10.0),
24          "result = Space::overloadedmethod(arg1);  Space::overloadedmethod  overloadedmethod  __SWIG_0 Java_special_1variables_special_1variablesJNI_overloadedmethod_1_1SWIG_10");
25
26    ABC a = new ABC(0, 0.0);
27    verify(special_variables.getDeclaration(), "SpaceNamespace::ABC::ABC(int,double) SpaceNamespace::ABC::ABC(int,double)");
28    a = new ABC();
29    verify(special_variables.getDeclaration(), "SpaceNamespace::ABC::ABC() SpaceNamespace::ABC::ABC()");
30    a.instancemethod(1);
31    verify(special_variables.getDeclaration(), "short * SpaceNamespace::ABC::instancemethod(int) SpaceNamespace::ABC::instancemethod(int)");
32    a.instancemethod(1, false);
33    verify(special_variables.getDeclaration(), "short * SpaceNamespace::ABC::instancemethod(int,bool) SpaceNamespace::ABC::instancemethod(int,bool)");
34    a.constmethod(1);
35    verify(special_variables.getDeclaration(), "short * SpaceNamespace::ABC::constmethod(int) const SpaceNamespace::ABC::constmethod(int) const");
36    ABC.staticmethod(0, false);
37    verify(special_variables.getDeclaration(), "short * SpaceNamespace::ABC::staticmethod(int,bool) SpaceNamespace::ABC::staticmethod(int,bool)");
38    a.delete();
39    verify(special_variables.getDeclaration(), "SpaceNamespace::ABC::~ABC() SpaceNamespace::ABC::~ABC()");
40    TemplateABC abc = new TemplateABC();
41    verify(special_variables.getDeclaration(), "SpaceNamespace::Template< SpaceNamespace::ABC >::Template() SpaceNamespace::Template< SpaceNamespace::ABC >::Template()");
42    abc.tmethod(new ABC());
43    verify(special_variables.getDeclaration(), "std::string SpaceNamespace::Template< SpaceNamespace::ABC >::tmethod(SpaceNamespace::ABC) SpaceNamespace::Template< SpaceNamespace::ABC >::tmethod(SpaceNamespace::ABC)");
44    abc.delete();
45    verify(special_variables.getDeclaration(), "SpaceNamespace::Template< SpaceNamespace::ABC >::~Template() SpaceNamespace::Template< SpaceNamespace::ABC >::~Template()");
46    special_variables.globtemplate(new TemplateABC());
47    verify(special_variables.getDeclaration(), "void SpaceNamespace::globtemplate(SpaceNamespace::Template< SpaceNamespace::ABC >) SpaceNamespace::globtemplate(SpaceNamespace::Template< SpaceNamespace::ABC >)");
48  }
49  static void verify(String received, String expected) {
50    if (!received.equals(expected))
51      throw new RuntimeException("Incorrect, received: " + received);
52  }
53}