]>
git.scottworley.com Git - inverse-tax/blob - tax.test.js
6fcc15c74dbc39ad806c7c3961b495360ed7edf1
3 var assert
= require('assert');
5 function test(description
, f
) {
9 test("parse tax table", () => {
10 const parsed
= parse_tax_table(' 1 2\n10 4\n');
11 assert
.strictEqual(parsed
.length
, 2);
12 assert
.deepStrictEqual(parsed
[0], [1, 10, .02]);
13 assert
.deepStrictEqual(parsed
[1], [10, Infinity
, .04]);
17 assert
.strictEqual(sum([]), 0);
18 assert
.strictEqual(sum([7]), 7);
19 assert
.strictEqual(sum([100, 1, 10]), 111);
23 assert
.strictEqual(tax([[10, 100, .01], [100, Infinity
, .1]], 150), 5.9);