AddressInfoTests.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using NUnit.Framework;
  2. using Ryujinx.Audio.Renderer.Server.MemoryPool;
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. namespace Ryujinx.Tests.Audio.Renderer.Server
  6. {
  7. class AddressInfoTests
  8. {
  9. [Test]
  10. public void EnsureTypeSize()
  11. {
  12. Assert.AreEqual(0x20, Unsafe.SizeOf<AddressInfo>());
  13. }
  14. [Test]
  15. public void TestGetReference()
  16. {
  17. MemoryPoolState[] memoryPoolState = new MemoryPoolState[1];
  18. memoryPoolState[0] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
  19. memoryPoolState[0].SetCpuAddress(0x1000000, 0x10000);
  20. memoryPoolState[0].DspAddress = 0x4000000;
  21. AddressInfo addressInfo = AddressInfo.Create(0x1000000, 0x1000);
  22. addressInfo.ForceMappedDspAddress = 0x2000000;
  23. Assert.AreEqual(0x2000000, addressInfo.GetReference(true));
  24. addressInfo.SetupMemoryPool(memoryPoolState.AsSpan());
  25. Assert.AreEqual(0x4000000, addressInfo.GetReference(true));
  26. }
  27. }
  28. }