summaryrefslogtreecommitdiff
path: root/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-10-01 20:59:36 -0500
committersanine <sanine.not@pm.me>2022-10-01 20:59:36 -0500
commitc5fc66ee58f2c60f2d226868bb1cf5b91badaf53 (patch)
tree277dd280daf10bf77013236b8edfa5f88708c7e0 /libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c
parent1cf9cc3408af7008451f9133fb95af66a9697d15 (diff)
add ode
Diffstat (limited to 'libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c')
-rw-r--r--libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c99
1 files changed, 99 insertions, 0 deletions
diff --git a/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c b/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c
new file mode 100644
index 0000000..36628f6
--- /dev/null
+++ b/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c
@@ -0,0 +1,99 @@
+#include <stdio.h>
+#include <cu/cu.h>
+#include "support.h"
+#include <ccd/ccd.h>
+
+TEST(spheresphereSetUp)
+{
+}
+
+TEST(spheresphereTearDown)
+{
+}
+
+TEST(spheresphereAlignedX)
+{
+ ccd_t ccd;
+ CCD_SPHERE(s1);
+ CCD_SPHERE(s2);
+ size_t i;
+ int res;
+
+ CCD_INIT(&ccd);
+ ccd.support1 = ccdSupport;
+ ccd.support2 = ccdSupport;
+
+ s1.radius = 0.35;
+ s2.radius = .5;
+
+ ccdVec3Set(&s1.pos, -5., 0., 0.);
+ for (i = 0; i < 100; i++){
+ res = ccdGJKIntersect(&s1, &s2, &ccd);
+
+ if (i < 42 || i > 58){
+ assertFalse(res);
+ }else{
+ assertTrue(res);
+ }
+
+ s1.pos.v[0] += 0.1;
+ }
+}
+
+TEST(spheresphereAlignedY)
+{
+ ccd_t ccd;
+ CCD_SPHERE(s1);
+ CCD_SPHERE(s2);
+ size_t i;
+ int res;
+
+ CCD_INIT(&ccd);
+ ccd.support1 = ccdSupport;
+ ccd.support2 = ccdSupport;
+
+ s1.radius = 0.35;
+ s2.radius = .5;
+
+ ccdVec3Set(&s1.pos, 0., -5., 0.);
+ for (i = 0; i < 100; i++){
+ res = ccdGJKIntersect(&s1, &s2, &ccd);
+
+ if (i < 42 || i > 58){
+ assertFalse(res);
+ }else{
+ assertTrue(res);
+ }
+
+ s1.pos.v[1] += 0.1;
+ }
+}
+
+TEST(spheresphereAlignedZ)
+{
+ ccd_t ccd;
+ CCD_SPHERE(s1);
+ CCD_SPHERE(s2);
+ size_t i;
+ int res;
+
+ CCD_INIT(&ccd);
+ ccd.support1 = ccdSupport;
+ ccd.support2 = ccdSupport;
+
+ s1.radius = 0.35;
+ s2.radius = .5;
+
+ ccdVec3Set(&s1.pos, 0., 0., -5.);
+ for (i = 0; i < 100; i++){
+ res = ccdGJKIntersect(&s1, &s2, &ccd);
+
+ if (i < 42 || i > 58){
+ assertFalse(res);
+ }else{
+ assertTrue(res);
+ }
+
+ s1.pos.v[2] += 0.1;
+ }
+}