Home | History | Annotate | Download | only in lload
      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.lload;
     18 
     19 import dxc.junit.DxTestCase;
     20 import dxc.junit.DxUtil;
     21 import dxc.junit.opcodes.lload.jm.T_lload_1;
     22 import dxc.junit.opcodes.lload.jm.T_lload_1_w;
     23 import dxc.junit.opcodes.lload.jm.T_lload_2;
     24 import dxc.junit.opcodes.lload.jm.T_lload_2_w;
     25 
     26 public class Test_lload extends DxTestCase {
     27 
     28     /*
     29      * NORMAL ILOAD VERSION
     30      */
     31 
     32     /**
     33      * @title Test lload 1
     34      */
     35     public void testN1() {
     36         T_lload_1 t = new T_lload_1();
     37         assertEquals(1234567890123l, t.run());
     38     }
     39 
     40     /**
     41      * @title  Test lload 255
     42      */
     43     public void testN2() {
     44         T_lload_2 t = new T_lload_2();
     45         assertEquals(9876543210123l, t.run());
     46     }
     47 
     48     /**
     49      * @constraint 4.8.1.21
     50      * @title index must be no greater than the value
     51      * of max_locals-1
     52      */
     53     public void testVFE1() {
     54         try {
     55             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_3");
     56             fail("expected a verification exception");
     57         } catch (Throwable t) {
     58             DxUtil.checkVerifyException(t);
     59         }
     60     }
     61 
     62     /**
     63      * @constraint 4.8.2.1
     64      * @title types of argument - double
     65      */
     66     public void testVFE2() {
     67         try {
     68             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_4");
     69             fail("expected a verification exception");
     70         } catch (Throwable t) {
     71             DxUtil.checkVerifyException(t);
     72         }
     73     }
     74 
     75     /**
     76      * @constraint 4.8.2.1
     77      * @title types of argument - int
     78      */
     79     public void testVFE3() {
     80         try {
     81             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_5");
     82             fail("expected a verification exception");
     83         } catch (Throwable t) {
     84             DxUtil.checkVerifyException(t);
     85         }
     86     }
     87 
     88     /**
     89      * @constraint 4.8.2.5
     90      * @title stack size
     91      */
     92     public void testVFE4() {
     93         try {
     94             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_6");
     95             fail("expected a verification exception");
     96         } catch (Throwable t) {
     97             DxUtil.checkVerifyException(t);
     98         }
     99     }
    100 
    101     /*
    102      * WIDE ILOAD VERSION
    103      */
    104 
    105     /**
    106      * @title  Test lload_w 1
    107      */
    108     public void testN3() {
    109         T_lload_1_w t = new T_lload_1_w();
    110         assertEquals(1234567890123l, t.run());
    111     }
    112 
    113     /**
    114      * @title  Test lload 257
    115      */
    116     public void testN4() {
    117         T_lload_2_w t = new T_lload_2_w();
    118         assertEquals(9876543210123l, t.run());
    119     }
    120 
    121     /**
    122      * @constraint 4.8.1.25
    123      * @title index must be no greater than the value
    124      * of max_locals-1
    125      */
    126     public void testVFE5() {
    127         try {
    128             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_3_w");
    129             fail("expected a verification exception");
    130         } catch (Throwable t) {
    131             DxUtil.checkVerifyException(t);
    132         }
    133     }
    134 
    135     /**
    136      * @constraint 4.8.2.1
    137      * @title types of argument - double
    138      */
    139     public void testVFE6() {
    140         try {
    141             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_4_w");
    142             fail("expected a verification exception");
    143         } catch (Throwable t) {
    144             DxUtil.checkVerifyException(t);
    145         }
    146     }
    147 
    148     /**
    149      * @constraint 4.8.2.1
    150      * @title types of argument - int
    151      */
    152     public void testVFE7() {
    153         try {
    154             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_5_w");
    155             fail("expected a verification exception");
    156         } catch (Throwable t) {
    157             DxUtil.checkVerifyException(t);
    158         }
    159     }
    160 
    161     /**
    162      * @constraint 4.8.2.5
    163      * @title stack size
    164      */
    165     public void testVFE8() {
    166         try {
    167             Class.forName("dxc.junit.opcodes.lload.jm.T_lload_6_w");
    168             fail("expected a verification exception");
    169         } catch (Throwable t) {
    170             DxUtil.checkVerifyException(t);
    171         }
    172     }
    173 
    174 }
    175