Home | History | Annotate | Download | only in move_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 dot.junit.opcodes.move_wide;
     18 
     19 import dot.junit.DxTestCase;
     20 import dot.junit.DxUtil;
     21 import dot.junit.opcodes.move_wide.d.T_move_wide_1;
     22 import dot.junit.opcodes.move_wide.d.T_move_wide_6;
     23 
     24 public class Test_move_wide extends DxTestCase {
     25     /**
     26      * @title tests move-wide functionality
     27      */
     28     public void testN1() {
     29         assertTrue(T_move_wide_1.run());
     30     }
     31 
     32 
     33     /**
     34      * @title v0 -> v1
     35      */
     36     public void testN2() {
     37         assertEquals(T_move_wide_6.run(), 0);
     38     }
     39 
     40     /**
     41      * @constraint A24
     42      * @title number of registers - src is not valid
     43      */
     44     public void testVFE1() {
     45         try {
     46             Class.forName("dot.junit.opcodes.move_wide.d.T_move_wide_2");
     47             fail("expected a verification exception");
     48         } catch (Throwable t) {
     49             DxUtil.checkVerifyException(t);
     50         }
     51     }
     52 
     53     /**
     54      * @constraint A24
     55      * @title number of registers - dst is not valid
     56      */
     57     public void testVFE2() {
     58         try {
     59             Class.forName("dot.junit.opcodes.move_wide.d.T_move_wide_3");
     60             fail("expected a verification exception");
     61         } catch (Throwable t) {
     62             DxUtil.checkVerifyException(t);
     63         }
     64     }
     65 
     66     /**
     67      * @constraint B1
     68      * @title src register contains reference
     69      */
     70     public void testVFE3() {
     71         try {
     72             Class.forName("dot.junit.opcodes.move_wide.d.T_move_wide_4");
     73             fail("expected a verification exception");
     74         } catch (Throwable t) {
     75             DxUtil.checkVerifyException(t);
     76         }
     77     }
     78 
     79     /**
     80      * @constraint B1
     81      * @title  src register contains 32-bit value
     82      */
     83     public void testVFE4() {
     84         try {
     85             Class.forName("dot.junit.opcodes.move_wide.d.T_move_wide_5");
     86             fail("expected a verification exception");
     87         } catch (Throwable t) {
     88             DxUtil.checkVerifyException(t);
     89         }
     90     }
     91 
     92     /**
     93      * @constraint B18
     94      * @title When writing to a register that is one half of a
     95      * register pair, but not touching the other half, the old register pair gets broken
     96      * up, and the other register involved in it becomes undefined.
     97      */
     98     public void testVFE6() {
     99         try {
    100             Class.forName("dot.junit.opcodes.move_wide.d.T_move_wide_7");
    101             fail("expected a verification exception");
    102         } catch (Throwable t) {
    103             DxUtil.checkVerifyException(t);
    104         }
    105     }
    106 
    107 }
    108