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