forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_1182Test.java
More file actions
41 lines (33 loc) · 974 Bytes
/
_1182Test.java
File metadata and controls
41 lines (33 loc) · 974 Bytes
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
package com.fishercoder;
import com.fishercoder.solutions._1182;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
public class _1182Test {
private static _1182.Solution1 solution1;
private static int[] colors;
private static int[][] queries;
@BeforeClass
public static void setup() {
solution1 = new _1182.Solution1();
}
@Test
public void test1() {
colors = new int[]{1, 1, 2, 1, 3, 2, 2, 3, 3};
queries = new int[][]{
{1, 3},
{2, 2},
{6, 1}
};
assertEquals(Arrays.asList(3, 0, 3), solution1.shortestDistanceColor(colors, queries));
}
@Test
public void test2() {
colors = new int[]{1, 2};
queries = new int[][]{
{0, 3}
};
assertEquals(Arrays.asList(-1), solution1.shortestDistanceColor(colors, queries));
}
}