Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import junit.framework.TestCase;
- import java.util.Arrays;
- import java.util.List;
- import java.util.stream.Collectors;
- public class PascalVectorTest extends TestCase {
- public void test0() {
- assertArraysEquals(new int[] {1}, PascalVectorSolution.pascalVector(0));
- }
- public void test1() {
- assertArraysEquals(new int[] {1, 1}, PascalVectorSolution.pascalVector(1));
- }
- public void test2() {
- assertArraysEquals(new int[] {1, 2, 1}, PascalVectorSolution.pascalVector(2));
- }
- public void test3() {
- assertArraysEquals(new int[] {1, 3, 3, 1}, PascalVectorSolution.pascalVector(3));
- }
- public void test4() {
- assertArraysEquals(new int[] {1, 4, 6, 4, 1}, PascalVectorSolution.pascalVector(4));
- }
- private void assertArraysEquals(final int[] expectedPascalVectorValues, final int[] actualPascalVectorValues) {
- final List<Integer> expectedValuesAsList = Arrays.stream(expectedPascalVectorValues).boxed().collect(Collectors.toList());
- final List<Integer> actualValuesAsList = Arrays.stream(actualPascalVectorValues).boxed().collect(Collectors.toList());
- assertEquals(expectedValuesAsList, actualValuesAsList);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement