js-practice/test/string/longest-substring-without-repeating-characters.test.js

12 lines
513 B
JavaScript
Raw Normal View History

2020-05-02 16:06:08 +08:00
import { lengthOfLongestSubstring } from '../../src/string/longest-substring-without-repeating-characters'
test('最长无重复字符的子串', () => {
expect(lengthOfLongestSubstring('abcabcbb')).toBe(3)
expect(lengthOfLongestSubstring('bbbbb')).toBe(1)
expect(lengthOfLongestSubstring('pwwkew')).toBe(3)
expect(lengthOfLongestSubstring('')).toBe(0)
expect(lengthOfLongestSubstring(' ')).toBe(1)
expect(lengthOfLongestSubstring('au')).toBe(2)
expect(lengthOfLongestSubstring('dvdf')).toBe(3)
})