|
|
@@ -0,0 +1,41 @@
|
|
|
+package leetcode.p64;
|
|
|
+
|
|
|
+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/23 22:12
|
|
|
+ * @Description:
|
|
|
+ */
|
|
|
+@RunWith(Parameterized.class)
|
|
|
+public class SolutionTest {
|
|
|
+ public static final Solution solution = new Solution();
|
|
|
+ private int[][] grid;
|
|
|
+ private int expect;
|
|
|
+
|
|
|
+ public SolutionTest(int[][] grid, int expect) {
|
|
|
+ this.grid = grid;
|
|
|
+ this.expect = expect;
|
|
|
+ }
|
|
|
+ @Parameterized.Parameters
|
|
|
+ public static Collection<Object[]> data(){
|
|
|
+ return Arrays.asList(new Object[][]{
|
|
|
+ {new int[][]{{1,3,1},{1,5,1},{4,2,1}},7},
|
|
|
+ {new int[][]{{1,2,3},{4,5,6}},12},
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void minPathSum() {
|
|
|
+ assertEquals(expect,solution.minPathSum(grid));
|
|
|
+ }
|
|
|
+}
|