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