Skip to content

Commit 0e5cf5e

Browse files
authored
tests: add missing test for KnightTour (#1598)
1 parent 069803f commit 0e5cf5e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Diff for: Backtracking/tests/KnightTour.test.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('OpenKnightTour', () => {
1111
[0, 0, 0, 0, 0]
1212
])
1313

14-
KT.solve()
14+
expect(KT.solve()).toBe(true)
1515
expect(KT.board).toEqual([
1616
[19, 4, 15, 10, 25],
1717
[14, 9, 18, 5, 16],
@@ -20,4 +20,18 @@ describe('OpenKnightTour', () => {
2020
[21, 2, 7, 12, 23]
2121
])
2222
})
23+
24+
it('OpenKnightTour(2)', () => {
25+
const KT = new OpenKnightTour(2)
26+
expect(KT.board).toEqual([
27+
[0, 0],
28+
[0, 0]
29+
])
30+
31+
expect(KT.solve()).toBe(false)
32+
expect(KT.board).toEqual([
33+
[0, 0],
34+
[0, 0]
35+
])
36+
})
2337
})

0 commit comments

Comments
 (0)