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


C# DefaultSprakRunner.RunFunction方法代码示例

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


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

示例1: ElseIfStatementInsideFunction

        public void ElseIfStatementInsideFunction()
        {
            TextReader programString = File.OpenText("code78.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.RunFunction("Foo", new object[] { "Left" });

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

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

示例2: DontMissStatementAfterElseIfElse

        public void DontMissStatementAfterElseIfElse()
        {
            TextReader programString = File.OpenText("code79.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.RunFunction("Foo", new object[] { "Forward" });

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

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

示例3: CallFunctionFromOutside

        public void CallFunctionFromOutside()
        {
            TextReader programString = File.OpenText("code73.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();
            program.getCompileTimeErrorHandler().printErrorsToConsole();
            object result1 = program.RunFunction ("foo", new object[] {});
            object result2 = program.RunFunction ("bar", new object[] {});

            Console.WriteLine ("Result from foo: " + result1.ToString ());
            Console.WriteLine ("Result from bar: " + result2.ToString ());

            Assert.AreEqual (42, (int)(float)result1);
            Assert.AreEqual (127, (int)(float)result2);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:16,代码来源:DefaultSprakRunner_TEST.cs

示例4: CallFunctionFromOutsideWithArgument

        public void CallFunctionFromOutsideWithArgument()
        {
            TextReader programString = File.OpenText("code74.txt");
            DefaultSprakRunner program = new DefaultSprakRunner(programString);
            program.run();
            program.printOutputToConsole();
            program.getCompileTimeErrorHandler().printErrorsToConsole();

            object result = program.RunFunction ("double", new object[] { 40 });
            Console.WriteLine ("Result from double: " + result.ToString ());
            Assert.AreEqual (80, (int)(float)result);
        }
开发者ID:cyberis,项目名称:Sprak,代码行数:12,代码来源:DefaultSprakRunner_TEST.cs

示例5: RemoteFunctionCallShouldNotRunCodeInGlobalScope

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

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

            object result = program.RunFunction ("double", new object[] { 32 });

            Console.WriteLine ("Result from double: " + result.ToString ());
            Assert.AreEqual (64, (int)(float)result);

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


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