Home | History | Annotate | Download | only in move_wide_16
      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 dot.junit.opcodes.move_wide_16;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.move_wide_16.d.T_move_wide_16_1;
     22 import dot.junit.opcodes.move_wide_16.d.T_move_wide_16_9;
     23 
     24 public class Test_move_wide_16 extends DxTestCase {
     25     /**
     26      * @title v4001 -> v4000
     27      */
     28     public void testN1() {
     29         assertTrue(T_move_wide_16_1.run());
     30     }
     31 
     32     /**
     33      * @title v1 -> v4001
     34      */
     35     public void testN2() {
     36         assertTrue(T_move_wide_16_1.run());
     37     }
     38 
     39     /**
     40      * @title v1 -> v2
     41      */
     42     public void testN3() {
     43         assertEquals(T_move_wide_16_9.run(), 0);
     44     }
     45 
     46     /**
     47      * @constraint A24
     48      * @title number of registers - src is not valid
     49      */
     50     public void testVFE1() {
     51         try {
     52             Class.forName("dot.junit.opcodes.move_wide_16.d.T_move_wide_16_3");
     53             fail("expected a verification exception");
     54         } catch (Throwable t) {
     55             DxUtil.checkVerifyException(t);
     56         }
     57     }
     58 
     59     /**
     60      * @constraint A24
     61      * @title number of registers - dst is not valid
     62      */
     63     public void testVFE2() {
     64         try {
     65             Class.forName("dot.junit.opcodes.move_wide_16.d.T_move_wide_16_4");
     66             fail("expected a verification exception");
     67         } catch (Throwable t) {
     68             DxUtil.checkVerifyException(t);
     69         }
     70     }
     71 
     72     /**
     73      * @constraint B1
     74      * @title src register contains reference
     75      */
     76     public void testVFE3() {
     77         try {
     78             Class.forName("dot.junit.opcodes.move_wide_16.d.T_move_wide_16_5");
     79             fail("expected a verification exception");
     80         } catch (Throwable t) {
     81             DxUtil.checkVerifyException(t);
     82         }
     83     }
     84 
     85     /**
     86      * @constraint B1
     87      * @title src register contains 32-bit value
     88      */
     89     public void testVFE4() {
     90         try {
     91             Class.forName("dot.junit.opcodes.move_wide_16.d.T_move_wide_16_6");
     92             fail("expected a verification exception");
     93         } catch (Throwable t) {
     94             DxUtil.checkVerifyException(t);
     95         }
     96     }
     97 
     98     /**
     99      * @constraint B1
    100      * @title src register is a part of reg pair
    101      */
    102     public void testVFE5() {
    103         try {
    104             Class.forName("dot.junit.opcodes.move_wide_16.d.T_move_wide_16_7");
    105             fail("expected a verification exception");
    106         } catch (Throwable t) {
    107             DxUtil.checkVerifyException(t);
    108         }
    109     }
    110 
    111     /**
    112      * @constraint B18
    113      * @title When writing to a register that is one half of a
    114      * register pair, but not touching the other half, the old register pair gets broken
    115      * up, and the other register involved in it becomes undefined.
    116      */
    117     public void testVFE6() {
    118         try {
    119             Class.forName("dot.junit.opcodes.move_wide_16.d.T_move_wide_16_8");
    120             fail("expected a verification exception");
    121         } catch (Throwable t) {
    122             DxUtil.checkVerifyException(t);
    123         }
    124     }
    125 
    126 }
    127