Exemplo n.º 1
0
        static (OptionsInstructionInfo[] testCases, HashSet <int> ignored) ReadAllInfos()
        {
            var filename = PathUtils.GetTestTextFilename("Options.txt", "Formatter");
            var ignored  = new HashSet <int>();

            return(OptionsTestsReader.ReadFile(filename, ignored).ToArray(), ignored);
        }
Exemplo n.º 2
0
        public static IEnumerable <object[]> GetFormatData(string formatterDir, string formattedStringsFile, string optionsFile = null)
        {
            OptionsInstructionInfo[] infos;
            HashSet <int>            ignored;

            if (optionsFile is null)
            {
                (infos, ignored) = FormatterOptionsTests.AllInfos;
            }
            else
            {
                var infosFilename = FileUtils.GetFormatterFilename(Path.Combine(formatterDir, optionsFile));
                ignored = new HashSet <int>();
                infos   = OptionsTestsReader.ReadFile(infosFilename, ignored).ToArray();
            }
            var formattedStrings = FileUtils.ReadRawStrings(Path.Combine(formatterDir, formattedStringsFile)).ToArray();

            formattedStrings = Utils.Filter(formattedStrings, ignored);
            if (infos.Length != formattedStrings.Length)
            {
                throw new ArgumentException($"(infos.Length) {infos.Length} != (formattedStrings.Length) {formattedStrings.Length} . infos[0].HexBytes = {(infos.Length == 0 ? "<EMPTY>" : infos[0].HexBytes)} & formattedStrings[0] = {(formattedStrings.Length == 0 ? "<EMPTY>" : formattedStrings[0])}");
            }
            var res = new object[infos.Length][];

            for (int i = 0; i < infos.Length; i++)
            {
                res[i] = new object[3] {
                    i, infos[i], formattedStrings[i]
                }
            }
            ;
            return(res);
        }
    }
Exemplo n.º 3
0
        public static IEnumerable <object[]> GetFormatData(string formatterDir, string formattedStringsFile, string optionsFile)
        {
            var infosFilename = FileUtils.GetFormatterFilename(Path.Combine(formatterDir, optionsFile));
            var ignored       = new HashSet <int>();
            var infos         = OptionsTestsReader.ReadFile(infosFilename, ignored).ToArray();

            return(GetFormatData(formatterDir, formattedStringsFile, infos, ignored));
        }
Exemplo n.º 4
0
        static OptionsInstructionInfo[] ReadAllInfos()
        {
            var filename = PathUtils.GetTestTextFilename("Options.txt", "Formatter");

            return(OptionsTestsReader.ReadFile(filename).ToArray());
        }