--- /dev/null
+#include <msp/geometry/box.h>
+#include <msp/linal/vector3.h>
+#include <msp/test/test.h>
+
+using namespace Msp;
+
+class HyperBoxTests: public Test::RegisteredTest<HyperBoxTests>
+{
+public:
+ HyperBoxTests();
+
+ static const char *get_name() { return "HyperBox"; }
+
+private:
+ void ray_intersection();
+};
+
+HyperBoxTests::HyperBoxTests()
+{
+ add(&HyperBoxTests::ray_intersection, "Ray intersection");
+}
+
+void HyperBoxTests::ray_intersection()
+{
+ Geometry::Box<double> box(2, 4, 3);
+ Geometry::Ray<double, 3> ray(LinAl::Vector3<double>(10, 0, 0), LinAl::Vector3<double>(-1, 0, 0));
+ EXPECT(box.check_intersection(ray));
+ ray = Geometry::Ray<double, 3>(LinAl::Vector3<double>(10, 0, 0), LinAl::Vector3<double>(1, 0, 0));
+ EXPECT(!box.check_intersection(ray));
+ ray = Geometry::Ray<double, 3>(LinAl::Vector3<double>(9, 0, 11.45), LinAl::Vector3<double>(-1, 0, -1));
+ EXPECT(box.check_intersection(ray));
+ ray = Geometry::Ray<double, 3>(LinAl::Vector3<double>(9, 0, 11.55), LinAl::Vector3<double>(-1, 0, -1));
+ EXPECT(!box.check_intersection(ray));
+}