public void Accept(NewInt command) { if (_variables.ContainsKey(command.Name)) { _isExecutable = false; return; } _variables[command.Name] = null; }
public void Accept(NewInt command) { _builder.AppendLine($"int {command.Name}"); }
public void Accept(NewInt command) { if (!_conditions.Peek()) return; _variables[command.Name] = null; }
private AddCommandMutation GetMutationForNewInt(ICommandsList commands, NewInt command, int indexToAdd) { var random = new AddRandom(); random.TuneNewInt(command.Name, indexToAdd); return new AddCommandMutation(random, commands); }
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; }
private ReplaceCommandMutation GetMutationForNewInt(ICommandsList commands, int replaceIndex, NewInt command) { var random = new ReplaceRandom(); random.TuneNewInt(replaceIndex, command.Name); return new ReplaceCommandMutation(random, commands); }
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)); }