|
@@ -0,0 +1,41 @@
|
|
|
|
|
+package leetcode.p66;
|
|
|
|
|
+
|
|
|
|
|
+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.assertArrayEquals;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @ProjectName: LeetCode
|
|
|
|
|
+ * @FileName: SolutionTest
|
|
|
|
|
+ * @Author: 杨逸
|
|
|
|
|
+ * @Data:2026/3/11 21:09
|
|
|
|
|
+ * @Description:
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(Parameterized.class)
|
|
|
|
|
+public class SolutionTest {
|
|
|
|
|
+ public static final Solution solution = new Solution();
|
|
|
|
|
+ private int[] digits;
|
|
|
|
|
+ private int[] expected;
|
|
|
|
|
+ public SolutionTest(int[] digits, int[] expected){
|
|
|
|
|
+ this.digits = digits;
|
|
|
|
|
+ this.expected = expected;
|
|
|
|
|
+ }
|
|
|
|
|
+ @Parameterized.Parameters
|
|
|
|
|
+ public static Collection<Object[]> data(){
|
|
|
|
|
+ return Arrays.asList(new Object[][]{
|
|
|
|
|
+ {new int[]{1,2,3},new int[]{1,2,4}},
|
|
|
|
|
+ {new int[]{4,3,2,1},new int[]{4,3,2,2}},
|
|
|
|
|
+ {new int[]{9},new int[]{1,0}},
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void plusOne() {
|
|
|
|
|
+ assertArrayEquals(expected,solution.plusOne(digits));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|