PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 26 lines | 20 code | 5 blank | 1 comment | 8 complexity | d508498b70201b28f27e8e556ed93770 MD5 | raw file
 1import rename_pcre_enum.*;
 2
 3public class rename_pcre_enum_runme {
 4  static { System.loadLibrary("rename_pcre_enum"); }
 5
 6  public static void main(String argv[])
 7  {
 8    Foo foo = Foo.First;
 9    if ( foo == Foo.Second )
10      throw new RuntimeException("Enum values should be different");
11
12    // Check that Foo_Max enum element was ignored.
13    int numFooEnumElements = Foo.values().length;
14    if ( numFooEnumElements != 2 )
15      throw new RuntimeException(String.format("Enum should have 2 elements, not %d",
16                                        numFooEnumElements));
17
18    BoundaryCondition bc = BoundaryCondition.MaxMax;
19    if ( bc.ordinal() != 2 )
20      throw new RuntimeException("Wrong enum value");
21
22    Colour c = Colour.red;
23    if ( c == Colour.blue )
24        throw new RuntimeException("Enum values should be different");
25  }
26}