michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function log(text) { michael@0: dump("WORKER " + text + "\n"); michael@0: } michael@0: michael@0: function send(message) { michael@0: self.postMessage(message); michael@0: } michael@0: michael@0: function finish() { michael@0: send({kind: "finish"}); michael@0: } michael@0: michael@0: function ok(condition, description) { michael@0: send({kind: "ok", condition: !!condition, description: "" + description}); michael@0: } michael@0: michael@0: function is(a, b, description) { michael@0: let outcome = a == b; // Need to decide outcome here, as not everything can be serialized michael@0: send({kind: "is", outcome: outcome, description: "" + description, a: "" + a, b: "" + b}); michael@0: } michael@0: michael@0: function isnot(a, b, description) { michael@0: let outcome = a != b; // Need to decide outcome here, as not everything can be serialized michael@0: send({kind: "isnot", outcome: outcome, description: "" + description, a: "" + a, b: "" + b}); michael@0: } michael@0: michael@0: function info(description) { michael@0: send({kind: "info", description: "" + description}); michael@0: }