test/script/basic/JDK-8008298.js

Wed, 18 Jun 2014 12:35:42 -0700

author
katleman
date
Wed, 18 Jun 2014 12:35:42 -0700
changeset 863
6e9c4e34bc61
parent 0
b1a7da25b547
permissions
-rw-r--r--

Added tag jdk8u20-b19 for changeset b047df215de4

     1 /*
     2  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    25 /**
    26  * JDK-8008298: Add tests to cover specialized versions of Math functions.
    27  * Excerise all specialized Math functions with various literal values.
    28  *
    29  * @test
    30  * @run
    31  */
    33 if (Math.abs(-88) != 88) {
    34     fail("Math.abs for int value");
    35 }
    37 if (Math.abs(-2147483648) != 2147483648) {
    38     fail("Math.abs failed for long value");
    39 }
    41 if (Math.acos(1.0) != 0) {
    42     fail("Math.acos failed on double value");
    43 }
    45 if (Math.asin(0.0) != 0) {
    46     fail("Math.asin failed on double value");
    47 }
    49 if (Math.atan(0.0) != 0) {
    50     fail("Math.atan failed on double value");
    51 }
    53 if (Math.ceil(1) != 1) {
    54     fail("Math.ceil failed on int value");
    55 }
    57 if (Math.ceil(2147483648) != 2147483648) {
    58     fail("Math.ceil failed on long value");
    59 }
    61 if (Math.ceil(-0.3) != 0) {
    62     fail("Math.ceil failed on double value");
    63 }
    65 if (Math.floor(1) != 1) {
    66     fail("Math.floor failed on int value");
    67 }
    69 if (Math.floor(2147483648) != 2147483648) {
    70     fail("Math.floor failed on long value");
    71 }
    73 if (Math.floor(0.3) != 0) {
    74     fail("Math.floor failed on double value");
    75 }
    77 if (Math.log(1.0) != 0) {
    78     fail("Math.log failed on double value");
    79 }
    81 if (Math.max(2, 28) != 28) {
    82     fail("Math.max failed for int values");
    83 }
    85 if (Math.max(2147483649, 2147483648) != 2147483649) {
    86     fail("Math.max failed for long values");
    87 }
    89 if (Math.max(0.0, -2.5) != 0.0) {
    90     fail("Math.max failed for double values");
    91 }
    93 if (Math.min(2, 28) != 2) {
    94     fail("Math.min failed for int values");
    95 }
    97 if (Math.min(2147483649, 2147483648) != 2147483648) {
    98     fail("Math.min failed for long values");
    99 }
   101 if (Math.min(0.0, 2.5) != 0.0) {
   102     fail("Math.min failed for double values");
   103 }
   105 if (Math.sqrt(4) != 2) {
   106     fail("Math.sqrt failed for int value");
   107 }
   109 if (Math.tan(0.0) != 0.0) {
   110     fail("Math.tan failed for double value");
   111 }

mercurial