1 package dot.junit.opcodes.shl_long; 2 3 import dot.junit.DxTestCase; 4 import dot.junit.DxUtil; 5 import dot.junit.opcodes.shl_long.d.T_shl_long_1; 6 import dot.junit.opcodes.shl_long.d.T_shl_long_7; 7 8 public class Test_shl_long extends DxTestCase { 9 10 /** 11 * @title Arguments = 5000000000l, 3 12 */ 13 public void testN1() { 14 T_shl_long_1 t = new T_shl_long_1(); 15 assertEquals(40000000000l, t.run(5000000000l, 3)); 16 } 17 18 /** 19 * @title Arguments = 5000000000l, 1 20 */ 21 public void testN2() { 22 T_shl_long_1 t = new T_shl_long_1(); 23 assertEquals(10000000000l, t.run(5000000000l, 1)); 24 } 25 26 /** 27 * @title Arguments = -5000000000l, 1 28 */ 29 public void testN3() { 30 T_shl_long_1 t = new T_shl_long_1(); 31 assertEquals(-10000000000l, t.run(-5000000000l, 1)); 32 } 33 34 /** 35 * @title Arguments = 1 & -1 36 */ 37 public void testN4() { 38 T_shl_long_1 t = new T_shl_long_1(); 39 assertEquals(0x8000000000000000l, t.run(1l, -1)); 40 } 41 42 /** 43 * @title Verify that shift distance is actually in range 0 to 64. 44 */ 45 public void testN5() { 46 T_shl_long_1 t = new T_shl_long_1(); 47 assertEquals(130l, t.run(65l, 65)); 48 } 49 50 /** 51 * @title Types of arguments - double, int. Dalvik doens't distinguish 64-bits types internally, 52 * so this operation of double makes no sense but shall not crash the VM. 53 */ 54 public void testN6() { 55 T_shl_long_7 t = new T_shl_long_7(); 56 try { 57 t.run(4.67d, 1); 58 } catch (Throwable e) { 59 } 60 } 61 62 63 64 /** 65 * @title Arguments = 0 & -1 66 */ 67 public void testB1() { 68 T_shl_long_1 t = new T_shl_long_1(); 69 assertEquals(0, t.run(0, -1)); 70 } 71 72 /** 73 * @title Arguments = 1 & 0 74 */ 75 public void testB2() { 76 T_shl_long_1 t = new T_shl_long_1(); 77 assertEquals(1, t.run(1, 0)); 78 } 79 80 /** 81 * @title Arguments = Long.MAX_VALUE & 1 82 */ 83 public void testB3() { 84 T_shl_long_1 t = new T_shl_long_1(); 85 assertEquals(0xfffffffe, t.run(Long.MAX_VALUE, 1)); 86 } 87 88 /** 89 * @title Arguments = Long.MIN_VALUE & 1 90 */ 91 public void testB4() { 92 T_shl_long_1 t = new T_shl_long_1(); 93 assertEquals(0l, t.run(Long.MIN_VALUE, 1)); 94 } 95 96 /** 97 * @constraint A24 98 * @title number of registers 99 */ 100 public void testVFE1() { 101 try { 102 Class.forName("dot.junit.opcodes.shl_long.d.T_shl_long_2"); 103 fail("expected a verification exception"); 104 } catch (Throwable t) { 105 DxUtil.checkVerifyException(t); 106 } 107 } 108 109 110 111 /** 112 * @constraint B1 113 * @title types of arguments - long & double 114 */ 115 public void testVFE2() { 116 try { 117 Class.forName("dot.junit.opcodes.shl_long.d.T_shl_long_3"); 118 fail("expected a verification exception"); 119 } catch (Throwable t) { 120 DxUtil.checkVerifyException(t); 121 } 122 } 123 124 /** 125 * @constraint B1 126 * @title types of arguments - int & int 127 */ 128 public void testVFE3() { 129 try { 130 Class.forName("dot.junit.opcodes.shl_long.d.T_shl_long_4"); 131 fail("expected a verification exception"); 132 } catch (Throwable t) { 133 DxUtil.checkVerifyException(t); 134 } 135 } 136 137 /** 138 * @constraint B1 139 * @title types of arguments - float & int 140 */ 141 public void testVFE4() { 142 try { 143 Class.forName("dot.junit.opcodes.shl_long.d.T_shl_long_5"); 144 fail("expected a verification exception"); 145 } catch (Throwable t) { 146 DxUtil.checkVerifyException(t); 147 } 148 } 149 150 /** 151 * @constraint B1 152 * @title types of arguments - reference & int 153 */ 154 public void testVFE5() { 155 try { 156 Class.forName("dot.junit.opcodes.shl_long.d.T_shl_long_6"); 157 fail("expected a verification exception"); 158 } catch (Throwable t) { 159 DxUtil.checkVerifyException(t); 160 } 161 } 162 163 } 164