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 e09700d439
3 changed files with 6 additions and 6 deletions

View file

@ -106,7 +106,7 @@ namespace GameCult.Caching.Tests
}
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)!;
@ -138,7 +138,7 @@ namespace GameCult.Caching.Tests
[Test]
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 path = Seed(UnitRegistry, typeof(UnitDoc), () => new UnitDoc { Name = "u" }, payload);
using var cache = Open(path, UnitRegistry);
@ -214,7 +214,7 @@ namespace GameCult.Caching.Tests
[TestCase("extra-slot-nested-record.msgpack", false, TestName = "ANestedMarkBesideACatalogReportedSlotIsNotConsentedTo")]
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 snapshot = CultDocumentMessagePackSerialization.DeserializeSnapshot(File.ReadAllBytes(path));
var entry = snapshot.SchemaCatalog.Single();
@ -265,7 +265,7 @@ namespace GameCult.Caching.Tests
public void AMarkedRecordIsCarriedByteForByteWhenAnotherRecordIsWritten()
{
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 original = before.Records.Single(record => record.Key == Marked.Value);
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}");
}
internal static byte[] Committed(string name)
private static byte[] Committed(string name)
{
var path = VectorPath(name);
Assert.That(File.Exists(path), Is.True, $"vector {name} is committed");

View file

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