|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function send(message) { |
|
5 self.postMessage(message); |
|
6 } |
|
7 |
|
8 function do_test_complete() { |
|
9 send({kind: "do_test_complete", args: []}); |
|
10 } |
|
11 |
|
12 function do_check_true(x) { |
|
13 send({kind: "do_check_true", args: [!!x]}); |
|
14 if (x) { |
|
15 dump("TEST-PASS: " + x + "\n"); |
|
16 } else { |
|
17 throw new Error("do_check_true failed"); |
|
18 } |
|
19 } |
|
20 |
|
21 function do_check_eq(a, b) { |
|
22 let result = a == b; |
|
23 send({kind: "do_check_true", args: [result]}); |
|
24 if (!result) { |
|
25 throw new Error("do_check_eq failed " + a + " != " + b); |
|
26 } |
|
27 } |
|
28 |
|
29 function do_check_neq(a, b) { |
|
30 let result = a != b; |
|
31 send({kind: "do_check_true", args: [result]}); |
|
32 if (!result) { |
|
33 throw new Error("do_check_neq failed " + a + " == " + b); |
|
34 } |
|
35 } |
|
36 |
|
37 function do_print(x) { |
|
38 dump("TEST-INFO: " + x + "\n"); |
|
39 } |