8008298: Add tests to cover specialized versions of Math functions.

Fri, 15 Feb 2013 20:40:05 +0530

author
sundar
date
Fri, 15 Feb 2013 20:40:05 +0530
changeset 98
5851c5dac260
parent 97
757a49aaad02
child 99
d5f74bd2dc20

8008298: Add tests to cover specialized versions of Math functions.
Reviewed-by: jlaskey, lagergren

test/script/basic/JDK-8008298.js file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/script/basic/JDK-8008298.js	Fri Feb 15 20:40:05 2013 +0530
     1.3 @@ -0,0 +1,111 @@
     1.4 +/*
     1.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + */
    1.26 +
    1.27 +
    1.28 +/**
    1.29 + * JDK-8008298: Add tests to cover specialized versions of Math functions.
    1.30 + * Excerise all specialized Math functions with various literal values.
    1.31 + *
    1.32 + * @test
    1.33 + * @run
    1.34 + */
    1.35 +
    1.36 +if (Math.abs(-88) != 88) {
    1.37 +    fail("Math.abs for int value");
    1.38 +}
    1.39 +
    1.40 +if (Math.abs(-2147483648) != 2147483648) {
    1.41 +    fail("Math.abs failed for long value");
    1.42 +}
    1.43 +
    1.44 +if (Math.acos(1.0) != 0) {
    1.45 +    fail("Math.acos failed on double value");
    1.46 +}
    1.47 +
    1.48 +if (Math.asin(0.0) != 0) {
    1.49 +    fail("Math.asin failed on double value");
    1.50 +}
    1.51 +
    1.52 +if (Math.atan(0.0) != 0) {
    1.53 +    fail("Math.atan failed on double value");
    1.54 +}
    1.55 +
    1.56 +if (Math.ceil(1) != 1) {
    1.57 +    fail("Math.ceil failed on int value");
    1.58 +}
    1.59 +
    1.60 +if (Math.ceil(2147483648) != 2147483648) {
    1.61 +    fail("Math.ceil failed on long value");
    1.62 +}
    1.63 +
    1.64 +if (Math.ceil(-0.3) != 0) {
    1.65 +    fail("Math.ceil failed on double value");
    1.66 +}
    1.67 +
    1.68 +if (Math.floor(1) != 1) {
    1.69 +    fail("Math.floor failed on int value");
    1.70 +}
    1.71 +
    1.72 +if (Math.floor(2147483648) != 2147483648) {
    1.73 +    fail("Math.floor failed on long value");
    1.74 +}
    1.75 +
    1.76 +if (Math.floor(0.3) != 0) {
    1.77 +    fail("Math.floor failed on double value");
    1.78 +}
    1.79 +
    1.80 +if (Math.log(1.0) != 0) {
    1.81 +    fail("Math.log failed on double value");
    1.82 +}
    1.83 +
    1.84 +if (Math.max(2, 28) != 28) {
    1.85 +    fail("Math.max failed for int values");
    1.86 +}
    1.87 +
    1.88 +if (Math.max(2147483649, 2147483648) != 2147483649) {
    1.89 +    fail("Math.max failed for long values");
    1.90 +}
    1.91 +
    1.92 +if (Math.max(0.0, -2.5) != 0.0) {
    1.93 +    fail("Math.max failed for double values");
    1.94 +}
    1.95 +
    1.96 +if (Math.min(2, 28) != 2) {
    1.97 +    fail("Math.min failed for int values");
    1.98 +}
    1.99 +
   1.100 +if (Math.min(2147483649, 2147483648) != 2147483648) {
   1.101 +    fail("Math.min failed for long values");
   1.102 +}
   1.103 +
   1.104 +if (Math.min(0.0, 2.5) != 0.0) {
   1.105 +    fail("Math.min failed for double values");
   1.106 +}
   1.107 +
   1.108 +if (Math.sqrt(4) != 2) {
   1.109 +    fail("Math.sqrt failed for int value");
   1.110 +}
   1.111 +
   1.112 +if (Math.tan(0.0) != 0.0) {
   1.113 +    fail("Math.tan failed for double value");
   1.114 +}

mercurial