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 dxc.junit.opcodes.dload_2; 18 19 import dxc.junit.DxTestCase; 20 import dxc.junit.DxUtil; 21 import dxc.junit.opcodes.dload_2.jm.T_dload_2_1; 22 import dxc.junit.opcodes.dload_2.jm.T_dload_2_6; 23 24 public class Test_dload_2 extends DxTestCase { 25 26 /** 27 * @title value is pushed onto the operand stack 28 */ 29 public void testN1() { 30 assertEquals(1d, T_dload_2_1.run()); 31 } 32 33 /** 34 * @title equality of dload_<n> and dload <n> 35 */ 36 public void testN2() { 37 assertTrue(T_dload_2_6.run()); 38 } 39 40 /** 41 * @constraint 4.8.1.22 42 * @title index must be no greater than the value 43 * of max_locals-1 44 */ 45 public void testVFE1() { 46 try { 47 Class.forName("dxc.junit.opcodes.dload_2.jm.T_dload_2_2"); 48 fail("expected a verification exception"); 49 } catch (Throwable t) { 50 DxUtil.checkVerifyException(t); 51 } 52 } 53 54 /** 55 * @constraint 4.8.2.1 56 * @title types of argument - float 57 */ 58 public void testVFE2() { 59 try { 60 Class.forName("dxc.junit.opcodes.dload_2.jm.T_dload_2_3"); 61 fail("expected a verification exception"); 62 } catch (Throwable t) { 63 DxUtil.checkVerifyException(t); 64 } 65 } 66 67 /** 68 * @constraint 4.8.2.1 69 * @title types of argument - long 70 */ 71 public void testVFE3() { 72 try { 73 Class.forName("dxc.junit.opcodes.dload_2.jm.T_dload_2_4"); 74 fail("expected a verification exception"); 75 } catch (Throwable t) { 76 DxUtil.checkVerifyException(t); 77 } 78 } 79 80 /** 81 * @constraint 4.8.2.5 82 * @title stack size 83 */ 84 public void testVFE4() { 85 try { 86 Class.forName("dxc.junit.opcodes.dload_2.jm.T_dload_2_5"); 87 fail("expected a verification exception"); 88 } catch (Throwable t) { 89 DxUtil.checkVerifyException(t); 90 } 91 } 92 93 } 94