Ejemplo n.º 1
0
        public void NewCobol85TestsToFix()
        {
            int nbOfTests = 0;

            string[] extensions = { "*.cbl", "*.pgm" };
            string[] compilerExtensions = extensions.Concat(new[] { "*.cpy" }).ToArray();
            foreach (string directory in GetCurrentAndSubDirectories(sampleRoot))
            {
                var dirname = Path.GetFileName(directory);

                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) +
                                         "]:");
                var folderTester = new FolderTester(sampleRoot, resultRoot, directory, extensions, compilerExtensions);
                folderTester.Test();
                nbOfTests += folderTester.GetTestCount();
                Console.Write("\n");
            }

            Console.Write("Number of tests: " + nbOfTests + "\n");
            Assert.IsTrue(nbOfTests > 0, "No tests found");

            //This test use TypeChecker which is specific to TypeCobol
            //As specifications of TypeCobol are not final yet this test can't be used
            //            TestParser.Check_ParserIntegration();
        }
Ejemplo n.º 2
0
        public void CheckParserCobol85()
        {
            TestTokenSource.Check_CobolCharStream();
            TestTokenSource.Check_CobolTokenSource();
            TestTokenSource.Check_CobolTokenSource_WithStartToken();

            // Test the recognition of potentially ambiguous CodeElements which begin with the same first Token
            TestCodeElements.Check("AT");
            TestCodeElements.Check("END");
            TestCodeElements.Check("NOT");
            TestCodeElements.Check("ON");
            // TO DO -> fix new identifier parsing :
            TestCodeElements.Check_DISPLAYCodeElements();
            TestCodeElements.Check_EXITCodeElements();
            TestCodeElements.Check_IDCodeElements();
            TestCodeElements.Check_UDWCodeElements();
            //            TestCodeElements.Check_WHENCodeElements(); //TODO: these cannot be parsed alone anymore since today

            TestCodeElements.Check_HeaderCodeElements();
            TestCodeElements.Check_IdentificationCodeElements();
            TestCodeElements.Check_ParagraphCodeElements();
            //TODO  TestCodeElements.Check_EntryCodeElements();// RefreshProgramClassDocumentSnapshot
            TestParser.Check_BeforeAfterInsertion();
            TestParser.Check_BeforeAfterInsertionBatched();

            var errors = new System.Collections.Generic.List<Exception>();
            int nbOfTests = 0;
            foreach (string directory in Directory.GetDirectories(sampleRoot)) {
                var dirname = Path.GetFileName(directory);
                string[] extensions = {"*.cbl"};
                if (dirname.Equals("Programs")) extensions = new[] {"*.pgm", "*.cbl", "*.cpy" };
                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(sampleRoot, resultRoot, directory, extensions);
                try { folderTester.Test(); }
                catch (Exception ex) { errors.Add(ex); }
                nbOfTests += folderTester.GetTestCount();
                Console.WriteLine();
            }

            Console.Write("Number of tests: " + nbOfTests + "\n");
            Assert.IsTrue(nbOfTests > 0, "No tests found");

            if (errors.Count > 0) {
                var str = new System.Text.StringBuilder();
                foreach(var ex in errors) str.Append(ex.Message);
                throw new Exception(str.ToString());
            }

            //This test use TypeChecker which is specific to TypeCobol
            //As specifications of TypeCobol are not final yet this test can't be used
            //            TestParser.Check_ParserIntegration();
        }
Ejemplo n.º 3
0
        public void CheckParserCobol85()
        {
            TestTokenSource.Check_CobolCharStream();
            TestTokenSource.Check_CobolTokenSource();
            TestTokenSource.Check_CobolTokenSource_WithStartToken();

            // Test the recognition of potentially ambiguous CodeElements which begin with the same first Token
            TestCodeElements.Check("AT");
            TestCodeElements.Check("END");
            TestCodeElements.Check("NOT");
            TestCodeElements.Check("ON");
            // TO DO -> fix new identifier parsing :
            TestCodeElements.Check_DISPLAYCodeElements();
            TestCodeElements.Check_EXITCodeElements();
            TestCodeElements.Check_IDCodeElements();
            TestCodeElements.Check_UDWCodeElements();
            TestCodeElements.Check_WHENCodeElements();

            TestCodeElements.Check_HeaderCodeElements();
            TestCodeElements.Check_IdentificationCodeElements();
            TestCodeElements.Check_ParagraphCodeElements();
            TestCodeElements.Check_EntryCodeElements();
            TestParser.Check_BeforeAfterInsertion();
            TestParser.Check_BeforeAfterInsertionBatched();

            var errors = new System.Collections.Generic.List<Exception>();
            int nbOfTests = 0;
            string[] extensions = { "*.cbl", "*.pgm" };
            string[] compilerExtensions = extensions.Concat(new[] { "*.cpy" }).ToArray();

            foreach (string directory in Directory.GetDirectories(sampleRoot)) {
                var dirname = Path.GetFileName(directory);

                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(sampleRoot, resultRoot, directory, extensions, compilerExtensions);
                try { folderTester.Test(); }
                catch (Exception ex) { errors.Add(ex); }
                nbOfTests += folderTester.GetTestCount();
                Console.WriteLine();
            }

            Console.Write("Number of tests: " + nbOfTests + "\n");
            Assert.IsTrue(nbOfTests > 0, "No tests found");

            if (errors.Count > 0) {
                var str = new System.Text.StringBuilder();
                foreach(var ex in errors) str.Append(ex.Message);
                throw new Exception(str.ToString());
            }
        }
Ejemplo n.º 4
0
        public void NewTcblTestsToFix()
        {
            int nbOfTests = 0;

            foreach (string directory in GetCurrentAndSubDirectories(sampleRoot))
            {
                var dirname = Path.GetFileName(directory);
                string[] extensions = { "*.tcbl", "*.cpy" };
                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(sampleRoot, resultRoot, directory, extensions);
                folderTester.Test();
                nbOfTests += folderTester.GetTestCount();
                Console.Write("\n");
            }
            Console.Write("Number of tests: " + nbOfTests + "\n");
            Assert.IsTrue(nbOfTests > 0, "No tests found");
        }
Ejemplo n.º 5
0
        public void CheckParserTcblPrograms()
        {
            int nbOfTests = 0;

            foreach (string directory in Directory.GetDirectories(sampleRoot))
            {
                var dirname = Path.GetFileName(directory);
                string[] extensions = { "*.tcbl" };
                if (dirname == "Programs") extensions = new[] { "*.tcbl", "*.cpy" };
                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(sampleRoot, resultRoot, directory, extensions);
                folderTester.Test();
                nbOfTests += folderTester.GetTestCount();
                Console.Write("\n");
            }
            Console.Write("Number of tests: " + nbOfTests + "\n");
            Assert.IsTrue(nbOfTests > 0, "No tests found");
        }