|
@@ -0,0 +1,42 @@
|
|
|
|
|
+package leetcode.p476;
|
|
|
|
|
+
|
|
|
|
|
+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/11 20:42
|
|
|
|
|
+ * @Description:
|
|
|
|
|
+ */
|
|
|
|
|
+@RunWith(Parameterized.class)
|
|
|
|
|
+public class SolutionTest {
|
|
|
|
|
+ public static final Solution solution = new Solution();
|
|
|
|
|
+ private int num;
|
|
|
|
|
+ private int expected;
|
|
|
|
|
+ @Parameterized.Parameters
|
|
|
|
|
+ public static Collection<Object[]> data(){
|
|
|
|
|
+ return Arrays.asList(new Object[][]{
|
|
|
|
|
+ {5,2},
|
|
|
|
|
+ {7,0},
|
|
|
|
|
+ {10,5},
|
|
|
|
|
+ {0,1},
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ public SolutionTest(int num, int expected) {
|
|
|
|
|
+ this.num = num;
|
|
|
|
|
+ this.expected = expected;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Test
|
|
|
|
|
+ public void findComplement() {
|
|
|
|
|
+ assertEquals(expected, solution.findComplement(num));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|