|
@@ -0,0 +1,47 @@
|
|
|
|
|
+package leetcode.p205;
|
|
|
|
|
+
|
|
|
|
|
+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 16:11
|
|
|
|
|
+ * @Description:
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(Parameterized.class)
|
|
|
|
|
+public class SolutionTest {
|
|
|
|
|
+ public static final Solution solution = new Solution();
|
|
|
|
|
+ private final String s;
|
|
|
|
|
+ private final String t;
|
|
|
|
|
+ private final boolean expected;
|
|
|
|
|
+
|
|
|
|
|
+ public SolutionTest(String s, String t, boolean expected) {
|
|
|
|
|
+ this.s = s;
|
|
|
|
|
+ this.t = t;
|
|
|
|
|
+ this.expected = expected;
|
|
|
|
|
+ }
|
|
|
|
|
+ @Parameterized.Parameters
|
|
|
|
|
+ public static Collection<Object[]> data(){
|
|
|
|
|
+ return Arrays.asList(new Object[][]{
|
|
|
|
|
+ {"egg","add",true},
|
|
|
|
|
+ {"f11","b23",false},
|
|
|
|
|
+ {"paper","title",true},
|
|
|
|
|
+ {"bbbaaaba","aaabbbba",false},
|
|
|
|
|
+ {"badc","baba",false},
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void isIsomorphic() {
|
|
|
|
|
+ boolean result = solution.isIsomorphic(s, t);
|
|
|
|
|
+ assertEquals(expected, result);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|