• 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.array_length;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.array_length.d.T_array_length_1;
22 import dot.junit.opcodes.array_length.d.T_array_length_4;
23 
24 
25 public class Test_array_length extends DxTestCase {
26     /**
27      * @title get length of array of references
28      */
testN1()29     public void testN1() {
30         T_array_length_1 t = new T_array_length_1();
31         String[] a = new String[5];
32         assertEquals(5, t.run(a));
33     }
34 
35     /**
36      * @title get length of array of doubles
37      */
testN2()38     public void testN2() {
39         T_array_length_4 t = new T_array_length_4();
40         double[] a = new double[10];
41         assertEquals(10, t.run(a));
42     }
43 
44     /**
45      * @title expected NullPointerException
46      */
testNPE1()47     public void testNPE1() {
48         loadAndRun("dot.junit.opcodes.array_length.d.T_array_length_1", NullPointerException.class,
49                    new Object[] {null});
50     }
51 
52     /**
53      * @constraint B1
54      * @title types of arguments - Object
55      */
testVFE1()56     public void testVFE1() {
57         load("dot.junit.opcodes.array_length.d.T_array_length_2", VerifyError.class);
58     }
59 
60     /**
61      * @constraint B1
62      * @title types of arguments - int
63      */
testVFE2()64     public void testVFE2() {
65         load("dot.junit.opcodes.array_length.d.T_array_length_3", VerifyError.class);
66     }
67 
68     /**
69      * @constraint A23
70      * @title number of registers
71      */
testVFE3()72     public void testVFE3() {
73         load("dot.junit.opcodes.array_length.d.T_array_length_5", VerifyError.class);
74     }
75 }
76