blob: 74f1dfad7939f93c3a4aad13b000fbf93aacec4b [file] [log] [blame]
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -07001/*
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
17package dot.junit.opcodes.add_float;
18
19import dot.junit.DxTestCase;
20import dot.junit.DxUtil;
21import dot.junit.opcodes.add_float.d.T_add_float_1;
22import dot.junit.opcodes.add_float.d.T_add_float_5;
23
24public class Test_add_float extends DxTestCase {
25 /**
26 * @title Arguments = 2.7f, 3.14f
27 */
28 public void testN1() {
29 T_add_float_1 t = new T_add_float_1();
30 assertEquals(5.84f, t.run(2.7f, 3.14f));
31 }
32
33 /**
34 * @title Arguments = 0, -3.14f
35 */
36 public void testN2() {
37 T_add_float_1 t = new T_add_float_1();
38 assertEquals(-3.14f, t.run(0, -3.14f));
39 }
40
41 /**
42 * @title Arguments = -3.14f, -2.7f
43 */
44 public void testN3() {
45 T_add_float_1 t = new T_add_float_1();
46 assertEquals(-5.84f, t.run(-3.14f, -2.7f));
47 }
48
49 /**
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -070050 * @title Arguments = Float.MAX_VALUE, Float.NaN
51 */
52 public void testB1() {
53 T_add_float_1 t = new T_add_float_1();
54 assertEquals(Float.POSITIVE_INFINITY, t.run(3.3028235E38f, 0.11E38f));
55 }
56
57 /**
58 * @title Arguments = Float.POSITIVE_INFINITY,
59 * Float.NEGATIVE_INFINITY
60 */
61 public void testB2() {
62 T_add_float_1 t = new T_add_float_1();
63 assertTrue(Float.isNaN(t.run(Float.POSITIVE_INFINITY,
64 Float.NEGATIVE_INFINITY)));
65 }
66
67 /**
68 * @title Arguments = Float.POSITIVE_INFINITY,
69 * Float.POSITIVE_INFINITY
70 */
71 public void testB3() {
72 T_add_float_1 t = new T_add_float_1();
73 assertEquals(Float.POSITIVE_INFINITY, t.run(Float.POSITIVE_INFINITY,
74 Float.POSITIVE_INFINITY));
75 }
76
77 /**
78 * @title Arguments = Float.POSITIVE_INFINITY, -2.7f
79 */
80 public void testB4() {
81 T_add_float_1 t = new T_add_float_1();
82 assertEquals(Float.POSITIVE_INFINITY, t.run(Float.POSITIVE_INFINITY,
83 -2.7f));
84 }
85
86 /**
87 * @title Arguments = +0, -0f
88 */
89 public void testB5() {
90 T_add_float_1 t = new T_add_float_1();
91 assertEquals(+0f, t.run(+0f, -0f));
92 }
93
94 /**
95 * @title Arguments = -0f, -0f
96 */
97 public void testB6() {
98 T_add_float_1 t = new T_add_float_1();
99 assertEquals(-0f, t.run(-0f, -0f));
100 }
101
102 /**
103 * @title Arguments = -2.7f, 2.7f
104 */
105 public void testB7() {
106 T_add_float_1 t = new T_add_float_1();
107 assertEquals(+0f, t.run(-2.7f, 2.7f));
108 }
109
110 /**
111 * @title Arguments = Float.MAX_VALUE, Float.MAX_VALUE
112 */
113 public void testB8() {
114 T_add_float_1 t = new T_add_float_1();
115 assertEquals(Float.POSITIVE_INFINITY, t.run(Float.MAX_VALUE,
116 Float.MAX_VALUE));
117 }
118
119 /**
120 * @title Arguments = Float.MIN_VALUE, -1.4E-45f
121 */
122 public void testB9() {
123 T_add_float_1 t = new T_add_float_1();
124 assertEquals(0f, t.run(Float.MIN_VALUE, -1.4E-45f));
125 }
126
127
128
129 /**
130 * @constraint B1
131 * @title types of arguments - float, double
132 */
133 public void testVFE1() {
Andreas Gampe1d1a3a92014-08-23 00:11:27 -0700134 load("dot.junit.opcodes.add_float.d.T_add_float_2", VerifyError.class);
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700135 }
136
137 /**
138 * @constraint B1
139 * @title types of arguments - long, float
140 */
141 public void testVFE2() {
Andreas Gampe1d1a3a92014-08-23 00:11:27 -0700142 load("dot.junit.opcodes.add_float.d.T_add_float_3", VerifyError.class);
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700143 }
144
145 /**
146 * @constraint B1
147 * @title types of arguments - float, reference
148 */
149 public void testVFE3() {
Andreas Gampe1d1a3a92014-08-23 00:11:27 -0700150 load("dot.junit.opcodes.add_float.d.T_add_float_4", VerifyError.class);
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700151 }
152
153 /**
154 * @constraint A23
155 * @title number of registers
156 */
157 public void testVFE4() {
Andreas Gampe1d1a3a92014-08-23 00:11:27 -0700158 load("dot.junit.opcodes.add_float.d.T_add_float_6", VerifyError.class);
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700159 }
160
jeffhao4fda9ca2011-10-04 19:20:23 -0700161 /**
162 * @constraint B1
163 * @title Types of arguments - int, float. The verifier checks that ints
164 * and floats are not used interchangeably.
165 */
166 public void testVFE5() {
Andreas Gampe1d1a3a92014-08-23 00:11:27 -0700167 load("dot.junit.opcodes.add_float.d.T_add_float_5", VerifyError.class);
jeffhao4fda9ca2011-10-04 19:20:23 -0700168 }
169
Tsu Chiang Chuang9a223d72011-04-27 17:19:46 -0700170}