Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 0e5cf5e

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

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎Backtracking/tests/KnightTour.test.js

Lines changed: 15 additions & 1 deletion
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)

AltStyle によって変換されたページ (->オリジナル) /