Beispiel #1
0
 private void IncrementalParse(int start, int end)
 {
     var setupText = File.ReadAllText("../../Input Files/Incremental/LogansRun_Setup.bdunit");
     var testText = File.ReadAllText("../../Input Files/Incremental/LogansRun_Tests.bdunit");
     var setupCharacters = setupText.ToCharArray();
     var testCharacters = testText.ToCharArray();
     var setupCount = setupCharacters.Length;
     var testCount = testCharacters.Length;
     var setupInput = string.Empty;
     var testInputs = new List<string>();
     for (var i = 0; i < setupCount; i++)
     {
         setupInput = string.Concat(setupInput, setupCharacters[i]);
         testInputs.Add(CreateInput(setupInput, null, "User"));
     }
     var testInput = string.Empty;
     for (var i = 0; i < testCount; i++)
     {
         testInput = string.Concat(testInput, testCharacters[i]);
         testInputs.Add(CreateInput(null, testInput, "User"));
     }
     var total = testInputs.Count;
     for (var i = start; i < end; i++)
     {
         var testInputToParse = testInputs[i];
         try
         {
             Debug.WriteLine(string.Format("Parsing and Converting {0} of {1}", i+1, total));
             var parser = new Parser(testInputToParse);
             parser.Parse(UnitTestFrameworkEnum.NUnit);
             Debug.WriteLine(string.Format("Successfully Parsed and Converted {0} of {1}", i + 1, total));
         }
         catch (Exception ex)
         {
             if (!(ex is DynamicParserExtensions.ParserErrorException))
             {
                 Debug.WriteLine(string.Format("Parse {0} of {1} Passed But AST Mapping Failed \nReason: {2}", i + 1, total, ex.Message));
             }
         }
     }
 }
Beispiel #2
0
 public void LogansRun_WithText()
 {
     var input = _input.Replace("\"\"", "\"");
     var grammar = _grammar.Replace("\"\"", "\"");
     var parser = new Parser(input);
     Debug.Write(parser.Parse(UnitTestFrameworkEnum.NUnit));
 }
Beispiel #3
0
 public void LogansRun_WithFile()
 {
     var paths = new Dictionary<string, string>();
     paths["input"] = "../../../Core/Inputs/LogansRun.bdunit";
     paths["grammar"] = "../../../Core/Grammar/TestWrapper.mg";
     var parser = new Parser(paths);
     Debug.Write(parser.Parse(UnitTestFrameworkEnum.NUnit));
 }