Fix "Non-serializable data" warnings

This commit is contained in:
TSR Berry 2023-07-09 02:42:09 +02:00
parent 620bfcb0f9
commit f9a41302f9
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2
4 changed files with 73 additions and 4 deletions

View file

@ -1,17 +1,36 @@
using ARMeilleure.CodeGen.Arm64;
using Xunit;
using Xunit.Abstractions;
namespace Ryujinx.Tests.Cpu
{
public class Arm64CodeGenCommonTests
{
public struct TestCase
public struct TestCase : IXunitSerializable
{
public ulong Value;
public bool Valid;
public int ImmN;
public int ImmS;
public int ImmR;
public void Deserialize(IXunitSerializationInfo info)
{
Value = info.GetValue<ulong>(nameof(Value));
Valid = info.GetValue<bool>(nameof(Valid));
ImmN = info.GetValue<int>(nameof(ImmN));
ImmS = info.GetValue<int>(nameof(ImmS));
ImmR = info.GetValue<int>(nameof(ImmR));
}
public void Serialize(IXunitSerializationInfo info)
{
info.AddValue(nameof(Value), Value, Value.GetType());
info.AddValue(nameof(Valid), Valid, Valid.GetType());
info.AddValue(nameof(ImmN), ImmN, ImmN.GetType());
info.AddValue(nameof(ImmS), ImmS, ImmS.GetType());
info.AddValue(nameof(ImmR), ImmR, ImmR.GetType());
}
}
private static readonly TestCase[] _testCases =

View file

@ -3,6 +3,7 @@
using ARMeilleure.State;
using System;
using Xunit;
using Xunit.Abstractions;
namespace Ryujinx.Tests.Cpu
{
@ -10,7 +11,7 @@ namespace Ryujinx.Tests.Cpu
public sealed class CpuTestAluBinary : CpuTest
{
#if AluBinary
public struct CrcTest
public struct CrcTest : IXunitSerializable
{
public uint Crc;
public ulong Value;
@ -25,6 +26,22 @@ namespace Ryujinx.Tests.Cpu
C = c;
Results = results;
}
public void Deserialize(IXunitSerializationInfo info)
{
Crc = info.GetValue<uint>(nameof(Crc));
Value = info.GetValue<ulong>(nameof(Value));
C = info.GetValue<bool>(nameof(C));
Results = info.GetValue<uint[]>(nameof(Results));
}
public void Serialize(IXunitSerializationInfo info)
{
info.AddValue(nameof(Crc), Crc, Crc.GetType());
info.AddValue(nameof(Value), Value, Value.GetType());
info.AddValue(nameof(C), C, C.GetType());
info.AddValue(nameof(Results), Results, Results.GetType());
}
}
#region "ValueSource (CRC32)"

View file

@ -3,6 +3,7 @@
using ARMeilleure.State;
using System;
using Xunit;
using Xunit.Abstractions;
namespace Ryujinx.Tests.Cpu
{
@ -11,7 +12,7 @@ namespace Ryujinx.Tests.Cpu
public sealed class CpuTestAluBinary32 : CpuTest32
{
#if AluBinary32
public struct CrcTest32
public struct CrcTest32 : IXunitSerializable
{
public uint Crc;
public uint Value;
@ -26,6 +27,22 @@ namespace Ryujinx.Tests.Cpu
C = c;
Results = results;
}
public void Deserialize(IXunitSerializationInfo info)
{
Crc = info.GetValue<uint>(nameof(Crc));
Value = info.GetValue<uint>(nameof(Value));
C = info.GetValue<bool>(nameof(C));
Results = info.GetValue<uint[]>(nameof(Results));
}
public void Serialize(IXunitSerializationInfo info)
{
info.AddValue(nameof(Crc), Crc, Crc.GetType());
info.AddValue(nameof(Value), Value, Value.GetType());
info.AddValue(nameof(C), C, C.GetType());
info.AddValue(nameof(Results), Results, Results.GetType());
}
}
#region "ValueSource (CRC32/CRC32C)"

View file

@ -1,9 +1,25 @@
using Xunit.Abstractions;
namespace Ryujinx.Tests.Cpu
{
public class PrecomputedThumbTestCase
public struct PrecomputedThumbTestCase : IXunitSerializable
{
public ushort[] Instructions;
public uint[] StartRegs;
public uint[] FinalRegs;
public void Deserialize(IXunitSerializationInfo info)
{
Instructions = info.GetValue<ushort[]>(nameof(Instructions));
StartRegs = info.GetValue<uint[]>(nameof(StartRegs));
FinalRegs = info.GetValue<uint[]>(nameof(FinalRegs));
}
public void Serialize(IXunitSerializationInfo info)
{
info.AddValue(nameof(Instructions), Instructions, Instructions.GetType());
info.AddValue(nameof(StartRegs), StartRegs, StartRegs.GetType());
info.AddValue(nameof(FinalRegs), FinalRegs, FinalRegs.GetType());
}
}
}