| 1 | const assert = require("node:assert"); |
| 2 | const math = require("./math"); |
| 3 | |
| 4 | assert.strictEqual(math.add(2, 3), 5); |
| 5 | assert.strictEqual(math.multiply(4, 5), 20); |
| 6 | assert.strictEqual(math.mod(7, 3), 1); |
| 7 | assert.strictEqual(math.mod(-1, 3), 2); |
| 8 | assert.strictEqual(math.mod(6, 3), 0); |
| 9 | assert.strictEqual(math.mod(-1, -3), 2); |
| 10 | assert.throws(() => math.mod(1, 0), RangeError); |
| 11 | assert.strictEqual(math.power(2, 10), 1024); |
| 12 | assert.strictEqual(math.power(5, 0), 1); |
| 13 | assert.throws(() => math.power(2, -1), RangeError); |
| 14 | console.log("all tests passed"); |