static SymbolResolverTestCase ParseLine(string line) { var elems = line.Split(commaSeparator); const int SYM_RES_INDEX = 4; if (elems.Length < SYM_RES_INDEX) { throw new Exception($"Invalid number of commas: {elems.Length - 1}"); } var bitness = NumberConverter.ToInt32(elems[0].Trim()); var hexBytes = elems[1].Trim(); var code = ToEnumConverter.GetCode(elems[2].Trim()); var options = new List <(OptionsProps property, object value)>(); foreach (var part in elems[3].Split(spaceSeparator, StringSplitOptions.RemoveEmptyEntries)) { options.Add(OptionsParser.ParseOption(part)); } var symbolResults = new SymbolResultTestCase[elems.Length - SYM_RES_INDEX]; for (int i = 0; i < symbolResults.Length; i++) { var symParts = elems[SYM_RES_INDEX + i].Split(semicolonSeparator); if (symParts.Length != 5) { throw new Exception($"Invalid number of semicolons: {symParts.Length - 1}"); } var address = NumberConverter.ToUInt64(symParts[0].Trim()); var symbolAddress = NumberConverter.ToUInt64(symParts[1].Trim()); var addressSize = NumberConverter.ToInt32(symParts[2].Trim()); var symbolParts = symParts[3].Split(barSeparator); MemorySize?memorySize = null; var flags = SymbolFlags.None; foreach (var value in symParts[4].Split(spaceSeparator, StringSplitOptions.RemoveEmptyEntries)) { if (Dicts.ToSymbolFlags.TryGetValue(value, out var f)) { flags |= f; } else { if (!ToEnumConverter.TryMemorySize(value, out var memSize)) { throw new Exception($"Invalid value: {value}"); } memorySize = memSize; } } symbolResults[i] = new SymbolResultTestCase(address, symbolAddress, addressSize, flags, memorySize, symbolParts); } return(new SymbolResolverTestCase(bitness, hexBytes, code, options.ToArray(), symbolResults)); }
public SymbolResultTestCase(ulong address, ulong symbolAddress, int addressSize, SymbolFlags flags, MemorySize?memorySize, string[] symbolParts) { Address = address; SymbolAddress = symbolAddress; AddressSize = addressSize; Flags = flags; MemorySize = memorySize; SymbolParts = symbolParts; }