test(net): UpdateMotion tests updated for corrected 6-byte header
The previous tests pinned the buggy 8-byte header assumption. Now they match ACE's actual wire format: u16 movSeq + u16 srvSeq + u8 isAuto + 1 pad (via BinaryWriter.Align based on absolute stream length 15→16). All 166 Core.Net tests now green again. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
53f0110b89
commit
63b6922fc2
1 changed files with 9 additions and 9 deletions
|
|
@ -36,19 +36,19 @@ public class UpdateMotionTests
|
|||
// u32 opcode = 0xF74C
|
||||
// u32 guid
|
||||
// u16 instanceSeq
|
||||
// u16 movementSeq + u16 serverControlSeq + u8 isAutonomous + 3 pad (= 8 bytes total header)
|
||||
// u16 movementSeq + u16 serverControlSeq + u8 isAutonomous + 1 pad (= 6 bytes total header, per ACE Align())
|
||||
// u8 movementType = 0 (Invalid)
|
||||
// u8 motionFlags = 0
|
||||
// u16 currentStyle (outer MovementData field) = 0x0042
|
||||
// u32 packed = CurrentStyle flag (0x1) only
|
||||
// u16 inner currentStyle = 0x0005 (overrides outer per InterpretedMotionState semantics)
|
||||
var body = new byte[4 + 4 + 2 + 8 + 4 + 4 + 2];
|
||||
var body = new byte[4 + 4 + 2 + 6 + 4 + 4 + 2];
|
||||
int p = 0;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0xF74Cu); p += 4;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0x12345678u); p += 4;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0x0001); p += 2;
|
||||
// 8-byte header slot — leave zero
|
||||
p += 8;
|
||||
p += 6;
|
||||
body[p++] = 0; // movementType = Invalid
|
||||
body[p++] = 0; // motionFlags
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0x0042); p += 2;
|
||||
|
|
@ -66,12 +66,12 @@ public class UpdateMotionTests
|
|||
public void ParsesStanceAndForwardCommand()
|
||||
{
|
||||
// Flags = CurrentStyle (0x1) | ForwardCommand (0x2)
|
||||
var body = new byte[4 + 4 + 2 + 8 + 4 + 4 + 2 + 2];
|
||||
var body = new byte[4 + 4 + 2 + 6 + 4 + 4 + 2 + 2];
|
||||
int p = 0;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0xF74Cu); p += 4;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0xABCDEF01u); p += 4;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0x0010); p += 2;
|
||||
p += 8; // MovementData header slot
|
||||
p += 6; // MovementData header slot
|
||||
body[p++] = 0;
|
||||
body[p++] = 0;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0x0000); p += 2; // outer style = 0
|
||||
|
|
@ -93,12 +93,12 @@ public class UpdateMotionTests
|
|||
// currentStyle nor the forward command are present in the payload,
|
||||
// so the parser should fall back to the MovementData outer stance
|
||||
// field and leave ForwardCommand null.
|
||||
var body = new byte[4 + 4 + 2 + 8 + 4 + 4];
|
||||
var body = new byte[4 + 4 + 2 + 6 + 4 + 4];
|
||||
int p = 0;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0xF74Cu); p += 4;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0x55555555u); p += 4;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0); p += 2;
|
||||
p += 8;
|
||||
p += 6;
|
||||
body[p++] = 0;
|
||||
body[p++] = 0;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0x00AA); p += 2;
|
||||
|
|
@ -116,12 +116,12 @@ public class UpdateMotionTests
|
|||
// movementType != 0 means one of the Move* variants we don't parse.
|
||||
// The parser must still return a valid Parsed with the outer stance
|
||||
// and a null ForwardCommand rather than failing the whole message.
|
||||
var body = new byte[4 + 4 + 2 + 8 + 4];
|
||||
var body = new byte[4 + 4 + 2 + 6 + 4];
|
||||
int p = 0;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0xF74Cu); p += 4;
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(body.AsSpan(p), 0x99999999u); p += 4;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0); p += 2;
|
||||
p += 8;
|
||||
p += 6;
|
||||
body[p++] = 1; // movementType = MoveToObject (non-Invalid)
|
||||
body[p++] = 0;
|
||||
BinaryPrimitives.WriteUInt16LittleEndian(body.AsSpan(p), 0x00CC); p += 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue