Home | History | Annotate | Download | only in fstore
      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.fstore;
     18 
     19 import dxc.junit.DxTestCase;
     20 import dxc.junit.DxUtil;
     21 import dxc.junit.opcodes.fstore.jm.T_fstore_1;
     22 import dxc.junit.opcodes.fstore.jm.T_fstore_1_w;
     23 import dxc.junit.opcodes.fstore.jm.T_fstore_5;
     24 import dxc.junit.opcodes.fstore.jm.T_fstore_5_w;
     25 
     26 public class Test_fstore extends DxTestCase {
     27 
     28     /*
     29      * NORMAL fstore VERSION
     30      */
     31 
     32     /**
     33      * @title  fstore 0
     34      */
     35     public void testN1() {
     36         assertEquals(2f, T_fstore_1.run());
     37     }
     38 
     39     /**
     40      * @title  fstore 255
     41      */
     42     public void testN2() {
     43         assertEquals(2f, T_fstore_5.run());
     44     }
     45 
     46     /**
     47      * @constraint 4.8.1.22
     48      * @title index must be no greater than the value
     49      * of max_locals-1)
     50      */
     51     public void testVFE1() {
     52         try {
     53             Class.forName("dxc.junit.opcodes.fstore.jm.T_fstore_2");
     54             fail("expected a verification exception");
     55         } catch (Throwable t) {
     56             DxUtil.checkVerifyException(t);
     57         }
     58     }
     59 
     60     /**
     61      * @constraint 4.8.2.1
     62      * @title types of argument - double
     63      */
     64     public void testVFE2() {
     65         try {
     66             Class.forName("dxc.junit.opcodes.fstore.jm.T_fstore_3");
     67             fail("expected a verification exception");
     68         } catch (Throwable t) {
     69             DxUtil.checkVerifyException(t);
     70         }
     71     }
     72 
     73     /**
     74      * @constraint 4.8.2.1
     75      * @title types of argument - long
     76      */
     77     public void testVFE3() {
     78         try {
     79             Class.forName("dxc.junit.opcodes.fstore.jm.T_fstore_4");
     80             fail("expected a verification exception");
     81         } catch (Throwable t) {
     82             DxUtil.checkVerifyException(t);
     83         }
     84     }
     85 
     86     /*
     87      * WIDE fstore VERSION
     88      */
     89 
     90     /**
     91      * @title  fstore_w 0
     92      */
     93     public void testN3() {
     94         assertEquals(2f, T_fstore_1_w.run());
     95     }
     96 
     97     /**
     98      * @title  fstore 257
     99      */
    100     public void testN4() {
    101         assertEquals(2f, T_fstore_5_w.run());
    102     }
    103 
    104     /**
    105      * @constraint 4.8.1.25
    106      * @title index must be no greater than the value
    107      * of max_locals-1
    108      */
    109     public void testVFE4() {
    110         try {
    111             Class.forName("dxc.junit.opcodes.fstore.jm.T_fstore_2_w");
    112             fail("expected a verification exception");
    113         } catch (Throwable t) {
    114             DxUtil.checkVerifyException(t);
    115         }
    116     }
    117 
    118     /**
    119      * @constraint 4.8.2.1
    120      * @title types of argument - double
    121      */
    122     public void testVFE5() {
    123         try {
    124             Class.forName("dxc.junit.opcodes.fstore.jm.T_fstore_3_w");
    125             fail("expected a verification exception");
    126         } catch (Throwable t) {
    127             DxUtil.checkVerifyException(t);
    128         }
    129     }
    130 
    131     /**
    132      * @constraint 4.8.2.1
    133      * @title types of argument - long
    134      */
    135     public void testVFE6() {
    136         try {
    137             Class.forName("dxc.junit.opcodes.fstore.jm.T_fstore_4_w");
    138             fail("expected a verification exception");
    139         } catch (Throwable t) {
    140             DxUtil.checkVerifyException(t);
    141         }
    142     }
    143 }
    144