#ifdef TORQUE_TESTS_ENABLED
#include "testing/unitTesting.h"
#include "math/mBox.h"
TEST(Box3F, CubeConstructor)
{
// Build a cube!
F32 cubeSize = 1.0f;
Box3F cube(cubeSize);
// Test that all the sides have the expected length.
EXPECT_FLOAT_EQ(cubeSize, cube.len_x());
EXPECT_FLOAT_EQ(cubeSize, cube.len_y());
EXPECT_FLOAT_EQ(cubeSize, cube.len_z());
}
TEST(Box3F, GetOverlap)
{
Box3F b1(Point3F(-1, -1, -1), Point3F(1, 1, 1));
// This test shows a custom message when it fails.
EXPECT_EQ(b1.getOverlap(b1), b1)
<< "A box's overlap with itself should be itself.";
Box3F b2(Point3F(0, 0, 0), Point3F(1, 1, 1));
EXPECT_EQ(b1.getOverlap(b2), b2)
<< "Box's overlap should be the intersection of two boxes.";
Box3F b3(Point3F(10, 10, 10), Point3F(11, 11, 11));
EXPECT_TRUE(b1.getOverlap(b3).isEmpty())
<< "Overlap of boxes that do not overlap should be empty.";
}
#endif