summaryrefslogtreecommitdiff
path: root/libs/ode-0.16.1/libccd/src/testsuites/spheresphere.c
diff options
context:
space:
mode:
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;
+ }
+}