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_int_lit16;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_1;
22 import dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_2;
23 import dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_3;
24 import dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_4;
25 import dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_5;
26 import dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_6;
27 
28 public class Test_mul_int_lit16 extends DxTestCase {
29 
30     /**
31      * @title Arguments = 205, 130
32      */
testN1()33     public void testN1() {
34         T_mul_int_lit16_1 t = new T_mul_int_lit16_1();
35         assertEquals(26650, t.run(205));
36     }
37 
38     /**
39      * @title Arguments = -180, 130
40      */
testN2()41     public void testN2() {
42         T_mul_int_lit16_1 t = new T_mul_int_lit16_1();
43         assertEquals(-23400, t.run(-180));
44     }
45 
46     /**
47      * @title Arguments = 0xfa, 130
48      */
testN3()49     public void testN3() {
50         T_mul_int_lit16_1 t = new T_mul_int_lit16_1();
51         assertEquals(0x7ef4, t.run(0xfa));
52     }
53 
54     /**
55      * @title Arguments = -101, -321
56      */
testN4()57     public void testN4() {
58         T_mul_int_lit16_2 t = new T_mul_int_lit16_2();
59         assertEquals(32421, t.run(-101));
60     }
61 
62     /**
63      * @title Arguments = 0, 0
64      */
testB1()65     public void testB1() {
66         T_mul_int_lit16_4 t = new T_mul_int_lit16_4();
67         assertEquals(0, t.run(0));
68     }
69 
70     /**
71      * @title Arguments = 0, Short.MAX_VALUE
72      */
testB2()73     public void testB2() {
74         T_mul_int_lit16_4 t = new T_mul_int_lit16_4();
75         assertEquals(0, t.run(Short.MAX_VALUE));
76     }
77 
78     /**
79      * @title Arguments = 1, Short.MAX_VALUE
80      */
testB3()81     public void testB3() {
82         T_mul_int_lit16_5 t = new T_mul_int_lit16_5();
83         assertEquals(Short.MAX_VALUE, t.run(Short.MAX_VALUE));
84     }
85 
86     /**
87      * @title Arguments = 1, Short.MIN_VALUE
88      */
testB4()89     public void testB4() {
90         T_mul_int_lit16_5 t = new T_mul_int_lit16_5();
91         assertEquals(Short.MIN_VALUE, t.run(Short.MIN_VALUE));
92     }
93 
94     /**
95      * @title Arguments = 32767, Short.MIN_VALUE
96      */
testB5()97     public void testB5() {
98         T_mul_int_lit16_6 t = new T_mul_int_lit16_6();
99         assertEquals(-1073709056, t.run(Short.MIN_VALUE));
100     }
101 
102     /**
103      * @constraint A23
104      * @title number of registers
105      */
testVFE1()106     public void testVFE1() {
107         load("dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_7", VerifyError.class);
108     }
109 
110 
111 
112     /**
113      * @constraint B1
114      * @title types of arguments - int * double
115      */
testVFE2()116     public void testVFE2() {
117         load("dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_8", VerifyError.class);
118     }
119 
120     /**
121      * @constraint B1
122      * @title types of arguments - long * int
123      */
testVFE3()124     public void testVFE3() {
125         load("dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_9", VerifyError.class);
126     }
127 
128     /**
129      * @constraint B1
130      * @title types of arguments - reference * int
131      */
testVFE4()132     public void testVFE4() {
133         load("dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_10", VerifyError.class);
134     }
135 
136     /**
137      * @constraint B1
138      * @title Types of arguments - int, float. The verifier checks that ints
139      * and floats are not used interchangeably.
140      */
testVFE5()141     public void testVFE5() {
142         load("dot.junit.opcodes.mul_int_lit16.d.T_mul_int_lit16_3", VerifyError.class);
143     }
144 }
145