using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
private static uint LocalSelectionSelfTest()
{
LocalIdentity identity = new() { key = 42, body = 91, kind = 18, market = 123 };
identity.name[0] = (byte)'S';
var wanted = new LocalSelection { target = identity, generation = 7, epoch = 3, entity = 11, life = 0x1000, fsd = 0x2000, inputRoot = 0x3000 };
var observed = new LocalTargetObservation { target = identity, valid = true, tick = 1000, epoch = 3, entity = 11, world = 91, life = 0x1000, fsd = 0x2000, inputRoot = 0x3000 };
bool Accepted(LocalTargetObservation sample, ulong generation = 7, ulong now = 1100, ulong epoch = 3, bool overridden = false) => LocalSelectionAcknowledged(wanted, sample, generation, now, epoch, overridden);
uint passed = 0;
// No LocalFlightObservation is needed to confirm the original target.
if (Accepted(observed)) passed |= 1;
if (!Accepted(observed, generation: 6)) passed |= 2;
if (!Accepted(observed, now: 1201) && !Accepted(observed, now: 999)) passed |= 4;
if (!Accepted(observed, epoch: 4) && !Accepted(observed, overridden: true)) passed |= 8;
var other = observed; other.entity++; if (!Accepted(other)) passed |= 16;
other = observed; other.target.market++; if (!Accepted(other)) passed |= 32;
other = observed; other.world++; if (!Accepted(other)) passed |= 64;
other = observed; other.fsd++; var invalid = observed; invalid.valid = false;
if (!Accepted(other) && !Accepted(invalid)) passed |= 128;
return passed;
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint = "XFENavigationLocalSelectionSelfTest")]
internal static uint ExportLocalSelectionSelfTest() => RunTest(LocalSelectionSelfTest);
#endif
}
using System.Runtime.InteropServices;
namespace XFEEDToolBox.Plugin;
internal static unsafe partial class Navigation
{
private static uint LocalSelectionSelfTest()
{
LocalIdentity identity = new() { key = 42, body = 91, kind = 18, market = 123 };
identity.name[0] = (byte)'S';
var wanted = new LocalSelection { target = identity, generation = 7, epoch = 3, entity = 11, life = 0x1000, fsd = 0x2000, inputRoot = 0x3000 };
var observed = new LocalTargetObservation { target = identity, valid = true, tick = 1000, epoch = 3, entity = 11, world = 91, life = 0x1000, fsd = 0x2000, inputRoot = 0x3000 };
bool Accepted(LocalTargetObservation sample, ulong generation = 7, ulong now = 1100, ulong epoch = 3, bool overridden = false) => LocalSelectionAcknowledged(wanted, sample, generation, now, epoch, overridden);
uint passed = 0;
// No LocalFlightObservation is needed to confirm the original target.
if (Accepted(observed)) passed |= 1;
if (!Accepted(observed, generation: 6)) passed |= 2;
if (!Accepted(observed, now: 1201) && !Accepted(observed, now: 999)) passed |= 4;
if (!Accepted(observed, epoch: 4) && !Accepted(observed, overridden: true)) passed |= 8;
var other = observed; other.entity++; if (!Accepted(other)) passed |= 16;
other = observed; other.target.market++; if (!Accepted(other)) passed |= 32;
other = observed; other.world++; if (!Accepted(other)) passed |= 64;
other = observed; other.fsd++; var invalid = observed; invalid.valid = false;
if (!Accepted(other) && !Accepted(invalid)) passed |= 128;
return passed;
}
#if PLUGIN_NAVIGATION
[UnmanagedCallersOnly(EntryPoint = "XFENavigationLocalSelectionSelfTest")]
internal static uint ExportLocalSelectionSelfTest() => RunTest(LocalSelectionSelfTest);
#endif
}