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