-
Notifications
You must be signed in to change notification settings - Fork 2
/
ResultTest.java
31 lines (25 loc) · 1.03 KB
/
ResultTest.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
package hackrank.algorithm.implement.stick;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.Test;
public class ResultTest {
@Test
public void cutTheSticks_LinearDecrease_Expected() {
List<Integer> stickLengths = Arrays.asList(4, 3, 2, 1);
List<Integer> cutIterations = Result.cutTheSticks(stickLengths);
assertThat(cutIterations).containsExactly(4, 3, 2, 1);
}
@Test
public void cutTheSticks_AllOnes_OneIteration() {
List<Integer> stickLengths = Arrays.asList(1, 1, 1, 1);
List<Integer> cutIterations = Result.cutTheSticks(stickLengths);
assertThat(cutIterations).containsExactly(4);
}
@Test
public void cutTheSticks_HackerRankSampleInput0_ExpectedIterationCuts() {
List<Integer> stickLengths = Arrays.asList(5, 4, 4, 2, 2, 8);
List<Integer> cutIterations = Result.cutTheSticks(stickLengths);
assertThat(cutIterations).containsExactly(6, 4, 2, 1);
}
}