Skip to content

Commit

Permalink
tests: add missing test for KnightTour (TheAlgorithms#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 authored Jan 27, 2024
1 parent 069803f commit 0e5cf5e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Backtracking/tests/KnightTour.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('OpenKnightTour', () => {
[0, 0, 0, 0, 0]
])

KT.solve()
expect(KT.solve()).toBe(true)
expect(KT.board).toEqual([
[19, 4, 15, 10, 25],
[14, 9, 18, 5, 16],
Expand All @@ -20,4 +20,18 @@ describe('OpenKnightTour', () => {
[21, 2, 7, 12, 23]
])
})

it('OpenKnightTour(2)', () => {
const KT = new OpenKnightTour(2)
expect(KT.board).toEqual([
[0, 0],
[0, 0]
])

expect(KT.solve()).toBe(false)
expect(KT.board).toEqual([
[0, 0],
[0, 0]
])
})
})

0 comments on commit 0e5cf5e

Please sign in to comment.