상속: ICommandDeclaration
예제 #1
0
 public void Accept(NewInt command)
 {
     if (_variables.ContainsKey(command.Name))
     {
         _isExecutable = false;
         return;
     }
     _variables[command.Name] = null;
 }
예제 #2
0
 public void Accept(NewInt command)
 {
     _builder.AppendLine($"int {command.Name}");
 }
예제 #3
0
        public void Accept(NewInt command)
        {
            if (!_conditions.Peek()) return;

            _variables[command.Name] = null;
        }
예제 #4
0
 private AddCommandMutation GetMutationForNewInt(ICommandsList commands, NewInt command, int indexToAdd)
 {
     var random = new AddRandom();
     random.TuneNewInt(command.Name, indexToAdd);
     return new AddCommandMutation(random, commands);
 }
예제 #5
0
        public void AddNewInt()
        {
            const string code = @"int ione
                                  int itwo";
            const int indexToAdd = 2;
            var commandToAdd = new NewInt("ithree");
            var commandsList = GenerateCommands(code);
            var mutation = GetMutationForNewInt(commandsList, commandToAdd, indexToAdd);

            mutation.Transform();

            const string resultCode = @"int ione
                                        int itwo
                                        int ithree";
            var resultCommandsList = GenerateCommands(resultCode);
            Assert.IsTrue(AreCollectionsEquals(commandsList, resultCommandsList));
        }
 public void Accept(NewInt command)
 {
     _isEqual = command.Name == (_second as NewInt).Name;
 }
예제 #7
0
 private ReplaceCommandMutation GetMutationForNewInt(ICommandsList commands, int replaceIndex, NewInt command)
 {
     var random = new ReplaceRandom();
     random.TuneNewInt(replaceIndex, command.Name);
     return new ReplaceCommandMutation(random, commands);
 }
예제 #8
0
        public void ReplaceNewInt()
        {
            const string code = @"int ione
                                  ione = 5
                                  int itwo
                                  itwo = 2";
            const int indexToReplace = 2;
            var commandToReplace = new NewInt("noname");
            var commands = GenerateCommands(code);
            var mutation = GetMutationForNewInt(commands, indexToReplace, commandToReplace);

            mutation.Transform();

            const string resultCode = @"int ione
                                       ione = 5
                                       int noname
                                       itwo = 2";
            var resultCommands = GenerateCommands(resultCode);
            Assert.IsTrue(AreCollectionsEquals(commands, resultCommands));
        }