Cleanup serialisation of test cases in CheatDecoderTests

This commit is contained in:
YoshiRulz 2021-03-26 18:46:15 +10:00
parent 3860199c52
commit 5dd7a66120
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 10 additions and 1 deletions

View File

@ -22,7 +22,16 @@ namespace BizHawk.Tests.Client.Common.cheats
=> GenerateNonsense ? NonsenseData : RealData;
public string GetDisplayName(MethodInfo methodInfo, object?[] data)
=> $"{methodInfo.Name}({string.Join(", ", data.Select(o => o is int i ? $"0x{i:X}" : o?.ToString() ?? "null"))})";
{
static string Format(object? o) => o switch
{
null => "null",
int i => $"0x{i:X}",
string s => $"\"{s}\"",
_ => o.ToString()!
};
return $"{methodInfo.Name}({string.Join(", ", data.Select(Format))})";
}
}
private const string ERROR_GBA_CODEBREAKER = "Codebreaker/GameShark SP/Xploder codes are not yet supported.";