mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-07-07 09:54:53 +08:00
Add more tests for rabinKarp.
This commit is contained in:
@ -11,6 +11,9 @@ describe('rabinKarp', () => {
|
||||
});
|
||||
|
||||
it('should find substring in a string', () => {
|
||||
expect(rabinKarp('', '')).toBe(0);
|
||||
expect(rabinKarp('a', '')).toBe(0);
|
||||
expect(rabinKarp('a', 'a')).toBe(0);
|
||||
expect(rabinKarp('abcbcglx', 'abca')).toBe(-1);
|
||||
expect(rabinKarp('abcbcglx', 'bcgl')).toBe(3);
|
||||
expect(rabinKarp('abcxabcdabxabcdabcdabcy', 'abcdabcy')).toBe(15);
|
||||
|
Reference in New Issue
Block a user