diff --git a/tests/GameCult.Caching.Tests/CatalogMemberVectorTests.cs b/tests/GameCult.Caching.Tests/CatalogMemberVectorTests.cs index f428b43c..dc0bb1ae 100644 --- a/tests/GameCult.Caching.Tests/CatalogMemberVectorTests.cs +++ b/tests/GameCult.Caching.Tests/CatalogMemberVectorTests.cs @@ -10,6 +10,53 @@ using NUnit.Framework; namespace GameCult.Caching.Tests { + [MessagePackObject] + public sealed class CatalogMemberMark + { + [Key(0)] public string Label = string.Empty; + [Key(1)] public int Weight; + } + + [Union(0, typeof(CatalogMemberTextArm))] + [Union(1, typeof(CatalogMemberCountArm))] + public abstract class CatalogMemberArm { } + + [MessagePackObject] + public sealed class CatalogMemberTextArm : CatalogMemberArm + { + [Key(0)] public string Text = string.Empty; + } + + [MessagePackObject] + public sealed class CatalogMemberCountArm : CatalogMemberArm + { + [Key(0)] public int Count; + } + + [CultDocument("tests.catalog_members", "tests.catalog_members.v1")] + [MessagePackObject] + public sealed class CatalogMembersDocument + { + [Key(0)] [CultName] public string Title = string.Empty; + [Key(1)] [CultIndex("sku")] public string Sku = string.Empty; + [Key(2)] public int Count; + [Key(3)] public ulong Total; + [Key(4)] public double Ratio; + [Key(5)] public float Scale; + [Key(6)] public bool Flag; + [Key(7)] public int? MaybeCount; + [Key(8)] public string? Note; + [Key(9)] public List Tags = new(); + [Key(10)] public string[] Labels = Array.Empty(); + [Key(11)] public byte[] Raw = Array.Empty(); + [Key(12)] public List Chunks = new(); + [Key(13)] public Dictionary Weights = new(); + [Key(14)] public CatalogMemberMark Mark = new(); + [Key(15)] public CatalogMemberArm? Arm; + // Slot 16 is a gap. + [Key(17)] public long Late; + } + // tests/vectors/catalog-members (variants:ruling:rs-catalog-member-rows-every-member): a record holding a value in every // member shape, in two stores. csharp-members-store.cc is written by this reference, under CULTCACHE_WRITE_VECTORS=1, and // carries one catalog row per member; every other run compares its bytes. rust-members-empty-store.cc is written by @@ -18,53 +65,6 @@ namespace GameCult.Caching.Tests { private const string Vector = "catalog-members"; - [MessagePackObject] - public sealed class CatalogMemberMark - { - [Key(0)] public string Label = string.Empty; - [Key(1)] public int Weight; - } - - [Union(0, typeof(CatalogMemberTextArm))] - [Union(1, typeof(CatalogMemberCountArm))] - public abstract class CatalogMemberArm { } - - [MessagePackObject] - public sealed class CatalogMemberTextArm : CatalogMemberArm - { - [Key(0)] public string Text = string.Empty; - } - - [MessagePackObject] - public sealed class CatalogMemberCountArm : CatalogMemberArm - { - [Key(0)] public int Count; - } - - [CultDocument("tests.catalog_members", "tests.catalog_members.v1")] - [MessagePackObject] - public sealed class CatalogMembersDocument - { - [Key(0)] [CultName] public string Title = string.Empty; - [Key(1)] [CultIndex("sku")] public string Sku = string.Empty; - [Key(2)] public int Count; - [Key(3)] public ulong Total; - [Key(4)] public double Ratio; - [Key(5)] public float Scale; - [Key(6)] public bool Flag; - [Key(7)] public int? MaybeCount; - [Key(8)] public string? Note; - [Key(9)] public List Tags = new(); - [Key(10)] public string[] Labels = Array.Empty(); - [Key(11)] public byte[] Raw = Array.Empty(); - [Key(12)] public List Chunks = new(); - [Key(13)] public Dictionary Weights = new(); - [Key(14)] public CatalogMemberMark Mark = new(); - [Key(15)] public CatalogMemberArm? Arm; - // Slot 16 is a gap. - [Key(17)] public long Late; - } - private static readonly CultDocumentRegistry Registry = CultDocumentRegistry.ForTypes(new[] { typeof(CatalogMembersDocument) }); private static CatalogMembersDocument Expected() => new()