Add unit tests for SBOM ingestion and transformation
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled

- Implement `SbomIngestServiceCollectionExtensionsTests` to verify the SBOM ingestion pipeline exports snapshots correctly.
- Create `SbomIngestTransformerTests` to ensure the transformation produces expected nodes and edges, including deduplication of license nodes and normalization of timestamps.
- Add `SbomSnapshotExporterTests` to test the export functionality for manifest, adjacency, nodes, and edges.
- Introduce `VexOverlayTransformerTests` to validate the transformation of VEX nodes and edges.
- Set up project file for the test project with necessary dependencies and configurations.
- Include JSON fixture files for testing purposes.
This commit is contained in:
master
2025-11-04 07:49:39 +02:00
parent f72c5c513a
commit 2eb6852d34
491 changed files with 39445 additions and 3917 deletions

View File

@@ -0,0 +1,44 @@
using System.Text;
namespace StellaOps.Graph.Indexer.Schema;
/// <summary>
/// Base32 encoder using the Crockford alphabet (0-9A-HJKMNPQRSTVWXYZ).
/// </summary>
internal static class Base32Crockford
{
private const string Alphabet = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
public static string Encode(ReadOnlySpan<byte> data)
{
if (data.IsEmpty)
{
return string.Empty;
}
var output = new StringBuilder((data.Length * 8 + 4) / 5);
var buffer = 0;
var bitsLeft = 0;
foreach (var b in data)
{
buffer = (buffer << 8) | b;
bitsLeft += 8;
while (bitsLeft >= 5)
{
bitsLeft -= 5;
var index = (buffer >> bitsLeft) & 0x1F;
output.Append(Alphabet[index]);
}
}
if (bitsLeft > 0)
{
var index = (buffer << (5 - bitsLeft)) & 0x1F;
output.Append(Alphabet[index]);
}
return output.ToString();
}
}