本文整理汇总了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);
}
示例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]);
}
示例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]);
}
示例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]);
}
示例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]);
}
示例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);
}
示例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]);
}
示例8: SimpleIFTest
public void SimpleIFTest()
{
TextReader programString = File.OpenText("code42.txt");
DefaultSprakRunner program = new DefaultSprakRunner(programString);
program.run();
program.printOutputToConsole();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}