From 781636e0a35fa4e3608178ba3273f514f1d86f2f Mon Sep 17 00:00:00 2001 From: feyris-tan Date: Thu, 6 Nov 2025 16:04:55 +0100 Subject: [PATCH] Added a further BFBS Test. --- skyscraper8.Tests/AstraBarkerTransponderTests.cs | 6 ++---- skyscraper8.Tests/GsType1SanityTest.cs | 10 ++++++++++ .../Properties/Resources.Designer.cs | 7 +++++++ skyscraper8.Tests/Properties/Resources.resx | 3 +++ .../Frame00000012_TSGS1_MIS000_SYNC001.bbf | Bin 0 -> 3206 bytes skyscraper8.Tests/SanityTests.cs | 2 ++ skyscraper8.Tests/TsDuckTestPatterns.cs | 6 +++++- skyscraper8.Tests/UselessCodeCoverageTests.cs | 13 +++++++++++++ skyscraper8.sln.DotSettings.user | 5 ++--- skyscraper8/Mpeg2/Crc32.cs | 14 ++++++++++++++ .../Scraper/Storage/NullObjectStorage.cs | 2 +- 11 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 skyscraper8.Tests/Resources/Frame00000012_TSGS1_MIS000_SYNC001.bbf create mode 100644 skyscraper8.Tests/UselessCodeCoverageTests.cs diff --git a/skyscraper8.Tests/AstraBarkerTransponderTests.cs b/skyscraper8.Tests/AstraBarkerTransponderTests.cs index 9f12657..f0ed3fc 100644 --- a/skyscraper8.Tests/AstraBarkerTransponderTests.cs +++ b/skyscraper8.Tests/AstraBarkerTransponderTests.cs @@ -30,8 +30,7 @@ namespace skyscraper8.Tests public void TestAstraSdt() { Stream stream = GetBarkerTransponder(); - if (stream == null) - return; + Skip.If(stream == null, "Barker Transponder stream not available."); SdtContestant contestant = new SdtContestant(0x002d); @@ -62,8 +61,7 @@ namespace skyscraper8.Tests public void TestAstraLcn() { Stream stream = GetBarkerTransponder(); - if (stream == null) - return; + Skip.If(stream == null, "Barker Transponder stream not available."); SgtCandidate contestant = new SgtCandidate(0x0777); SgtCandidate contestant2 = new SgtCandidate(0x0776); diff --git a/skyscraper8.Tests/GsType1SanityTest.cs b/skyscraper8.Tests/GsType1SanityTest.cs index 77086ab..fbc2889 100644 --- a/skyscraper8.Tests/GsType1SanityTest.cs +++ b/skyscraper8.Tests/GsType1SanityTest.cs @@ -1,3 +1,4 @@ +using System.Reflection; using skyscraper5.Mpeg2; using skyscraper8.Tests.Properties; @@ -18,4 +19,13 @@ public class GsType1SanityTest result = DvbCrc32.ValidateCrc(ms, 0, (int)ms.Length); Assert.True(result); } + + [Fact] + public void CheckBfbsCrcSpan() + { + byte[] blob = Resources.Frame00000012_TSGS1_MIS000_SYNC001; + ReadOnlySpan span = new ReadOnlySpan(blob); + bool result = DvbCrc32.ValidateCrc(span); + Assert.True(result); + } } \ No newline at end of file diff --git a/skyscraper8.Tests/Properties/Resources.Designer.cs b/skyscraper8.Tests/Properties/Resources.Designer.cs index 72d011c..f385bb9 100644 --- a/skyscraper8.Tests/Properties/Resources.Designer.cs +++ b/skyscraper8.Tests/Properties/Resources.Designer.cs @@ -128,5 +128,12 @@ namespace skyscraper8.Tests.Properties { return ((byte[])(obj)); } } + + internal static byte[] Frame00000012_TSGS1_MIS000_SYNC001 { + get { + object obj = ResourceManager.GetObject("Frame00000012_TSGS1_MIS000_SYNC001", resourceCulture); + return ((byte[])(obj)); + } + } } } diff --git a/skyscraper8.Tests/Properties/Resources.resx b/skyscraper8.Tests/Properties/Resources.resx index 8bdd6b7..33cfa0a 100644 --- a/skyscraper8.Tests/Properties/Resources.resx +++ b/skyscraper8.Tests/Properties/Resources.resx @@ -154,4 +154,7 @@ ..\Resources\Frame00000008_TSGS1_MIS000_SYNC001.bbf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\Frame00000012_TSGS1_MIS000_SYNC001.bbf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/skyscraper8.Tests/Resources/Frame00000012_TSGS1_MIS000_SYNC001.bbf b/skyscraper8.Tests/Resources/Frame00000012_TSGS1_MIS000_SYNC001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HlXrcwrvYxS%%- zle(czlcrSh76YC_)L%4A>yQ_HG7mV-_9!$2IQ_uw-KWm;z1Ld)3~9mtAg)q?H(>lU z?%d)%{FdkZ>qq1F?kT5D9}%pHJNR<-kuX(oxGxNceFD+1(yd7fr<}z7JE0s9z}*7? zktRUq9`;Zv`6PnEOD>J5Em7_+_LR(^Lj7V6H0zDrgOpb7UZGX3dF|3@vhQ}W-gP>8 zA=}QWD-xj{Qk9++(U!#q<~eRpR6qL}0n1y|m2`fhEMFJqcDG}3y$?dQ|qL%c9zMydhPUc`Y{9J3Y+ z^6ud44Vn$*Nh(UlbEb)8dM!rHAB-~Q9%xOM6Godv$Z)}Du{ zGk@}fSxqI1j%3aMM$U!%+j}Tw0#*A2E3>*%_38FlTondvI$ItoYVx}ye===raDUUbINk8J)tpq<&S=S6;K+VRtJWstIWmO5Fors36` zT#z=wXP`wGQ{2l9n`(ic-1-H+o!)MED&)V6j-@5oJ6*;UI$Vo}aXa_2 zj=q~caG>|Q)J44=KTE>@nSk{jKT4sw^`>)pR{p6~Em>y5W0GKkocmDp4pL=z;wzwy TJ<ForceIncluded ForceIncluded ForceIncluded + /home/schiemas/.cache/JetBrains/Rider2025.1/resharper-host/temp/Rider/vAny/CoverageData/_skyscraper8.1808907683/Snapshot/snapshot.utdcvr <SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckBfbsCrc #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> - <TestAncestor> - <TestId>xUnit::84EE9FCD-2C7F-DF84-C1BA-99D018CE9412::net8.0::skyscraper8.Tests.GsType1SanityTest.CheckBfbsCrc</TestId> - </TestAncestor> + <Solution /> </SessionState> <SessionState ContinuousTestingMode="0" Name="CheckBfbsCrc" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> <TestAncestor> diff --git a/skyscraper8/Mpeg2/Crc32.cs b/skyscraper8/Mpeg2/Crc32.cs index 4e8bd75..b2fb901 100644 --- a/skyscraper8/Mpeg2/Crc32.cs +++ b/skyscraper8/Mpeg2/Crc32.cs @@ -112,6 +112,20 @@ namespace skyscraper5.Mpeg2 return crc == 0; } + public static bool ValidateCrc(ReadOnlySpan data) + { + uint crc = 0xffffffff; + + for (int i = 0; i < data.Length; i++) + { + uint b = (crc >> 24) & 0xff; + int c = (data[i]) & 0xff; + crc = (crc << 8) ^ table[b ^ c]; + } + + return crc == 0; + } + public static uint CreateCrc(MemoryStream ms, int offset, int end) { long restorePosition = ms.Position; diff --git a/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs b/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs index bad78b9..d8106af 100644 --- a/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs +++ b/skyscraper8/Skyscraper/Scraper/Storage/NullObjectStorage.cs @@ -13,7 +13,7 @@ using skyscraper8.Skyscraper.Drawing; namespace skyscraper8.Skyscraper.Scraper.Storage { - internal class NullObjectStorage : ObjectStorage + public class NullObjectStorage : ObjectStorage { public bool ObjectCarouselFileArrival(VfsFile vfsFile, int transportStreamId, int networkId) {