using StellaOps.Scanner.Reachability; using Xunit; namespace StellaOps.Scanner.Reachability.Tests; public class SymbolIdTests { [Fact] public void ForBinaryAddressed_NormalizesAddressAndKeepsLinkage() { var id1 = SymbolId.ForBinaryAddressed("sha256:deadbeef", ".text", "0x0040", "foo", "weak"); var id2 = SymbolId.ForBinaryAddressed("sha256:deadbeef", ".text", "0x40", "foo", "weak"); Assert.Equal(id1, id2); var id3 = SymbolId.ForBinaryAddressed("sha256:deadbeef", ".text", "40", "foo", "strong"); Assert.NotEqual(id1, id3); } [Fact] public void CodeIdBinarySegment_NormalizesAddressAndLength() { var cid1 = CodeId.ForBinarySegment("elf", "sha256:abc", "0X0010", 64, ".text"); var cid2 = CodeId.ForBinarySegment("elf", "sha256:abc", "16", 64, ".text"); Assert.Equal(cid1, cid2); var cid3 = CodeId.ForBinarySegment("elf", "sha256:abc", "0x20", 32, ".text"); Assert.NotEqual(cid1, cid3); } [Fact] public void SymbolIdForShell_RemainsStableForSameCommand() { var id1 = SymbolId.ForShell("/entrypoint.sh", "python -m app"); var id2 = SymbolId.ForShell("/entrypoint.sh", "python -m app"); Assert.Equal(id1, id2); } }