Пример #1
0
        public void SaveFile()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.PsaFile.SaveFile("./Tests/GeneralTests/Out/SaveFile/FitMario.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/Data/FitMario.pac", "./Tests/GeneralTests/Out/SaveFile/FitMario.pac"));
        }
Пример #2
0
        public void AddOneCommandToSubActionWithNoExistingCommands(int subActionId, int codeBlockId, string comparisonFileName)
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.SubActionsHandler.AddCommand(subActionId, codeBlockId);
            psaMovesetParser.PsaFile.SaveFile($"./Tests/SubActionsTests/Out/Add/{comparisonFileName}");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical($"./Tests/SubActionsTests/ComparisonData/Add/{comparisonFileName}", $"./Tests/SubActionsTests/Out/Add/{comparisonFileName}"));
        }
Пример #3
0
        public void MoveCommandDownwardsThatHasParameters()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.ActionsHandler.MoveActionCommand(0, 0, 9, MoveDirection.DOWN);
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Move/FitMarioMoveCommandDownwards-CommandWithParametersSwapWithCommandWithNoParameters.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Move/FitMarioMoveCommandDownwards-CommandWithParametersSwapWithCommandWithNoParameters.pac", "./Tests/ActionsTests/Out/Move/FitMarioMoveCommandDownwards-CommandWithParametersSwapWithCommandWithNoParameters.pac"));
        }
Пример #4
0
        public void MoveCommandUpwards()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.ActionsHandler.MoveActionCommand(0, 0, 1, MoveDirection.UP);
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Move/FitMarioMoveCommandUpwards-BothCommandsHaveParameters.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Move/FitMarioMoveCommandUpwards-BothCommandsHaveParameters.pac", "./Tests/ActionsTests/Out/Move/FitMarioMoveCommandUpwards-BothCommandsHaveParameters.pac"));
        }
Пример #5
0
        public void RemoveOneCommandFromAction(int actionId, int codeBlockId, int commandIndex, string comparisonFileName)
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.ActionsHandler.RemoveCommandFromAction(actionId, codeBlockId, commandIndex);
            psaMovesetParser.PsaFile.SaveFile($"./Tests/ActionsTests/Out/Remove/{comparisonFileName}");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical($"./Tests/ActionsTests/ComparisonData/Remove/{comparisonFileName}", $"./Tests/ActionsTests/Out/Remove/{comparisonFileName}"));
        }
Пример #6
0
        public void RemoveCommandWithPointerFromAction()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.ActionsHandler.RemoveCommandFromAction(2, 0, 11);
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Remove/FitMarioRemoveCommandWithPointerInAction.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Remove/FitMarioRemoveCommandWithPointerInAction.pac", "./Tests/ActionsTests/Out/Remove/FitMarioRemoveCommandWithPointerInAction.pac"));
        }
Пример #7
0
        public void AddOneCommandToSubActionWithNoExistingCommandsWithExistingOffset()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.SubActionsHandler.AddCommand(0, 0);
            psaMovesetParser.PsaFile.SaveFile("./Tests/SubActionsTests/Out/Add/FitMarioOneCommandAddedWithNoExistingCommandsWithExistingOffset.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/SubActionsTests/ComparisonData/Add/FitMarioOneCommandAddedWithNoExistingCommandsWithExistingOffset.pac", "./Tests/SubActionsTests/Out/Add/FitMarioOneCommandAddedWithNoExistingCommandsWithExistingOffset.pac"));
        }
Пример #8
0
        public void AddCommandsToSubActionWithFreeSpaceInMiddleOfDataSection()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.SubActionsHandler.RemoveCommand(19, 0, 0);
            psaMovesetParser.SubActionsHandler.AddCommand(19, 0);
            psaMovesetParser.PsaFile.SaveFile("./Tests/SubActionsTests/Out/Add/FitMarioOneCommandAddedWithFreeSpaceInMiddleOfDataSection.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/SubActionsTests/ComparisonData/Add/FitMarioOneCommandAddedWithFreeSpaceInMiddleOfDataSection.pac", "./Tests/SubActionsTests/Out/Add/FitMarioOneCommandAddedWithFreeSpaceInMiddleOfDataSection.pac"));
        }
Пример #9
0
        public void AddTwoCommandsToActionWithExistingCommands()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.ActionsHandler.AddCommandToAction(0, 0);
            psaMovesetParser.ActionsHandler.AddCommandToAction(0, 0);
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Add/FitMarioTwoCommandsAdded.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Add/FitMarioTwoCommandsAdded.pac", "./Tests/ActionsTests/Out/Add/FitMarioTwoCommandsAdded.pac"));
        }
Пример #10
0
        public void RemoveCommandAtEndOfDataSection()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            psaMovesetParser.ActionsHandler.AddCommandToAction(6, 1);
            psaMovesetParser.ActionsHandler.RemoveCommandFromAction(6, 1, 3);
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Remove/FitMarioRemoveCommandAtEndOfDataSection.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Remove/FitMarioRemoveCommandAtEndOfDataSection.pac", "./Tests/ActionsTests/Out/Remove/FitMarioRemoveCommandAtEndOfDataSection.pac"));
        }
Пример #11
0
        public void ModifyCommandInActionWithParametersToCommandWithNoParameters()
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>();

            psaMovesetParser.ActionsHandler.ModifyActionCommand(0, 0, 0, new PsaCommand(917504, 25788, parameters));
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Modify/FitMarioModifyCommandWithParametersToCommandWithNoParameters.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Modify/FitMarioModifyCommandWithParametersToCommandWithNoParameters.pac", "./Tests/ActionsTests/Out/Modify/FitMarioModifyCommandWithParametersToCommandWithNoParameters.pac"));
        }
Пример #12
0
        public void RemoveAllCommandsFromSubAction()
        {
            PsaMovesetHandler psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");

            for (int i = 0; i < 5; i++)
            {
                psaMovesetParser.SubActionsHandler.RemoveCommand(70, 0, 0);
            }
            psaMovesetParser.PsaFile.SaveFile("./Tests/SubActionsTests/Out/Remove/FitMarioRemoveAllCommandsInSubAction.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/SubActionsTests/ComparisonData/Remove/FitMarioRemoveAllCommandsInSubAction.pac", "./Tests/SubActionsTests/Out/Remove/FitMarioRemoveAllCommandsInSubAction.pac"));
        }
Пример #13
0
        public void ModifyCommandInActionWithDifferentCommandWithSmallerParameterCount()
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>
            {
                new PsaCommandParameter(0, 0)
            };

            psaMovesetParser.ActionsHandler.ModifyActionCommand(0, 0, 0, new PsaCommand(67109120, 25788, parameters));
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Modify/FitMarioModifyCommandWithDifferentCommandWithSmallerParameterCount.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Modify/FitMarioModifyCommandWithDifferentCommandWithSmallerParameterCount.pac", "./Tests/ActionsTests/Out/Modify/FitMarioModifyCommandWithDifferentCommandWithSmallerParameterCount.pac"));
        }
Пример #14
0
        public void ModifyCommandInActionWithCommandThatHasPointerParameter()
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>
            {
                new PsaCommandParameter(2, 98464)
            };

            psaMovesetParser.ActionsHandler.ModifyActionCommand(0, 0, 0, new PsaCommand(459008, 103152, parameters));
            psaMovesetParser.PsaFile.SaveFile("./Tests/ActionsTests/Out/Modify/FitMarioModifyCommandInActionWithCommandThatHasPointerParameter.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/ActionsTests/ComparisonData/Modify/FitMarioModifyCommandInActionWithCommandThatHasPointerParameter.pac", "./Tests/ActionsTests/Out/Modify/FitMarioModifyCommandInActionWithCommandThatHasPointerParameter.pac"));
        }
Пример #15
0
        public void ModifyCommandInSubActionWithDifferentCommandWithSmallerParameterCount()
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>
            {
                new PsaCommandParameter(1, 2400000)
            };

            psaMovesetParser.SubActionsHandler.ModifyCommand(72, 0, 1, new PsaCommand(131328, 68456, parameters));
            psaMovesetParser.PsaFile.SaveFile("./Tests/SubActionsTests/Out/Modify/FitMarioModifyCommandWithDifferentCommandWithSmallerParameterCount.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/SubActionsTests/ComparisonData/Modify/FitMarioModifyCommandWithDifferentCommandWithSmallerParameterCount.pac", "./Tests/SubActionsTests/Out/Modify/FitMarioModifyCommandWithDifferentCommandWithSmallerParameterCount.pac"));
        }
Пример #16
0
        public void ModifyCommandInActionWithPointerParameter(int actionId, int codeBlockId, int commandIndex, string comparisonFileName)
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>
            {
                new PsaCommandParameter(0, 0),
                new PsaCommandParameter(6, 0)
            };

            psaMovesetParser.ActionsHandler.ModifyActionCommand(actionId, codeBlockId, commandIndex, new PsaCommand(33620480, 25788, parameters));
            psaMovesetParser.PsaFile.SaveFile($"./Tests/ActionsTests/Out/Modify/{comparisonFileName}");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical($"./Tests/ActionsTests/ComparisonData/Modify/{comparisonFileName}", $"./Tests/ActionsTests/Out/Modify/{comparisonFileName}"));
        }
Пример #17
0
        public void ModifyCommandInSubActionWithIdenticalCommandWithDifferentParameterTypes()
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>
            {
                new PsaCommandParameter(1, 39),
                new PsaCommandParameter(5, 2)
            };

            psaMovesetParser.SubActionsHandler.ModifyCommand(93, 0, 3, new PsaCommand(101188096, 73880, parameters));
            psaMovesetParser.PsaFile.SaveFile("./Tests/SubActionsTests/Out/Modify/FitMarioModifyCommandWithIdenticalCommandWithDifferentParameterTypes.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/SubActionsTests/ComparisonData/Modify/FitMarioModifyCommandWithIdenticalCommandWithDifferentParameterTypes.pac", "./Tests/SubActionsTests/Out/Modify/FitMarioModifyCommandWithIdenticalCommandWithDifferentParameterTypes.pac"));
        }
Пример #18
0
        public void ModifyCommandInSubActionWithNoParametersToCommandWithParameters()
        {
            PsaMovesetHandler          psaMovesetParser = WriteTestsHelper.GetPsaMovesetParser("./Tests/Data/FitMario.pac");
            List <PsaCommandParameter> parameters       = new List <PsaCommandParameter>
            {
                new PsaCommandParameter(0, 0),
                new PsaCommandParameter(6, 0)
            };

            psaMovesetParser.SubActionsHandler.ModifyCommand(72, 0, 5, new PsaCommand(33620480, 0, parameters));
            psaMovesetParser.PsaFile.SaveFile("./Tests/SubActionsTests/Out/Modify/FitMarioModifyCommandWithNoParametersToCommandWithParameters.pac");
            Assert.IsTrue(WriteTestsHelper.AreFilesIdentical("./Tests/SubActionsTests/ComparisonData/Modify/FitMarioModifyCommandWithNoParametersToCommandWithParameters.pac", "./Tests/SubActionsTests/Out/Modify/FitMarioModifyCommandWithNoParametersToCommandWithParameters.pac"));
        }