public static IEnumerable <object[]> GetTestCases(int bitness, int stackAddressSize) { var toRegister = ToEnumConverter.CloneRegisterDict(); switch (stackAddressSize) { case 16: toRegister.Add(MiscInstrInfoTestConstants.XSP, Register.SP); toRegister.Add(MiscInstrInfoTestConstants.XBP, Register.BP); break; case 32: toRegister.Add(MiscInstrInfoTestConstants.XSP, Register.ESP); toRegister.Add(MiscInstrInfoTestConstants.XBP, Register.EBP); break; case 64: toRegister.Add(MiscInstrInfoTestConstants.XSP, Register.RSP); toRegister.Add(MiscInstrInfoTestConstants.XBP, Register.RBP); break; default: throw new InvalidOperationException(); } for (int i = 0; i < IcedConstants.VMM_count; i++) { toRegister.Add(MiscInstrInfoTestConstants.VMM_prefix + i.ToString(), IcedConstants.VMM_first + i); } var filename = PathUtils.GetTestTextFilename($"InstructionInfoTest_{bitness}.txt", "InstructionInfo"); Debug.Assert(File.Exists(filename)); int lineNo = 0; foreach (var line in File.ReadLines(filename)) { lineNo++; if (line.Length == 0 || line.StartsWith("#")) { continue; } (string hexBytes, Code code, DecoderOptions options, InstructionInfoTestCase testCase)info; try { info = ParseLine(line, bitness, toRegister); } catch (Exception ex) { throw new Exception($"Invalid line {lineNo} ({filename}): {ex.Message}"); } if (info.testCase is object) { yield return new object[5] { info.hexBytes, info.code, info.options, lineNo, info.testCase } } ; } }