-
Notifications
You must be signed in to change notification settings - Fork 19.4k
/
BoardPathTest.java
33 lines (26 loc) · 1.1 KB
/
BoardPathTest.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
package com.thealgorithms.dynamicprogramming;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.stream.Stream;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
public class BoardPathTest {
@ParameterizedTest
@MethodSource("provideTestCases")
void testBpR(int start, int end, int expected) {
assertEquals(expected, BoardPath.bpR(start, end));
}
@ParameterizedTest
@MethodSource("provideTestCases")
void testBpRS(int start, int end, int expected) {
assertEquals(expected, BoardPath.bpRS(start, end, new int[end + 1]));
}
@ParameterizedTest
@MethodSource("provideTestCases")
void testBpIS(int start, int end, int expected) {
assertEquals(expected, BoardPath.bpIS(start, end, new int[end + 1]));
}
private static Stream<Arguments> provideTestCases() {
return Stream.of(Arguments.of(0, 10, 492), Arguments.of(0, 5, 16), Arguments.of(0, 6, 32), Arguments.of(0, 3, 4), Arguments.of(0, 1, 1));
}
}