mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-20 12:58:39 +00:00
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Cosmos.Debug.Common;
|
|
using Cosmos.IL2CPU;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace Cosmos.Core.VSTests
|
|
{
|
|
[TestClass]
|
|
public class FieldOrderTests
|
|
{
|
|
// the memory stuff requires DataLookupEntry.DataBlock to be the first field
|
|
[TestMethod]
|
|
public unsafe void TestFieldOrderingOfDataLookupEntry()
|
|
{
|
|
ILOp.mPlugManager = new PlugManager(delegate(Exception exception)
|
|
{
|
|
throw new Exception("Error: " + exception.Message, exception);
|
|
});
|
|
using (var xDbg = new DebugInfo(":memory:", true))
|
|
{
|
|
try
|
|
{
|
|
var xInfo = ILOp.GetFieldsInfo(typeof(DataLookupEntry), false).OrderBy(i => i.Offset).ToArray();
|
|
Assert.IsNotNull(xInfo);
|
|
Assert.AreEqual(3, xInfo.Length);
|
|
Assert.AreEqual(nameof(DataLookupEntry.DataBlock), xInfo[0].Field.Name);
|
|
}
|
|
finally
|
|
{
|
|
ILOp.mPlugManager = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|