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