1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-21 16:02:05 +00:00
Ryujinx/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);
}
}
}