示例#1
0
        public void PrintNotInitInt()
        {
            var executor = new ValidationExecutor();
            var commands =
                new StringBuilder()
                .AppendLine("int a")
                .AppendLine("print a");

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

            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }
示例#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())));
        }
示例#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())));
        }
示例#4
0
        public void SkippedCloseCondition()
        {
            var executor = new ValidationExecutor();
            var commands =
                new StringBuilder()
                .AppendLine("int b")
                .AppendLine("b = 1")
                .AppendLine("if b then")
                .AppendLine("if b then")
                .AppendLine("print b")
                .AppendLine("endif");

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

            Assert.IsFalse(executor.Execute(parsedcommands, new ExecutorToolset(new Random())));
        }
示例#5
0
        private bool AssertValid()
        {
            var executor = new ValidationExecutor();

            return(executor.Execute(_commands, new ExecutorToolset(new Random())));
        }