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.neg_double; 18 19 import dot.junit.DxTestCase; 20 import dot.junit.DxUtil; 21 import dot.junit.opcodes.neg_double.d.T_neg_double_1; 22 import dot.junit.opcodes.neg_double.d.T_neg_double_4; 23 24 public class Test_neg_double extends DxTestCase { 25 26 /** 27 * @title Argument = 1 28 */ testN1()29 public void testN1() { 30 T_neg_double_1 t = new T_neg_double_1(); 31 assertEquals(-1d, t.run(1d)); 32 } 33 34 /** 35 * @title Argument = -1 36 */ testN2()37 public void testN2() { 38 T_neg_double_1 t = new T_neg_double_1(); 39 assertEquals(1d, t.run(-1d)); 40 } 41 42 /** 43 * @title Argument = +0 44 */ testN3()45 public void testN3() { 46 T_neg_double_1 t = new T_neg_double_1(); 47 assertEquals(-0d, t.run(+0d)); 48 } 49 50 /** 51 * @title Argument = -2.7 52 */ testN4()53 public void testN4() { 54 T_neg_double_1 t = new T_neg_double_1(); 55 assertEquals(2.7d, t.run(-2.7d)); 56 } 57 58 59 /** 60 * @title Argument = Double.NaN 61 */ testB1()62 public void testB1() { 63 T_neg_double_1 t = new T_neg_double_1(); 64 assertEquals(Double.NaN, t.run(Double.NaN)); 65 } 66 67 /** 68 * @title Argument = Double.NEGATIVE_INFINITY 69 */ testB2()70 public void testB2() { 71 T_neg_double_1 t = new T_neg_double_1(); 72 assertEquals(Double.POSITIVE_INFINITY, t.run(Double.NEGATIVE_INFINITY)); 73 } 74 75 /** 76 * @title Argument = Double.POSITIVE_INFINITY 77 */ testB3()78 public void testB3() { 79 T_neg_double_1 t = new T_neg_double_1(); 80 assertEquals(Double.NEGATIVE_INFINITY, t.run(Double.POSITIVE_INFINITY)); 81 } 82 83 /** 84 * @title Argument = Double.MAX_VALUE 85 */ testB4()86 public void testB4() { 87 T_neg_double_1 t = new T_neg_double_1(); 88 assertEquals(-1.7976931348623157E308d, t.run(Double.MAX_VALUE)); 89 } 90 91 /** 92 * @title Argument = Double.MIN_VALUE 93 */ testB5()94 public void testB5() { 95 T_neg_double_1 t = new T_neg_double_1(); 96 assertEquals(-4.9E-324d, t.run(Double.MIN_VALUE)); 97 } 98 99 /** 100 * @constraint A24 101 * @title number of registers 102 */ testVFE1()103 public void testVFE1() { 104 load("dot.junit.opcodes.neg_double.d.T_neg_double_2", VerifyError.class); 105 } 106 107 108 109 /** 110 * 111 * @constraint B1 112 * @title type of argument - float 113 */ testVFE2()114 public void testVFE2() { 115 load("dot.junit.opcodes.neg_double.d.T_neg_double_3", VerifyError.class); 116 } 117 118 /** 119 * 120 * @constraint B1 121 * @title type of argument - int 122 */ testVFE3()123 public void testVFE3() { 124 load("dot.junit.opcodes.neg_double.d.T_neg_double_5", VerifyError.class); 125 } 126 127 /** 128 * 129 * @constraint B1 130 * @title type of argument - reference 131 */ testVFE4()132 public void testVFE4() { 133 load("dot.junit.opcodes.neg_double.d.T_neg_double_6", VerifyError.class); 134 } 135 136 /** 137 * @constraint B1 138 * @title Types of arguments - long, double. The verifier checks that longs 139 * and doubles are not used interchangeably. 140 */ testVFE5()141 public void testVFE5() { 142 load("dot.junit.opcodes.neg_double.d.T_neg_double_4", VerifyError.class); 143 } 144 145 } 146