]>
Commit | Line | Data |
---|---|---|
1 | /* The contents of this file are subject to the Netscape Public | |
2 | * License Version 1.1 (the "License"); you may not use this file | |
3 | * except in compliance with the License. You may obtain a copy of | |
4 | * the License at http://www.mozilla.org/NPL/ | |
5 | * | |
6 | * Software distributed under the License is distributed on an "AS | |
7 | * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
8 | * implied. See the License for the specific language governing | |
9 | * rights and limitations under the License. | |
10 | * | |
11 | * The Original Code is Mozilla Communicator client code, released March | |
12 | * 31, 1998. | |
13 | * | |
14 | * The Initial Developer of the Original Code is Netscape Communications | |
15 | * Corporation. Portions created by Netscape are | |
16 | * Copyright (C) 1998 Netscape Communications Corporation. All | |
17 | * Rights Reserved. | |
18 | * | |
19 | * Contributor(s): | |
20 | * | |
21 | */ | |
22 | /** | |
23 | File Name: 15.8.2.16.js | |
24 | ECMA Section: 15.8.2.16 sin( x ) | |
25 | Description: return an approximation to the sine of the | |
26 | argument. argument is expressed in radians | |
27 | Author: christine@netscape.com | |
28 | Date: 7 july 1997 | |
29 | ||
30 | */ | |
31 | var SECTION = "15.8.2.16"; | |
32 | var VERSION = "ECMA_1"; | |
33 | startTest(); | |
34 | var TITLE = "Math.sin(x)"; | |
35 | ||
36 | writeHeaderToLog( SECTION + " "+ TITLE); | |
37 | ||
38 | var testcases = getTestCases(); | |
39 | test(); | |
40 | ||
41 | function getTestCases() { | |
42 | var array = new Array(); | |
43 | var item = 0; | |
44 | ||
45 | array[item++] = new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length ); | |
46 | ||
47 | array[item++] = new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() ); | |
48 | array[item++] = new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) ); | |
49 | array[item++] = new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) ); | |
50 | array[item++] = new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) ); | |
51 | array[item++] = new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') ); | |
52 | ||
53 | array[item++] = new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) ); | |
54 | array[item++] = new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) ); | |
55 | array[item++] = new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0)); | |
56 | array[item++] = new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY)); | |
57 | array[item++] = new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY)); | |
58 | array[item++] = new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974)); | |
59 | array[item++] = new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795)); | |
60 | array[item++] = new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192)); | |
61 | array[item++] = new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359)); | |
62 | ||
63 | return ( array ); | |
64 | } | |
65 | ||
66 | function test() { | |
67 | for ( tc=0; tc < testcases.length; tc++ ) { | |
68 | testcases[tc].passed = writeTestCaseResult( | |
69 | testcases[tc].expect, | |
70 | testcases[tc].actual, | |
71 | testcases[tc].description +" = "+ | |
72 | testcases[tc].actual ); | |
73 | ||
74 | testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "; | |
75 | } | |
76 | stopTest(); | |
77 | return ( testcases ); | |
78 | } |