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         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_2", VerifyError.class);
49     }
50 
51 
52     /**
53      * @constraint B1
54      * @title integer
55      */
testVFE2()56     public void testVFE2() {
57         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_3", VerifyError.class);
58     }
59 
60     /**
61      * @constraint B1
62      * @title wide
63      */
testVFE3()64     public void testVFE3() {
65         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_4", VerifyError.class);
66     }
67 
68 
69     /**
70      * @constraint B18
71      * @title When writing to a register that is one half of a
72      * register pair, but not touching the other half, the old register pair gets broken
73      * up, and the other register involved in it becomes undefined.
74      */
testVFE4()75     public void testVFE4() {
76         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_5", VerifyError.class);
77     }
78 
79     /**
80      * @constraint B19
81      * @title  move-result-object instruction must be immediately preceded
82      * (in the insns array) by an <invoke-kind> instruction
83      */
testVFE5()84     public void testVFE5() {
85         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_6", VerifyError.class);
86     }
87 
88     /**
89      * @constraint B20
90      * @title move-result-object instruction must be immediately preceded
91      * (in actual control flow) by an <invoke-kind> instruction
92      */
testVFE6()93     public void testVFE6() {
94         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_7", VerifyError.class);
95     }
96 
97     /**
98      * @constraint A23
99      * @title number of registers
100      */
testVFE7()101     public void testVFE7() {
102         load("dot.junit.opcodes.move_result_object.d.T_move_result_object_9", VerifyError.class);
103     }
104 
105 }
106