package test.leecode.array; import org.junit.Assert; import org.junit.Test; import cn.fansunion.leecode.array.RobotReturnToOrigin; /** * @author wen.lei@brgroup.com * * 2022-2-11 */ public class RobotReturnToOriginTest @Test public void test() RobotReturnToOrigin rrto = new RobotReturnToOrigin(); //my Assert.assertTrue(rrto.judgeCircle( "UDUDLRLR" )); Assert.assertTrue(rrto.judgeCircle( "UDLRLRUD" )); Assert.assertTrue(rrto.judgeCircle( "UD" )); Assert.assertTrue(rrto.judgeCircle( "LR" )); Assert.assertTrue(rrto.judgeCircle( "RL" )); Assert.assertFalse(rrto.judgeCircle( "UU" )); Assert.assertFalse(rrto.judgeCircle( "UDD" )); Assert.assertFalse(rrto.judgeCircle( "LRR" )); Assert.assertFalse(rrto.judgeCircle( "LRRLU" )); //官方方法 Assert.assertTrue(rrto.judgeCirclePoint( "UDUDLRLR" )); Assert.assertTrue(rrto.judgeCirclePoint( "UDLRLRUD" )); Assert.assertTrue(rrto.judgeCirclePoint( "UD" )); Assert.assertTrue(rrto.judgeCirclePoint( "LR" )); Assert.assertTrue(rrto.judgeCirclePoint( "RL" )); Assert.assertFalse(rrto.judgeCirclePoint( "UU" )); Assert.assertFalse(rrto.judgeCirclePoint( "UDD" )); Assert.assertFalse(rrto.judgeCirclePoint( "LRR" )); Assert.assertFalse(rrto.judgeCirclePoint( "LRRLU" ));
|