Skip to content

Commit 3051ba4

Browse files
committed
add result validation
1 parent e3c3525 commit 3051ba4

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

SunSpider/date-format-tofte.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,16 @@ function run() {
309309

310310

311311
class Benchmark {
312+
EXPECTED_RESULT_HASH = 439041101;
313+
312314
runIteration() {
313315
this.resultHash = 0x1a2b3c4d;
314316
for (let i = 0; i < 8; ++i)
315317
this.resultHash ^= run();
316318
}
319+
320+
validate() {
321+
if (this.resultHash != this.EXPECTED_RESULT_HASH)
322+
throw new Error(`Got unexpected result hash ${this.resultHash} instead of ${this.EXPECTED_RESULT_HASH}`)
323+
}
317324
}

SunSpider/date-format-xparb.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,16 @@ function run() {
428428

429429

430430
class Benchmark {
431+
EXPECTED_RESULT_HASH = 439041101;
432+
431433
runIteration() {
432434
this.resultHash = 0x1a2b3c4d;
433435
for (let i = 0; i < 8; ++i)
434436
this.resultHash ^= run();
435437
}
438+
439+
validate() {
440+
if (this.resultHash != this.EXPECTED_RESULT_HASH)
441+
throw new Error(`Got unexpected result hash ${this.resultHash} instead of ${this.EXPECTED_RESULT_HASH}`)
442+
}
436443
}

0 commit comments

Comments
 (0)