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