|
3 | 3 | public final class CProver
|
4 | 4 | {
|
5 | 5 | public static boolean enableAssume=true;
|
6 |
| - public static void assume(boolean condition) |
| 6 | + public static boolean enableNondet=true; |
| 7 | + |
| 8 | + public static boolean nondetBoolean() |
| 9 | + { |
| 10 | + if (enableNondet) |
| 11 | + { |
| 12 | + throw new RuntimeException( |
| 13 | + "Cannot execute program with CProver.nondetBoolean()"); |
| 14 | + } |
| 15 | + |
| 16 | + return false; |
| 17 | + } |
| 18 | + |
| 19 | + public static byte nondetByte() |
| 20 | + { |
| 21 | + if (enableNondet) |
| 22 | + { |
| 23 | + throw new RuntimeException( |
| 24 | + "Cannot execute program with CProver.nondetByte()"); |
| 25 | + } |
| 26 | + |
| 27 | + return 0; |
| 28 | + } |
| 29 | + |
| 30 | + public static char nondetChar() |
| 31 | + { |
| 32 | + if (enableNondet) |
| 33 | + { |
| 34 | + throw new RuntimeException( |
| 35 | + "Cannot execute program with CProver.nondetChar()"); |
| 36 | + } |
| 37 | + |
| 38 | + return '\0'; |
| 39 | + } |
| 40 | + |
| 41 | + public static short nondetShort() |
| 42 | + { |
| 43 | + if (enableNondet) |
| 44 | + { |
| 45 | + throw new RuntimeException( |
| 46 | + "Cannot execute program with CProver.nondetShort()"); |
| 47 | + } |
| 48 | + |
| 49 | + return 0; |
| 50 | + } |
| 51 | + |
| 52 | + public static int nondetInt() |
| 53 | + { |
| 54 | + if (enableNondet) |
| 55 | + { |
| 56 | + throw new RuntimeException( |
| 57 | + "Cannot execute program with CProver.nondetInt()"); |
| 58 | + } |
| 59 | + |
| 60 | + return 0; |
| 61 | + } |
| 62 | + |
| 63 | + public static long nondetLong() |
| 64 | + { |
| 65 | + if (enableNondet) |
| 66 | + { |
| 67 | + throw new RuntimeException( |
| 68 | + "Cannot execute program with CProver.nondetLong()"); |
| 69 | + } |
| 70 | + |
| 71 | + return 0; |
| 72 | + } |
| 73 | + |
| 74 | + public static float nondetFloat() |
| 75 | + { |
| 76 | + if (enableNondet) |
| 77 | + { |
| 78 | + throw new RuntimeException( |
| 79 | + "Cannot execute program with CProver.nondetFloat()"); |
| 80 | + } |
| 81 | + |
| 82 | + return 0; |
| 83 | + } |
| 84 | + |
| 85 | + public static double nondetDouble() |
| 86 | + { |
| 87 | + if (enableNondet) |
| 88 | + { |
| 89 | + throw new RuntimeException( |
| 90 | + "Cannot execute program with CProver.nondetDouble()"); |
| 91 | + } |
| 92 | + |
| 93 | + return 0; |
| 94 | + } |
| 95 | + |
| 96 | + public static <T> T nondetWithNull() |
| 97 | + { |
| 98 | + if (enableNondet) |
| 99 | + { |
| 100 | + throw new RuntimeException( |
| 101 | + "Cannot execute program with CProver.nondetWithNull<T>(T)"); |
| 102 | + } |
| 103 | + |
| 104 | + return null; |
| 105 | + } |
| 106 | + |
| 107 | + public static <T> T nondetWithoutNull() |
| 108 | + { |
| 109 | + if (enableNondet) |
| 110 | + { |
| 111 | + throw new RuntimeException( |
| 112 | + "Cannot execute program with CProver.nondetWithoutNull<T>(T)"); |
| 113 | + } |
| 114 | + |
| 115 | + return null; |
| 116 | + } |
| 117 | + |
| 118 | + public static void assume(boolean condition) |
7 | 119 | {
|
8 | 120 | if(enableAssume)
|
9 |
| - throw new RuntimeException("Cannot execute program with CProver.assume()"); |
10 |
| - } |
| 121 | + { |
| 122 | + throw new RuntimeException( |
| 123 | + "Cannot execute program with CProver.assume()"); |
| 124 | + } |
| 125 | + } |
11 | 126 | }
|
0 commit comments