mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
refactor: BoardPath
(#5431)
refactor: BoardPath Co-authored-by: alxkm <alx@alx.com>
This commit is contained in:
@ -0,0 +1,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));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user