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