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.mul_double_2addr;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_1;
22 import dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_4;
23 
24 public class Test_mul_double_2addr extends DxTestCase {
25 
26     /**
27      * @title Arguments = 2.7d, 3.14d
28      */
29 
testN1()30     public void testN1() {
31         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
32         assertEquals(8.478000000000002d, t.run(2.7d, 3.14d));
33     }
34 
35     /**
36      * @title Arguments = 0, -3.14d
37      */
testN2()38     public void testN2() {
39         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
40         assertEquals(-0d, t.run(0, -3.14d));
41     }
42 
43     /**
44      * @title Arguments = -2.7d, -3.14d
45      */
testN3()46     public void testN3() {
47         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
48         assertEquals(8.478000000000002d, t.run(-3.14d, -2.7d));
49     }
50 
51     /**
52      * @title Arguments = Double.MAX_VALUE, Double.NaN
53      */
testB1()54     public void testB1() {
55         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
56         assertEquals(Double.NaN, t.run(Double.MAX_VALUE, Double.NaN));
57     }
58 
59     /**
60      * @title Arguments = Double.POSITIVE_INFINITY, 0
61      */
testB2()62     public void testB2() {
63         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
64         assertEquals(Double.NaN, t.run(Double.POSITIVE_INFINITY, 0));
65     }
66 
67     /**
68      * @title Arguments = Double.POSITIVE_INFINITY, -2.7d
69      */
testB3()70     public void testB3() {
71         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
72         assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY,
73                 -2.7d));
74     }
75 
76     /**
77      * @title Arguments = Double.POSITIVE_INFINITY,
78      * Double.NEGATIVE_INFINITY
79      */
testB4()80     public void testB4() {
81         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
82         assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY,
83                 Double.NEGATIVE_INFINITY));
84     }
85 
86     /**
87      * @title Arguments = +0, -0d
88      */
testB5()89     public void testB5() {
90         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
91         assertEquals(-0d, t.run(+0d, -0d));
92     }
93 
94     /**
95      * @title Arguments = -0d, -0d
96      */
testB6()97     public void testB6() {
98         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
99         assertEquals(+0d, t.run(-0d, -0d));
100     }
101 
102     /**
103      * @title Arguments = Double.MAX_VALUE, Double.MAX_VALUE
104      */
testB7()105     public void testB7() {
106         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
107         assertEquals(Double.POSITIVE_INFINITY, t.run(Double.MAX_VALUE,
108                 Double.MAX_VALUE));
109     }
110 
111     /**
112      * @title Arguments = Double.MIN_VALUE, -1.4E-45f
113      */
testB8()114     public void testB8() {
115         T_mul_double_2addr_1 t = new T_mul_double_2addr_1();
116         assertEquals(-0d, t.run(Double.MIN_VALUE, -1.4E-45f));
117     }
118 
119     /**
120      * @constraint A24
121      * @title number of registers
122      */
testVFE1()123     public void testVFE1() {
124         load("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_2", VerifyError.class);
125     }
126 
127 
128 
129     /**
130      * @constraint B1
131      * @title types of arguments - float, double
132      */
testVFE2()133     public void testVFE2() {
134         load("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_3", VerifyError.class);
135     }
136 
137     /**
138      * @constraint B1
139      * @title types of arguments - double, reference
140      */
testVFE3()141     public void testVFE3() {
142         load("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_5", VerifyError.class);
143     }
144 
145     /**
146      * @constraint B1
147      * @title Types of arguments - long, double. The verifier checks that longs
148      * and doubles are not used interchangeably.
149      */
testVFE4()150     public void testVFE4() {
151         load("dot.junit.opcodes.mul_double_2addr.d.T_mul_double_2addr_4", VerifyError.class);
152     }
153 
154 }
155