author | attila |
Fri, 26 Apr 2013 09:20:37 +0200 | |
changeset 17249 | a2014831ae7a |
parent 16525 | 1409942e618e |
child 17518 | 2225a4f929c0 |
permissions | -rw-r--r-- |
16147 | 1 |
/* |
16151 | 2 |
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
16147 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* runsunspider : runs the sunspider tests and checks for compliance |
|
26 |
* |
|
16525
1409942e618e
8009982: Lazy execution bugfix. Added lazy sunspider unit test. Added mandreel to compile-octane test. Fixed warnings
lagergren
parents:
16164
diff
changeset
|
27 |
* @subtest |
16147 | 28 |
*/ |
29 |
||
30 |
/** |
|
31 |
* This is not a test, but a test "framework" for running sunspider tests. |
|
32 |
*/ |
|
33 |
||
34 |
function assertEq(a, b) { |
|
35 |
if (a !== b) { |
|
36 |
throw "ASSERTION FAILED: " + a + " should be " + b; |
|
37 |
} |
|
38 |
} |
|
39 |
||
40 |
var runs = 0; |
|
41 |
var iterations__ = 1; |
|
42 |
var total_time = 0; |
|
43 |
||
44 |
function runbench(name) { |
|
45 |
var filename = name.split("/").pop(); |
|
46 |
if (verbose_run) { |
|
47 |
print("Running " + filename); |
|
48 |
} |
|
49 |
||
50 |
var start = new Date; |
|
51 |
for (var i = 0; i < iterations__; i++) { |
|
52 |
load(name); |
|
53 |
} |
|
54 |
var stop = new Date - start; |
|
55 |
total_time += stop; |
|
56 |
||
57 |
if (verbose_run) { |
|
58 |
print(filename + " done in " + stop + " ms"); |
|
59 |
} |
|
60 |
runs++; |
|
61 |
} |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
62 |
|
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
63 |
var m_w = 4711; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
64 |
var m_z = 17; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
65 |
var MAXINT = 0x7fffffff; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
66 |
|
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
67 |
//produce deterministic random numbers for test suite |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
68 |
function pseudorandom() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
69 |
m_z = 36969 * (m_z & 65535) + (m_z >> 16); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
70 |
m_w = 18000 * (m_w & 65535) + (m_w >> 16); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
71 |
return (Math.abs((m_z << 16) + m_w) & MAXINT) / MAXINT; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
72 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
73 |
|
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
74 |
function runsuite(tests) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
75 |
var changed = false; |
16147 | 76 |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
77 |
var oldRandom = Math.random; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
78 |
Math.random = pseudorandom; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
79 |
|
16147 | 80 |
try { |
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
81 |
for (var n = 0; n < tests.length; n++) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
82 |
runbench(tests[n].name); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
83 |
if (typeof tests[n].actual !== 'undefined') { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
84 |
assertEq(tests[n].actual(), tests[n].expected()); |
16147 | 85 |
} |
86 |
changed = true; |
|
87 |
} |
|
88 |
} catch (e) { |
|
89 |
print("error: " + e); |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
90 |
if (e.toString().indexOf(tests) == 1) { |
16147 | 91 |
throw e; |
92 |
} |
|
93 |
// no scripting or something, silently fail |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
94 |
} finally { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
95 |
Math.random = oldRandom; |
16147 | 96 |
} |
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
97 |
|
16147 | 98 |
return changed; |
99 |
} |
|
100 |
||
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
101 |
function hash(str) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
102 |
var s = "" + str; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
103 |
var h = 0; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
104 |
var off = 0; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
105 |
for (var i = 0; i < s.length; i++) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
106 |
h = 31 * h + s.charCodeAt(off++); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
107 |
h &= 0x7fffffff; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
108 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
109 |
return h ^ s.length; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
110 |
} |
16147 | 111 |
|
112 |
var tests = [ |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
113 |
{ name: 'string-base64.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
114 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
115 |
return hash(str); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
116 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
117 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
118 |
return 1544571068; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
119 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
120 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
121 |
{ name: 'string-validate-input.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
122 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
123 |
return hash(endResult); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
124 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
125 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
126 |
return 2016572373; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
127 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
128 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
129 |
{ name: 'date-format-xparb.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
130 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
131 |
return shortFormat + longFormat; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
132 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
133 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
134 |
return "2017-09-05Tuesday, September 05, 2017 8:43:48 AM"; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
135 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
136 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
137 |
{ name: '3d-morph.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
138 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
139 |
var acceptableDelta = 4e-15; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
140 |
return (testOutput - 6.394884621840902e-14) < acceptableDelta; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
141 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
142 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
143 |
return true; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
144 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
145 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
146 |
{ name: 'crypto-aes.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
147 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
148 |
return plainText; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
149 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
150 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
151 |
return decryptedText; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
152 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
153 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
154 |
{ name: 'crypto-md5.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
155 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
156 |
return md5Output; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
157 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
158 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
159 |
return "a831e91e0f70eddcb70dc61c6f82f6cd"; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
160 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
161 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
162 |
{ name: 'crypto-sha1.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
163 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
164 |
return sha1Output; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
165 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
166 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
167 |
return "2524d264def74cce2498bf112bedf00e6c0b796d"; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
168 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
169 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
170 |
{ name: 'bitops-bitwise-and.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
171 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
172 |
return result; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
173 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
174 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
175 |
return 0; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
176 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
177 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
178 |
{ name: 'bitops-bits-in-byte.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
179 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
180 |
return result; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
181 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
182 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
183 |
return 358400; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
184 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
185 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
186 |
{ name: 'bitops-nsieve-bits.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
187 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
188 |
var ret = 0; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
189 |
for (var i = 0; i < result.length; ++i) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
190 |
ret += result[i]; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
191 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
192 |
ret += result.length; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
193 |
return ret; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
194 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
195 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
196 |
return -1286749539853; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
197 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
198 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
199 |
{ name: 'bitops-3bit-bits-in-byte.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
200 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
201 |
return sum; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
202 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
203 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
204 |
return 512000; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
205 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
206 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
207 |
{ name: 'access-nbody.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
208 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
209 |
return ret; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
210 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
211 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
212 |
return -0.16906933525822856; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
213 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
214 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
215 |
{ name: 'access-binary-trees.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
216 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
217 |
return ret; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
218 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
219 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
220 |
return -1; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
221 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
222 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
223 |
{ name: 'access-fannkuch.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
224 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
225 |
return ret; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
226 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
227 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
228 |
return 22; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
229 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
230 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
231 |
{ name: 'math-spectral-norm.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
232 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
233 |
var ret = ''; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
234 |
for (var i = 6; i <= 48; i *= 2) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
235 |
ret += spectralnorm(i) + ','; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
236 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
237 |
return ret; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
238 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
239 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
240 |
return "1.2657786149754053,1.2727355112619148,1.273989979775574,1.274190125290389,"; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
241 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
242 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
243 |
{ name: '3d-raytrace.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
244 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
245 |
return hash(testOutput); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
246 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
247 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
248 |
return 230692593; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
249 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
250 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
251 |
{ name: 'regexp-dna.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
252 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
253 |
return dnaOutputString; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
254 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
255 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
256 |
return "undefinedagggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n"; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
257 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
258 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
259 |
{ name: 'math-cordic.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
260 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
261 |
return total; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
262 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
263 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
264 |
return 10362.570468755888; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
265 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
266 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
267 |
{ name: 'controlflow-recursive.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
268 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
269 |
var ret = 0; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
270 |
for (var i = 3; i <= 5; i++) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
271 |
ret += ack(3,i); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
272 |
ret += fib(17.0+i); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
273 |
ret += tak(3*i+3,2*i+2,i+1); |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
274 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
275 |
return ret; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
276 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
277 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
278 |
return 57775; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
279 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
280 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
281 |
{ name: 'date-format-tofte.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
282 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
283 |
return shortFormat + longFormat; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
284 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
285 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
286 |
return "2008-05-01Thursday, May 01, 2008 6:31:22 PM"; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
287 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
288 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
289 |
{ name: 'string-tagcloud.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
290 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
291 |
// The result string embeds floating-point numbers, which can vary a bit on different platforms, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
292 |
// so we truncate them a bit before comparing. |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
293 |
var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' }) |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
294 |
return tagcloud_norm.length; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
295 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
296 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
297 |
return 295906; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
298 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
299 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
300 |
{ name: 'string-unpack-code.js', |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
301 |
actual: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
302 |
return decompressedMochiKit.length == 106415 && |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
303 |
decompressedMochiKit[2000] == '5' && |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
304 |
decompressedMochiKit[12000] == '_' && |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
305 |
decompressedMochiKit[82556] == '>'; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
306 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
307 |
expected: function() { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
308 |
return true; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
309 |
} |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
310 |
}, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
311 |
//TODO no easy way to sanity check result |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
312 |
{ name: 'string-fasta.js' }, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
313 |
//TODO no easy way to sanity check result |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
314 |
{ name: 'math-partial-sums.js' }, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
315 |
//TODO no easy way to sanity check result |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
316 |
{ name: 'access-nsieve.js' }, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
317 |
//TODO no easy way to sanity check result |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
318 |
{ name: '3d-cube.js' }, |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
319 |
]; |
16147 | 320 |
|
321 |
// handle the case this script may be run by a JS engine that doesn't |
|
322 |
// support __DIR__ global variable. |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
323 |
var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__; |
16147 | 324 |
|
325 |
for (i in tests) { |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
326 |
tests[i].name = dir + '../external/sunspider/tests/sunspider-1.0/' + tests[i].name; |
16147 | 327 |
} |
328 |
||
329 |
var verbose_run = false; |
|
330 |
||
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
331 |
var args = []; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
332 |
if (typeof $ARGS !== 'undefined') { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
333 |
args = $ARGS; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
334 |
} else if (typeof arguments !== 'undefined' && arguments.length != 0) { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
335 |
args = arguments; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
336 |
} |
16147 | 337 |
|
338 |
for (i in args) { |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
339 |
if (args[i] === '--verbose') { |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
340 |
verbose_run = true; |
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
341 |
break; |
16147 | 342 |
} |
343 |
} |
|
344 |
||
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
345 |
runsuite(tests); |
16147 | 346 |
|
347 |
if (verbose_run) { |
|
16164
1899aada11f8
8005971: runsunspider.js should check results of benchmarks
lagergren
parents:
16163
diff
changeset
|
348 |
print('\n' + runs + "/" + tests.length + " tests were successfully run in " + total_time + " ms "); |
16147 | 349 |
} |
350 |
||
351 |
print("Sunspider finished!"); |