package test.leecode.intelligence; import org.junit.Assert; import org.junit.Test; import cn.fansunion.leecode.intelligence.XOfAKindInADeckOfCards; /** * @author wen.lei@brgroup.com * * 2022-2-25 */ public class XOfAKindInADeckOfCardsTest @Test public void test() XOfAKindInADeckOfCards test = new XOfAKindInADeckOfCards(); Assert.assertTrue(test.hasGroupsSizeX( new int [] 1 , 1 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 )); Assert.assertTrue(test.hasGroupsSizeX( new int [] 1 , 1 , 2 , 2 , 2 , 2 )); Assert.assertFalse(test.hasGroupsSizeX( new int [] 1 , 2 , 3 , 4 )); Assert.assertTrue(test.hasGroupsSizeX( new int [] 1 , 2 , 3 , 4 , 4 , 3 , 2 , 1 , 5 , 6 , 6 , 5 )); Assert.assertTrue(test.hasGroupsSizeX( new int [] 1 , 2 , 3 , 4 , 4 , 3 , 2 , 1 )); Assert.assertFalse(test.hasGroupsSizeX( new int [] 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 )); Assert.assertFalse(test.hasGroupsSizeX( new int [] 1 , 2 , 3 , 4 , 4 )); Assert.assertFalse(test.hasGroupsSizeX( new int [] 1 , 2 , 2 ));
@Test public void testError() XOfAKindInADeckOfCards test = new XOfAKindInADeckOfCards(); Assert.assertFalse(test.hasGroupsSizeXError( new int [] 1 , 2 , 3 , 4 )); Assert.assertTrue(test.hasGroupsSizeXError( new int [] 1 , 2 , 3 , 4 , 4 , 3 , 2 , 1 , 5 , 6 , 6 , 5 )); Assert.assertTrue(test.hasGroupsSizeXError( new int [] 1 , 2 , 3 , 4 , 4 , 3 , 2 , 1 )); Assert.assertFalse(test.hasGroupsSizeXError( new int [] 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 )); Assert.assertFalse(test.hasGroupsSizeXError( new int [] 1 , 2 , 3 , 4 , 4 )); Assert.assertFalse(test.hasGroupsSizeXError( new int [] 1 , 2 , 2 ));
|