mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 02:05:08 +08:00
Apply JS standard rules on KMPPatternSearching.js
This commit is contained in:
@ -12,4 +12,16 @@ describe('KMP Matcher', () => {
|
|||||||
const pattern = 'ABCDABD'
|
const pattern = 'ABCDABD'
|
||||||
expect(KMPSearch(text, pattern)).toStrictEqual([4, 16])
|
expect(KMPSearch(text, pattern)).toStrictEqual([4, 16])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('TC3: expects to return matching indices for pattern in text', () => {
|
||||||
|
const text = 'AAAAA'
|
||||||
|
const pattern = 'AAA'
|
||||||
|
expect(KMPSearch(text, pattern)).toStrictEqual([0, 1, 2])
|
||||||
|
})
|
||||||
|
|
||||||
|
it('TC4: expects to return matching indices for pattern in text', () => {
|
||||||
|
const text = 'ABCD'
|
||||||
|
const pattern = 'BA'
|
||||||
|
expect(KMPSearch(text, pattern)).toStrictEqual([])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user