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