fix: test
This commit is contained in:
parent
20d3daebc3
commit
119f141002
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user