示例#1
0
        private void parseCSVDataSet(string filename, string knownfailsfile = null)
        {
            ISet <string> knownfails  = new HashSet <string>(readFormulaCSV(knownfailsfile));
            int           parseErrors = 0;
            var           LOCK        = new object();

            Parallel.ForEach(readFormulaCSV(filename), (formula, control, linenr) =>
            {
                if (parseErrors > MaxParseErrors)
                {
                    control.Stop();
                    return;
                }
                try
                {
                    ParserTests.test(formula);
                }
                catch (ArgumentException)
                {
                    if (!knownfails.Contains(formula))
                    {
                        lock (LOCK)
                        {
                            TestContext.WriteLine($"Failed parsing line {linenr} <<{formula}>>");
                            parseErrors++;
                        }
                    }
                }
            });
            if (parseErrors > 0)
            {
                Assert.Fail("Parse Errors on file " + filename);
            }
        }
示例#2
0
        private void ParseCsvDataSet(string filename, string knownFailsFile = null)
        {
            ISet <string> knownfails  = new HashSet <string>(ReadFormulaCsv(knownFailsFile));
            var           parseErrors = 0;
            var           lockObj     = new object();

            Parallel.ForEach(ReadFormulaCsv(filename), (formula, control, lineNumber) =>
            {
                if (parseErrors > MaxParseErrors)
                {
                    control.Stop();
                    return;
                }

                try
                {
                    ParserTests.Test(formula);
                }
                catch (ArgumentException)
                {
                    if (!knownfails.Contains(formula))
                    {
                        lock (lockObj)
                        {
#if !_NETCORE_
                            TestContext.WriteLine($"Failed parsing line {lineNumber} <<{formula}>>");
#endif
                            parseErrors++;
                        }
                    }
                }
            });
            if (parseErrors > 0)
            {
                Assert.Fail("Parse Errors on file " + filename);
            }
        }