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_long; 18 19 import dot.junit.DxTestCase; 20 import dot.junit.DxUtil; 21 import dot.junit.opcodes.not_long.d.T_not_long_1; 22 import dot.junit.opcodes.not_long.d.T_not_long_2; 23 24 public class Test_not_long extends DxTestCase { 25 26 /** 27 * @title Argument = 500000l 28 */ testN1()29 public void testN1() { 30 T_not_long_1 t = new T_not_long_1(); 31 assertEquals(-500001l, t.run(500000l)); 32 } 33 34 /** 35 * @title Argument = -500000l 36 */ testN2()37 public void testN2() { 38 T_not_long_1 t = new T_not_long_1(); 39 assertEquals(499999l, t.run(-500000l)); 40 } 41 42 /** 43 * @title Argument = 0xcafe; 0x12c 44 */ testN3()45 public void testN3() { 46 T_not_long_1 t = new T_not_long_1(); 47 assertEquals(-0xcaff, t.run(0xcafe)); 48 assertEquals(-0x12d, t.run(0x12c)); 49 } 50 51 /** 52 * @title Argument = Long.MAX_VALUE 53 */ testB1()54 public void testB1() { 55 T_not_long_1 t = new T_not_long_1(); 56 assertEquals(Long.MIN_VALUE, t.run(Long.MAX_VALUE)); 57 } 58 59 /** 60 * @title Argument = Long.MIN_VALUE 61 */ testB2()62 public void testB2() { 63 T_not_long_1 t = new T_not_long_1(); 64 assertEquals(Long.MAX_VALUE, t.run(Long.MIN_VALUE)); 65 } 66 67 /** 68 * @title Argument = 1l 69 */ testB3()70 public void testB3() { 71 T_not_long_1 t = new T_not_long_1(); 72 assertEquals(-2l, t.run(1l)); 73 } 74 75 /** 76 * @title Argument = 0l 77 */ testB4()78 public void testB4() { 79 T_not_long_1 t = new T_not_long_1(); 80 assertEquals(-1l, t.run(0l)); 81 } 82 83 /** 84 * @title Argument = -1l 85 */ testB5()86 public void testB5() { 87 T_not_long_1 t = new T_not_long_1(); 88 assertEquals(0l, t.run(-1l)); 89 } 90 91 /** 92 * @constraint A23 93 * @title number of registers 94 */ testVFE1()95 public void testVFE1() { 96 load("dot.junit.opcodes.not_long.d.T_not_long_3", VerifyError.class); 97 } 98 99 100 101 /** 102 * @constraint B1 103 * @title types of arguments - int 104 */ testVFE2()105 public void testVFE2() { 106 load("dot.junit.opcodes.not_long.d.T_not_long_4", VerifyError.class); 107 } 108 109 /** 110 * @constraint B1 111 * @title types of arguments - float 112 */ testVFE3()113 public void testVFE3() { 114 load("dot.junit.opcodes.not_long.d.T_not_long_5", VerifyError.class); 115 } 116 117 /** 118 * @constraint B1 119 * @title types of arguments - reference 120 */ testVFE4()121 public void testVFE4() { 122 load("dot.junit.opcodes.not_long.d.T_not_long_6", VerifyError.class); 123 } 124 125 /** 126 * @constraint B1 127 * @title Types of arguments - long, double. The verifier checks that longs 128 * and doubles are not used interchangeably. 129 */ testVFE5()130 public void testVFE5() { 131 load("dot.junit.opcodes.not_long.d.T_not_long_2", VerifyError.class); 132 } 133 } 134