Home | History | Annotate | Download | only in aload_3
      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.aload_3;
     18 
     19 import dxc.junit.DxTestCase;
     20 import dxc.junit.DxUtil;
     21 import dxc.junit.opcodes.aload_3.jm.T_aload_3_1;
     22 import dxc.junit.opcodes.aload_3.jm.T_aload_3_6;
     23 
     24 public class Test_aload_3 extends DxTestCase {
     25 
     26     /**
     27      * @title value is pushed onto the operand stack
     28      */
     29     public void testN1() {
     30         assertEquals("hello", T_aload_3_1.run());
     31     }
     32 
     33     /**
     34      * @title equality of aload_<n> and aload <n>
     35      */
     36     public void testN2() {
     37         assertTrue(T_aload_3_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.aload_3.jm.T_aload_3_2");
     48             fail("expected a verification exception");
     49         } catch (Throwable t) {
     50             DxUtil.checkVerifyException(t);
     51         }
     52     }
     53 
     54 
     55     /**
     56      * @constraint 4.8.2.1
     57      * @title types of argument - float
     58      */
     59     public void testVFE2() {
     60         try {
     61             Class.forName("dxc.junit.opcodes.aload_3.jm.T_aload_3_3");
     62             fail("expected a verification exception");
     63         } catch (Throwable t) {
     64             DxUtil.checkVerifyException(t);
     65         }
     66     }
     67 
     68     /**
     69      * @constraint 4.8.2.1
     70      * @title types of argument - long
     71      */
     72     public void testVFE3() {
     73         try {
     74             Class.forName("dxc.junit.opcodes.aload_3.jm.T_aload_3_4");
     75             fail("expected a verification exception");
     76         } catch (Throwable t) {
     77             DxUtil.checkVerifyException(t);
     78         }
     79     }
     80 
     81     /**
     82      * @constraint 4.8.2.1
     83      * @title types of argument - int
     84      */
     85     public void testVFE4() {
     86         try {
     87             Class.forName("dxc.junit.opcodes.aload_3.jm.T_aload_3_5");
     88             fail("expected a verification exception");
     89         } catch (Throwable t) {
     90             DxUtil.checkVerifyException(t);
     91         }
     92     }
     93 
     94     /**
     95      * @constraint 4.8.2.5
     96      * @title stack size
     97      */
     98     public void testVFE5() {
     99         try {
    100             Class.forName("dxc.junit.opcodes.aload_3.jm.T_aload_3_7");
    101             fail("expected a verification exception");
    102         } catch (Throwable t) {
    103             DxUtil.checkVerifyException(t);
    104         }
    105     }
    106 
    107     /**
    108      * @constraint 4.8.2.21
    109      * @title returnAddress may not be loaded from
    110      * local variable
    111      */
    112     public void testVFE6() {
    113         try {
    114             Class.forName("dxc.junit.opcodes.aload_3.jm.T_aload_3_8");
    115             fail("expected a verification exception");
    116         } catch (Throwable t) {
    117             DxUtil.checkVerifyException(t);
    118         }
    119     }
    120 }
    121