Apply JS standard rules on KMPPatternSearching.js

This commit is contained in:
Rahul Jain
2020-10-30 23:04:21 +05:30
parent 2c5aaa3690
commit 291f7b1a23

View File

@ -12,4 +12,16 @@ describe('KMP Matcher', () => {
const pattern = 'ABCDABD'
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([])
})
})