package test.leecode.isNumber; import java.util.List; import org.junit.Assert; import org.junit.Test; import cn.fansunion.leecode.number.FindAllNumbersDisappearedInAnArray; /** * @author wen.lei@brgroup.com * * 2022-2-22 */ public class FindAllNumbersDisappearedInAnArrayTest @Test public void test() FindAllNumbersDisappearedInAnArray mn = new FindAllNumbersDisappearedInAnArray(); int [] nums2= new int [] 1 , 1 ; int [] nums5= new int [] 1 , 3 , 4 , 2 , 2 ; int [] nums11= new int [] 10 , 9 , 8 , 2 , 5 , 6 , 4 , 3 , 3 , 7 , 9 ; Assert.assertEquals((Object) 2 ,mn.findDisappearedNumbers(nums2).get( 0 )); Assert.assertEquals((Object) 5 ,mn.findDisappearedNumbers(nums5).get( 0 )); final List<Integer> numList = mn.findDisappearedNumbers(nums11); final Object actual1 = numList.get( 0 ); final Object actual11 = numList.get( 1 ); Assert.assertEquals( 1 ,actual1); Assert.assertEquals( 11 ,actual11);
@Test public void testSet() FindAllNumbersDisappearedInAnArray mn = new FindAllNumbersDisappearedInAnArray(); int [] nums2= new int [] 1 , 1 ; int [] nums5= new int [] 1 , 3 , 4 , 2 , 2 ; int [] nums11= new int [] 10 , 9 , 8 , 2 , 5 , 6 , 4 , 3 , 3 , 7 , 9 ; Assert.assertEquals((Object) 2 ,mn.findDisappearedNumberSet(nums2).get( 0 )); Assert.assertEquals((Object) 5 ,mn.findDisappearedNumberSet(nums5).get( 0 )); final List<Integer> numList = mn.findDisappearedNumberSet(nums11); final Object actual1 = numList.get( 0 ); final Object actual11 = numList.get( 1 ); Assert.assertEquals( 1 ,actual1); Assert.assertEquals( 11 ,actual11);
|