Exemplo n.º 1
0
        public static void Check_BeforeAfterInsertionBatched()
        {
            Paths paths = new Paths(sampleRoot, resultRoot, sampleRoot + Path.DirectorySeparatorChar + "Programs" + 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;
            names.index = 2;
            Console.WriteLine("Compare with result file: "+unit.Comparator.paths.Result);
            unit.Compare();//with Simple.2.txt
        }
Exemplo n.º 2
0
        public static void Check_BeforeAfterInsertion()
        {
            Paths paths = new Paths(sampleRoot, resultRoot, sampleRoot + Path.DirectorySeparatorChar + "Programs" + 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;
            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
        }
Exemplo n.º 3
0
 public ProgramsComparator(Paths path, bool debug = false)
     : base(path, debug)
 {
 }
Exemplo n.º 4
0
 public Outputter(Paths path, bool debug = false)
     : base(path, debug)
 {
 }
Exemplo n.º 5
0
 public NYComparator(Paths path, bool debug = false)
     : base(path, debug)
 {
 }
Exemplo n.º 6
0
 public Multipass(Paths path, bool debug = false)
     : base(path, debug)
 {
 }
Exemplo n.º 7
0
 public ArithmeticComparator(Paths path, bool debug = false)
     : base(path, debug)
 {
 }
Exemplo n.º 8
0
        private IList<FilesComparator> GetComparators(string sampleRoot, string resultsRoot, string samplePath, bool debug)
        {
            IList<FilesComparator> comparators = new List<FilesComparator>();
            foreach (var names in Names)
            {

                //var paths = new Paths(sample, names);
                //paths.sextension = extensions[0];
                Paths path =new Paths(sampleRoot, resultsRoot, samplePath, names);
                if (System.IO.File.Exists(path.Result))
                {
                    Type type = names.GetComparatorType();
                    System.Reflection.ConstructorInfo constructor = type.GetConstructor(new[] { typeof(Paths), typeof(bool) });
                    comparators.Add((FilesComparator)constructor.Invoke(new object[] { path, debug }));
                }
            }
            return comparators;
        }
Exemplo n.º 9
0
 public FilesComparator(Paths path, bool debug = false)
 {
     paths = path;
     this.debug = debug;
 }