Skip to content

Commit 77c571a

Browse files
committed
feat: add test case
1 parent d0c1a2a commit 77c571a

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

  • longest-substring-without-repeating-characters

longest-substring-without-repeating-characters/gyeo-ri.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,18 @@ def lengthOfLongestSubstring(self, s: str) -> int:
1919

2020

2121
if __name__ == "__main__":
22-
s = Solution()
23-
print(s.lengthOfLongestSubstring("a"))
22+
solution = Solution()
23+
24+
test_cases = [
25+
("abcabcbb", 3),
26+
("bbbbb", 1),
27+
("pwwkew", 3),
28+
("a", 1),
29+
("bb!1 2@!#$1%3", 9),
30+
]
31+
for idx, cases_ in enumerate(test_cases):
32+
s, answer = cases_
33+
result = solution.lengthOfLongestSubstring(s)
34+
assert (
35+
answer == result
36+
), f"Test Case {idx} Failed: Expected {answer}, Got {result}"

0 commit comments

Comments
 (0)