Slot tests read vectors through VectorFiles; the variant read-past test is named for what it pins

SlotReadOnlyTests reads the union-parity vectors through VectorFiles.Committed, the shared reader, so
UnionParityVectorTests.Committed stays private. The variant test that only pins the read no longer says
the extra slot is ignored: under the slot rule it is read past and the record is read-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Libby 2026-11-11 23:58:11 +00:00
commit 3b590a8a0e
3 changed files with 6 additions and 6 deletions

View file

@ -106,7 +106,7 @@ namespace GameCult.Caching.Tests
} }
private string SeedSurface(string vector) => private string SeedSurface(string vector) =>
Seed(SurfaceRegistry, typeof(Surface), () => new Surface { Id = "x" }, UnionParityVectorTests.Committed(vector)); Seed(SurfaceRegistry, typeof(Surface), () => new Surface { Id = "x" }, VectorFiles.Committed("union-parity", vector));
private static CultStoredDocument Stored(CultCache cache, CultRecordKey key) => cache.GetStored(key)!; private static CultStoredDocument Stored(CultCache cache, CultRecordKey key) => cache.GetStored(key)!;
@ -138,7 +138,7 @@ namespace GameCult.Caching.Tests
[Test] [Test]
public void AUnitArmWithAnExtraSlotHoldsTheRecordReadOnly() public void AUnitArmWithAnExtraSlotHoldsTheRecordReadOnly()
{ {
var arm = UnionParityVectorTests.Committed("extra-slot-unit-arm.msgpack"); var arm = VectorFiles.Committed("union-parity", "extra-slot-unit-arm.msgpack");
var payload = Emit((ref MessagePackWriter w) => { w.WriteArrayHeader(2); w.Write("u"); w.WriteRaw(arm); }); var payload = Emit((ref MessagePackWriter w) => { w.WriteArrayHeader(2); w.Write("u"); w.WriteRaw(arm); });
var path = Seed(UnitRegistry, typeof(UnitDoc), () => new UnitDoc { Name = "u" }, payload); var path = Seed(UnitRegistry, typeof(UnitDoc), () => new UnitDoc { Name = "u" }, payload);
using var cache = Open(path, UnitRegistry); using var cache = Open(path, UnitRegistry);
@ -214,7 +214,7 @@ namespace GameCult.Caching.Tests
[TestCase("extra-slot-nested-record.msgpack", false, TestName = "ANestedMarkBesideACatalogReportedSlotIsNotConsentedTo")] [TestCase("extra-slot-nested-record.msgpack", false, TestName = "ANestedMarkBesideACatalogReportedSlotIsNotConsentedTo")]
public void ACompatibleIdConsentsOnlyToTheDepthZeroSlotTheCatalogReports(string vector, bool consented) public void ACompatibleIdConsentsOnlyToTheDepthZeroSlotTheCatalogReports(string vector, bool consented)
{ {
var original = UnionParityVectorTests.Committed(vector); var original = VectorFiles.Committed("union-parity", vector);
var path = Seed(SurfaceRegistry, typeof(Surface), () => new Surface { Id = "x" }, AppendRootSlot(original, "wider writer")); var path = Seed(SurfaceRegistry, typeof(Surface), () => new Surface { Id = "x" }, AppendRootSlot(original, "wider writer"));
var snapshot = CultDocumentMessagePackSerialization.DeserializeSnapshot(File.ReadAllBytes(path)); var snapshot = CultDocumentMessagePackSerialization.DeserializeSnapshot(File.ReadAllBytes(path));
var entry = snapshot.SchemaCatalog.Single(); var entry = snapshot.SchemaCatalog.Single();
@ -265,7 +265,7 @@ namespace GameCult.Caching.Tests
public void AMarkedRecordIsCarriedByteForByteWhenAnotherRecordIsWritten() public void AMarkedRecordIsCarriedByteForByteWhenAnotherRecordIsWritten()
{ {
var path = Path.Combine(_directory, "extra-slot-store.cc"); var path = Path.Combine(_directory, "extra-slot-store.cc");
File.WriteAllBytes(path, UnionParityVectorTests.Committed("extra-slot-store.cc")); File.WriteAllBytes(path, VectorFiles.Committed("union-parity", "extra-slot-store.cc"));
var before = CultDocumentMessagePackSerialization.DeserializeSnapshot(File.ReadAllBytes(path)); var before = CultDocumentMessagePackSerialization.DeserializeSnapshot(File.ReadAllBytes(path));
var original = before.Records.Single(record => record.Key == Marked.Value); var original = before.Records.Single(record => record.Key == Marked.Value);
using (var cache = Open(path, SurfaceRegistry)) using (var cache = Open(path, SurfaceRegistry))

View file

@ -58,7 +58,7 @@ namespace GameCult.Caching.Tests
Assert.That(Convert.ToHexString(reference), Is.EqualTo(Convert.ToHexString(File.ReadAllBytes(path))), $"vector {name}"); Assert.That(Convert.ToHexString(reference), Is.EqualTo(Convert.ToHexString(File.ReadAllBytes(path))), $"vector {name}");
} }
internal static byte[] Committed(string name) private static byte[] Committed(string name)
{ {
var path = VectorPath(name); var path = VectorPath(name);
Assert.That(File.Exists(path), Is.True, $"vector {name} is committed"); Assert.That(File.Exists(path), Is.True, $"vector {name} is committed");

View file

@ -513,7 +513,7 @@ namespace GameCult.Caching.Tests
} }
[Test] [Test]
public void AnOverrideOfASlotTheTypeNeverHadIsIgnoredOnLoadAsAPlainRecordIgnoresAnExtraSlot() public void AnOverrideOfASlotTheTypeNeverHadIsReadPastOnLoadAsAPlainRecordReadsPastAnExtraSlot()
{ {
var path = WriteStore(PlainGear("hand-base"), OverridingRecord("hand-variant", "hand-base", var path = WriteStore(PlainGear("hand-base"), OverridingRecord("hand-variant", "hand-base",
CultVariantOverride.Set(99, new byte[] { 0x01 }), CultVariantOverride.Set(99, new byte[] { 0x01 }),