fix: FASS2 状态帧校验 XOR
错误校验和的 100B 上报不再被当成合法状态解析。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -124,6 +124,24 @@ namespace StandardScene.Magnetic.Tests.Protocol
|
||||
Assert.Equal((ushort)500, report.Node.Distance);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryExtractStateFrame_RejectsBadXor()
|
||||
{
|
||||
var frame = Fass2TestFrameBuilder.BuildStateFrame(5, 2, 7, 42);
|
||||
frame[98] ^= 0xFF;
|
||||
|
||||
Assert.False(Fass2Protocol.TryExtractStateFrame(frame, frame.Length, out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseState_RejectsBadXor()
|
||||
{
|
||||
var frame = Fass2TestFrameBuilder.BuildStateFrame(5, 2, 7, 42);
|
||||
frame[98] ^= 0xFF;
|
||||
|
||||
Assert.Throws<ArgumentException>(() => Fass2Protocol.ParseState(frame));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NodeMessage_ToBytes_FromBytes_RoundTrip()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user