本文整理汇总了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]);
}
示例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]);
}
示例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);
}
示例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);
}
示例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);
}