summaryrefslogtreecommitdiffstats
path: root/src/BoundingBox.cpp
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2015-06-12 12:00:47 +0200
committerAlexander Harkness <me@bearbin.net>2015-06-12 12:00:47 +0200
commit001305247fa28e78d0f3d9d565ff7aff25864edc (patch)
tree9f1e41fa0e6afee7ce9f90f3778f02e7a770ebf7 /src/BoundingBox.cpp
parentUpdate gratipay (diff)
parentSelfTests are registered and executed after logging framework init. (diff)
downloadcuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.gz
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.bz2
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.lz
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.xz
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.tar.zst
cuberite-001305247fa28e78d0f3d9d565ff7aff25864edc.zip
Diffstat (limited to 'src/BoundingBox.cpp')
-rw-r--r--src/BoundingBox.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/BoundingBox.cpp b/src/BoundingBox.cpp
index 6b163b01e..64e3c02d2 100644
--- a/src/BoundingBox.cpp
+++ b/src/BoundingBox.cpp
@@ -5,6 +5,7 @@
#include "Globals.h"
#include "BoundingBox.h"
#include "Defines.h"
+#include "SelfTests.h"
@@ -18,6 +19,11 @@ static class SelfTest_BoundingBox
public:
SelfTest_BoundingBox(void)
{
+ cSelfTests::Get().Register(cSelfTests::SelfTestFunction(&Test), "Bounding box intersections");
+ }
+
+ static void Test(void)
+ {
Vector3d Min(1, 1, 1);
Vector3d Max(2, 2, 2);
Vector3d LineDefs[] =
@@ -41,7 +47,7 @@ public:
bool res = cBoundingBox::CalcLineIntersection(Min, Max, Line1, Line2, LineCoeff, Face);
if (res != Results[i])
{
- fprintf(stderr, "LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d\n",
+ LOGERROR("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d",
Line1.x, Line1.y, Line1.z,
Line2.x, Line2.y, Line2.z,
res ? 1 : 0, LineCoeff, Face
@@ -52,7 +58,7 @@ public:
{
if (LineCoeff != LineCoeffs[i])
{
- fprintf(stderr, "LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d\n",
+ LOGERROR("LineIntersection({%.02f, %.02f, %.02f}, {%.02f, %.02f, %.02f}) -> %d, %.05f, %d",
Line1.x, Line1.y, Line1.z,
Line2.x, Line2.y, Line2.z,
res ? 1 : 0, LineCoeff, Face
@@ -61,9 +67,8 @@ public:
}
}
} // for i - LineDefs[]
- fprintf(stderr, "BoundingBox selftest complete.\n");
}
-} gTest;
+} g_BoundingBoxTest;
#endif