Repository navigation
Expand file tree
/
Copy path_340Test.java
More file actions
59 lines (47 loc) · 1.44 KB
/
Copy path_340Test.java
File metadata and controls
59 lines (47 loc) · 1.44 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.fishercoder;
import com.fishercoder.solutions._340;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* Created by stevesun on 6/10/17.
*/
public class _340Test {
private static _340.Solution1 solution1;
private static _340.Solution2 solution2;
@BeforeClass
public static void setup() {
solution1 = new _340.Solution1();
solution2 = new _340.Solution2();
}
@Test
public void test1() {
assertEquals(3, solution1.lengthOfLongestSubstringKDistinct("eceba", 2));
assertEquals(3, solution2.lengthOfLongestSubstringKDistinct("eceba", 2));
}
@Test
public void test2() {
assertEquals(0, solution1.lengthOfLongestSubstringKDistinct("", 0));
assertEquals(0, solution2.lengthOfLongestSubstringKDistinct("", 0));
}
@Test
public void test3() {
assertEquals(0, solution1.lengthOfLongestSubstringKDistinct("a", 0));
}
@Test
public void test4() {
assertEquals(1, solution1.lengthOfLongestSubstringKDistinct("a", 1));
}
@Test
public void test5() {
assertEquals(1, solution1.lengthOfLongestSubstringKDistinct("a", 2));
}
@Test
public void test6() {
assertEquals(2, solution1.lengthOfLongestSubstringKDistinct("aa", 1));
}
@Test
public void test7() {
assertEquals(3, solution1.lengthOfLongestSubstringKDistinct("bacc", 2));
}
}