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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:          15.8.2.7.js
     9    ECMA Section:       15.8.2.7 cos( x )
    10    Description:        return an approximation to the cosine of the
    11    argument.  argument is expressed in radians
    12    Author:             christine@netscape.com
    13    Date:               7 july 1997
    15 */
    17 var SECTION = "15.8.2.7";
    18 var VERSION = "ECMA_1";
    19 startTest();
    20 var TITLE   = "Math.cos(x)";
    22 writeHeaderToLog( SECTION + " "+ TITLE);
    24 new TestCase( SECTION,
    25 	      "Math.cos.length",
    26 	      1,
    27 	      Math.cos.length );
    29 new TestCase( SECTION,
    30 	      "Math.cos()",
    31 	      Number.NaN,
    32 	      Math.cos() );
    34 new TestCase( SECTION,
    35 	      "Math.cos(void 0)",
    36 	      Number.NaN,
    37 	      Math.cos(void 0) );
    39 new TestCase( SECTION,
    40 	      "Math.cos(false)",
    41 	      1,
    42 	      Math.cos(false) );
    44 new TestCase( SECTION,
    45 	      "Math.cos(null)",
    46 	      1,
    47 	      Math.cos(null) );
    49 new TestCase( SECTION,
    50 	      "Math.cos('0')",
    51 	      1,
    52 	      Math.cos('0') );
    54 new TestCase( SECTION,
    55 	      "Math.cos('Infinity')",
    56 	      Number.NaN,
    57 	      Math.cos("Infinity") );
    59 new TestCase( SECTION,
    60 	      "Math.cos('3.14159265359')",
    61 	      -1,
    62 	      Math.cos('3.14159265359') );
    64 new TestCase( SECTION,
    65 	      "Math.cos(NaN)",
    66 	      Number.NaN,
    67 	      Math.cos(Number.NaN)        );
    69 new TestCase( SECTION,
    70 	      "Math.cos(0)",
    71 	      1,
    72 	      Math.cos(0)                 );
    74 new TestCase( SECTION,
    75 	      "Math.cos(-0)",
    76 	      1,
    77 	      Math.cos(-0)                );
    79 new TestCase( SECTION,
    80 	      "Math.cos(Infinity)",
    81 	      Number.NaN,
    82 	      Math.cos(Number.POSITIVE_INFINITY) );
    84 new TestCase( SECTION,
    85 	      "Math.cos(-Infinity)",
    86 	      Number.NaN,
    87 	      Math.cos(Number.NEGATIVE_INFINITY) );
    89 new TestCase( SECTION,
    90 	      "Math.cos(0.7853981633974)",
    91 	      0.7071067811865,
    92 	      Math.cos(0.7853981633974)   );
    94 new TestCase( SECTION,
    95 	      "Math.cos(1.570796326795)",
    96 	      0,
    97 	      Math.cos(1.570796326795)    );
    99 new TestCase( SECTION,
   100 	      "Math.cos(2.356194490192)",
   101 	      -0.7071067811865,
   102 	      Math.cos(2.356194490192)    );
   104 new TestCase( SECTION,
   105 	      "Math.cos(3.14159265359)",
   106 	      -1,
   107 	      Math.cos(3.14159265359)     );
   109 new TestCase( SECTION,
   110 	      "Math.cos(3.926990816987)",
   111 	      -0.7071067811865,
   112 	      Math.cos(3.926990816987)    );
   114 new TestCase( SECTION,
   115 	      "Math.cos(4.712388980385)",
   116 	      0,
   117 	      Math.cos(4.712388980385)    );
   119 new TestCase( SECTION,
   120 	      "Math.cos(5.497787143782)",
   121 	      0.7071067811865,
   122 	      Math.cos(5.497787143782)    );
   124 new TestCase( SECTION,
   125 	      "Math.cos(Math.PI*2)",
   126 	      1,
   127 	      Math.cos(Math.PI*2)         );
   129 new TestCase( SECTION,
   130 	      "Math.cos(Math.PI/4)",
   131 	      Math.SQRT2/2,
   132 	      Math.cos(Math.PI/4)         );
   134 new TestCase( SECTION,
   135 	      "Math.cos(Math.PI/2)",
   136 	      0,
   137 	      Math.cos(Math.PI/2)         );
   139 new TestCase( SECTION,
   140 	      "Math.cos(3*Math.PI/4)",
   141 	      -Math.SQRT2/2,
   142 	      Math.cos(3*Math.PI/4)       );
   144 new TestCase( SECTION,
   145 	      "Math.cos(Math.PI)",
   146 	      -1,
   147 	      Math.cos(Math.PI)           );
   149 new TestCase( SECTION,
   150 	      "Math.cos(5*Math.PI/4)",
   151 	      -Math.SQRT2/2,
   152 	      Math.cos(5*Math.PI/4)       );
   154 new TestCase( SECTION,
   155 	      "Math.cos(3*Math.PI/2)",
   156 	      0,
   157 	      Math.cos(3*Math.PI/2)       );
   159 new TestCase( SECTION,
   160 	      "Math.cos(7*Math.PI/4)",
   161 	      Math.SQRT2/2,
   162 	      Math.cos(7*Math.PI/4)       );
   164 new TestCase( SECTION,
   165 	      "Math.cos(Math.PI*2)",
   166 	      1,
   167 	      Math.cos(2*Math.PI)         );
   169 new TestCase( SECTION,
   170 	      "Math.cos(-0.7853981633974)",
   171 	      0.7071067811865,
   172 	      Math.cos(-0.7853981633974)  );
   174 new TestCase( SECTION,
   175 	      "Math.cos(-1.570796326795)",
   176 	      0,
   177 	      Math.cos(-1.570796326795)   );
   179 new TestCase( SECTION,
   180 	      "Math.cos(-2.3561944901920)",
   181 	      -.7071067811865,
   182 	      Math.cos(2.3561944901920)   );
   184 new TestCase( SECTION,
   185 	      "Math.cos(-3.14159265359)",
   186 	      -1,
   187 	      Math.cos(3.14159265359)     );
   189 new TestCase( SECTION,
   190 	      "Math.cos(-3.926990816987)",
   191 	      -0.7071067811865,
   192 	      Math.cos(3.926990816987)    );
   194 new TestCase( SECTION,
   195 	      "Math.cos(-4.712388980385)",
   196 	      0,
   197 	      Math.cos(4.712388980385)    );
   199 new TestCase( SECTION,
   200 	      "Math.cos(-5.497787143782)",
   201 	      0.7071067811865,
   202 	      Math.cos(5.497787143782)    );
   204 new TestCase( SECTION,
   205 	      "Math.cos(-6.28318530718)",
   206 	      1,
   207 	      Math.cos(6.28318530718)     );
   209 new TestCase( SECTION,
   210 	      "Math.cos(-Math.PI/4)",
   211 	      Math.SQRT2/2,
   212 	      Math.cos(-Math.PI/4)        );
   214 new TestCase( SECTION,
   215 	      "Math.cos(-Math.PI/2)",
   216 	      0,
   217 	      Math.cos(-Math.PI/2)        );
   219 new TestCase( SECTION,
   220 	      "Math.cos(-3*Math.PI/4)",
   221 	      -Math.SQRT2/2,
   222 	      Math.cos(-3*Math.PI/4)      );
   224 new TestCase( SECTION,
   225 	      "Math.cos(-Math.PI)",
   226 	      -1,
   227 	      Math.cos(-Math.PI)          );
   229 new TestCase( SECTION,
   230 	      "Math.cos(-5*Math.PI/4)",
   231 	      -Math.SQRT2/2,
   232 	      Math.cos(-5*Math.PI/4)      );
   234 new TestCase( SECTION,
   235 	      "Math.cos(-3*Math.PI/2)",
   236 	      0,
   237 	      Math.cos(-3*Math.PI/2)      );
   239 new TestCase( SECTION,
   240 	      "Math.cos(-7*Math.PI/4)",
   241 	      Math.SQRT2/2,
   242 	      Math.cos(-7*Math.PI/4)      );
   244 new TestCase( SECTION,
   245 	      "Math.cos(-Math.PI*2)",
   246 	      1,
   247 	      Math.cos(-Math.PI*2)        );
   249 test();

mercurial