diff --git a/tests/AcDream.Core.Net.Tests/Messages/InteractRequestsTests.cs b/tests/AcDream.Core.Net.Tests/Messages/InteractRequestsTests.cs index f251cf4..c36e54f 100644 --- a/tests/AcDream.Core.Net.Tests/Messages/InteractRequestsTests.cs +++ b/tests/AcDream.Core.Net.Tests/Messages/InteractRequestsTests.cs @@ -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))); + } }