@dxzmpk/js-algorithms-data-structures
Version:
Algorithms and data-structures implemented on JavaScript
44 lines (38 loc) • 739 B
JavaScript
import knightTour from '../knightTour';
describe('knightTour', () => {
it('should not find solution on 3x3 board', () => {
const moves = knightTour(3);
expect(moves.length).toBe(0);
});
it('should find one solution to do knight tour on 5x5 board', () => {
const moves = knightTour(5);
expect(moves.length).toBe(25);
expect(moves).toEqual([
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
[ ],
]);
});
});