Added a further BFBS Test.
All checks were successful
🚀 Pack skyscraper8 / make-zip (push) Successful in 1m39s

This commit is contained in:
feyris-tan 2025-11-06 16:04:55 +01:00
parent 980cec0332
commit 781636e0a3
11 changed files with 59 additions and 9 deletions

View File

@ -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);

View File

@ -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<byte> span = new ReadOnlySpan<byte>(blob);
bool result = DvbCrc32.ValidateCrc(span);
Assert.True(result);
}
}

View File

@ -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));
}
}
}
}

View File

@ -154,4 +154,7 @@
<data name="Frame00000008_TSGS1_MIS000_SYNC001" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Frame00000008_TSGS1_MIS000_SYNC001.bbf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Frame00000012_TSGS1_MIS000_SYNC001" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Frame00000012_TSGS1_MIS000_SYNC001.bbf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View File

@ -19,6 +19,8 @@ namespace skyscraper8.Tests
bool msbSet = (readUInt8 & 0x80) != 0;
Assert.True(msbSet);
readUInt8 &= 0b01111111;
int result = ms.ReadUInt8();
result <<= 8;
result += readUInt8;

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using skyscraper8.Skyscraper.Scraper.Storage;
namespace skyscraper8.Tests
{
@ -22,7 +23,10 @@ namespace skyscraper8.Tests
foreach (byte[] buffer in buffers)
{
TsContext mpeg2 = new TsContext();
SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, null, null);
DataStorage ds = new InMemoryScraperStorageFactory().CreateDataStorage();
ObjectStorage os = new NullObjectStorage();
SkyscraperContext skyscraper = new SkyscraperContext(mpeg2, ds, os);
MemoryStream ms = new MemoryStream(buffer, false);
skyscraper.InitalizeFilterChain();

View File

@ -0,0 +1,13 @@
using skyscraper5.Mpeg2;
namespace skyscraper8.Tests;
public class UselessCodeCoverageTests
{
[Fact]
void PsiSectionTest()
{
PsiSection section = new PsiSection();
section.Append(new byte[] { 3 });
}
}

View File

@ -10,10 +10,9 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003Feb_003F3c476997_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe1ab690537c44e02a014076312b886b7b2e200_003F4f_003F7bfc5050_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATuple_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F57d616db882b441b8c50720b4477e03db2e200_003F9f_003F0d16f921_003FTuple_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">/home/schiemas/.cache/JetBrains/Rider2025.1/resharper-host/temp/Rider/vAny/CoverageData/_skyscraper8.1808907683/Snapshot/snapshot.utdcvr</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=1108d3f2_002D5e6f_002D416b_002Da8ee_002D3c9502a978e2/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="CheckBfbsCrc #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;TestAncestor&gt;
&lt;TestId&gt;xUnit::84EE9FCD-2C7F-DF84-C1BA-99D018CE9412::net8.0::skyscraper8.Tests.GsType1SanityTest.CheckBfbsCrc&lt;/TestId&gt;
&lt;/TestAncestor&gt;
&lt;Solution /&gt;
&lt;/SessionState&gt;</s:String>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=8cbe9c8f_002Dfc55_002D47f1_002D9df1_002Dcb4c7fbbc56b/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="CheckBfbsCrc" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;TestAncestor&gt;

View File

@ -112,6 +112,20 @@ namespace skyscraper5.Mpeg2
return crc == 0;
}
public static bool ValidateCrc(ReadOnlySpan<byte> 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;

View File

@ -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)
{