Execute() public method

public Execute ( IEnumerable parsedCommands, IExecutorToolset executorToolset ) : bool
parsedCommands IEnumerable
executorToolset IExecutorToolset
return bool
Exemplo n.º 1
0
        public void DeclareFewInt()
        {
            var executor = new ValidationExecutor();
            var commands =
               new StringBuilder()
                   .AppendLine("int a")
                   .AppendLine("int a");

            var parsedcommands = new Parser().ProcessCommands(commands.ToString());
            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }
Exemplo n.º 2
0
        public void InitNotDeclaredInt()
        {
            var executor = new ValidationExecutor();
            var commands =
                new StringBuilder()
                    .AppendLine("b = 1")
                    .AppendLine("if b then")
                    .AppendLine("stop")
                    .AppendLine("endif");

            var parsedcommands = new Parser().ProcessCommands(commands.ToString());
            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }
Exemplo n.º 3
0
        public void LonelyEndIf()
        {
            var executor = new ValidationExecutor();
            var commands=
                new StringBuilder(@"
                    int a
                    endif
                    a = 1
                        ");

            var parsedcommands = new Parser().ProcessCommands(commands.ToString());

            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }
Exemplo n.º 4
0
        public void ConditionIgnoreTest()
        {
            var executor = new ValidationExecutor();
            var commands =
               new StringBuilder()
                   .AppendLine("int b")
                   .AppendLine("b = -1")
                   .AppendLine("if b then")
                   .AppendLine("print a")
                   .AppendLine("endif");

            var parsedcommands = new Parser().ProcessCommands(commands.ToString());
            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }
Exemplo n.º 5
0
        public void MinusUsingNotInitInt()
        {
            var executor = new ValidationExecutor();
            var commands =
                new StringBuilder()
                    .AppendLine("int b")
                    .AppendLine("b = 1")
                    .AppendLine("int a")
                    .AppendLine("int c")
                    .AppendLine("c = a - b");

            var parsedcommands = new Parser().ProcessCommands(commands.ToString());
            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }