Ejemplo n.º 1
0
        public void Check_BeforeAfterInsertionBatched()
        {
            Paths    paths = new Paths(Root, Root, Root + Path.DirectorySeparatorChar + "Simple.pgm", new Multipass.IndexNames());
            TestUnit unit  = new TestUnit(new Multipass(paths));

            unit.Init(new[] { ".pgm", ".cpy" });
            unit.Parse();

            var e = UpdateLine(TextChangeType.LineInserted, 2, "END PROGRAM Simple.");

            e = UpdateLine(TextChangeType.LineUpdated, 1, "PROGRAM-ID. Simpler.", e);

            // clear document
            unit.Compiler.CompilationResultsForProgram.UpdateTextLines(e);
            unit.Parse();

            var names = unit.Comparator.paths.Resultnames as Multipass.IndexNames;

            if (names != null)
            {
                names.index = 2;
            }
            Console.WriteLine("Compare with result file: " + unit.Comparator.paths.Result);
            unit.Compare();//with Simple.2.txt
        }
Ejemplo n.º 2
0
 /// <summary>
 /// This method will initialize the paths and the unit. It will also parse the tcbl program once.
 /// </summary>
 /// <param name="inputFileName">File name of the test</param>
 private void InitUnitTest(string inputFileName)
 {
     UnitTestPaths = new Paths(Root, Root, Root + Path.DirectorySeparatorChar + inputFileName, new Multipass.IndexNames());
     UnitTest      = new TestUnit(new Multipass(UnitTestPaths));
     UnitTest.Init(new[] { ".tcbl", ".cpy" });
     //Parser file for the first time
     UnitTest.Parse();
 }
Ejemplo n.º 3
0
        public void AntlrPerformanceProfiler()
        {
            Paths    paths = new Paths(AntlrFolder, AntlrFolder, AntlrFolder + Path.DirectorySeparatorChar + "AntlrTest.rdz.pgm", new AntlrName());
            TestUnit unit  = new TestUnit(new Multipass(paths));

            unit.Init(new[] { ".pgm", ".cpy" }, false, true);
            unit.Parse();

            unit.Compare(unit.Compiler.CompilationResultsForProgram.AntlrResult);
        }
Ejemplo n.º 4
0
        public void Check_BeforeAfterInsertion()
        {
            Paths    paths = new Paths(Root, Root, Root + Path.DirectorySeparatorChar + "Simple.pgm", new Multipass.IndexNames());
            TestUnit unit  = new TestUnit(new Multipass(paths));

            unit.Init(new[] { ".pgm", ".cpy" });
            unit.Parse();
            var names = unit.Comparator.paths.Resultnames as Multipass.IndexNames;

            if (names != null)
            {
                names.index = 0;
                unit.Compare();//with Simple.0.txt

                // explicitely close program by adding END PROGRAM line
                var e2 = UpdateLine(TextChangeType.LineInserted, 2, "END PROGRAM Simple.");
                var e  = UpdateLine(TextChangeType.LineUpdated, 1, "  PROGRAM-ID. Simple.");
                e.TextChanges.Add(e2.TextChanges[0]);
                unit.Compiler.CompilationResultsForProgram.UpdateTextLines(e);
                unit.Parse();
                names.index++;
                Console.WriteLine("Compare with result file: " + unit.Comparator.paths.Result);
                unit.Compare();//with Simple.1.txt

                // change program name ; now first and last line have differing program id
                e = UpdateLine(TextChangeType.LineUpdated, 1, "PROGRAM-ID. Simpler.");
                unit.Compiler.CompilationResultsForProgram.UpdateTextLines(e);
                unit.Parse();
                names.index++;
                Console.WriteLine("Compare with result file: " + unit.Comparator.paths.Result);
                unit.Compare();//with Simple.2.txt

                // clear document
                e = UpdateLine(TextChangeType.DocumentCleared, /* the following parameters are not used when DocumentCleared*/ 0, null);
                unit.Compiler.CompilationResultsForProgram.UpdateTextLines(e);
                unit.Parse();
                names.index++;
            }
            Console.WriteLine("Compare with result file: " + unit.Comparator.paths.Result);
            unit.Compare();//with Simple.3.txt
        }