Skip to content

Commit c365e82

Browse files
Adding testcases for Boyer Moore Algorithm (#1135)
1 parent ea7d06a commit c365e82

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

String/test/BoyerMoore.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { boyerMoore } from '../BoyerMoore'
2+
3+
describe('Testing the boyer moore algorithm', () => {
4+
it('Testing with alphabetical strings', () => {
5+
expect(boyerMoore('THIS IS A TEST TEXT', 'TEST')).toBe(10)
6+
expect(boyerMoore('AAIOOOAADDZXYCAADAABAABA', 'AADA')).toBe(14)
7+
expect(boyerMoore('Hello World! This is a test case.', 'Boyer')).toBe(-1)
8+
})
9+
10+
it('Testing with alphabets and symbols', () => {
11+
expect(boyerMoore('AA&&@_OPOODDA##!', '@_')).toBe(4)
12+
expect(boyerMoore('LK_||{{}}[[$($', '||')).toBe(3)
13+
expect(boyerMoore('__||{{__+}}[[$($', '-}}')).toBe(-1)
14+
})
15+
})

0 commit comments

Comments
 (0)