mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
15 lines
582 B
JavaScript
15 lines
582 B
JavaScript
const testCompare = (t, lhs, op, rhs, message) => {
|
|
const details = `Expected: ${lhs} ${op} ${rhs}`;
|
|
const extra = {details};
|
|
switch (op) {
|
|
case '<': return t.ok(lhs < rhs, message, extra);
|
|
case '<=': return t.ok(lhs <= rhs, message, extra);
|
|
case '===': return t.ok(lhs === rhs, message, extra);
|
|
case '!==': return t.ok(lhs !== rhs, message, extra);
|
|
case '>=': return t.ok(lhs >= rhs, message, extra);
|
|
case '>': return t.ok(lhs > rhs, message, extra);
|
|
default: return t.fail(`Unrecognized op: ${op}`);
|
|
}
|
|
};
|
|
|
|
module.exports = testCompare;
|