• 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 dot.junit.opcodes.move_result_object;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.move_result_object.d.T_move_result_object_1;
22 import dot.junit.opcodes.move_result_object.d.T_move_result_object_8;
23 
24 public class Test_move_result_object extends DxTestCase {
25     /**
26      * @title tests move-result-object functionality
27      */
testN1()28     public void testN1() {
29         T_move_result_object_1 t = new T_move_result_object_1();
30         assertTrue(t.run());
31     }
32 
33     /**
34      * @title filled-new-array result
35      */
testN2()36     public void testN2() {
37         T_move_result_object_8 t = new T_move_result_object_8();
38         int[] arr = t.run();
39         if(arr.length != 2 || arr[0] != 1 || arr[1] != 2)
40             fail("wrong array size or content");
41     }
42 
43     /**
44      * @constraint A23
45      * @title number of registers - dest is not valid
46      */
testVFE1()47     public void testVFE1() {
48         try {
49             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_2");
50             fail("expected a verification exception");
51         } catch (Throwable t) {
52             DxUtil.checkVerifyException(t);
53         }
54     }
55 
56 
57     /**
58      * @constraint B1
59      * @title integer
60      */
testVFE2()61     public void testVFE2() {
62         try {
63             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_3");
64             fail("expected a verification exception");
65         } catch (Throwable t) {
66             DxUtil.checkVerifyException(t);
67         }
68     }
69 
70     /**
71      * @constraint B1
72      * @title wide
73      */
testVFE3()74     public void testVFE3() {
75         try {
76             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_4");
77             fail("expected a verification exception");
78         } catch (Throwable t) {
79             DxUtil.checkVerifyException(t);
80         }
81     }
82 
83 
84     /**
85      * @constraint B18
86      * @title When writing to a register that is one half of a
87      * register pair, but not touching the other half, the old register pair gets broken
88      * up, and the other register involved in it becomes undefined.
89      */
testVFE4()90     public void testVFE4() {
91         try {
92             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_5");
93             fail("expected a verification exception");
94         } catch (Throwable t) {
95             DxUtil.checkVerifyException(t);
96         }
97     }
98 
99     /**
100      * @constraint B19
101      * @title  move-result-object instruction must be immediately preceded
102      * (in the insns array) by an <invoke-kind> instruction
103      */
testVFE5()104     public void testVFE5() {
105         try {
106             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_6");
107             fail("expected a verification exception");
108         } catch (Throwable t) {
109             DxUtil.checkVerifyException(t);
110         }
111     }
112 
113     /**
114      * @constraint B20
115      * @title move-result-object instruction must be immediately preceded
116      * (in actual control flow) by an <invoke-kind> instruction
117      */
testVFE6()118     public void testVFE6() {
119         try {
120             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_7");
121             fail("expected a verification exception");
122         } catch (Throwable t) {
123             DxUtil.checkVerifyException(t);
124         }
125     }
126 
127     /**
128      * @constraint A23
129      * @title number of registers
130      */
testVFE7()131     public void testVFE7() {
132         try {
133             Class.forName("dot.junit.opcodes.move_result_object.d.T_move_result_object_9");
134             fail("expected a verification exception");
135         } catch (Throwable t) {
136             DxUtil.checkVerifyException(t);
137         }
138     }
139 
140 }
141