Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions String/test/BoyerMoore.test.js
Original file line number Diff line number Diff line change
@@ -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)
})
})