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