• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package dxc.junit.opcodes.ifne;
18 
19 import dxc.junit.DxTestCase;
20 import dxc.junit.DxUtil;
21 import dxc.junit.opcodes.ifne.jm.T_ifne_1;
22 
23 public class Test_ifne extends DxTestCase {
24 
25     /**
26      * @title  Argument = 5
27      */
testN1()28     public void testN1() {
29         T_ifne_1 t = new T_ifne_1();
30         assertEquals(1, t.run(5));
31     }
32 
33     /**
34      * @title  Argument = 0
35      */
testN2()36     public void testN2() {
37         T_ifne_1 t = new T_ifne_1();
38         /*
39          * Compare with 1234 to check that in case of failed comparison
40          * execution proceeds at the address following if_acmpeq instruction
41          */
42         assertEquals(1234, t.run(0));
43     }
44 
45     /**
46      * @title  Arguments = -5
47      */
testN3()48     public void testN3() {
49         T_ifne_1 t = new T_ifne_1();
50         assertEquals(1, t.run(-5));
51     }
52 
53     /**
54      * @title  Arguments = Integer.MAX_VALUE
55      */
testB1()56     public void testB1() {
57         T_ifne_1 t = new T_ifne_1();
58         assertEquals(1, t.run(Integer.MAX_VALUE));
59     }
60 
61     /**
62      * @title  Arguments = Integer.MIN_VALUE
63      */
testB2()64     public void testB2() {
65         T_ifne_1 t = new T_ifne_1();
66         assertEquals(1, t.run(Integer.MIN_VALUE));
67     }
68 
69     /**
70      * @constraint 4.8.2.1
71      * @title number of arguments
72      */
testVFE1()73     public void testVFE1() {
74         try {
75             Class.forName("dxc.junit.opcodes.ifne.jm.T_ifne_2");
76             fail("expected a verification exception");
77         } catch (Throwable t) {
78             DxUtil.checkVerifyException(t);
79         }
80     }
81 
82     /**
83      * @constraint 4.8.2.1
84      * @title types of arguments - double
85      */
testVFE2()86     public void testVFE2() {
87         try {
88             Class.forName("dxc.junit.opcodes.ifne.jm.T_ifne_3");
89             fail("expected a verification exception");
90         } catch (Throwable t) {
91             DxUtil.checkVerifyException(t);
92         }
93     }
94 
95     /**
96      * @constraint 4.8.2.1
97      * @title types of arguments - long
98      */
testVFE3()99     public void testVFE3() {
100         try {
101             Class.forName("dxc.junit.opcodes.ifne.jm.T_ifne_4");
102             fail("expected a verification exception");
103         } catch (Throwable t) {
104             DxUtil.checkVerifyException(t);
105         }
106     }
107 
108     /**
109      * @constraint 4.8.1.7
110      * @title branch target shall be inside the
111      * method
112      */
testVFE4()113     public void testVFE4() {
114         try {
115             Class.forName("dxc.junit.opcodes.ifne.jm.T_ifne_5");
116             fail("expected a verification exception");
117         } catch (Throwable t) {
118             DxUtil.checkVerifyException(t);
119         }
120     }
121 
122     /**
123      * @constraint 4.8.1.7
124      * @title branch target shall not be "inside" wide
125      * instruction
126      */
testVFE5()127     public void testVFE5() {
128         try {
129             Class.forName("dxc.junit.opcodes.ifne.jm.T_ifne_6");
130             fail("expected a verification exception");
131         } catch (Throwable t) {
132             DxUtil.checkVerifyException(t);
133         }
134     }
135 
136     /**
137      * @constraint 4.8.2.1
138      * @title types of arguments - reference
139      */
testVFE6()140     public void testVFE6() {
141         try {
142             Class.forName("dxc.junit.opcodes.ifne.jm.T_ifne_7");
143             fail("expected a verification exception");
144         } catch (Throwable t) {
145             DxUtil.checkVerifyException(t);
146         }
147     }
148 
149 }
150