michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function send(message) { michael@0: self.postMessage(message); michael@0: } michael@0: michael@0: function do_test_complete() { michael@0: send({kind: "do_test_complete", args: []}); michael@0: } michael@0: michael@0: function do_check_true(x) { michael@0: send({kind: "do_check_true", args: [!!x]}); michael@0: if (x) { michael@0: dump("TEST-PASS: " + x + "\n"); michael@0: } else { michael@0: throw new Error("do_check_true failed"); michael@0: } michael@0: } michael@0: michael@0: function do_check_eq(a, b) { michael@0: let result = a == b; michael@0: send({kind: "do_check_true", args: [result]}); michael@0: if (!result) { michael@0: throw new Error("do_check_eq failed " + a + " != " + b); michael@0: } michael@0: } michael@0: michael@0: function do_check_neq(a, b) { michael@0: let result = a != b; michael@0: send({kind: "do_check_true", args: [result]}); michael@0: if (!result) { michael@0: throw new Error("do_check_neq failed " + a + " == " + b); michael@0: } michael@0: } michael@0: michael@0: function do_print(x) { michael@0: dump("TEST-INFO: " + x + "\n"); michael@0: }