|
@@ -0,0 +1,45 @@
|
|
|
|
|
+package leetcode.p1456;
|
|
|
|
|
+
|
|
|
|
|
+import org.junit.Test;
|
|
|
|
|
+import org.junit.runner.RunWith;
|
|
|
|
|
+import org.junit.runners.Parameterized;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.Collection;
|
|
|
|
|
+
|
|
|
|
|
+import static org.junit.Assert.assertEquals;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @ProjectName: LeetCode
|
|
|
|
|
+ * @FileName: SolutionTest
|
|
|
|
|
+ * @Author: 杨逸
|
|
|
|
|
+ * @Data:2026/3/8 15:42
|
|
|
|
|
+ * @Description:
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(Parameterized.class)
|
|
|
|
|
+public class SolutionTest {
|
|
|
|
|
+ public static final Solution solution = new Solution();
|
|
|
|
|
+ private String s;
|
|
|
|
|
+ private int k;
|
|
|
|
|
+ private int expected;
|
|
|
|
|
+
|
|
|
|
|
+ public SolutionTest(String s, int k, int expected) {
|
|
|
|
|
+ this.s = s;
|
|
|
|
|
+ this.k = k;
|
|
|
|
|
+ this.expected = expected;
|
|
|
|
|
+ }
|
|
|
|
|
+ @Parameterized.Parameters
|
|
|
|
|
+ public static Collection<Object[]> data() {
|
|
|
|
|
+ return Arrays.asList(new Object[][]{
|
|
|
|
|
+ {"abciiidef",3,3},
|
|
|
|
|
+ {"aeiou",2,2},
|
|
|
|
|
+ {"leetcode",3,2},
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void maxVowels() {
|
|
|
|
|
+ int result = solution.maxVowels(s, k);
|
|
|
|
|
+ assertEquals(expected, result);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|