0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 18:05:46 +00:00
ryujinx-fork/Ryujinx.Memory.Tests/Tests.cs

42 lines
913 B
C#
Raw Normal View History

using NUnit.Framework;
using Ryujinx.Memory;
using System;
using System.Runtime.InteropServices;
namespace Ryujinx.Memory.Tests
{
public class Tests
{
private const ulong MemorySize = 0x8000;
private MemoryBlock _memoryBlock;
[SetUp]
public void Setup()
{
_memoryBlock = new MemoryBlock(MemorySize);
}
[TearDown]
public void Teardown()
{
_memoryBlock.Dispose();
}
[Test]
public void Test_Read()
{
Marshal.WriteInt32(_memoryBlock.Pointer, 0x2020, 0x1234abcd);
Assert.AreEqual(_memoryBlock.Read<int>(0x2020), 0x1234abcd);
}
[Test]
public void Test_Write()
{
_memoryBlock.Write(0x2040, 0xbadc0de);
Assert.AreEqual(Marshal.ReadInt32(_memoryBlock.Pointer, 0x2040), 0xbadc0de);
}
}
}