feat(headless): complete deterministic bot command parity
This commit is contained in:
parent
7e8acb74dd
commit
38e83640d9
37 changed files with 2805 additions and 295 deletions
|
|
@ -113,6 +113,33 @@ public sealed class HeadlessProcessSchedulerTests
|
|||
Assert.True(session.Runtime.Session.IsInWorld);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IdleDispatchBeforeDeadlineAllocatesNothingAndDoesNotTick()
|
||||
{
|
||||
var time = new ManualTimeProvider();
|
||||
var operations = new FixtureSessionOperations();
|
||||
using HeadlessSessionHost session =
|
||||
CreateSession("idle", time, operations);
|
||||
Assert.Equal(
|
||||
RuntimeSessionStartStatus.Connected,
|
||||
session.Start().Status);
|
||||
var scheduler = new HeadlessProcessScheduler([session], time);
|
||||
|
||||
for (int index = 0; index < 32; index++)
|
||||
Assert.False(scheduler.DispatchDue(time.GetTimestamp()));
|
||||
long before = GC.GetAllocatedBytesForCurrentThread();
|
||||
for (int index = 0; index < 100_000; index++)
|
||||
{
|
||||
if (scheduler.DispatchDue(time.GetTimestamp()))
|
||||
throw new InvalidOperationException("Idle session ticked.");
|
||||
}
|
||||
long allocated = GC.GetAllocatedBytesForCurrentThread() - before;
|
||||
|
||||
Assert.Equal(0L, allocated);
|
||||
Assert.Equal(0UL, session.Runtime.Clock.FrameNumber);
|
||||
Assert.Equal(0L, scheduler.CaptureSnapshot().TurnCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ProcessHostRunsMultipleSessionsOnOneScheduler()
|
||||
{
|
||||
|
|
@ -134,7 +161,7 @@ public sealed class HeadlessProcessSchedulerTests
|
|||
using var host = new HeadlessProcessHost(
|
||||
configuration,
|
||||
HeadlessPathSet.Resolve(new HeadlessPathOverrides()),
|
||||
new StringReader(
|
||||
new System.IO.StringReader(
|
||||
"first-password"
|
||||
+ Environment.NewLine
|
||||
+ "second-password"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue