fix: test

This commit is contained in:
cha0s 2021-04-19 12:11:02 -05:00
parent 20d3daebc3
commit 119f141002

View File

@ -8,19 +8,19 @@ describe('Floodwalk', () => {
it('can walk', () => {
const data = [
0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 1, 0, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 0,
1, 1, 1, 1, 0, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 1,
];
let correct = data.reduce((r, v, i) => r.concat(v ? [+i] : []), []);
expect(
floodwalk(data, [1, 1], 8, 4)
floodwalk(new Set([1]), data, [1, 1, 8, 4])
.sort((l, r) => l < r ? -1 : 1)
).to.deep.equal(correct);
data[12] = 0;
correct = [9, 10, 16, 17, 18, 19];
correct = [9, 10, 11, 16, 17, 18, 19];
expect(
floodwalk(data, [1, 1], 8, 4)
floodwalk(new Set([1]), data, [1, 1, 8, 4])
.sort((l, r) => l < r ? -1 : 1)
).to.deep.equal(correct);
});