+void IntersectionTest::testAABB() {
+ AABB a{ { -1, -1, -1 }, { 1, 1, 1 } };
+ AABB b(a);
+
+ CPPUNIT_ASSERT_MESSAGE(
+ "coincidental AABBs should intersect",
+ Intersection(a, b)
+ );
+
+ b.Move({ 1, 0, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should intersect",
+ Intersection(a, b)
+ );
+
+ b.Move({ 2, 0, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should not intersect",
+ !Intersection(a, b)
+ );
+
+ b.Move({ -4, 0, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should intersect",
+ Intersection(a, b)
+ );
+
+ b.Move({ -2, 0, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should not intersect",
+ !Intersection(a, b)
+ );
+
+ b.Move({ 3, 1, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should intersect",
+ Intersection(a, b)
+ );
+
+ b.Move({ 0, 2, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should not intersect",
+ !Intersection(a, b)
+ );
+
+ b.Move({ 2, 0, 0 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should not intersect",
+ !Intersection(a, b)
+ );
+
+ b.Move({ 0, 0, 2 });
+ CPPUNIT_ASSERT_MESSAGE(
+ "AABBs should not intersect",
+ !Intersection(a, b)
+ );
+}
+