feat(runtime): atomically replace collision generations
This commit is contained in:
parent
99bf1751bb
commit
9b0f59bd1b
21 changed files with 2435 additions and 408 deletions
|
|
@ -0,0 +1,44 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using AcDream.Core.Physics;
|
||||
|
||||
namespace AcDream.Runtime.Tests.Physics;
|
||||
|
||||
public sealed class RuntimePhysicsOwnershipBoundaryTests
|
||||
{
|
||||
[Fact]
|
||||
public void PhysicsWorldRootMutatorsAreRuntimeOnlyProductionInternals()
|
||||
{
|
||||
string[] rootMutators =
|
||||
[
|
||||
nameof(PhysicsEngine.AddLandblock),
|
||||
nameof(PhysicsEngine.RemoveLandblock),
|
||||
nameof(PhysicsEngine.DemoteLandblockToTerrain),
|
||||
nameof(PhysicsEngine.Clear),
|
||||
];
|
||||
Type engine = typeof(PhysicsEngine);
|
||||
MethodInfo[] publicMethods = engine.GetMethods(
|
||||
BindingFlags.Instance | BindingFlags.Public);
|
||||
MethodInfo[] internalMethods = engine.GetMethods(
|
||||
BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
foreach (string name in rootMutators)
|
||||
{
|
||||
Assert.DoesNotContain(
|
||||
publicMethods,
|
||||
method => method.Name == name);
|
||||
Assert.Contains(
|
||||
internalMethods,
|
||||
method => method.Name == name);
|
||||
}
|
||||
|
||||
string[] friends = engine.Assembly
|
||||
.GetCustomAttributes<InternalsVisibleToAttribute>()
|
||||
.Select(attribute => attribute.AssemblyName.Split(',')[0])
|
||||
.ToArray();
|
||||
Assert.Contains("AcDream.Runtime", friends);
|
||||
Assert.DoesNotContain("AcDream.App", friends);
|
||||
Assert.DoesNotContain("acdream-headless", friends);
|
||||
Assert.Contains("AcDream.App.Tests", friends);
|
||||
Assert.Contains("AcDream.Headless.Tests", friends);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue