diff options
Diffstat (limited to 'src/test/PhysicsTest.cpp')
-rw-r--r-- | src/test/PhysicsTest.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/test/PhysicsTest.cpp b/src/test/PhysicsTest.cpp index 3afb3c7..79ed0b8 100644 --- a/src/test/PhysicsTest.cpp +++ b/src/test/PhysicsTest.cpp @@ -57,10 +57,10 @@ TEST_F(PhysicsTest, gravity) { ASSERT_FALSE(transforms.empty()); EXPECT_EQ(transform.position.y, 0); - system.update(); + system.fixed_update(); EXPECT_NEAR(transform.position.y, 0.0004, 0.0001); - system.update(); + system.fixed_update(); EXPECT_NEAR(transform.position.y, 0.002, 0.001); } @@ -74,14 +74,14 @@ TEST_F(PhysicsTest, max_velocity) { rigidbody.add_force_linear({100, 100}); rigidbody.add_force_angular(100); - system.update(); + system.fixed_update(); EXPECT_NEAR(rigidbody.data.linear_velocity.y, 7.07, 0.01); EXPECT_NEAR(rigidbody.data.linear_velocity.x, 7.07, 0.01); EXPECT_EQ(rigidbody.data.angular_velocity, 10); rigidbody.add_force_linear({-100, -100}); rigidbody.add_force_angular(-100); - system.update(); + system.fixed_update(); EXPECT_NEAR(rigidbody.data.linear_velocity.y, -7.07, 0.01); EXPECT_NEAR(rigidbody.data.linear_velocity.x, -7.07, 0.01); EXPECT_EQ(rigidbody.data.angular_velocity, -10); @@ -99,7 +99,7 @@ TEST_F(PhysicsTest, movement) { rigidbody.add_force_linear({1, 1}); rigidbody.add_force_angular(1); - system.update(); + system.fixed_update(); EXPECT_NEAR(transform.position.x, 0.02, 0.001); EXPECT_NEAR(transform.position.y, 0.02, 0.001); EXPECT_NEAR(transform.rotation, 0.02, 0.001); @@ -112,7 +112,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_NEAR(rigidbody.data.linear_velocity.x, 0.98, 0.01); EXPECT_NEAR(rigidbody.data.linear_velocity.y, 0.98, 0.01); EXPECT_NEAR(rigidbody.data.angular_velocity, 0.98, 0.01); @@ -121,12 +121,12 @@ 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_NEAR(transform.rotation, 7.24, 0.01); rigidbody.data.angular_velocity = -360; - system.update(); + system.fixed_update(); EXPECT_NEAR(transform.rotation, 0.04, 0.001); - system.update(); + system.fixed_update(); EXPECT_NEAR(transform.rotation, 352.84, 0.01); } |