test(B.5): exercise i32 sign-correctness for BuildPickUp.placement

The original test only used placement=0, which encodes identically
under WriteInt32 and WriteUInt32. Add a -1 case so a future regression
to the unsigned writer would actually fail the test.

Flagged by Task 1 code review.
This commit is contained in:
Erik 2026-05-14 15:05:07 +02:00
parent e8a20f26c7
commit ced1b85c61

View file

@ -66,4 +66,22 @@ public sealed class InteractRequestsTests
Assert.Equal(0,
BinaryPrimitives.ReadInt32LittleEndian(body.AsSpan(20)));
}
[Fact]
public void BuildPickUp_NegativePlacement_WritesSignedLittleEndian()
{
// Sign-correctness guard: placement is i32 on the wire (ACE
// GameActionPutItemInContainer.Handle reads ReadInt32). A
// placement=0 test would pass even if the builder used
// WriteUInt32, so we also exercise a negative value where the
// unsigned/signed encodings would diverge.
byte[] body = InteractRequests.BuildPickUp(
gameActionSequence: 1,
itemGuid: 0x1u,
containerGuid: 0x2u,
placement: -1);
Assert.Equal(-1,
BinaryPrimitives.ReadInt32LittleEndian(body.AsSpan(20)));
}
}