Testing physics

This commit is contained in:
2026-07-18 20:53:22 -05:00
parent 1174e471f6
commit 6c5738c863
24 changed files with 347 additions and 126 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ static void test_physicsShapeMeshCreateIntegratesWithDispatch(void **state) {
// Landscape as B, matching physicsWorldStep's dynamic(A)-vs-static(B).
vec3 normal; float_t depth;
assert_true(physicsTestShapeVsShape(
sphereCenter, sphere, meshPos, landscape, normal, &depth
sphereCenter, &sphere, meshPos, &landscape, normal, &depth
));
assert_float_equal(depth, 0.2f, 0.0001f);
assert_float_equal(normal[1], 1.0f, 0.0001f);
+7 -7
View File
@@ -91,12 +91,12 @@ static void test_dispatchSymmetryAndPlaneRouting(void **state) {
vec3 normalAB; float_t depthAB;
assert_true(physicsTestShapeVsShape(
aPos, cubeA, bPos, sphereB, normalAB, &depthAB
aPos, &cubeA, bPos, &sphereB, normalAB, &depthAB
));
vec3 normalBA; float_t depthBA;
assert_true(physicsTestShapeVsShape(
bPos, sphereB, aPos, cubeA, normalBA, &depthBA
bPos, &sphereB, aPos, &cubeA, normalBA, &depthBA
));
// Swapping A/B should give the same depth and a negated normal.
@@ -111,7 +111,7 @@ static void test_dispatchSymmetryAndPlaneRouting(void **state) {
vec3 cubePos = { 0.0f, 0.4f, 0.0f };
vec3 normal; float_t depth;
assert_true(physicsTestShapeVsShape(
cubePos, cubeA, bPos, plane, normal, &depth
cubePos, &cubeA, bPos, &plane, normal, &depth
));
assert_float_equal(depth, 0.1f, 0.0001f);
@@ -173,7 +173,7 @@ static void test_customShapeFlatLandscape(void **state) {
// body as A, static/custom body as B).
vec3 normal; float_t depth;
assert_true(physicsTestShapeVsShape(
spherePos, sphere, landscapePos, landscape, normal, &depth
spherePos, &sphere, landscapePos, &landscape, normal, &depth
));
assert_float_equal(depth, 0.2f, 0.0001f);
assert_float_equal(normal[0], 0.0f, 0.0001f);
@@ -183,7 +183,7 @@ static void test_customShapeFlatLandscape(void **state) {
// Landscape as A: same depth, negated normal.
vec3 normalSwapped; float_t depthSwapped;
assert_true(physicsTestShapeVsShape(
landscapePos, landscape, spherePos, sphere, normalSwapped, &depthSwapped
landscapePos, &landscape, spherePos, &sphere, normalSwapped, &depthSwapped
));
assert_float_equal(depthSwapped, depth, 0.0001f);
assert_float_equal(normalSwapped[1], -normal[1], 0.0001f);
@@ -191,7 +191,7 @@ static void test_customShapeFlatLandscape(void **state) {
// Sphere far above the ground: no overlap.
vec3 sphereFar = { 0.0f, 10.0f, 0.0f };
assert_false(physicsTestShapeVsShape(
sphereFar, sphere, landscapePos, landscape, normal, &depth
sphereFar, &sphere, landscapePos, &landscape, normal, &depth
));
assert_int_equal(memoryGetAllocatedCount(), 0);
@@ -208,7 +208,7 @@ static void test_customVsCustomAsserts(void **state) {
vec3 normal; float_t depth;
expect_assert_failure(physicsTestShapeVsShape(
pos, landscapeA, pos, landscapeB, normal, &depth
pos, &landscapeA, pos, &landscapeB, normal, &depth
));
}