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.fmul; 18 19 import dxc.junit.DxTestCase; 20 import dxc.junit.DxUtil; 21 import dxc.junit.opcodes.fmul.jm.T_fmul_1; 22 23 public class Test_fmul extends DxTestCase { 24 25 /** 26 * @title Arguments = 2.7f, 3.14f 27 */ 28 public void testN1() { 29 T_fmul_1 t = new T_fmul_1(); 30 assertEquals(8.478001f, t.run(2.7f, 3.14f)); 31 } 32 33 /** 34 * @title Arguments = 0, -3.14f 35 */ 36 public void testN2() { 37 T_fmul_1 t = new T_fmul_1(); 38 assertEquals(-0f, t.run(0, -3.14f)); 39 } 40 41 /** 42 * @title Arguments = -2.7f, -3.14f 43 */ 44 public void testN3() { 45 T_fmul_1 t = new T_fmul_1(); 46 assertEquals(8.478001f, t.run(-3.14f, -2.7f)); 47 } 48 49 /** 50 * @title Arguments = Float.MAX_VALUE, Float.NaN 51 */ 52 public void testB1() { 53 T_fmul_1 t = new T_fmul_1(); 54 assertEquals(Float.NaN, t.run(Float.MAX_VALUE, Float.NaN)); 55 } 56 57 /** 58 * @title Arguments = Float.POSITIVE_INFINITY, 0 59 */ 60 public void testB2() { 61 T_fmul_1 t = new T_fmul_1(); 62 assertEquals(Float.NaN, t.run(Float.POSITIVE_INFINITY, 0)); 63 } 64 65 /** 66 * @title Arguments = Float.POSITIVE_INFINITY, -2.7f 67 */ 68 public void testB3() { 69 T_fmul_1 t = new T_fmul_1(); 70 assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, 71 -2.7f)); 72 } 73 74 /** 75 * @title Arguments = Float.POSITIVE_INFINITY, 76 * Float.NEGATIVE_INFINITY 77 */ 78 public void testB4() { 79 T_fmul_1 t = new T_fmul_1(); 80 assertEquals(Float.NEGATIVE_INFINITY, t.run(Float.POSITIVE_INFINITY, 81 Float.NEGATIVE_INFINITY)); 82 } 83 84 /** 85 * @title Arguments = +0, -0f 86 */ 87 public void testB5() { 88 T_fmul_1 t = new T_fmul_1(); 89 assertEquals(-0f, t.run(+0f, -0f)); 90 } 91 92 /** 93 * @title Arguments = -0f, -0f 94 */ 95 public void testB6() { 96 T_fmul_1 t = new T_fmul_1(); 97 assertEquals(+0f, t.run(-0f, -0f)); 98 } 99 100 /** 101 * @title Arguments = Float.MAX_VALUE, Float.MAX_VALUE 102 */ 103 public void testB7() { 104 T_fmul_1 t = new T_fmul_1(); 105 assertEquals(Float.POSITIVE_INFINITY, t.run(Float.MAX_VALUE, 106 Float.MAX_VALUE)); 107 } 108 109 /** 110 * @title Arguments = Float.MIN_VALUE, -1.4E-45f 111 */ 112 public void testB8() { 113 T_fmul_1 t = new T_fmul_1(); 114 assertEquals(-0f, t.run(Float.MIN_VALUE, -1.4E-45f)); 115 } 116 117 /** 118 * @constraint 4.8.2.1 119 * @title number of arguments 120 */ 121 public void testVFE1() { 122 try { 123 Class.forName("dxc.junit.opcodes.fmul.jm.T_fmul_2"); 124 fail("expected a verification exception"); 125 } catch (Throwable t) { 126 DxUtil.checkVerifyException(t); 127 } 128 } 129 130 /** 131 * @constraint 4.8.2.1 132 * @title types of arguments - float, double 133 */ 134 public void testVFE2() { 135 try { 136 Class.forName("dxc.junit.opcodes.fmul.jm.T_fmul_3"); 137 fail("expected a verification exception"); 138 } catch (Throwable t) { 139 DxUtil.checkVerifyException(t); 140 } 141 } 142 143 /** 144 * @constraint 4.8.2.1 145 * @title types of arguments - long, float 146 */ 147 public void testVFE3() { 148 try { 149 Class.forName("dxc.junit.opcodes.fmul.jm.T_fmul_4"); 150 fail("expected a verification exception"); 151 } catch (Throwable t) { 152 DxUtil.checkVerifyException(t); 153 } 154 } 155 156 /** 157 * @constraint 4.8.2.1 158 * @title types of arguments - reference, float 159 */ 160 public void testVFE4() { 161 try { 162 Class.forName("dxc.junit.opcodes.fmul.jm.T_fmul_5"); 163 fail("expected a verification exception"); 164 } catch (Throwable t) { 165 DxUtil.checkVerifyException(t); 166 } 167 } 168 169 } 170