Parse the complete PhysicsDesc plus F754/F755 packets, correct every PhysicsState bit, and gate all nine retail update channels with generation-safe immutable snapshots. Preserve ForcePosition, teleport, placement, velocity, parent, pickup, delete, and same-generation CreateObject ordering from the named client. Separate accepted logical lifecycle notifications from retained UI qualities, make GUID replacement and session reset clear every projection exactly once, and add packet, wraparound, malformed-input, parent FIFO, canonical-position, reconnect, and GUID-reuse conformance coverage. Co-Authored-By: Codex <noreply@openai.com>
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Buffers.Binary;
|
|
using AcDream.Core.Net.Messages;
|
|
using Xunit;
|
|
|
|
namespace AcDream.Core.Net.Tests.Messages;
|
|
|
|
public sealed class DeleteObjectTests
|
|
{
|
|
[Fact]
|
|
public void RejectsWrongOpcode()
|
|
{
|
|
Span<byte> body = stackalloc byte[12];
|
|
BinaryPrimitives.WriteUInt32LittleEndian(body, 0xDEADBEEFu);
|
|
|
|
Assert.Null(DeleteObject.TryParse(body));
|
|
}
|
|
|
|
[Fact]
|
|
public void RejectsTruncated()
|
|
{
|
|
Assert.Null(DeleteObject.TryParse(ReadOnlySpan<byte>.Empty));
|
|
Assert.Null(DeleteObject.TryParse(new byte[9]));
|
|
}
|
|
|
|
[Fact]
|
|
public void ParsesGuidAndInstanceSequence()
|
|
{
|
|
Span<byte> body = stackalloc byte[12];
|
|
BinaryPrimitives.WriteUInt32LittleEndian(body, DeleteObject.Opcode);
|
|
BinaryPrimitives.WriteUInt32LittleEndian(body.Slice(4), 0x80000439u);
|
|
BinaryPrimitives.WriteUInt16LittleEndian(body.Slice(8), 0x1234);
|
|
|
|
var parsed = DeleteObject.TryParse(body);
|
|
|
|
Assert.NotNull(parsed);
|
|
Assert.Equal(0x80000439u, parsed!.Value.Guid);
|
|
Assert.Equal((ushort)0x1234, parsed.Value.InstanceSequence);
|
|
}
|
|
|
|
}
|