-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSocksLaunderingTest.java
More file actions
56 lines (46 loc) · 1.44 KB
/
Copy pathSocksLaunderingTest.java
File metadata and controls
56 lines (46 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
package algorithm.exercises;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class SocksLaunderingTest {
private SocksLaundering socksLaundering = new SocksLaundering();
@Test
void testBasicSolution() {
var C = new int[]{1, 2, 1, 1};
var D = new int[]{1, 4, 3, 2, 4};
var K = 2;
int solution = socksLaundering.solution(K, C, D);
assertEquals(3, solution);
}
@Test
void testSolutionNoWashing() {
var C = new int[]{1, 2, 1, 1};
var D = new int[]{1, 4, 3, 2, 4};
var K = 0;
int solution = socksLaundering.solution(K, C, D);
assertEquals(1, solution);
}
@Test
void testSolutionWithOnlyOneAvailableDirty() {
var C = new int[]{};
var D = new int[]{1, 4, 1, 2, 4};
var K = 2;
int solution = socksLaundering.solution(K, C, D);
assertEquals(1, solution);
}
@Test
void testSolutionWithOnlyTwoAvailableDirty() {
var C = new int[]{};
var D = new int[]{1, 4, 1, 2, 4, 7, 7};
var K = 4;
int solution = socksLaundering.solution(K, C, D);
assertEquals(2, solution);
}
@Test
void testSolutionWithOnlyClean() {
var C = new int[]{1, 2, 3, 1, 2, 3, 3, 3};
var D = new int[]{};
var K = 10;
int solution = socksLaundering.solution(K, C, D);
assertEquals(4, solution);
}
}