mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
Adding testcases for Boyer Moore Algorithm (#1135)
This commit is contained in:
15
String/test/BoyerMoore.test.js
Normal file
15
String/test/BoyerMoore.test.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { boyerMoore } from '../BoyerMoore'
|
||||||
|
|
||||||
|
describe('Testing the boyer moore algorithm', () => {
|
||||||
|
it('Testing with alphabetical strings', () => {
|
||||||
|
expect(boyerMoore('THIS IS A TEST TEXT', 'TEST')).toBe(10)
|
||||||
|
expect(boyerMoore('AAIOOOAADDZXYCAADAABAABA', 'AADA')).toBe(14)
|
||||||
|
expect(boyerMoore('Hello World! This is a test case.', 'Boyer')).toBe(-1)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Testing with alphabets and symbols', () => {
|
||||||
|
expect(boyerMoore('AA&&@_OPOODDA##!', '@_')).toBe(4)
|
||||||
|
expect(boyerMoore('LK_||{{}}[[$($', '||')).toBe(3)
|
||||||
|
expect(boyerMoore('__||{{__+}}[[$($', '-}}')).toBe(-1)
|
||||||
|
})
|
||||||
|
})
|
Reference in New Issue
Block a user