예제 #1
0
        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);
        }
예제 #2
0
        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)[]