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