Esempio 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
        }
Esempio n. 2
0
        private void CompareTextDocuments()
        {
            //Get document's lines as string
            var stringDocument = GetTextDocument(UnitTest.Compiler.CompilationResultsForProgram.CobolTextLines);

            //Compare with result file
            UnitTest.Compare(stringDocument);
        }
Esempio 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);
        }
Esempio 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
        }