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