Beispiel #1
0
 private void ProcessDir(string dir, PrintUnitTestDelegate unitTestPrinter)
 {
     foreach (string file in Directory.GetFiles(dir, "*.s", SearchOption.AllDirectories))
     {
         Console.WriteLine($"  FILE => {file}");
         using (StreamReader rdr = File.OpenText(file))
         {
             var asmFile = new LLVMTestConverter(rdr, unitTestPrinter, out bool success);
             if (!success)
             {
                 continue;
             }
         }
     }
 }
Beispiel #2
0
        public LLVMTestConverter(StreamReader rdr, PrintUnitTestDelegate unitTestPrinter, out bool success)
        {
            this.rdr = rdr;
            DetectCommentStyle();

            while (!stopHandling)
            {
                string line = ReadLine(out LineType type);
                if (line == null)
                {
                    break;
                }

                if (line == string.Empty)
                {
                    continue;
                }

                long pos = rdr.GetActualPosition();

                switch (type)
                {
                case LineType.Comment:
                    if (HandleComment(line, out CommentSubType modifier))
                    {
                        unitTestPrinter.Invoke(Check, Encoding, modifier);
                    }
                    else
                    {
                        Seek(pos, SeekOrigin.Begin);
                    }
                    break;

                case LineType.Assembly:
                    break;

                case LineType.Invalid:
                    throw new InvalidDataException("Failed to load source");
                }
            }

            success = !stopHandling;
        }