• 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_object;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.move_object.d.T_move_object_1;
22 
23 public class Test_move_object extends DxTestCase {
24     /**
25      * @title tests move-object functionality
26      */
testN1()27     public void testN1() {
28         T_move_object_1 t = new T_move_object_1();
29         assertEquals(t.run(), t);
30     }
31 
32 
33     /**
34      * @constraint A23
35      * @title  number of registers - src is not valid
36      */
testVFE1()37     public void testVFE1() {
38         try {
39             Class.forName("dot.junit.opcodes.move_object.d.T_move_object_2");
40             fail("expected a verification exception");
41         } catch (Throwable t) {
42             DxUtil.checkVerifyException(t);
43         }
44     }
45 
46     /**
47      * @constraint A23
48      * @title number of registers - dst is not valid
49      */
testVFE2()50     public void testVFE2() {
51         try {
52             Class.forName("dot.junit.opcodes.move_object.d.T_move_object_3");
53             fail("expected a verification exception");
54         } catch (Throwable t) {
55             DxUtil.checkVerifyException(t);
56         }
57     }
58 
59     /**
60      * @constraint B1
61      * @title src register contains integer
62      */
testVFE3()63     public void testVFE3() {
64         try {
65             Class.forName("dot.junit.opcodes.move_object.d.T_move_object_4");
66             fail("expected a verification exception");
67         } catch (Throwable t) {
68             DxUtil.checkVerifyException(t);
69         }
70     }
71 
72     /**
73      * @constraint B1
74      * @title src register contains wide
75      */
testVFE4()76     public void testVFE4() {
77         try {
78             Class.forName("dot.junit.opcodes.move_object.d.T_move_object_5");
79             fail("expected a verification exception");
80         } catch (Throwable t) {
81             DxUtil.checkVerifyException(t);
82         }
83     }
84 
85     /**
86      * @constraint B1
87      * @title src register is a part of reg pair
88      */
testVFE5()89     public void testVFE5() {
90         try {
91             Class.forName("dot.junit.opcodes.move_object.d.T_move_object_6");
92             fail("expected a verification exception");
93         } catch (Throwable t) {
94             DxUtil.checkVerifyException(t);
95         }
96     }
97 
98     /**
99      * @constraint B18
100      * @title When writing to a register that is one half of a
101      * register pair, but not touching the other half, the old register pair gets broken
102      * up, and the other register involved in it becomes undefined.
103      */
testVFE6()104     public void testVFE6() {
105         try {
106             Class.forName("dot.junit.opcodes.move_object.d.T_move_object_7");
107             fail("expected a verification exception");
108         } catch (Throwable t) {
109             DxUtil.checkVerifyException(t);
110         }
111     }
112 }
113