summaryrefslogtreecommitdiff
path: root/Examples/test-suite/java/preproc_line_file_runme.java
blob: c29cef680380eaecf289c9969eb257d40621ad08 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import preproc_line_file.*;

public class preproc_line_file_runme {

  static {
    try {
        System.loadLibrary("preproc_line_file");
    } 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 String FILENAME_WINDOWS = "..\\..\\..\\..\\Examples\\test-suite\\preproc_line_file.i";
  public static String FILENAME_UNIX = "../../../../Examples/test-suite/preproc_line_file.i";
  public static void main(String argv[]) throws Throwable
  {
    int myline = preproc_line_file.MYLINE;
    int myline_adjusted = preproc_line_file.MYLINE_ADJUSTED;
    if (myline != 4)
      throw new RuntimeException("preproc failure");
    if (myline + 100 + 1 != myline_adjusted)
      throw new RuntimeException("preproc failure");

    String myfile = preproc_line_file.MYFILE;
    String myfile_adjusted = preproc_line_file.MYFILE_ADJUSTED;
    if (!(myfile.equals(FILENAME_UNIX) || myfile.equals(FILENAME_WINDOWS)))
      throw new RuntimeException("preproc failure");

    if (!(myfile_adjusted.equals(FILENAME_UNIX + ".bak") || myfile_adjusted.equals(FILENAME_WINDOWS + ".bak")))
      throw new RuntimeException("preproc failure");

    if (!preproc_line_file.MY_STRINGNUM_A.equals("my15"))
      throw new RuntimeException("preproc failed MY_STRINGNUM_A");

    if (!preproc_line_file.MY_STRINGNUM_B.equals("my16"))
      throw new RuntimeException("preproc failed MY_STRINGNUM_B");

    if (preproc_line_file.getThing27() != -1)
      throw new RuntimeException("preproc failure");

    if (preproc_line_file.getThing28() != -2)
      throw new RuntimeException("preproc failure");

    if (preproc_line_file.MYLINE2 != 30)
      throw new RuntimeException("preproc failure");

    if (SillyStruct.LINE_NUMBER != 52)
      throw new RuntimeException("preproc failure");

    if (SillyMacroClass.LINE_NUM != 56)
      throw new RuntimeException("preproc failure");

    if (SillyMultipleMacroStruct.LINE_NUM != 81)
      throw new RuntimeException("preproc failure");

    if (preproc_line_file.INLINE_LINE != 87)
      throw new RuntimeException("preproc failure");

    String inlineFile = preproc_line_file.INLINE_FILE;
    if (!(inlineFile.equals(FILENAME_UNIX) || inlineFile.equals(FILENAME_WINDOWS)))
      throw new RuntimeException("preproc failure");

    if (Slash.LINE_NUM != 93)
      throw new RuntimeException("preproc failure");

  }
}