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 dxc.junit.opcodes.i2d; 18 19 import dxc.junit.DxTestCase; 20 import dxc.junit.DxUtil; 21 import dxc.junit.opcodes.i2d.jm.T_i2d_1; 22 23 public class Test_i2d extends DxTestCase { 24 25 /** 26 * @title Argument = 300000000 27 */ testN1()28 public void testN1() { 29 T_i2d_1 t = new T_i2d_1(); 30 assertEquals(300000000d, t.run(300000000), 0d); 31 } 32 33 /** 34 * @title Argument = 1 35 */ testN2()36 public void testN2() { 37 T_i2d_1 t = new T_i2d_1(); 38 assertEquals(1d, t.run(1), 0d); 39 } 40 41 /** 42 * @title Argument = -1 43 */ testN3()44 public void testN3() { 45 T_i2d_1 t = new T_i2d_1(); 46 assertEquals(-1d, t.run(-1), 0d); 47 } 48 49 50 /** 51 * @title Argument = Integer.MAX_VALUE 52 */ testB1()53 public void testB1() { 54 T_i2d_1 t = new T_i2d_1(); 55 assertEquals(2147483647d, t.run(Integer.MAX_VALUE), 0d); 56 } 57 58 /** 59 * @title Argument = Integer.MIN_VALUE 60 */ testB2()61 public void testB2() { 62 T_i2d_1 t = new T_i2d_1(); 63 assertEquals(-2147483648d, t.run(Integer.MIN_VALUE), 0d); 64 } 65 66 /** 67 * @title Argument = 0 68 */ testB3()69 public void testB3() { 70 T_i2d_1 t = new T_i2d_1(); 71 assertEquals(0d, t.run(0), 0d); 72 } 73 74 /** 75 * @constraint 4.8.2.1 76 * @title number of arguments 77 */ testVFE1()78 public void testVFE1() { 79 try { 80 Class.forName("dxc.junit.opcodes.i2d.jm.T_i2d_2"); 81 fail("expected a verification exception"); 82 } catch (Throwable t) { 83 DxUtil.checkVerifyException(t); 84 } 85 } 86 87 /** 88 * @constraint 4.8.2.1 89 * @title type of argument - float 90 */ testVFE2()91 public void testVFE2() { 92 try { 93 Class.forName("dxc.junit.opcodes.i2d.jm.T_i2d_3"); 94 fail("expected a verification exception"); 95 } catch (Throwable t) { 96 DxUtil.checkVerifyException(t); 97 } 98 } 99 100 /** 101 * @constraint 4.8.2.1 102 * @title type of argument - long 103 */ testVFE3()104 public void testVFE3() { 105 try { 106 Class.forName("dxc.junit.opcodes.i2d.jm.T_i2d_4"); 107 fail("expected a verification exception"); 108 } catch (Throwable t) { 109 DxUtil.checkVerifyException(t); 110 } 111 } 112 113 /** 114 * @constraint 4.8.2.5 115 * @title stack size 116 */ testVFE4()117 public void testVFE4() { 118 try { 119 Class.forName("dxc.junit.opcodes.i2d.jm.T_i2d_5"); 120 fail("expected a verification exception"); 121 } catch (Throwable t) { 122 DxUtil.checkVerifyException(t); 123 } 124 } 125 126 /** 127 * @constraint 4.8.2.1 128 * @title type of argument - reference 129 */ testVFE5()130 public void testVFE5() { 131 try { 132 Class.forName("dxc.junit.opcodes.i2d.jm.T_i2d_6"); 133 fail("expected a verification exception"); 134 } catch (Throwable t) { 135 DxUtil.checkVerifyException(t); 136 } 137 } 138 139 } 140