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:
parent
e8a20f26c7
commit
ced1b85c61
1 changed files with 18 additions and 0 deletions
|
|
@ -66,4 +66,22 @@ public sealed class InteractRequestsTests
|
||||||
Assert.Equal(0,
|
Assert.Equal(0,
|
||||||
BinaryPrimitives.ReadInt32LittleEndian(body.AsSpan(20)));
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue