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.not_int; 18 19 import dot.junit.DxTestCase; 20 import dot.junit.DxUtil; 21 import dot.junit.opcodes.not_int.d.T_not_int_1; 22 import dot.junit.opcodes.not_int.d.T_not_int_2; 23 24 public class Test_not_int extends DxTestCase { 25 26 /** 27 * @title Argument = 5; 256 28 */ testN1()29 public void testN1() { 30 T_not_int_1 t = new T_not_int_1(); 31 assertEquals(-6, t.run(5)); 32 assertEquals(-257, t.run(256)); 33 } 34 35 /** 36 * @title Argument = -5, -256 37 */ testN2()38 public void testN2() { 39 T_not_int_1 t = new T_not_int_1(); 40 assertEquals(4, t.run(-5)); 41 assertEquals(255, t.run(-256)); 42 } 43 44 /** 45 * @title Argument = 0xcafe; 0x12c 46 */ testN3()47 public void testN3() { 48 T_not_int_1 t = new T_not_int_1(); 49 assertEquals(-0xcaff, t.run(0xcafe)); 50 assertEquals(-0x12d, t.run(0x12c)); 51 } 52 53 /** 54 * @title Argument = Integer.MAX_VALUE 55 */ testB1()56 public void testB1() { 57 T_not_int_1 t = new T_not_int_1(); 58 assertEquals(Integer.MIN_VALUE, t.run(Integer.MAX_VALUE)); 59 } 60 61 /** 62 * @title Argument = Integer.MIN_VALUE 63 */ testB2()64 public void testB2() { 65 T_not_int_1 t = new T_not_int_1(); 66 assertEquals(Integer.MAX_VALUE, t.run(Integer.MIN_VALUE)); 67 } 68 69 /** 70 * @title Argument = 1 71 */ testB3()72 public void testB3() { 73 T_not_int_1 t = new T_not_int_1(); 74 assertEquals(-2, t.run(1)); 75 } 76 77 /** 78 * @title Argument = 0 79 */ testB4()80 public void testB4() { 81 T_not_int_1 t = new T_not_int_1(); 82 assertEquals(-1, t.run(0)); 83 } 84 85 /** 86 * @title Argument = -1 87 */ testB5()88 public void testB5() { 89 T_not_int_1 t = new T_not_int_1(); 90 assertEquals(0, t.run(-1)); 91 } 92 93 /** 94 * @title Argument = Short.MAX_VALUE 95 */ testB6()96 public void testB6() { 97 T_not_int_1 t = new T_not_int_1(); 98 assertEquals(Short.MIN_VALUE, t.run(Short.MAX_VALUE)); 99 } 100 101 /** 102 * @title Argument = Short.MIN_VALUE 103 */ testB7()104 public void testB7() { 105 T_not_int_1 t = new T_not_int_1(); 106 assertEquals(Short.MAX_VALUE, t.run(Short.MIN_VALUE)); 107 } 108 109 /** 110 * @constraint A23 111 * @title number of registers 112 */ testVFE1()113 public void testVFE1() { 114 load("dot.junit.opcodes.not_int.d.T_not_int_3", VerifyError.class); 115 } 116 117 118 119 /** 120 * @constraint B1 121 * @title types of arguments - double 122 */ testVFE2()123 public void testVFE2() { 124 load("dot.junit.opcodes.not_int.d.T_not_int_4", VerifyError.class); 125 } 126 127 /** 128 * @constraint B1 129 * @title types of arguments - long 130 */ testVFE3()131 public void testVFE3() { 132 load("dot.junit.opcodes.not_int.d.T_not_int_5", VerifyError.class); 133 } 134 135 /** 136 * @constraint B1 137 * @title types of arguments - reference 138 */ testVFE4()139 public void testVFE4() { 140 load("dot.junit.opcodes.not_int.d.T_not_int_6", VerifyError.class); 141 } 142 143 /** 144 * @constraint B1 145 * @title Types of arguments - int, float. The verifier checks that ints 146 * and floats are not used interchangeably. 147 */ testVFE5()148 public void testVFE5() { 149 load("dot.junit.opcodes.not_int.d.T_not_int_2", VerifyError.class); 150 } 151 152 } 153