From e09700d439c8d8a22af53989b0bc03fec02246d4 Mon Sep 17 00:00:00 2001 From: Libby Date: Wed, 11 Nov 2026 23:58:11 +0000 Subject: [PATCH] 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 --- tests/GameCult.Caching.Tests/SlotReadOnlyTests.cs | 8 ++++---- tests/GameCult.Caching.Tests/UnionParityVectorTests.cs | 2 +- tests/GameCult.Caching.Tests/VariantTests.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/GameCult.Caching.Tests/SlotReadOnlyTests.cs b/tests/GameCult.Caching.Tests/SlotReadOnlyTests.cs index 040d9c97..f0caf141 100644 --- a/tests/GameCult.Caching.Tests/SlotReadOnlyTests.cs +++ b/tests/GameCult.Caching.Tests/SlotReadOnlyTests.cs @@ -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)) diff --git a/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs b/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs index 08a37243..22ef82c9 100644 --- a/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs +++ b/tests/GameCult.Caching.Tests/UnionParityVectorTests.cs @@ -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"); diff --git a/tests/GameCult.Caching.Tests/VariantTests.cs b/tests/GameCult.Caching.Tests/VariantTests.cs index 020490fe..cdbdcf58 100644 --- a/tests/GameCult.Caching.Tests/VariantTests.cs +++ b/tests/GameCult.Caching.Tests/VariantTests.cs @@ -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 }),