Exemple #1
0
        public void LoadStairTests(LogicPart logic, RMRules rules)
        {
            var yellowUp = new RMCommand[] {
                rules.Move(90),
                rules.Rotate(Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.UpLadder(),
            };

            var greenUp = new RMCommand[yellowUp.Length];
            yellowUp.CopyTo(greenUp, 0);
            greenUp[0] = rules.Move(140);

            AddTest(logic, "Stairs_YellowSuccess", PositionTest(-25, 80, 10, yellowUp));
            AddTest(logic, "Stairs_GreenFailure", PositionTest(25, 30, 10, greenUp));

            AddTest(logic, "Stairs_Scoring_Success", ScoreTest(15, yellowUp));
            AddTest(logic, "Stairs_Scoring_Failure", ScoreTest(0, greenUp));

            AddTest(logic, "Stairs_Scoring_UpWithoutCommand", ScoreTest(0,
                rules.Move(90),
                rules.Rotate(Angle.HalfPi),
                rules.Move(80),
                rules.Stand(0.1)
            ));
        }
        public void LoadTowerBuilderTests(LogicPart logic, RMRules rules)
        {
            AddTest(logic, "Tower_Grip_SingleDetail", TowerBuilderTest(
                1,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect()
            ));

            AddTest(logic, "Tower_Grip_MultipleDetails", TowerBuilderTest(
                2,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(15),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(1),
                rules.Collect()
            ));

            AddTest(logic, "Tower_Grip_LightBeforeStand", TowerBuilderTest(
                1,
                rules.Rotate(Angle.Pi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect()
            ));

            AddTest(logic, "Tower_Grip_LightAfterStand", TowerBuilderTest(
                1,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Rotate(Angle.Pi),
                rules.Move(25),
                rules.Rotate(Angle.HalfPi),
                rules.Move(75),
                rules.Stand(0.1),
                rules.Collect()
            ));

            AddTest(logic, "Tower_Release_SingleDetail", TowerBuilderTest(
                0,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Release_MultipleDetail", TowerBuilderTest(
                0,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(15),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Grip_AlreadyConnected", TowerBuilderTest(
                2,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(15),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.BuildTower(),
                rules.Collect()
            ));
        }
        public void LoadClapperboardDeployingTests(LogicPart logic, RMRules rules)
        {
            AddTest(logic, "Clapper_Scores_RightDeployer", ScoreTest(5,
                rules.Move(55),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(85),
                rules.Rotate(Angle.HalfPi),
                rules.Stand(0.1),
                rules.UseRightDeployer()
            ));

            AddTest(logic, "Clapper_Scores_LeftDeployer", ScoreTest(5,
                rules.Move(55),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(85),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.UseLeftDeployer()
            ));

            AddTest(logic, "Clapper_Scores_RemoteDeployingShouldBeFailure", ScoreTest(0,
                rules.Move(55),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.UseLeftDeployer()
            ));

            AddTest(logic, "Clapper_Scores_BackDeployingNotEnough", ScoreTest(0,
                rules.Move(50),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-85),
                rules.Stand(0.1),
                rules.UseLeftDeployer(),
                rules.UseRightDeployer()
            ));

            AddTest(logic, "Clapper_Scores_WrongDeployingObjects", ScoreTest(0,
                rules.Move(200),
                rules.Rotate(Angle.HalfPi),
                rules.Stand(0.1),
                rules.UseRightDeployer(),
                rules.Stand(0.1),
                rules.Rotate(Angle.HalfPi),
                rules.Move(125),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Rotate(Angle.HalfPi),
                rules.Stand(0.1),
                rules.UseRightDeployer()
            ));

            AddTest(logic, "Clapper_Scores_WrongClapperboardColor", ScoreTest(-10,
                rules.Move(25),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(85),
                rules.Rotate(Angle.HalfPi),
                rules.Stand(0.1),
                rules.UseRightDeployer()
            ));

            /* не работает, нужно поменять константы
             *
             * AddTest(logic, "Clapper_Scores_AllClapperboardsClose", ScoreTest(30,
             *     rules.Move(50),
             *     rules.Rotate(Angle.HalfPi),
             *     rules.Move(-90),
             *     rules.Rotate(Angle.HalfPi),
             *     rules.Move(45),
             *     rules.Stand(0.1),
             *     rules.UseLeftDeployer(),
             *     rules.Stand(0.1),
             *     rules.Move(-25),
             *     rules.Stand(0.1),
             *     rules.UseLeftDeployer(),
             *     rules.Stand(0.1),
             *     rules.Move(-25),
             *     rules.Stand(0.1),
             *     rules.UseLeftDeployer(),
             *     rules.Stand(0.1),
             *     rules.Rotate(-Angle.HalfPi),
             *     rules.Move(40),
             *     rules.Rotate(-Angle.HalfPi),
             *     rules.Move(150),
             *     rules.Rotate(-Angle.HalfPi),
             *     rules.Move(40),
             *     rules.Rotate(Angle.HalfPi),
             *     rules.Stand(0.1),
             *     rules.UseRightDeployer(),
             *     rules.Move(-25),
             *     rules.Stand(0.1),
             *     rules.UseRightDeployer(),
             *     rules.Move(-25),
             *     rules.Stand(0.1),
             *     rules.UseRightDeployer()
             * ));
             */
        }
        public void LoadPopCornScoringTests(LogicPart logic, RMRules rules)
        {
            AddTest(logic, "PopCorn_Scores_StartingArea", ScoreTest(
                4,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-54),
                rules.Stand(0.1),
                rules.Release()
            ));

            AddTest(logic, "PopCorn_Scores_UpperCinema", ScoreTest(
                4,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(130),
                rules.Rotate(Angle.HalfPi),
                rules.Move(40),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(60),
                rules.Stand(0.1),
                rules.Release()
            ));

            AddTest(logic, "PopCorn_Scores_BottomCinema", ScoreTest(
                4,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(130),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(40),
                rules.Rotate(Angle.HalfPi),
                rules.Move(60),
                rules.Stand(0.1),
                rules.Release()
            ));

            AddTest(logic, "PopCorn_Scores_BuildingArea", ScoreTest(
                0,
                rules.Move(115),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-60),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Move(-15),
                rules.Stand(0.1),
                rules.Release(),
                rules.Move(40),
                rules.Stand(0.1)
            ));

            AddTest(logic, "PopCorn_Scores_TwoCupsSameLocation", ScoreTest(
                4,
                rules.Move(115),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-60),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Move(60),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-115),
                rules.Stand(0.1),
                rules.Release(),
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-40),
                rules.Stand(0.1),
                rules.Release()
            ));

            AddTest(logic, "PopCorn_Scores_TwoCupsDiffLocations", ScoreTest(
                4 + 4,
                rules.Move(115),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-60),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Move(60),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-115),
                rules.Stand(0.1),
                rules.Release(),
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(130),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(40),
                rules.Rotate(Angle.HalfPi),
                rules.Move(60),
                rules.Stand(0.1),
                rules.Release()
            ));

            AddTest(logic, "PopCorn_Scores_GrippedShouldBeZero", ScoreTest(
                0,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-64),
                rules.Stand(0.1)
            ));

            AddTest(logic, "PopCorn_Scores_FilledCup", ScoreTest(
                5,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-70),
                rules.Stand(0.1),
                rules.GetPopCorn(),
                rules.Move(70),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-10),
                rules.Stand(0.1),
                rules.Release()
            ));

            AddTest(logic, "PopCorn_Scores_TwoCupsFilled", ScoreTest(
                5,
                rules.Move(115),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-60),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Move(60),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-115),
                rules.Stand(0.1),
                rules.Release(),
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-70),
                rules.Stand(0.1),
                rules.GetPopCorn(),
                rules.Move(70),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-10),
                rules.Stand(0.1),
                rules.Release()
            ));
        }
        public void LoadTowerScoringTests(LogicPart logic, RMRules rules)
        {
            AddTest(logic, "Tower_Scores_Zero", ScoreTest(
                0,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_BottomBuildingArea", ScoreTest(
                2,
                rules.Move(100),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(50),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_StartingAreaSquare", ScoreTest(
                2,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-25),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(65),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_StartingAreaCircle", ScoreTest(
                2,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-25),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(35),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_BuildingInYellowSquare", ScoreTest(
                0,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(20),
                rules.Rotate(Angle.HalfPi),
                rules.Move(170),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_BigTower", ScoreTest(
                2 * 2,
                rules.Move(65),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(15),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(1),
                rules.Collect(),
                rules.Move(20),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(30),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_TowerWithLight", ScoreTest(
                2 + 3,
                rules.Rotate(Angle.Pi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Rotate(Angle.Pi),
                rules.Move(105),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(50),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_BigTowerWithLight", ScoreTest(
                (2 + 3) * 2,
                rules.Rotate(Angle.Pi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Rotate(Angle.Pi),
                rules.Move(75),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(15),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(1),
                rules.Collect(),
                rules.Move(20),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(30),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_LightWithoutStands", ScoreTest(
                0,
                rules.Rotate(Angle.Pi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-10),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_ScamTest", ScoreTest(
                2,
                rules.Move(100),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-25),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(90),
                rules.Stand(0.1),
                rules.BuildTower(),
                rules.Collect(),
                rules.BuildTower(),
                rules.Collect(),
                rules.BuildTower(),
                rules.Collect(),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_InvalidStandPenalty", ScoreTest(
                -10,
                rules.Move(135),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect()
            ));

            AddTest(logic, "Tower_Scores_TwoTowersOneLocation", ScoreTest(
                (2 + 3) * 2 /* 2-level spotlight with bonus */ + (2 + 0) * 1 /* one level spotlight, no bonus */,
                rules.Rotate(Angle.Pi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-74),
                rules.Rotate(Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-25),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(44),
                rules.Stand(0.1),
                rules.BuildTower(),
                rules.Move(-10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(85),
                rules.Rotate(Angle.HalfPi),
                rules.Move(50),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(30),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(35),
                rules.Rotate(Angle.HalfPi),
                rules.Move(50),
                rules.Stand(0.1),
                rules.BuildTower()
            ));

            AddTest(logic, "Tower_Scores_TwoTowersTwoLocations", ScoreTest(
                (2 + 3) * 2 + (2 + 3) * 1,
                rules.Rotate(Angle.Pi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-74),
                rules.Rotate(Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(-25),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(44),
                rules.Stand(0.1),
                rules.BuildTower(),
                rules.Move(-10),
                rules.Rotate(Angle.HalfPi),
                rules.Move(85),
                rules.Rotate(Angle.HalfPi),
                rules.Move(50),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(10),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(30),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Collect(),
                rules.Move(10),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(25),
                rules.Stand(0.1),
                rules.BuildTower()
            ));
        }
        public void LoadPopCornFillingTests(LogicPart logic, RMRules rules)
        {
            AddTest(logic, "PopCorn_Scores_SensorWorking", PopCornTest(
                4,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip()
            ));

            AddTest(logic, "PopCorn_Filling_CheckWorking", PopCornTest(
                4 + 1,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-70),
                rules.Stand(0.1),
                rules.GetPopCorn()
            ));

            AddTest(logic, "PopCorn_Filling_Backward", PopCornTest(
                4,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(Angle.HalfPi),
                rules.Move(70),
                rules.Stand(0.1),
                rules.GetPopCorn()
            ));

            AddTest(logic, "PopCorn_Filling_DispenserLimit", PopCornTest(
                4 + 5, // not 4 + 6 !
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-70),
                rules.Stand(0.1),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn()
            ));

            AddTest(logic, "PopCorn_Filling_CupLimit", PopCornTest(
                10,
                rules.Move(64),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.Grip(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-70),
                rules.Stand(0.1),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.Rotate(Angle.HalfPi),
                rules.Move(-30),
                rules.Rotate(-Angle.HalfPi),
                rules.Stand(0.1),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn()
            ));

            AddTest(logic, "PopCorn_Filling_EmptyGripper", PopCornTest(
                0,
                rules.Move(34),
                rules.Rotate(-Angle.HalfPi),
                rules.Move(-75),
                rules.Stand(0.1),
                rules.GetPopCorn(),
                rules.GetPopCorn(),
                rules.GetPopCorn()
            ));
        }