Example #1
0
        public void EILegacyCheck()
        {
            string tempRoot       = root + Path.DirectorySeparatorChar + "EILegacy";
            string tempSampleRoot = tempRoot + Path.DirectorySeparatorChar + "Samples";
            string tempResultRoot = tempRoot + Path.DirectorySeparatorChar + "ResultFiles";

            int nbOfTests = 0;

            string[] extensions = { ".tcbl", ".cbl" };

            string[] compilerExtensions = extensions.Concat(new[] { ".cpy" }).ToArray();
            foreach (string directory in Directory.GetDirectories(tempRoot))
            {
                var dirname = Path.GetFileName(directory);

                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(tempSampleRoot, tempResultRoot, directory, extensions, compilerExtensions);

                folderTester.Test(false, false, true);

                nbOfTests += folderTester.GetTestCount();
                Console.Write("\n");
            }
            Console.Write("Number of tests: " + nbOfTests + "\n");
            Assert.IsTrue(nbOfTests > 0, "No tests found");
        }
Example #2
0
        public void CheckParserCobol85()
        {
            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(root))
            {
                var dirname = Path.GetFileName(directory);

                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(root, root, 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());
            }
        }
Example #3
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();
        }
Example #4
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());
            }
        }
Example #5
0
        public void CheckParserTcblPrograms()
        {
            int nbOfTests = 0;

            string[] extensions         = { ".tcbl" };
            string[] compilerExtensions = extensions.Concat(new[] { ".cpy" }).ToArray();
            foreach (string directory in Directory.GetDirectories(root))
            {
                var dirname = Path.GetFileName(directory);

                Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
                var folderTester = new FolderTester(root, root, 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");
        }
Example #6
0
        public void EILegacyCheck()
        {
            string tempRoot = PlatformUtils.GetPathForProjectFile("Parser" + Path.DirectorySeparatorChar + "EILegacy");

            int nbOfTests = 0;

            string[] extensions = { ".tcbl", ".cbl" };

            string[] compilerExtensions = extensions.Concat(new[] { ".cpy" }).ToArray();


            //Console.WriteLine("Entering directory \"" + dirname + "\" [" + string.Join(", ", extensions) + "]:");
            var folderTester = new FolderTester(tempRoot, tempRoot, tempRoot, extensions, compilerExtensions);

            folderTester.Test(false, false, true);

            nbOfTests += folderTester.GetTestCount();
            Console.Write("\n");

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