Files
MovementTests/tests/components/MovementSystemUnitTest.cs
Minimata 9207295a99
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 20s
Create tag and build when new code gets to main / Test (push) Failing after 7m29s
Create tag and build when new code gets to main / Export (push) Successful in 8m18s
basic tests for a wider variety of files
2026-02-20 16:58:17 +01:00

33 lines
975 B
C#

using Godot;
using GdUnit4;
using static GdUnit4.Assertions;
using Movementtests.interfaces;
using Movementtests.scenes.movement;
namespace Movementtests.tests;
[TestSuite, RequireGodotRuntime]
public class MovementSystemUnitTest
{
[TestCase]
public void GroundedMovement_Accelerates_And_Applies_Gravity()
{
var move = new CGroundedMovement();
move.RMovement = new RMovement(speed: 10.0f, acceleration: 1.0f, gravityModifier: 0.5f, targetHeight: 0.0f);
move.WallInFrontRayCast = new RayCast3D();
move.GlobalPosition = Vector3.Zero;
var inputs = new MovementInputs(
Velocity: Vector3.Zero,
TargetLocation: new Vector3(10, 0, 0),
isOnFloor: false,
gravity: Vector3.Down * 9.8f,
delta: 1.0
);
var v = move.ComputeVelocity(inputs);
AssertVector(v).IsEqualApprox(new Vector3(10, -4.9f, 0), new Vector3(0.0001f, 0.0001f, 0.0001f));
}
}