Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 3 additions & 0 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /