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