public void ExecuteAsyncSimple() { List <double> expect = new List <double>(); for (int i = 0; i < 1000; i++) { expect.Add(i); } List <double>[] stories = new List <double> [1000]; (ReportParser report, List <Token> tokens, List <string> commands) = Compile(Resources.AsyncSimple); for (int i = 0; i < stories.Length; i++) { StackMachinePrint stackMachine = new StackMachinePrint(); stackMachine.Execute(commands); stories[i] = stackMachine.PrintHistory; } for (int i = 0; i < stories.Length; i++) { Console.WriteLine(string.Join(" ", stories[i])); CollectionAssert.AreEquivalent(expect, stories[i]); } for (int i = 1; i < stories.Length; i++) { if (!stories[0].SequenceEqual(stories[i])) { return; } } Assert.Fail(); }
private static StackMachinePrint ExecuteResource(string resource, bool needOptimize = true) { StackMachinePrint stackMachine = new StackMachinePrint(); List <string> compiled = needOptimize ? CompileAndOptimizing(resource) : Compile(resource).Item3; stackMachine.Execute(compiled); return(stackMachine); }
private static StackMachinePrint ExecuteResource(string resource) { StackMachinePrint stackMachine = new StackMachinePrint(); List <string> compiled = Compile(resource).Item3; stackMachine.Execute(compiled); return(stackMachine); }