using System.Collections.Immutable; using AcDream.Core.Physics; using DatReaderWriter.DBObjs; namespace AcDream.Core.Tests.Physics; public sealed class PhysicsDataCacheProductionTests { [Fact] public void CreateProduction_SelectsFlatTraversal() { PhysicsDataCache cache = PhysicsDataCache.CreateProduction(); Assert.Equal( CollisionTraversalMode.Flat, cache.CollisionTraversalMode); } [Fact] public void ProductionSetupPublication_RejectsMissingPreparedAsset() { PhysicsDataCache cache = PhysicsDataCache.CreateProduction(); InvalidOperationException fault = Assert.Throws( () => cache.CacheSetup(0x0200_0001u, new Setup())); Assert.Contains( "no prepared collision asset", fault.Message, StringComparison.Ordinal); } [Fact] public void GraphOracleFixture_StillAcceptsSourceSetup() { var cache = new PhysicsDataCache(); cache.CacheSetup(0x0200_0001u, new Setup()); Assert.NotNull(cache.GetSetup(0x0200_0001u)); } [Fact] public void ProductionSetupPublication_AllowsIdempotentCachedFlatAsset() { PhysicsDataCache cache = PhysicsDataCache.CreateProduction(); var setup = new Setup(); var prepared = new FlatSetupCollision( ImmutableArray.Empty, ImmutableArray.Empty, 0f, 0f, 0f, 0f); cache.CacheSetup(0x0200_0001u, setup, prepared); cache.CacheSetup(0x0200_0001u, setup); Assert.Same(prepared, cache.GetFlatSetup(0x0200_0001u)); } }