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