• 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.rem_int_lit8;
18 
19 import dot.junit.DxTestCase;
20 import dot.junit.DxUtil;
21 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_1;
22 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_2;
23 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_3;
24 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_4;
25 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_5;
26 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_6;
27 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_7;
28 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_8;
29 import dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_9;
30 
31 public class Test_rem_int_lit8 extends DxTestCase {
32 
33     /**
34      * @title Arguments = 8, 4
35      */
testN1()36     public void testN1() {
37         T_rem_int_lit8_1 t = new T_rem_int_lit8_1();
38         assertEquals(0, t.run(8));
39     }
40 
41     /**
42      * @title Arguments = 123, 4
43      */
testN2()44     public void testN2() {
45         T_rem_int_lit8_1 t = new T_rem_int_lit8_1();
46         assertEquals(3, t.run(123));
47     }
48 
49     /**
50      * @title Dividend = 0
51      */
testN3()52     public void testN3() {
53         T_rem_int_lit8_1 t = new T_rem_int_lit8_1();
54         assertEquals(0, t.run(0));
55     }
56 
57     /**
58      * @title Dividend is negative
59      */
testN4()60     public void testN4() {
61         T_rem_int_lit8_1 t = new T_rem_int_lit8_1();
62         assertEquals(-2, t.run(-10));
63     }
64 
65     /**
66      * @title Divisor is negative
67      */
testN5()68     public void testN5() {
69         T_rem_int_lit8_2 t = new T_rem_int_lit8_2();
70         assertEquals(0, t.run(123));
71     }
72 
73     /**
74      * @title Both Dividend and divisor are negative
75      */
testN6()76     public void testN6() {
77         T_rem_int_lit8_3 t = new T_rem_int_lit8_3();
78         assertEquals(-3, t.run(-123));
79     }
80 
81     /**
82      * @title Arguments = Byte.MIN_VALUE, -1
83      */
testB1()84     public void testB1() {
85         T_rem_int_lit8_5 t = new T_rem_int_lit8_5();
86         assertEquals(0, t.run(Byte.MIN_VALUE));
87     }
88 
89     /**
90      * @title Arguments = Byte.MIN_VALUE, 1
91      */
testB2()92     public void testB2() {
93         T_rem_int_lit8_6 t = new T_rem_int_lit8_6();
94         assertEquals(0, t.run(Byte.MIN_VALUE));
95     }
96 
97     /**
98      * @title Arguments = Byte.MAX_VALUE, 1
99      */
testB3()100     public void testB3() {
101         T_rem_int_lit8_6 t = new T_rem_int_lit8_6();
102         assertEquals(0, t.run(Byte.MAX_VALUE));
103     }
104 
105     /**
106      * @title Arguments = Short.MIN_VALUE, 127
107      */
testB4()108     public void testB4() {
109         T_rem_int_lit8_7 t = new T_rem_int_lit8_7();
110         assertEquals(-2, t.run(Short.MIN_VALUE));
111     }
112 
113     /**
114      * @title Arguments = 1, 127
115      */
testB5()116     public void testB5() {
117         T_rem_int_lit8_7 t = new T_rem_int_lit8_7();
118         assertEquals(1, t.run(1));
119     }
120 
121     /**
122      * @title Arguments = 1, -128
123      */
testB6()124     public void testB6() {
125         T_rem_int_lit8_8 t = new T_rem_int_lit8_8();
126         assertEquals(1, t.run(1));
127     }
128 
129     /**
130      * @title Divisor is 0
131      */
testE1()132     public void testE1() {
133         loadAndRun("dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_9", ArithmeticException.class,
134                    1);
135     }
136 
137     /**
138      * @constraint A23
139      * @title number of registers
140      */
testVFE1()141     public void testVFE1() {
142         load("dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_10", VerifyError.class);
143     }
144 
145 
146 
147     /**
148      * @constraint B1
149      * @title types of arguments - int, double
150      */
testVFE2()151     public void testVFE2() {
152         load("dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_11", VerifyError.class);
153     }
154 
155     /**
156      * @constraint B1
157      * @title types of arguments - long, int
158      */
testVFE3()159     public void testVFE3() {
160         load("dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_12", VerifyError.class);
161     }
162 
163     /**
164      * @constraint B1
165      * @title types of arguments - reference, int
166      */
testVFE4()167     public void testVFE4() {
168         load("dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_13", VerifyError.class);
169     }
170 
171     /**
172      * @constraint B1
173      * @title Types of arguments - float, int. The verifier checks that ints
174      * and floats are not used interchangeably.
175      */
testVFE5()176     public void testVFE5() {
177         load("dot.junit.opcodes.rem_int_lit8.d.T_rem_int_lit8_4", VerifyError.class);
178     }
179 
180 }
181