using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
static uint GalaxyColonisationFactsSelfTest()
{
var memory=Platform.Allocate(16384);if(memory==0)return 0;
try
{
var table=memory+8192;var expected=unchecked(table-0x519D720);var source=memory+256;var galaxy=memory+2048;
var obj=memory+3072;var compact=memory+4096;
Write(source,table);Write(source-0x58,expected+0x519D5F0);Write(source-0x50,expected+0x519D620);
Write(table+0x38,expected+0x119A8D0);Write(galaxy,expected+0x5539C28);
var context=new GalaxyFilterContext{expectedImage=expected,colonisation=source};var services=new GalaxyServices{galaxy=galaxy};
uint passed=0;
if(GalaxyColonisationQuerySource(context,services))passed|=1;
Write(source,table+8);if(!GalaxyColonisationQuerySource(context,services))passed|=2;Write(source,table);
Write(source-0x58,expected+0x519D638);if(!GalaxyColonisationQuerySource(context,services))passed|=4;Write(source-0x58,expected+0x519D5F0);
Write(table+0x38,expected+0x119A8E0);if(!GalaxyColonisationQuerySource(context,services))passed|=8;Write(table+0x38,expected+0x119A8D0);
Write(galaxy,expected+0x5539C60);if(!GalaxyColonisationQuerySource(context,services))passed|=16;Write(galaxy,expected+0x5539C28);
Write(obj+0x20,2U);Write(obj+0x28,300UL);Write(obj+0x38,compact);Write(compact,300UL);
if(GalaxyColonisationLoadedObject(obj,300)&&!GalaxyColonisationLoadedObject(obj,301))passed|=32;
Write(obj+0x20,1U);var pending=!GalaxyColonisationLoadedObject(obj,300);Write(obj+0x20,2U);Write(compact,301UL);
if(pending&&!GalaxyColonisationLoadedObject(obj,300))passed|=64;
var frame=new Snapshot{valid=true,entity=42,referenceWorld=100};
var work=new GalaxyFilterFactsWork();var load=new GalaxyColonisationLoad{work=work,entity=42,currentSystem=100,started=100};
var before=!GalaxyColonisationLoadRetired(load,frame,2000);var expired=GalaxyColonisationLoadRetired(load,frame,2101);
load.readyAt=500;var ready=!GalaxyColonisationLoadRetired(load,frame,2101);work.cancelled=true;var cancelled=GalaxyColonisationLoadRetired(load,frame,600);
work.cancelled=false;frame.referenceWorld=101;var changed=GalaxyColonisationLoadRetired(load,frame,600);
if(GalaxyColonisationPending(12)&&GalaxyColonisationPending(13)&&GalaxyColonisationPending(14)&&
!GalaxyColonisationPending(0)&&!GalaxyColonisationPending(11)&&!GalaxyColonisationPending(null)&&before&&expired&&ready&&cancelled&&changed)passed|=128;
return passed;
}
finally{Platform.Free(memory);}
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyColonisationFactsSelfTest")]
internal static uint ExportGalaxyColonisationFactsSelfTest()=>RunTest(GalaxyColonisationFactsSelfTest);
#endif
}
using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
static uint GalaxyColonisationFactsSelfTest()
{
var memory=Platform.Allocate(16384);if(memory==0)return 0;
try
{
var table=memory+8192;var expected=unchecked(table-0x519D720);var source=memory+256;var galaxy=memory+2048;
var obj=memory+3072;var compact=memory+4096;
Write(source,table);Write(source-0x58,expected+0x519D5F0);Write(source-0x50,expected+0x519D620);
Write(table+0x38,expected+0x119A8D0);Write(galaxy,expected+0x5539C28);
var context=new GalaxyFilterContext{expectedImage=expected,colonisation=source};var services=new GalaxyServices{galaxy=galaxy};
uint passed=0;
if(GalaxyColonisationQuerySource(context,services))passed|=1;
Write(source,table+8);if(!GalaxyColonisationQuerySource(context,services))passed|=2;Write(source,table);
Write(source-0x58,expected+0x519D638);if(!GalaxyColonisationQuerySource(context,services))passed|=4;Write(source-0x58,expected+0x519D5F0);
Write(table+0x38,expected+0x119A8E0);if(!GalaxyColonisationQuerySource(context,services))passed|=8;Write(table+0x38,expected+0x119A8D0);
Write(galaxy,expected+0x5539C60);if(!GalaxyColonisationQuerySource(context,services))passed|=16;Write(galaxy,expected+0x5539C28);
Write(obj+0x20,2U);Write(obj+0x28,300UL);Write(obj+0x38,compact);Write(compact,300UL);
if(GalaxyColonisationLoadedObject(obj,300)&&!GalaxyColonisationLoadedObject(obj,301))passed|=32;
Write(obj+0x20,1U);var pending=!GalaxyColonisationLoadedObject(obj,300);Write(obj+0x20,2U);Write(compact,301UL);
if(pending&&!GalaxyColonisationLoadedObject(obj,300))passed|=64;
var frame=new Snapshot{valid=true,entity=42,referenceWorld=100};
var work=new GalaxyFilterFactsWork();var load=new GalaxyColonisationLoad{work=work,entity=42,currentSystem=100,started=100};
var before=!GalaxyColonisationLoadRetired(load,frame,2000);var expired=GalaxyColonisationLoadRetired(load,frame,2101);
load.readyAt=500;var ready=!GalaxyColonisationLoadRetired(load,frame,2101);work.cancelled=true;var cancelled=GalaxyColonisationLoadRetired(load,frame,600);
work.cancelled=false;frame.referenceWorld=101;var changed=GalaxyColonisationLoadRetired(load,frame,600);
if(GalaxyColonisationPending(12)&&GalaxyColonisationPending(13)&&GalaxyColonisationPending(14)&&
!GalaxyColonisationPending(0)&&!GalaxyColonisationPending(11)&&!GalaxyColonisationPending(null)&&before&&expired&&ready&&cancelled&&changed)passed|=128;
return passed;
}
finally{Platform.Free(memory);}
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint="XFENavigationGalaxyColonisationFactsSelfTest")]
internal static uint ExportGalaxyColonisationFactsSelfTest()=>RunTest(GalaxyColonisationFactsSelfTest);
#endif
}