forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_368Test.java
59 lines (48 loc) · 1.34 KB
/
_368Test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.fishercoder;
import com.fishercoder.solutions._368;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Arrays;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* Created by fishercoder on 5/28/17.
*/
public class _368Test {
private static _368 test;
private static int[] nums;
@BeforeClass
public static void setup(){
test = new _368();
}
@Test
public void test1(){
nums = new int[]{1,2,4,8};
assertThat(test.largestDivisibleSubset(nums), is(Arrays.asList(8,4,2,1)));
}
@Test
public void test2(){
nums = new int[]{1,2,3};
assertThat(test.largestDivisibleSubset(nums), is(Arrays.asList(2,1)));
}
@Test
public void test3(){
nums = new int[]{1};
assertThat(test.largestDivisibleSubset(nums), is(Arrays.asList(1)));
}
@Test
public void test4(){
nums = new int[]{546,669};
assertThat(test.largestDivisibleSubset(nums), is(Arrays.asList(546)));
}
@Test
public void test5(){
nums = new int[]{};
assertThat(test.largestDivisibleSubset(nums), is(Arrays.asList()));
}
@Test
public void test6(){
nums = new int[]{4,8,10,240};
assertThat(test.largestDivisibleSubset(nums), is(Arrays.asList(240,8,4)));
}
}