Files
sbox-public/engine/Sandbox.Test/System/Json/PatchGameObject.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

46 lines
1.4 KiB
C#

using System.Collections.Generic;
namespace TestSystem.JsonTests;
[TestClass]
public class PatchGameObject
{
[TestMethod]
[DataRow( 2, 1, 1 )]
[DataRow( 2, 2, 5 )]
[DataRow( 3, 2, 1 )]
[DataRow( 3, 3, 5 )]
[DataRow( 5, 3, 1 )]
[DataRow( 5, 5, 5 )]
[DataRow( 10, 5, 1 )]
[DataRow( 10, 10, 5 )]
[DataRow( 10, 10, 10 )]
[DataRow( 20, 20, 20 )]
[DataRow( 20, 20, 20 )]
[DataRow( 30, 30, 30 )]
[DataRow( 40, 40, 40 )]
[DataRow( 50, 50, 50 )]
[DataRow( 60, 60, 60 )]
[DataRow( 70, 70, 70 )]
[DataRow( 80, 80, 80 )]
[DataRow( 90, 90, 90 )]
[DataRow( 100, 100, 100 )]
[DataRow( 100, 200, 200 )]
[DataRow( 100, 300, 300 )]
[DataRow( 100, 400, 400 )]
[DataRow( 100, 500, 500 )]
[DataRow( 5000, 5000, 5000 )] // stress test let's go
public void StructuredGameObjects(
int gameObjectCount, int componentCount, int mutationCount )
{
var seed = (gameObjectCount << 20) | (componentCount << 10) | mutationCount;
var source = GameObjectTestDataGenerator.GenerateStructured( gameObjectCount, componentCount, seed );
// Apply multiple mutations
var target = source.DeepClone().AsObject();
target = GameObjectTestDataGenerator.Mutate( target, mutationCount, seed + 1 );
JsonTestUtils.RunRoundTripTest( source, target, $"GameObject hierarchy with {gameObjectCount} GameObjects, {componentCount} Components & {mutationCount} mutations", GameObject.DiffObjectDefinitions );
}
}