1 package dot.junit.opcodes.if_ge; 2 3 import dot.junit.DxTestCase; 4 import dot.junit.DxUtil; 5 import dot.junit.opcodes.if_ge.d.T_if_ge_1; 6 import dot.junit.opcodes.if_ge.d.T_if_ge_3; 7 8 public class Test_if_ge extends DxTestCase { 9 10 /** 11 * @title Case: 5 < 6 12 */ 13 public void testN1() { 14 T_if_ge_1 t = new T_if_ge_1(); 15 assertEquals(1234, t.run(5, 6)); 16 } 17 18 /** 19 * @title Case: 0x0f0e0d0c = 0x0f0e0d0c 20 */ 21 public void testN2() { 22 T_if_ge_1 t = new T_if_ge_1(); 23 assertEquals(1, t.run(0x0f0e0d0c, 0x0f0e0d0c)); 24 } 25 26 /** 27 * @title Case: 5 > -5 28 */ 29 public void testN3() { 30 T_if_ge_1 t = new T_if_ge_1(); 31 assertEquals(1, t.run(5, -5)); 32 } 33 34 /** 35 * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE 36 */ 37 public void testB1() { 38 T_if_ge_1 t = new T_if_ge_1(); 39 assertEquals(1, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); 40 } 41 42 /** 43 * @title Arguments = Integer.MIN_VALUE, Integer.MAX_VALUE 44 */ 45 public void testB2() { 46 T_if_ge_1 t = new T_if_ge_1(); 47 assertEquals(1234, t.run(Integer.MIN_VALUE, Integer.MAX_VALUE)); 48 } 49 50 /** 51 * @title Arguments = Integer.MAX_VALUE, Integer.MIN_VALUE 52 */ 53 public void testB3() { 54 T_if_ge_1 t = new T_if_ge_1(); 55 assertEquals(1, t.run(Integer.MAX_VALUE, Integer.MIN_VALUE)); 56 } 57 58 /** 59 * @title Arguments = 0, Integer.MIN_VALUE 60 */ 61 public void testB4() { 62 T_if_ge_1 t = new T_if_ge_1(); 63 assertEquals(1, t.run(0, Integer.MIN_VALUE)); 64 } 65 66 /** 67 * @title Arguments = 0, 0 68 */ 69 public void testB5() { 70 T_if_ge_1 t = new T_if_ge_1(); 71 assertEquals(1, t.run(0, 0)); 72 } 73 74 /** 75 * @constraint A23 76 * @title number of registers 77 */ 78 public void testVFE1() { 79 try { 80 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_4"); 81 fail("expected a verification exception"); 82 } catch (Throwable t) { 83 DxUtil.checkVerifyException(t); 84 } 85 } 86 87 88 89 /** 90 * @constraint B1 91 * @title types of arguments - int, double 92 */ 93 public void testVFE2() { 94 try { 95 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_5"); 96 fail("expected a verification exception"); 97 } catch (Throwable t) { 98 DxUtil.checkVerifyException(t); 99 } 100 } 101 102 /** 103 * @constraint B1 104 * @title types of arguments - long, int 105 */ 106 public void testVFE3() { 107 try { 108 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_6"); 109 fail("expected a verification exception"); 110 } catch (Throwable t) { 111 DxUtil.checkVerifyException(t); 112 } 113 } 114 115 /** 116 * @constraint B1 117 * @title types of arguments - int, reference 118 */ 119 public void testVFE4() { 120 try { 121 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_7"); 122 fail("expected a verification exception"); 123 } catch (Throwable t) { 124 DxUtil.checkVerifyException(t); 125 } 126 } 127 128 /** 129 * @constraint B1 130 * @title Types of arguments - int, float. The verifier checks that ints 131 * and floats are not used interchangeably. 132 */ 133 public void testVFE5() { 134 try { 135 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_3"); 136 fail("expected a verification exception"); 137 } catch (Throwable t) { 138 DxUtil.checkVerifyException(t); 139 } 140 } 141 142 /** 143 * @constraint A6 144 * @title branch target shall be inside the method 145 */ 146 public void testVFE6() { 147 try { 148 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_9"); 149 fail("expected a verification exception"); 150 } catch (Throwable t) { 151 DxUtil.checkVerifyException(t); 152 } 153 } 154 155 /** 156 * @constraint A6 157 * @title branch target shall not be "inside" instruction 158 */ 159 public void testVFE7() { 160 try { 161 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_10"); 162 fail("expected a verification exception"); 163 } catch (Throwable t) { 164 DxUtil.checkVerifyException(t); 165 } 166 } 167 168 /** 169 * @constraint n/a 170 * @title branch target shall 0 171 */ 172 public void testVFE8() { 173 try { 174 Class.forName("dot.junit.opcodes.if_ge.d.T_if_ge_11"); 175 fail("expected a verification exception"); 176 } catch (Throwable t) { 177 DxUtil.checkVerifyException(t); 178 } 179 } 180 181 } 182