1 package dot.junit.opcodes.if_ne; 2 3 import dot.junit.DxTestCase; 4 import dot.junit.DxUtil; 5 import dot.junit.opcodes.if_ne.d.T_if_ne_1; 6 import dot.junit.opcodes.if_ne.d.T_if_ne_2; 7 import dot.junit.opcodes.if_ne.d.T_if_ne_4; 8 9 public class Test_if_ne extends DxTestCase { 10 11 /** 12 * @title Arguments = 5, 6 13 */ testN1()14 public void testN1() { 15 T_if_ne_1 t = new T_if_ne_1(); 16 assertEquals(1, t.run(5, 6)); 17 } 18 19 /** 20 * @title Arguments = 0x0f0e0d0c, 0x0f0e0d0c 21 */ testN2()22 public void testN2() { 23 T_if_ne_1 t = new T_if_ne_1(); 24 assertEquals(1234, t.run(0x0f0e0d0c, 0x0f0e0d0c)); 25 } 26 27 /** 28 * @title Arguments = 5, -5 29 */ testN3()30 public void testN3() { 31 T_if_ne_1 t = new T_if_ne_1(); 32 assertEquals(1, t.run(5, -5)); 33 } 34 35 /** 36 * @title Arguments = 0x01001234, 0x1234 37 */ testN4()38 public void testN4() { 39 T_if_ne_1 t = new T_if_ne_1(); 40 assertEquals(1, t.run(0x01001234, 0x1234)); 41 } 42 43 /** 44 * @title compare references 45 */ testN5()46 public void testN5() { 47 T_if_ne_2 t = new T_if_ne_2(); 48 String a = "a"; 49 String b = "b"; 50 assertEquals(1, t.run(a, b)); 51 } 52 53 /** 54 * @title compare references 55 */ testN6()56 public void testN6() { 57 T_if_ne_2 t = new T_if_ne_2(); 58 String a = "a"; 59 assertEquals(1234, t.run(a, a)); 60 } 61 62 /** 63 * @title Arguments = Integer.MAX_VALUE, Integer.MAX_VALUE 64 */ testB1()65 public void testB1() { 66 T_if_ne_1 t = new T_if_ne_1(); 67 assertEquals(1234, t.run(Integer.MAX_VALUE, Integer.MAX_VALUE)); 68 } 69 70 /** 71 * @title Arguments = Integer.MIN_VALUE, Integer.MIN_VALUE 72 */ testB2()73 public void testB2() { 74 T_if_ne_1 t = new T_if_ne_1(); 75 assertEquals(1234, t.run(Integer.MIN_VALUE, Integer.MIN_VALUE)); 76 } 77 78 /** 79 * @title Arguments = 0, 1234567 80 */ testB3()81 public void testB3() { 82 T_if_ne_1 t = new T_if_ne_1(); 83 assertEquals(1, t.run(0, 1234567)); 84 } 85 86 /** 87 * @title Arguments = 0, 0 88 */ testB4()89 public void testB4() { 90 T_if_ne_1 t = new T_if_ne_1(); 91 assertEquals(1234, t.run(0, 0)); 92 } 93 94 /** 95 * @title Compare with null 96 */ testB5()97 public void testB5() { 98 T_if_ne_2 t = new T_if_ne_2(); 99 String a = "a"; 100 assertEquals(1, t.run(null, a)); 101 } 102 103 /** 104 * @constraint A23 105 * @title number of registers 106 */ testVFE1()107 public void testVFE1() { 108 load("dot.junit.opcodes.if_ne.d.T_if_ne_5", VerifyError.class); 109 } 110 111 112 113 /** 114 * @constraint B1 115 * @title types of arguments - int, double 116 */ testVFE2()117 public void testVFE2() { 118 load("dot.junit.opcodes.if_ne.d.T_if_ne_7", VerifyError.class); 119 } 120 121 /** 122 * @constraint B1 123 * @title types of arguments - long, int 124 */ testVFE3()125 public void testVFE3() { 126 load("dot.junit.opcodes.if_ne.d.T_if_ne_8", VerifyError.class); 127 } 128 129 /** 130 * @constraint B1 131 * @title types of arguments - int, reference 132 */ testVFE4()133 public void testVFE4() { 134 load("dot.junit.opcodes.if_ne.d.T_if_ne_9", VerifyError.class); 135 } 136 137 /** 138 * @constraint A6 139 * @title branch target shall be inside the method 140 */ testVFE5()141 public void testVFE5() { 142 load("dot.junit.opcodes.if_ne.d.T_if_ne_10", VerifyError.class); 143 } 144 145 /** 146 * @constraint A6 147 * @title branch target shall not be "inside" instruction 148 */ testVFE6()149 public void testVFE6() { 150 load("dot.junit.opcodes.if_ne.d.T_if_ne_11", VerifyError.class); 151 } 152 153 /** 154 * @constraint n/a 155 * @title branch target shall not be 0 156 */ testVFE7()157 public void testVFE7() { 158 load("dot.junit.opcodes.if_ne.d.T_if_ne_12", VerifyError.class); 159 } 160 161 /** 162 * @constraint B1 163 * @title Types of arguments - int, float. The verifier checks that ints 164 * and floats are not used interchangeably. 165 */ testVFE8()166 public void testVFE8() { 167 load("dot.junit.opcodes.if_ne.d.T_if_ne_4", VerifyError.class); 168 } 169 170 } 171