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