aboutsummaryrefslogtreecommitdiff
path: root/src/test/PhysicsTest.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-10 19:50:26 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-10 19:50:26 +0100
commit770496ee9d0e45480c0e0f8951adb8eee247bfe1 (patch)
tree98c68b0d37d8a1c0c8b8013ea7884d56f04aaa28 /src/test/PhysicsTest.cpp
parent0cb7f2f82ca167656b3c5cb9f0cc3b44c59cb0eb (diff)
big WIP
Diffstat (limited to 'src/test/PhysicsTest.cpp')
-rw-r--r--src/test/PhysicsTest.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/test/PhysicsTest.cpp b/src/test/PhysicsTest.cpp
index 43d2931..7bd7626 100644
--- a/src/test/PhysicsTest.cpp
+++ b/src/test/PhysicsTest.cpp
@@ -54,10 +54,10 @@ TEST_F(PhysicsTest, gravity) {
ASSERT_FALSE(transforms.empty());
EXPECT_EQ(transform.position.y, 0);
- system.update();
+ system.fixed_update();
EXPECT_EQ(transform.position.y, 1);
- system.update();
+ system.fixed_update();
EXPECT_EQ(transform.position.y, 3);
}
@@ -70,14 +70,14 @@ TEST_F(PhysicsTest, max_velocity) {
rigidbody.add_force_linear({100, 100});
rigidbody.add_force_angular(100);
- system.update();
+ system.fixed_update();
EXPECT_EQ(rigidbody.data.linear_velocity.y, 10);
EXPECT_EQ(rigidbody.data.linear_velocity.x, 10);
EXPECT_EQ(rigidbody.data.angular_velocity, 10);
rigidbody.add_force_linear({-100, -100});
rigidbody.add_force_angular(-100);
- system.update();
+ system.fixed_update();
EXPECT_EQ(rigidbody.data.linear_velocity.y, -10);
EXPECT_EQ(rigidbody.data.linear_velocity.x, -10);
EXPECT_EQ(rigidbody.data.angular_velocity, -10);
@@ -95,7 +95,7 @@ TEST_F(PhysicsTest, movement) {
rigidbody.add_force_linear({1, 1});
rigidbody.add_force_angular(1);
- system.update();
+ system.fixed_update();
EXPECT_EQ(transform.position.x, 1);
EXPECT_EQ(transform.position.y, 1);
EXPECT_EQ(transform.rotation, 1);
@@ -108,7 +108,7 @@ TEST_F(PhysicsTest, movement) {
rigidbody.data.linear_velocity_coefficient.x = 0.5;
rigidbody.data.linear_velocity_coefficient.y = 0.5;
rigidbody.data.angular_velocity_coefficient = 0.5;
- system.update();
+ system.fixed_update();
EXPECT_EQ(rigidbody.data.linear_velocity.x, 0.5);
EXPECT_EQ(rigidbody.data.linear_velocity.y, 0.5);
EXPECT_EQ(rigidbody.data.angular_velocity, 0.5);
@@ -117,10 +117,10 @@ TEST_F(PhysicsTest, movement) {
rigidbody.data.angular_velocity_coefficient = 0;
rigidbody.data.max_angular_velocity = 1000;
rigidbody.data.angular_velocity = 360;
- system.update();
+ system.fixed_update();
EXPECT_EQ(transform.rotation, 1);
rigidbody.data.angular_velocity = -360;
- system.update();
+ system.fixed_update();
EXPECT_EQ(transform.rotation, 1);
}