public void ScheduleOneSeqMixer(bool enableGC, bool enableOptimizations) { JSProgram program = new JSProgram(); program.AddInputBlock("a", 10); program.AddInputBlock("b", 10); program.AddMixerSegment("c", "a", 1, false, "b", 1, false); program.Finish(); (string, int)[] leftoverFluids = new (string, int)[]
public void ParseRepeatBlock() { JSProgram program = new JSProgram(); program.AddInputBlock("k", 10); program.AddOutputDeclarationBlock("z"); string conditionalBlock = program.AddConstantBlock(3); program.AddScope("a"); program.SetScope("a"); string guardedBlock = program.AddOutputSegment("k", "z", 1, false); program.SetScope(JSProgram.DEFAULT_SCOPE_NAME); program.AddRepeatSegment(conditionalBlock, guardedBlock); program.Finish(); TestTools.ExecuteJS(program); string xml = TestTools.GetWorkspaceString(); (CDFG cdfg, var _) = XmlParser.Parse(xml); Assert.AreEqual(2, cdfg.Nodes.Count); DFG <Block> firstDFG = cdfg.StartDFG; Assert.AreEqual(5, firstDFG.Nodes.Count); (var _, DFG <Block> lastDFG) = cdfg.Nodes.Where(x => x.dfg != firstDFG).Single(); Assert.AreEqual(1, lastDFG.Nodes.Count); }
public void ParseInputBlock() { JSProgram program = new JSProgram(); program.AddInputBlock("a", 20); TestTools.ExecuteJS(program); XmlNode node = TestTools.GetWorkspace(); ParserInfo parserInfo = new ParserInfo(); parserInfo.EnterDFG(); parserInfo.AddVariable("", VariableType.FLUID, "a"); InputDeclaration input = (InputDeclaration)XmlParser.ParseBlock(node, null, parserInfo, true); Assert.AreEqual(0, parserInfo.ParseExceptions.Count, parserInfo.ParseExceptions.FirstOrDefault()?.Message); Assert.AreEqual("a", input.OutputVariable); Assert.AreEqual(20, input.Amount); }