-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathProgrammerInCinemaDuringCovidTest.java
42 lines (33 loc) · 1.24 KB
/
ProgrammerInCinemaDuringCovidTest.java
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
package by.andd3dfx.common;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class ProgrammerInCinemaDuringCovidTest {
@Parameters(name = "{0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"Interval with length=3", new int[]{1, 0, 0, 0, 1}, 2},
{"Interval with length=4", new int[]{1, 0, 0, 0, 0, 1}, 2},
{"Interval with length=5", new int[]{1, 0, 0, 0, 0, 0, 1}, 3},
{"Two intervals", new int[]{1, 0, 0, 0, 0, 0, 1, 0, 0, 1}, 3},
{"Right interval", new int[]{1, 0, 0, 0}, 3},
{"Left interval", new int[]{0, 0, 1, 0}, 2},
});
}
@Parameter
public String name;
@Parameter(1)
public int[] input;
@Parameter(2)
public int expected;
@Test
public void testFind() {
assertEquals(expected, ProgrammerInCinemaDuringCovid.find(input));
}
}