Skip to content

Commit 12f0b33

Browse files
committed
Add more tests for rabinKarp.
1 parent 0361fe5 commit 12f0b33

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/algorithms/string/rabin-karp/__test__/rabinKarp.test.js

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ describe('rabinKarp', () => {
1111
});
1212

1313
it('should find substring in a string', () => {
14+
expect(rabinKarp('', '')).toBe(0);
15+
expect(rabinKarp('a', '')).toBe(0);
16+
expect(rabinKarp('a', 'a')).toBe(0);
1417
expect(rabinKarp('abcbcglx', 'abca')).toBe(-1);
1518
expect(rabinKarp('abcbcglx', 'bcgl')).toBe(3);
1619
expect(rabinKarp('abcxabcdabxabcdabcdabcy', 'abcdabcy')).toBe(15);

0 commit comments

Comments
 (0)