• 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.aget_object;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.aget_object.d.T_aget_object_1;
22 import dot.junit.opcodes.aget_object.d.T_aget_object_8;
23 
24 
25 public class Test_aget_object extends DxTestCase {
26      /**
27      * @title get reference from array
28      */
testN1()29     public void testN1() {
30         T_aget_object_1 t = new T_aget_object_1();
31         String[] arr = new String[] {"a", "b"};
32         assertEquals("a", t.run(arr, 0));
33     }
34 
35     /**
36      * @title  get reference from array
37      */
testN2()38     public void testN2() {
39         T_aget_object_1 t = new T_aget_object_1();
40         String[] arr = new String[] {"a", "b"};
41         assertEquals("b", t.run(arr, 1));
42     }
43 
44     /**
45      * @title expected ArrayIndexOutOfBoundsException
46      */
testE1()47     public void testE1() {
48         loadAndRun("dot.junit.opcodes.aget_object.d.T_aget_object_1",
49                    ArrayIndexOutOfBoundsException.class, new String[2], 2);
50     }
51 
52     /**
53      * @title expected ArrayIndexOutOfBoundsException (negative index)
54      */
testE2()55     public void testE2() {
56         loadAndRun("dot.junit.opcodes.aget_object.d.T_aget_object_1",
57                    ArrayIndexOutOfBoundsException.class, new String[2], -1);
58     }
59 
60     /**
61      * @title expected NullPointerException
62      */
testE3()63     public void testE3() {
64         loadAndRun("dot.junit.opcodes.aget_object.d.T_aget_object_1", NullPointerException.class,
65                    null, 0);
66     }
67 
68     /**
69      * @constraint B1
70      * @title types of arguments - array, double
71      */
testVFE1()72     public void testVFE1() {
73         load("dot.junit.opcodes.aget_object.d.T_aget_object_2", VerifyError.class);
74     }
75 
76     /**
77      * @constraint B1
78      * @title types of arguments - array, long
79      */
testVFE2()80     public void testVFE2() {
81         load("dot.junit.opcodes.aget_object.d.T_aget_object_3", VerifyError.class);
82     }
83 
84     /**
85      * @constraint B1
86      * @title types of arguments - Object, int
87      */
testVFE3()88     public void testVFE3() {
89         load("dot.junit.opcodes.aget_object.d.T_aget_object_4", VerifyError.class);
90     }
91 
92     /**
93      * @constraint B1
94      * @title types of arguments - float[], int
95      */
testVFE4()96     public void testVFE4() {
97         load("dot.junit.opcodes.aget_object.d.T_aget_object_5", VerifyError.class);
98     }
99 
100     /**
101      * @constraint B1
102      * @title types of arguments - long[], int
103      */
testVFE5()104     public void testVFE5() {
105         load("dot.junit.opcodes.aget_object.d.T_aget_object_6", VerifyError.class);
106     }
107 
108     /**
109      * @constraint B1
110      * @title types of arguments - array, reference
111      */
testVFE6()112     public void testVFE6() {
113         load("dot.junit.opcodes.aget_object.d.T_aget_object_7", VerifyError.class);
114     }
115 
116     /**
117      * @constraint A23
118      * @title number of registers
119      */
testVFE7()120     public void testVFE7() {
121         load("dot.junit.opcodes.aget_object.d.T_aget_object_9", VerifyError.class);
122     }
123 
124     /**
125      * @constraint B1
126      * @title Type of index argument - float. The verifier checks that ints
127      * and floats are not used interchangeably.
128      */
testVFE8()129     public void testVFE8() {
130         load("dot.junit.opcodes.aget_object.d.T_aget_object_8", VerifyError.class);
131     }
132 
133 }
134