|
Authored by: capt.Hij on Saturday, May 19 2012 @ 03:10 PM EDT |
G:gingerbread23 - GOOGLE-00-00000527ctstoolsdx-
testssrcdxcjunitopcodesn
newarrayTest_newarray.java
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 dxc.junit.opcodes.newarray;
18
19 import dxc.junit.DxTestCase;
20 import dxc.junit.DxUtil;
21 import dxc.junit.opcodes.newarray.jm.T_newarray_1;
22 import dxc.junit.opcodes.newarray.jm.T_newarray_2;
23
24 public class Test_newarray extends DxTestCase {
25
26 /*
27 * @title Array of ints
28 */
29 public void testN1() {
30 T_newarray_1 t = new T_newarray_1();
31 int[] r = t.run(10);
32 int l = r.length;
33 assertEquals(10, l);
34
35 // check default initialization
36 for (int i = 0; i < l; i++) {
37 assertEquals(0, r[i]);
38 }
39
40 }
41
42 /**
43 * @title Array of floats
44 */
45 public void testN2() {
46 T_newarray_2 t = new T_newarray_2();
47 float[] r = t.run(10);
48 int l = r.length;
49 assertEquals(10, l);
50
51 // check default initialization
52 for (int i = 0; i < l; i++) {
53 assertEquals(0f, r[i]);
55
54 }
55 }
56
57 /**
58 * @title expected NegativeArraySizeException
59 */
UNITED STATES DISTRICT COURT
NORTHERN DISTRICT OF CALIFORNIA
TRIAL EXHIBIT47.24
CASE NO. 10-03561 WHA
DATE ENTERED
BY
DEPUTY CLERK
Page 1 of 3
G:gingerbread23 - GOOGLE-00-00000527ctstoolsdx-
testssrcdxcjunitopcodesn
newarrayTest_newarray.java
60 public void testE1() {
61 T_newarray_2 t = new T_newarray_2();
62 try {
63 t.run(-1);
64 fail("expected NegativeArraySizeException");
65 } catch (NegativeArraySizeException nase) {
66 // expected
67 }
68 }
69
70 /**
71 * @title Array size = 0
72 */
73 public void testB1() {
74 T_newarray_1 t = new T_newarray_1();
75 int[] r = t.run(0);
76 assertNotNull(r);
77 assertEquals(0, r.length);
78 }
79
80 /**
81 * @constraint 4.8.2.1
82 * @title number of arguments
83 */
84 public void testVFE1() {
85 try {
86
Class.forName("dxc.junit.opcodes.newarray.jm.T_newarray_3");
87 fail("expected a verification exception");
88 } catch (Throwable t) {
89 DxUtil.checkVerifyException(t);
90 }
91 }
92
93 /**
94 * @constraint 4.8.2.1
95 * @title type of argument - float
96 */
97 public void testVFE2() {
98 try {
99
Class.forName("dxc.junit.opcodes.newarray.jm.T_newarray_4");
100 fail("expected a verification exception");
101 } catch (Throwable t) {
102 DxUtil.checkVerifyException(t);
103 }
104 }
105
106 /**
107 * @constraint 4.8.2.20
108 * @title atype must take one of the following
109 * values
110 */
111 public void testVFE3() {
112 try {
113
Class.forName("dxc.junit.opcodes.newarray.jm.T_newarray_5");
114 fail("expected a verification exception");
115 } catch (Throwable t) {
116 DxUtil.checkVerifyException(t);
117 }
118 }
119
Page 2 of 3
G:gingerbread23 - GOOGLE-00-00000527ctstoolsdx-
testssrcdxcjunitopcodesn
newarrayTest_newarray.java
120 /**
121 * @constraint 4.8.2.1
122 * @title type of argument - reference
123 */
124 public void testVFE4() {
125 try {
126
Class.forName("dxc.junit.opcodes.newarray.jm.T_newarray_6");
127 fail("expected a verification exception");
128 } catch (Throwable t) {
129 DxUtil.checkVerifyException(t);
130 }
131 }
132
133 }
[ Reply to This | Parent | # ]
|
|
|
|
|