Convert system CPU test to xUnit

This commit is contained in:
TSR Berry 2023-07-08 20:48:34 +02:00
commit 2c884075ca
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2

View file

@ -1,5 +1,8 @@
// #define System #define System
using ARMeilleure.State;
using System;
using System.Collections.Generic;
using Xunit; using Xunit;
namespace Ryujinx.Tests.Cpu namespace Ryujinx.Tests.Cpu
@ -17,10 +20,10 @@ namespace Ryujinx.Tests.Cpu
yield return 0x8000000000000000ul; yield return 0x8000000000000000ul;
yield return 0xFFFFFFFFFFFFFFFFul; yield return 0xFFFFFFFFFFFFFFFFul;
bool v = TestContext.CurrentContext.Random.NextBool(); bool v = Random.Shared.NextBool();
bool c = TestContext.CurrentContext.Random.NextBool(); bool c = Random.Shared.NextBool();
bool z = TestContext.CurrentContext.Random.NextBool(); bool z = Random.Shared.NextBool();
bool n = TestContext.CurrentContext.Random.NextBool(); bool n = Random.Shared.NextBool();
ulong rnd = 0UL; ulong rnd = 0UL;
@ -44,19 +47,25 @@ namespace Ryujinx.Tests.Cpu
} }
#endregion #endregion
[Test, Pairwise] private static readonly uint[] _testData_rt =
public void MrsMsr_Nzcv([ValueSource(nameof(_MrsMsr_Nzcv_))] uint opcodes, {
[Values(0u, 1u, 31u)] uint rt, 0u, 1u, 31u,
[ValueSource(nameof(_GenNzcv_))] ulong xt) };
public static readonly MatrixTheoryData<uint, uint, ulong> TestData = new(_MrsMsr_Nzcv_(), _testData_rt, _GenNzcv_());
[Theory]
[MemberData(nameof(TestData))]
public void MrsMsr_Nzcv(uint opcodes, uint rt, ulong xt)
{ {
opcodes |= (rt & 31) << 0; opcodes |= (rt & 31) << 0;
bool v = TestContext.CurrentContext.Random.NextBool(); bool v = Random.Shared.NextBool();
bool c = TestContext.CurrentContext.Random.NextBool(); bool c = Random.Shared.NextBool();
bool z = TestContext.CurrentContext.Random.NextBool(); bool z = Random.Shared.NextBool();
bool n = TestContext.CurrentContext.Random.NextBool(); bool n = Random.Shared.NextBool();
ulong x31 = TestContext.CurrentContext.Random.NextULong(); ulong x31 = Random.Shared.NextULong();
SingleOpcode(opcodes, x0: xt, x1: xt, x31: x31, overflow: v, carry: c, zero: z, negative: n); SingleOpcode(opcodes, x0: xt, x1: xt, x31: x31, overflow: v, carry: c, zero: z, negative: n);