fix(ab-transport): PCCC review r1 - UA bit, bit limits, stricter ParseReply, non-const verified flags
This commit is contained in:
@@ -22,6 +22,8 @@ public sealed class PcccAddressTests
|
||||
[InlineData("T4:0.EN", "T", 4, 0, 0, 15)]
|
||||
[InlineData("C5:0.CU", "C", 5, 0, 0, 15)]
|
||||
[InlineData("C5:0.OV", "C", 5, 0, 0, 12)]
|
||||
[InlineData("C5:0.UA", "C", 5, 0, 0, 10)]
|
||||
[InlineData("L9:0/31", "L", 9, 0, null, 31)]
|
||||
[InlineData("R6:0.LEN", "R", 6, 0, 1, null)]
|
||||
[InlineData("R6:0.POS", "R", 6, 0, 2, null)]
|
||||
[InlineData("I:0/1", "I", null, 0, null, 1)]
|
||||
@@ -39,6 +41,7 @@ public sealed class PcccAddressTests
|
||||
[Theory]
|
||||
[InlineData("")] [InlineData("N7")] [InlineData("N:0")] [InlineData("X7:0")] [InlineData("I1:0")]
|
||||
[InlineData("T4:0.FOO")] [InlineData("N7:0.ACC")] [InlineData("N7:-1")] [InlineData("N7:0/x")]
|
||||
[InlineData("N7:0/16")] [InlineData("F8:0/1")] [InlineData("L9:0/32")] [InlineData("T4:0/3")]
|
||||
public void Rejects(string text) => PcccAddress.TryParse(text).ShouldBeNull();
|
||||
|
||||
[Fact]
|
||||
|
||||
+21
-1
@@ -122,7 +122,27 @@ public sealed class PcccServicesTests
|
||||
|
||||
[Fact]
|
||||
public void ParseReply_cip_error_status_throws() =>
|
||||
Should.Throw<AbTransportException>(() => PcccServices.ParseReply(Reply("", 0x08), 1)).Status.ShouldNotBe(AbStatus.Ok);
|
||||
Should.Throw<AbTransportException>(() => PcccServices.ParseReply(Reply("", 0x08), 1)).Status.ShouldBe(AbStatus.Unsupported);
|
||||
|
||||
[Fact]
|
||||
public void ParseReply_wrong_command_byte_is_BadReply() =>
|
||||
Should.Throw<AbTransportException>(() => PcccServices.ParseReply(Reply(Id + "0F00 9987 E110"), 0x8799))
|
||||
.Status.ShouldBe(AbStatus.BadReply);
|
||||
|
||||
[Fact]
|
||||
public void ParseReply_stale_error_reply_with_wrong_tns_is_BadReply() =>
|
||||
Should.Throw<AbTransportException>(() => PcccServices.ParseReply(Reply(Id + "4F10 1111"), 0x8799))
|
||||
.Status.ShouldBe(AbStatus.BadReply);
|
||||
|
||||
[Fact]
|
||||
public void ParseReply_requestor_id_mismatch_is_BadReply()
|
||||
{
|
||||
var expected = Hex(Id);
|
||||
PcccServices.ParseReply(Reply(Id + "4F00 9987 E110"), 0x8799, expected).Length.ShouldBe(2);
|
||||
Should.Throw<AbTransportException>(() =>
|
||||
PcccServices.ParseReply(Reply("073DF3454350" + "22" + "4F00 9987 E110"), 0x8799, expected))
|
||||
.Status.ShouldBe(AbStatus.BadReply);
|
||||
}
|
||||
|
||||
// ---- Capture parity ----
|
||||
// The request is frame index 2 (after RegisterSession pair); its TNS is session-assigned, so we read it
|
||||
|
||||
Reference in New Issue
Block a user