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_lit8; 18 19 import dot.junit.DxTestCase; 20 import dot.junit.DxUtil; 21 import dot.junit.opcodes.mul_int_lit8.d.T_mul_int_lit8_1; 22 import dot.junit.opcodes.mul_int_lit8.d.T_mul_int_lit8_2; 23 import dot.junit.opcodes.mul_int_lit8.d.T_mul_int_lit8_3; 24 import dot.junit.opcodes.mul_int_lit8.d.T_mul_int_lit8_4; 25 import dot.junit.opcodes.mul_int_lit8.d.T_mul_int_lit8_5; 26 import dot.junit.opcodes.mul_int_lit8.d.T_mul_int_lit8_6; 27 28 public class Test_mul_int_lit8 extends DxTestCase { 29 30 /** 31 * @title Arguments = 10, 55 32 */ testN1()33 public void testN1() { 34 T_mul_int_lit8_1 t = new T_mul_int_lit8_1(); 35 assertEquals(550, t.run(55)); 36 } 37 38 /** 39 * @title Arguments = 10, -25 40 */ testN2()41 public void testN2() { 42 T_mul_int_lit8_1 t = new T_mul_int_lit8_1(); 43 assertEquals(-250, t.run(-25)); 44 } 45 46 /** 47 * @title Arguments = -15, -23 48 */ testN3()49 public void testN3() { 50 T_mul_int_lit8_2 t = new T_mul_int_lit8_2(); 51 assertEquals(345, t.run(-23)); 52 } 53 54 /** 55 * @title Arguments = 0x7ffffffe, 10 56 */ testN4()57 public void testN4() { 58 T_mul_int_lit8_1 t = new T_mul_int_lit8_1(); 59 assertEquals(-20, t.run(0x7ffffffe)); 60 } 61 62 /** 63 * @title Arguments = 0, 0 64 */ testB1()65 public void testB1() { 66 T_mul_int_lit8_4 t = new T_mul_int_lit8_4(); 67 assertEquals(0, t.run(0)); 68 } 69 70 /** 71 * @title Arguments = 0, Byte.MAX_VALUE 72 */ testB2()73 public void testB2() { 74 T_mul_int_lit8_4 t = new T_mul_int_lit8_4(); 75 assertEquals(0, t.run(Byte.MAX_VALUE)); 76 } 77 78 /** 79 * @title Arguments = 1, Byte.MAX_VALUE 80 */ testB3()81 public void testB3() { 82 T_mul_int_lit8_5 t = new T_mul_int_lit8_5(); 83 assertEquals(Byte.MAX_VALUE, t.run(Byte.MAX_VALUE)); 84 } 85 86 /** 87 * @title Arguments = 1, Short.MIN_VALUE 88 */ testB4()89 public void testB4() { 90 T_mul_int_lit8_5 t = new T_mul_int_lit8_5(); 91 assertEquals(Short.MIN_VALUE, t.run(Short.MIN_VALUE)); 92 } 93 94 /** 95 * @title Arguments = 127, Short.MIN_VALUE 96 */ testB5()97 public void testB5() { 98 T_mul_int_lit8_6 t = new T_mul_int_lit8_6(); 99 assertEquals(-4161536, 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_lit8.d.T_mul_int_lit8_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_lit8.d.T_mul_int_lit8_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_lit8.d.T_mul_int_lit8_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_lit8.d.T_mul_int_lit8_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_lit8.d.T_mul_int_lit8_3", VerifyError.class); 143 } 144 } 145