public void BoolInputOutput() { var(intIn, verifyIntIn) = BasicInputOutput.ToInput(new double[] { }); var(stringIn, verifyStringIn) = BasicInputOutput.ToInput(new string[] { }); var(boolIn, verifyBoolIn) = BasicInputOutput.ToInput(new bool[] { true }); var(intOut, verifyIntOut) = BasicInputOutput.ToOutput(new double[] { }); var(stringOut, verifyStringOut) = BasicInputOutput.ToOutput(new string[] { }); var(boolOut, verifyBoolOut) = BasicInputOutput.ToOutput(new bool[] { true }); Tac.Runner.Runner.Run("test", new[] { BasicInputOutput.Input(intIn, stringIn, boolIn), BasicInputOutput.Output(intOut, stringOut, boolOut) }, @" entry-point { new-empty > (in.read-bool) > (out.write-bool); };"); verifyIntIn(); verifyStringIn(); verifyBoolIn(); verifyIntOut(); verifyStringOut(); verifyBoolOut(); }
public void MultiplyCompact() { var(intIn, verifyIntIn) = BasicInputOutput.ToOutput(new double[] { 4.0, 6.0, 8.0, 10.0 }); var(stringIn, verifyStringIn) = BasicInputOutput.ToOutput(new string[] { }); var(boolIn, verifyBoolIn) = BasicInputOutput.ToOutput(new bool[] { }); Tac.Runner.Runner.Run("test", new[] { BasicInputOutput.Output(intIn, stringIn, boolIn) }, @"entry-point{2*2>(out.write-number);3*2>(out.write-number);4*2>(out.write-number);5*2>(out.write-number);};"); verifyIntIn(); verifyStringIn(); verifyBoolIn(); }
public void StringOutput() { var(intIn, verifyIntIn) = BasicInputOutput.ToOutput(new double[] { }); var(stringIn, verifyStringIn) = BasicInputOutput.ToOutput(new string[] { "hello world" }); var(boolIn, verifyBoolIn) = BasicInputOutput.ToOutput(new bool[] { }); Tac.Runner.Runner.Run("test", new[] { BasicInputOutput.Output(intIn, stringIn, boolIn) }, @" entry-point { ""hello world"" > (out.write-string); };"); verifyIntIn(); verifyStringIn(); verifyBoolIn(); }
public void NumberOutput() { var(intIn, verifyIntIn) = BasicInputOutput.ToOutput(new double[] { 2.0 }); var(stringIn, verifyStringIn) = BasicInputOutput.ToOutput(new string[] { }); var(boolIn, verifyBoolIn) = BasicInputOutput.ToOutput(new bool[] { }); Tac.Runner.Runner.Run("test", new[] { BasicInputOutput.Output(intIn, stringIn, boolIn) }, @" entry-point { 2 > (out.write-number); };"); verifyIntIn(); verifyStringIn(); verifyBoolIn(); }
public void LessThen() { var(intIn, verifyIntIn) = BasicInputOutput.ToOutput(new double[] { }); var(stringIn, verifyStringIn) = BasicInputOutput.ToOutput(new string[] { }); var(boolIn, verifyBoolIn) = BasicInputOutput.ToOutput(new bool[] { true, false, false }); Tac.Runner.Runner.Run("test", new[] { BasicInputOutput.Output(intIn, stringIn, boolIn) }, @" entry-point { 1 <? 2 > (out.write-bool); 2 <? 2 > (out.write-bool); 3 <? 2 > (out.write-bool); };"); verifyIntIn(); verifyStringIn(); verifyBoolIn(); }
public void OrType2() { var(intIn, verifyIntIn) = BasicInputOutput.ToOutput(new double[] { }); var(stringIn, verifyStringIn) = BasicInputOutput.ToOutput(new string[] { }); var(boolIn, verifyBoolIn) = BasicInputOutput.ToOutput(new bool[] { false, true, true }); Tac.Runner.Runner.Run("test", new[] { BasicInputOutput.Output(intIn, stringIn, boolIn) }, @" entry-point { true =: (bool|int) x; x ?=: int y > (out.write-bool); x ?=: bool z > (out.write-bool); z > (out.write-bool); };"); verifyIntIn(); verifyStringIn(); verifyBoolIn(); }