mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
refactor: PalindromicPartitioning
(#5419)
refactor: PalindromicPartitioning Co-authored-by: alxkm <alx@alx.com>
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
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 PalindromicPartitioningTest {
|
||||
|
||||
private static Stream<Arguments> provideTestCases() {
|
||||
return Stream.of(Arguments.of("a", 0), Arguments.of("aa", 0), Arguments.of("ab", 1), Arguments.of("ababbbabbababa", 3), Arguments.of("abcde", 4), Arguments.of("abacdcaba", 0));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("provideTestCases")
|
||||
public void testMinimalPartitions(String input, int expected) {
|
||||
assertEquals(expected, PalindromicPartitioning.minimalPartitions(input));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user