File tree Expand file tree Collapse file tree 5 files changed +32
-0
lines changed
jbmc/regression/jbmc/NondetEnumArg Expand file tree Collapse file tree 5 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ public enum Color {
2
+ RED ,
3
+ GREEN ,
4
+ BLUE
5
+ }
Original file line number Diff line number Diff line change
1
+ public class NondetEnum {
2
+
3
+ public static Color test (Color c ) {
4
+ if (c == null )
5
+ return c ;
6
+ assert c != null ;
7
+ boolean isRed = c .name ().startsWith ("RED" ) && c .name ().length () == 3
8
+ && c .ordinal () == 0 ;
9
+ boolean isGreen = c .name ().startsWith ("GREEN" ) && c .name ().length () == 5
10
+ && c .ordinal () == 1 ;
11
+ boolean isBlue = c .name ().startsWith ("BLUE" ) && c .name ().length () == 4
12
+ && c .ordinal () == 2 ;
13
+ assert (isRed || isGreen || isBlue );
14
+ return c ;
15
+ }
16
+
17
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ NondetEnum.class
3
+ --function NondetEnum.test --cp `../../../../scripts/format_classpath.sh . ../../../src/java_bytecode/library/core-models.jar`
4
+ ^VERIFICATION SUCCESSFUL$
5
+ ^EXIT=0$
6
+ ^SIGNAL=0$
7
+ --
8
+ --
9
+ The test checks that the name and ordinal fields of nondet-initialized enums
10
+ correspond to those of an enum constant of the same type.
You can’t perform that action at this time.
0 commit comments