From bbea38483fb35323fd4d039b07c1763fa86b5b2e Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 8 Oct 2026 16:55:10 -0400 Subject: [PATCH] test(s7): codec live tests use the documented byte-anchored DBB form (#632) Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe --- .../S7_1500/S7_1500CodecTests.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/S7_1500/S7_1500CodecTests.cs b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/S7_1500/S7_1500CodecTests.cs index 9ed3fe9f..2deec614 100644 --- a/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/S7_1500/S7_1500CodecTests.cs +++ b/tests/Drivers/ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests/S7_1500/S7_1500CodecTests.cs @@ -8,7 +8,7 @@ namespace ZB.MOM.WW.OtOpcUa.Driver.S7.IntegrationTests.S7_1500; /// Gitea #632 / #638 live coverage: the S7 STRING / WSTRING / CHAR / WCHAR / DTL / DATE / TOD / TIME / /// S5TIME codecs against the python-snap7 S7-1500 profile, over real ISO-on-TCP + S7comm, plus the /// TSAP override keys (LocalTsap / RemoteTsap / ConnectionType) and the negotiated -/// PDU size. Read seeds live at DB1 800..960 in Docker/profiles/s7_1500.json and are all +/// PDU size. Wide/date-time types are byte-anchored (DBB) by driver rule. Read seeds live at DB1 800..960 in Docker/profiles/s7_1500.json and are all /// distinct and non-zero, so a decode that returned zero/default cannot pass. Write tests use the /// unseeded DB1 1100..1199 scratch area and additionally need S7_SIM_ALLOW_WRITES=1. Everything /// skips cleanly when S7_SIM_ENDPOINT (default the shared Docker host) is unreachable. @@ -63,13 +63,13 @@ public sealed class S7_1500CodecTests(Snap7ServerFixture sim) new S7TagDefinition("Chr", "DB1.DBB870", S7DataType.Char), new S7TagDefinition("WChr", "DB1.DBB872", S7DataType.WChar), new S7TagDefinition("Dtl", "DB1.DBB880", S7DataType.Dtl), - new S7TagDefinition("Date", "DB1.DBW900", S7DataType.Date), - new S7TagDefinition("Tod", "DB1.DBD904", S7DataType.Tod), - new S7TagDefinition("TimePos", "DB1.DBD910", S7DataType.Time), - new S7TagDefinition("TimeNeg", "DB1.DBD914", S7DataType.Time), - new S7TagDefinition("S5Sec", "DB1.DBW920", S7DataType.S5Time), - new S7TagDefinition("S5Cs", "DB1.DBW922", S7DataType.S5Time), - new S7TagDefinition("DateMax", "DB1.DBW960", S7DataType.Date)); + new S7TagDefinition("Date", "DB1.DBB900", S7DataType.Date), + new S7TagDefinition("Tod", "DB1.DBB904", S7DataType.Tod), + new S7TagDefinition("TimePos", "DB1.DBB910", S7DataType.Time), + new S7TagDefinition("TimeNeg", "DB1.DBB914", S7DataType.Time), + new S7TagDefinition("S5Sec", "DB1.DBB920", S7DataType.S5Time), + new S7TagDefinition("S5Cs", "DB1.DBB922", S7DataType.S5Time), + new S7TagDefinition("DateMax", "DB1.DBB960", S7DataType.Date)); await using var drv = new S7Driver(o, "s7-codec-read"); await drv.InitializeAsync("{}", TestContext.Current.CancellationToken); @@ -100,10 +100,10 @@ public sealed class S7_1500CodecTests(Snap7ServerFixture sim) RequireSim(); var o = Options(sim.Host, sim.Port, new S7TagDefinition("DtlUninit", "DB1.DBB930", S7DataType.Dtl), - new S7TagDefinition("S5NonBcd", "DB1.DBW940", S7DataType.S5Time), - new S7TagDefinition("TodPastMidnight", "DB1.DBD944", S7DataType.Tod), + new S7TagDefinition("S5NonBcd", "DB1.DBB940", S7DataType.S5Time), + new S7TagDefinition("TodPastMidnight", "DB1.DBB944", S7DataType.Tod), new S7TagDefinition("WStrCurOverMax", "DB1.DBB950", S7DataType.WString, StringLength: 3), - new S7TagDefinition("Good", "DB1.DBD904", S7DataType.Tod)); + new S7TagDefinition("Good", "DB1.DBB904", S7DataType.Tod)); await using var drv = new S7Driver(o, "s7-codec-bad"); await drv.InitializeAsync("{}", TestContext.Current.CancellationToken); @@ -125,10 +125,10 @@ public sealed class S7_1500CodecTests(Snap7ServerFixture sim) new("Chr", "DB1.DBB1150", S7DataType.Char), new("WChr", "DB1.DBB1152", S7DataType.WChar), new("Dtl", "DB1.DBB1160", S7DataType.Dtl), - new("Date", "DB1.DBW1180", S7DataType.Date), - new("Tod", "DB1.DBD1184", S7DataType.Tod), - new("Time", "DB1.DBD1188", S7DataType.Time), - new("S5", "DB1.DBW1192", S7DataType.S5Time), + new("Date", "DB1.DBB1180", S7DataType.Date), + new("Tod", "DB1.DBB1184", S7DataType.Tod), + new("Time", "DB1.DBB1188", S7DataType.Time), + new("S5", "DB1.DBB1192", S7DataType.S5Time), ]; /// Write each codec's value, read it back through the driver (distinct non-zero values).