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