Home | History | Annotate | Download | only in wide
      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.wide;
     18 
     19 import dxc.junit.DxTestCase;
     20 import dxc.junit.DxUtil;
     21 
     22 
     23 public class Test_wide extends DxTestCase {
     24 
     25     /**
     26      * Wide instruction is tested as part of wide version of particular
     27      * instructions so here we just test if wide instruction can't be applied to
     28      * wrong bytecode.
     29      */
     30 
     31     /**
     32      * @constraint 4.8.1.5 (?)
     33      * @title Wide instruction shall be applied only on defined
     34      * instructions
     35      */
     36     public void testVFE1() {
     37         try {
     38             Class.forName("dxc.junit.opcodes.wide.jm.T_wide_1");
     39             fail("expected a verification exception");
     40         } catch (Throwable t) {
     41             DxUtil.checkVerifyException(t);
     42         }
     43     }
     44 
     45     /**
     46      * @constraint 4.8.1.5
     47      * @title bytecode modified with wide instruction must not be
     48      *          reachable directly
     49      */
     50     public void testVFE2() {
     51         try {
     52             Class.forName("dxc.junit.opcodes.wide.jm.T_wide_2");
     53             fail("expected a verification exception");
     54         } catch (Throwable t) {
     55             DxUtil.checkVerifyException(t);
     56         }
     57     }
     58 
     59 }
     60