1 package dot.junit.opcodes.shl_int; 2 3 import dot.junit.DxTestCase; 4 import dot.junit.DxUtil; 5 import dot.junit.opcodes.shl_int.d.T_shl_int_1; 6 import dot.junit.opcodes.shl_int.d.T_shl_int_6; 7 8 public class Test_shl_int extends DxTestCase { 9 10 /** 11 * @title 15 << 1 12 */ testN1()13 public void testN1() { 14 T_shl_int_1 t = new T_shl_int_1(); 15 assertEquals(30, t.run(15, 1)); 16 } 17 18 /** 19 * @title 33 << 2 20 */ testN2()21 public void testN2() { 22 T_shl_int_1 t = new T_shl_int_1(); 23 assertEquals(132, t.run(33, 2)); 24 } 25 26 /** 27 * @title -15 << 1 28 */ testN3()29 public void testN3() { 30 T_shl_int_1 t = new T_shl_int_1(); 31 assertEquals(-30, t.run(-15, 1)); 32 } 33 34 /** 35 * @title Arguments = 1 & -1 36 */ testN4()37 public void testN4() { 38 T_shl_int_1 t = new T_shl_int_1(); 39 assertEquals(0x80000000, t.run(1, -1)); 40 } 41 42 /** 43 * @title Verify that shift distance is actually in range 0 to 32. 44 */ testN5()45 public void testN5() { 46 T_shl_int_1 t = new T_shl_int_1(); 47 assertEquals(66, t.run(33, 33)); 48 } 49 50 51 /** 52 * @title Arguments = 0 & -1 53 */ testB1()54 public void testB1() { 55 T_shl_int_1 t = new T_shl_int_1(); 56 assertEquals(0, t.run(0, -1)); 57 } 58 59 /** 60 * @title Arguments = Integer.MAX_VALUE & 1 61 */ testB2()62 public void testB2() { 63 T_shl_int_1 t = new T_shl_int_1(); 64 assertEquals(0xfffffffe, t.run(Integer.MAX_VALUE, 1)); 65 } 66 67 /** 68 * @title Arguments = Integer.MIN_VALUE & 1 69 */ testB3()70 public void testB3() { 71 T_shl_int_1 t = new T_shl_int_1(); 72 assertEquals(0, t.run(Integer.MIN_VALUE, 1)); 73 } 74 75 /** 76 * @title Arguments = 1 & 0 77 */ testB4()78 public void testB4() { 79 T_shl_int_1 t = new T_shl_int_1(); 80 assertEquals(1, t.run(1, 0)); 81 } 82 83 /** 84 * @constraint A23 85 * @title number of registers 86 */ testVFE1()87 public void testVFE1() { 88 load("dot.junit.opcodes.shl_int.d.T_shl_int_2", VerifyError.class); 89 } 90 91 92 93 /** 94 * @constraint B1 95 * @title types of arguments - double & int 96 */ testVFE2()97 public void testVFE2() { 98 load("dot.junit.opcodes.shl_int.d.T_shl_int_3", VerifyError.class); 99 } 100 101 /** 102 * @constraint B1 103 * @title types of arguments - long & int 104 */ testVFE3()105 public void testVFE3() { 106 load("dot.junit.opcodes.shl_int.d.T_shl_int_4", VerifyError.class); 107 } 108 109 /** 110 * @constraint B1 111 * @title types of arguments - reference & int 112 */ testVFE4()113 public void testVFE4() { 114 load("dot.junit.opcodes.shl_int.d.T_shl_int_5", VerifyError.class); 115 } 116 117 /** 118 * @constraint B1 119 * @title Types of arguments - float, float. The verifier checks that ints 120 * and floats are not used interchangeably. 121 */ testVFE5()122 public void testVFE5() { 123 load("dot.junit.opcodes.shl_int.d.T_shl_int_6", VerifyError.class); 124 } 125 126 } 127