Debian Codegraph @

rhino/testsrc/tests/ecma/Math/15.8.2.12.js

raw symbols SCIP
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/. */
5
6 gTestfile = '15.8.2.12.js';
7
8 /**
9 File Name: 15.8.2.12.js
10 ECMA Section: 15.8.2.12 Math.min(x, y)
11 Description: return the smaller of the two arguments.
12 special cases:
13 - if x is NaN or y is NaN return NaN
14 - if x < y return x
15 - if y > x return y
16 - if x is +0 and y is +0 return +0
17 - if x is +0 and y is -0 return -0
18 - if x is -0 and y is +0 return -0
19 - if x is -0 and y is -0 return -0
20 Author: [email protected]
21 Date: 7 july 1997
22 */
23
24
25 var SECTION = "15.8.2.12";
26 var VERSION = "ECMA_1";
27 var TITLE = "Math.min(x, y)";
28 var BUGNUMBER="76439";
29
30 startTest();
31
32 writeHeaderToLog( SECTION + " "+ TITLE);
33
34 new TestCase( SECTION,
35 "Math.min.length",
36 2,
37 Math.min.length );
38
39 new TestCase( SECTION,
40 "Math.min()",
41 Infinity,
42 Math.min() );
43
44 new TestCase( SECTION,
45 "Math.min(void 0, 1)",
46 Number.NaN,
47 Math.min( void 0, 1 ) );
48
49 new TestCase( SECTION,
50 "Math.min(void 0, void 0)",
51 Number.NaN,
52 Math.min( void 0, void 0 ) );
53
54 new TestCase( SECTION,
55 "Math.min(null, 1)",
56 0,
57 Math.min( null, 1 ) );
58
59 new TestCase( SECTION,
60 "Math.min(-1, null)",
61 -1,
62 Math.min( -1, null ) );
63
64 new TestCase( SECTION,
65 "Math.min(true, false)",
66 0,
67 Math.min(true,false) );
68
69 new TestCase( SECTION,
70 "Math.min('-99','99')",
71 -99,
72 Math.min( "-99","99") );
73
74 new TestCase( SECTION,
75 "Math.min(NaN,0)",
76 Number.NaN,
77 Math.min(Number.NaN,0) );
78
79 new TestCase( SECTION,
80 "Math.min(NaN,1)",
81 Number.NaN,
82 Math.min(Number.NaN,1) );
83
84 new TestCase( SECTION,
85 "Math.min(NaN,-1)",
86 Number.NaN,
87 Math.min(Number.NaN,-1) );
88
89 new TestCase( SECTION,
90 "Math.min(0,NaN)",
91 Number.NaN,
92 Math.min(0,Number.NaN) );
93
94 new TestCase( SECTION,
95 "Math.min(1,NaN)",
96 Number.NaN,
97 Math.min(1,Number.NaN) );
98
99 new TestCase( SECTION,
100 "Math.min(-1,NaN)",
101 Number.NaN,
102 Math.min(-1,Number.NaN) );
103
104 new TestCase( SECTION,
105 "Math.min(NaN,NaN)",
106 Number.NaN,
107 Math.min(Number.NaN,Number.NaN) );
108
109 new TestCase( SECTION,
110 "Math.min(1,1.0000000001)",
111 1,
112 Math.min(1,1.0000000001) );
113
114 new TestCase( SECTION,
115 "Math.min(1.0000000001,1)",
116 1,
117 Math.min(1.0000000001,1) );
118
119 new TestCase( SECTION,
120 "Math.min(0,0)",
121 0,
122 Math.min(0,0) );
123
124 new TestCase( SECTION,
125 "Math.min(0,-0)",
126 -0,
127 Math.min(0,-0) );
128
129 new TestCase( SECTION,
130 "Math.min(-0,-0)",
131 -0,
132 Math.min(-0,-0) );
133
134 new TestCase( SECTION,
135 "Infinity/Math.min(0,-0)",
136 -Infinity,
137 Infinity/Math.min(0,-0) );
138
139 new TestCase( SECTION,
140 "Infinity/Math.min(-0,-0)",
141 -Infinity,
142 Infinity/Math.min(-0,-0) );
143
144 test();