当前位置: 首页>>代码示例>>C#>>正文


C# DefaultSprakRunner类代码示例

本文整理汇总了C#中DefaultSprakRunner的典型用法代码示例。如果您正苦于以下问题:C# DefaultSprakRunner类的具体用法?C# DefaultSprakRunner怎么用?C# DefaultSprakRunner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultSprakRunner类属于命名空间,在下文中一共展示了DefaultSprakRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Assignment

 public void Assignment()
 {
     StringReader programString = new StringReader("number a = 5");
     DefaultSprakRunner program = new DefaultSprakRunner(programString);
     program.run();
     Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
 }
开发者ID:substans,项目名称:Sprak,代码行数:7,代码来源:DefaultSprakRunner_TEST.cs

示例2: BasicArrayCreation

        public void BasicArrayCreation()
        {
            TextReader programString = File.OpenText("code55.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual("[3, 4, 5, 6]", program.Output[0]);
        }
开发者ID:substans,项目名称:Sprak,代码行数:10,代码来源:DefaultSprakRunner_TEST.cs

示例3: Bools

        public void Bools()
        {
            TextReader programString = File.OpenText("code48.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual("true", program.Output[0]);
            Assert.AreEqual("false", program.Output[1]);
        }
开发者ID:substans,项目名称:Sprak,代码行数:11,代码来源:DefaultSprakRunner_TEST.cs

示例4: AssigningToArray

        public void AssigningToArray()
        {
            TextReader programString = File.OpenText("code62.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual("abc", program.Output[0]);
            Assert.AreEqual("true", program.Output[1]);
            Assert.AreEqual("false", program.Output[2]);
            Assert.AreEqual("1", program.Output[3]);
            Assert.AreEqual("[1, 2, 3]", program.Output[4]);
        }
开发者ID:substans,项目名称:Sprak,代码行数:14,代码来源:DefaultSprakRunner_TEST.cs

示例5: AllowWhitespaceAsCommaInFunctionCall

        public void AllowWhitespaceAsCommaInFunctionCall()
        {
            TextReader programString = File.OpenText("code83.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);

            program.run();

            program.printOutputToConsole();
            program.getCompileTimeErrorHandler().printErrorsToConsole();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);

            Assert.AreEqual(1, program.Output.Count);
            Assert.AreEqual("500", program.Output[0]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:16,代码来源:DefaultSprakRunner_TEST.cs

示例6: AllowMissingTypesInArgumentDeclaration

        public void AllowMissingTypesInArgumentDeclaration()
        {
            StringReader programString = new StringReader(
                @"
            void f(x)

            end
            "
                );

            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();

            program.printOutputToConsole ();
            program.getCompileTimeErrorHandler().printErrorsToConsole ();
            program.getRuntimeErrorHandler().printErrorsToConsole ();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.Output.Count);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:21,代码来源:DefaultSprakRunner_TEST.cs

示例7: AllowPlusSignBeforeNumbers

        public void AllowPlusSignBeforeNumbers()
        {
            StringReader programString = new StringReader(
                @"
            var a = +10
            var b = -2
            print(a + b)
            "
                );

            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();

            program.printOutputToConsole ();
            program.getCompileTimeErrorHandler ().printErrorsToConsole ();
            program.getRuntimeErrorHandler ().printErrorsToConsole ();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.getRuntimeErrorHandler().getErrors().Count);
            Assert.AreEqual(1, program.Output.Count);
            Assert.AreEqual("8", program.Output[0]);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:22,代码来源:DefaultSprakRunner_TEST.cs

示例8: SimpleIFTest

 public void SimpleIFTest()
 {
     TextReader programString = File.OpenText("code42.txt");
     DefaultSprakRunner program = new DefaultSprakRunner(programString);
     program.run();
     program.printOutputToConsole();
 }
开发者ID:substans,项目名称:Sprak,代码行数:7,代码来源:DefaultSprakRunner_TEST.cs

示例9: SimpleFunctionCallInProgram

        public void SimpleFunctionCallInProgram()
        {
            TextReader programString = File.OpenText("code25.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);

            program.run();
            program.printOutputToConsole();

            Assert.AreEqual("42", program.Output[0]);
            Assert.AreEqual(1, program.Output.Count);
            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:12,代码来源:DefaultSprakRunner_TEST.cs

示例10: SimpleConditional

        public void SimpleConditional()
        {
            TextReader programString = File.OpenText("code36.txt");

            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();

            Assert.AreEqual("15", program.Output[0]);
            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:10,代码来源:DefaultSprakRunner_TEST.cs

示例11: ReturnFromMain

        public void ReturnFromMain()
        {
            TextReader programString = File.OpenText("code51.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.Output.Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:10,代码来源:DefaultSprakRunner_TEST.cs

示例12: LoopBasics

        public void LoopBasics()
        {
            TextReader programString = File.OpenText("code28.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();

            Assert.AreEqual(10, program.Output.Count);
            for (int i = 0; i < 10; i++)
            {
                Assert.AreEqual(i, Convert.ToInt32(program.Output[i]));
            }
            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:14,代码来源:DefaultSprakRunner_TEST.cs

示例13: TryingToBreakOutOfProgram

        public void TryingToBreakOutOfProgram()
        {
            TextReader programString = File.OpenText("code52.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();

            Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
            Assert.AreEqual(0, program.Output.Count);
        }
开发者ID:substans,项目名称:Sprak,代码行数:9,代码来源:DefaultSprakRunner_TEST.cs

示例14: SingleVariableAssignment

 public void SingleVariableAssignment()
 {
     TextReader programString = File.OpenText("code20.txt");
     DefaultSprakRunner program = new DefaultSprakRunner(programString);
     program.run();
     Assert.AreEqual("5", program.Output[0]);
     Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
 }
开发者ID:substans,项目名称:Sprak,代码行数:8,代码来源:DefaultSprakRunner_TEST.cs

示例15: CalculateSimple

 public void CalculateSimple()
 {
     StringReader programString = new StringReader("5 + 3");
     DefaultSprakRunner program = new DefaultSprakRunner(programString);
     program.run();
     Assert.AreEqual(0, program.getCompileTimeErrorHandler().getErrors().Count);
 }
开发者ID:substans,项目名称:Sprak,代码行数:7,代码来源:DefaultSprakRunner_TEST.cs


注:本文中的DefaultSprakRunner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。