1 package dot.junit.opcodes.if_eqz; 2 3 import dot.junit.DxTestCase; 4 import dot.junit.DxUtil; 5 import dot.junit.opcodes.if_eqz.d.T_if_eqz_1; 6 import dot.junit.opcodes.if_eqz.d.T_if_eqz_2; 7 import dot.junit.opcodes.if_eqz.d.T_if_eqz_3; 8 import dot.junit.opcodes.if_eqz.d.T_if_eqz_4; 9 10 public class Test_if_eqz extends DxTestCase { 11 12 /** 13 * @title Argument = 5 and -5 14 */ 15 public void testN1() { 16 T_if_eqz_1 t = new T_if_eqz_1(); 17 /* 18 * Compare with 1234 to check that in case of failed comparison 19 * execution proceeds at the address following if_acmpeq instruction 20 */ 21 assertEquals(1234, t.run(5)); 22 assertEquals(1234, t.run(-5)); 23 } 24 25 /** 26 * @title Arguments = not null 27 */ 28 public void testN2() { 29 T_if_eqz_2 t = new T_if_eqz_2(); 30 String str = "abc"; 31 assertEquals(1234, t.run(str)); 32 } 33 34 /** 35 * @title Arguments = Integer.MAX_VALUE 36 */ 37 public void testB1() { 38 T_if_eqz_1 t = new T_if_eqz_1(); 39 assertEquals(1234, t.run(Integer.MAX_VALUE)); 40 } 41 42 /** 43 * @title Arguments = Integer.MIN_VALUE 44 */ 45 public void testB2() { 46 T_if_eqz_1 t = new T_if_eqz_1(); 47 assertEquals(1234, t.run(Integer.MIN_VALUE)); 48 } 49 50 /** 51 * @title Arguments = 0 52 */ 53 public void testB5() { 54 T_if_eqz_1 t = new T_if_eqz_1(); 55 assertEquals(1, t.run(0)); 56 } 57 58 /** 59 * @title Compare with null 60 */ 61 public void testB6() { 62 T_if_eqz_4 t = new T_if_eqz_4(); 63 assertEquals(1, t.run(null)); 64 } 65 66 /** 67 * @constraint A23 68 * @title number of registers 69 */ 70 public void testVFE1() { 71 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_5", VerifyError.class); 72 } 73 74 75 /** 76 * @constraint B1 77 * @title types of arguments - double 78 */ 79 public void testVFE2() { 80 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_6", VerifyError.class); 81 } 82 83 /** 84 * @constraint B1 85 * @title types of arguments - long 86 */ 87 public void testVFE3() { 88 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_7", VerifyError.class); 89 } 90 91 /** 92 * @constraint A6 93 * @title branch target shall be inside the method 94 */ 95 public void testVFE4() { 96 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_9", VerifyError.class); 97 } 98 99 /** 100 * @constraint A6 101 * @title branch target shall not be "inside" instruction 102 */ 103 public void testVFE5() { 104 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_10", VerifyError.class); 105 } 106 107 /** 108 * @constraint n/a 109 * @title branch must not be 0 110 */ 111 public void testVFE6() { 112 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_11", VerifyError.class); 113 } 114 115 /** 116 * @constraint B1 117 * @title Type of argument - float. The verifier checks that ints 118 * and floats are not used interchangeably. 119 */ 120 public void testVFE7() { 121 load("dot.junit.opcodes.if_eqz.d.T_if_eqz_3", VerifyError.class); 122 } 123 124 } 125