-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLongStringSolution.test.java
More file actions
35 lines (28 loc) · 1.19 KB
/
Copy pathLongStringSolution.test.java
File metadata and controls
35 lines (28 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class LongStringSolutionTest {
@Test
public void testLengthOfLongestSubstring_General() {
assertEquals(5, LongStringSolution.lengthOfLongestSubstring("eadiedniweif"));
assertEquals(3, LongStringSolution.lengthOfLongestSubstring("abcabcbb"));
assertEquals(1, LongStringSolution.lengthOfLongestSubstring("bbbbb"));
assertEquals(3, LongStringSolution.lengthOfLongestSubstring("pwwkew"));
}
@Test
public void testLengthOfLongestSubstring_Empty() {
assertEquals(0, LongStringSolution.lengthOfLongestSubstring(""));
}
@Test
public void testLengthOfLongestSubstring_SingleCharacter() {
assertEquals(1, LongStringSolution.lengthOfLongestSubstring("a"));
}
@Test
public void testLengthOfLongestSubstring_TwoDistinctCharacters() {
assertEquals(2, LongStringSolution.lengthOfLongestSubstring("ab"));
}
@Test
public void testLengthOfLongestSubstring_TwoSameCharacters() {
assertEquals(1, LongStringSolution.lengthOfLongestSubstring("aa"));
}
// ... Additional test cases as necessary ...
}