forked from fishercoder1534/Leetcode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_487Test.java
54 lines (43 loc) · 1.11 KB
/
_487Test.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
package com.fishercoder;
import com.fishercoder.solutions._487;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static junit.framework.Assert.assertEquals;
public class _487Test {
private static _487 test;
private static int[] nums;
private static int expected;
private static int actual;
@BeforeClass
public static void setup(){
test = new _487();
}
@Before
public void setupForEachTest(){
expected = 0;
actual = 0;
nums = new int[1000];
}
@Test
public void test1(){
nums = new int[]{1,1,0,1,1,1};
expected = 3;
actual = test.findMaxConsecutiveOnes(nums);
assertEquals(expected, actual);
}
@Test
public void test2(){
nums = new int[]{1,1,1,1,1,1};
expected = 6;
actual = test.findMaxConsecutiveOnes(nums);
assertEquals(expected, actual);
}
@Test
public void test3(){
nums = new int[]{};
expected = 0;
actual = test.findMaxConsecutiveOnes(nums);
assertEquals(expected, actual);
}
}