refactor: ShortestCommonSuperSequenceLength (#5394)

This commit is contained in:
Alex Klymenko
2024-08-26 10:50:12 +02:00
committed by GitHub
parent 35f23d2ddc
commit b70f077343
2 changed files with 42 additions and 17 deletions

View File

@ -0,0 +1,14 @@
package com.thealgorithms.dynamicprogramming;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
public class ShortestCommonSuperSequenceLengthTest {
@ParameterizedTest
@CsvSource({"AGGTAB, GXTXAYB, 9", "ABC, ABC, 3", "ABC, DEF, 6", "'', ABC, 3", "ABCD, AB, 4", "ABC, BCD, 4", "A, B, 2"})
void testShortestSuperSequence(String input1, String input2, int expected) {
assertEquals(expected, ShortestCommonSuperSequenceLength.shortestSuperSequence(input1, input2));
}
}