js/src/tests/ecma/Math/15.8.2.7.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma/Math/15.8.2.7.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,249 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/**
    1.11 +   File Name:          15.8.2.7.js
    1.12 +   ECMA Section:       15.8.2.7 cos( x )
    1.13 +   Description:        return an approximation to the cosine of the
    1.14 +   argument.  argument is expressed in radians
    1.15 +   Author:             christine@netscape.com
    1.16 +   Date:               7 july 1997
    1.17 +
    1.18 +*/
    1.19 +
    1.20 +var SECTION = "15.8.2.7";
    1.21 +var VERSION = "ECMA_1";
    1.22 +startTest();
    1.23 +var TITLE   = "Math.cos(x)";
    1.24 +
    1.25 +writeHeaderToLog( SECTION + " "+ TITLE);
    1.26 +
    1.27 +new TestCase( SECTION,
    1.28 +	      "Math.cos.length",
    1.29 +	      1,
    1.30 +	      Math.cos.length );
    1.31 +
    1.32 +new TestCase( SECTION,
    1.33 +	      "Math.cos()",
    1.34 +	      Number.NaN,
    1.35 +	      Math.cos() );
    1.36 +
    1.37 +new TestCase( SECTION,
    1.38 +	      "Math.cos(void 0)",
    1.39 +	      Number.NaN,
    1.40 +	      Math.cos(void 0) );
    1.41 +
    1.42 +new TestCase( SECTION,
    1.43 +	      "Math.cos(false)",
    1.44 +	      1,
    1.45 +	      Math.cos(false) );
    1.46 +
    1.47 +new TestCase( SECTION,
    1.48 +	      "Math.cos(null)",
    1.49 +	      1,
    1.50 +	      Math.cos(null) );
    1.51 +
    1.52 +new TestCase( SECTION,
    1.53 +	      "Math.cos('0')",
    1.54 +	      1,
    1.55 +	      Math.cos('0') );
    1.56 +
    1.57 +new TestCase( SECTION,
    1.58 +	      "Math.cos('Infinity')",
    1.59 +	      Number.NaN,
    1.60 +	      Math.cos("Infinity") );
    1.61 +
    1.62 +new TestCase( SECTION,
    1.63 +	      "Math.cos('3.14159265359')",
    1.64 +	      -1,
    1.65 +	      Math.cos('3.14159265359') );
    1.66 +
    1.67 +new TestCase( SECTION,
    1.68 +	      "Math.cos(NaN)",
    1.69 +	      Number.NaN,
    1.70 +	      Math.cos(Number.NaN)        );
    1.71 +
    1.72 +new TestCase( SECTION,
    1.73 +	      "Math.cos(0)",
    1.74 +	      1,
    1.75 +	      Math.cos(0)                 );
    1.76 +
    1.77 +new TestCase( SECTION,
    1.78 +	      "Math.cos(-0)",
    1.79 +	      1,
    1.80 +	      Math.cos(-0)                );
    1.81 +
    1.82 +new TestCase( SECTION,
    1.83 +	      "Math.cos(Infinity)",
    1.84 +	      Number.NaN,
    1.85 +	      Math.cos(Number.POSITIVE_INFINITY) );
    1.86 +
    1.87 +new TestCase( SECTION,
    1.88 +	      "Math.cos(-Infinity)",
    1.89 +	      Number.NaN,
    1.90 +	      Math.cos(Number.NEGATIVE_INFINITY) );
    1.91 +
    1.92 +new TestCase( SECTION,
    1.93 +	      "Math.cos(0.7853981633974)",
    1.94 +	      0.7071067811865,
    1.95 +	      Math.cos(0.7853981633974)   );
    1.96 +
    1.97 +new TestCase( SECTION,
    1.98 +	      "Math.cos(1.570796326795)",
    1.99 +	      0,
   1.100 +	      Math.cos(1.570796326795)    );
   1.101 +
   1.102 +new TestCase( SECTION,
   1.103 +	      "Math.cos(2.356194490192)",
   1.104 +	      -0.7071067811865,
   1.105 +	      Math.cos(2.356194490192)    );
   1.106 +
   1.107 +new TestCase( SECTION,
   1.108 +	      "Math.cos(3.14159265359)",
   1.109 +	      -1,
   1.110 +	      Math.cos(3.14159265359)     );
   1.111 +
   1.112 +new TestCase( SECTION,
   1.113 +	      "Math.cos(3.926990816987)",
   1.114 +	      -0.7071067811865,
   1.115 +	      Math.cos(3.926990816987)    );
   1.116 +
   1.117 +new TestCase( SECTION,
   1.118 +	      "Math.cos(4.712388980385)",
   1.119 +	      0,
   1.120 +	      Math.cos(4.712388980385)    );
   1.121 +
   1.122 +new TestCase( SECTION,
   1.123 +	      "Math.cos(5.497787143782)",
   1.124 +	      0.7071067811865,
   1.125 +	      Math.cos(5.497787143782)    );
   1.126 +
   1.127 +new TestCase( SECTION,
   1.128 +	      "Math.cos(Math.PI*2)",
   1.129 +	      1,
   1.130 +	      Math.cos(Math.PI*2)         );
   1.131 +
   1.132 +new TestCase( SECTION,
   1.133 +	      "Math.cos(Math.PI/4)",
   1.134 +	      Math.SQRT2/2,
   1.135 +	      Math.cos(Math.PI/4)         );
   1.136 +
   1.137 +new TestCase( SECTION,
   1.138 +	      "Math.cos(Math.PI/2)",
   1.139 +	      0,
   1.140 +	      Math.cos(Math.PI/2)         );
   1.141 +
   1.142 +new TestCase( SECTION,
   1.143 +	      "Math.cos(3*Math.PI/4)",
   1.144 +	      -Math.SQRT2/2,
   1.145 +	      Math.cos(3*Math.PI/4)       );
   1.146 +
   1.147 +new TestCase( SECTION,
   1.148 +	      "Math.cos(Math.PI)",
   1.149 +	      -1,
   1.150 +	      Math.cos(Math.PI)           );
   1.151 +
   1.152 +new TestCase( SECTION,
   1.153 +	      "Math.cos(5*Math.PI/4)",
   1.154 +	      -Math.SQRT2/2,
   1.155 +	      Math.cos(5*Math.PI/4)       );
   1.156 +
   1.157 +new TestCase( SECTION,
   1.158 +	      "Math.cos(3*Math.PI/2)",
   1.159 +	      0,
   1.160 +	      Math.cos(3*Math.PI/2)       );
   1.161 +
   1.162 +new TestCase( SECTION,
   1.163 +	      "Math.cos(7*Math.PI/4)",
   1.164 +	      Math.SQRT2/2,
   1.165 +	      Math.cos(7*Math.PI/4)       );
   1.166 +
   1.167 +new TestCase( SECTION,
   1.168 +	      "Math.cos(Math.PI*2)",
   1.169 +	      1,
   1.170 +	      Math.cos(2*Math.PI)         );
   1.171 +
   1.172 +new TestCase( SECTION,
   1.173 +	      "Math.cos(-0.7853981633974)",
   1.174 +	      0.7071067811865,
   1.175 +	      Math.cos(-0.7853981633974)  );
   1.176 +
   1.177 +new TestCase( SECTION,
   1.178 +	      "Math.cos(-1.570796326795)",
   1.179 +	      0,
   1.180 +	      Math.cos(-1.570796326795)   );
   1.181 +
   1.182 +new TestCase( SECTION,
   1.183 +	      "Math.cos(-2.3561944901920)",
   1.184 +	      -.7071067811865,
   1.185 +	      Math.cos(2.3561944901920)   );
   1.186 +
   1.187 +new TestCase( SECTION,
   1.188 +	      "Math.cos(-3.14159265359)",
   1.189 +	      -1,
   1.190 +	      Math.cos(3.14159265359)     );
   1.191 +
   1.192 +new TestCase( SECTION,
   1.193 +	      "Math.cos(-3.926990816987)",
   1.194 +	      -0.7071067811865,
   1.195 +	      Math.cos(3.926990816987)    );
   1.196 +
   1.197 +new TestCase( SECTION,
   1.198 +	      "Math.cos(-4.712388980385)",
   1.199 +	      0,
   1.200 +	      Math.cos(4.712388980385)    );
   1.201 +
   1.202 +new TestCase( SECTION,
   1.203 +	      "Math.cos(-5.497787143782)",
   1.204 +	      0.7071067811865,
   1.205 +	      Math.cos(5.497787143782)    );
   1.206 +
   1.207 +new TestCase( SECTION,
   1.208 +	      "Math.cos(-6.28318530718)",
   1.209 +	      1,
   1.210 +	      Math.cos(6.28318530718)     );
   1.211 +
   1.212 +new TestCase( SECTION,
   1.213 +	      "Math.cos(-Math.PI/4)",
   1.214 +	      Math.SQRT2/2,
   1.215 +	      Math.cos(-Math.PI/4)        );
   1.216 +
   1.217 +new TestCase( SECTION,
   1.218 +	      "Math.cos(-Math.PI/2)",
   1.219 +	      0,
   1.220 +	      Math.cos(-Math.PI/2)        );
   1.221 +
   1.222 +new TestCase( SECTION,
   1.223 +	      "Math.cos(-3*Math.PI/4)",
   1.224 +	      -Math.SQRT2/2,
   1.225 +	      Math.cos(-3*Math.PI/4)      );
   1.226 +
   1.227 +new TestCase( SECTION,
   1.228 +	      "Math.cos(-Math.PI)",
   1.229 +	      -1,
   1.230 +	      Math.cos(-Math.PI)          );
   1.231 +
   1.232 +new TestCase( SECTION,
   1.233 +	      "Math.cos(-5*Math.PI/4)",
   1.234 +	      -Math.SQRT2/2,
   1.235 +	      Math.cos(-5*Math.PI/4)      );
   1.236 +
   1.237 +new TestCase( SECTION,
   1.238 +	      "Math.cos(-3*Math.PI/2)",
   1.239 +	      0,
   1.240 +	      Math.cos(-3*Math.PI/2)      );
   1.241 +
   1.242 +new TestCase( SECTION,
   1.243 +	      "Math.cos(-7*Math.PI/4)",
   1.244 +	      Math.SQRT2/2,
   1.245 +	      Math.cos(-7*Math.PI/4)      );
   1.246 +
   1.247 +new TestCase( SECTION,
   1.248 +	      "Math.cos(-Math.PI*2)",
   1.249 +	      1,
   1.250 +	      Math.cos(-Math.PI*2)        );
   1.251 +
   1.252 +test();

mercurial