diff options
author | Mattes D <github@xoft.cz> | 2015-06-11 22:20:04 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-06-11 22:20:04 +0200 |
commit | d390214929f4b280cc66cdbc170694ec9b1fa8c4 (patch) | |
tree | 3c49c75771ffd8931f47b895b2bd31014f7885d8 /src/BoundingBox.cpp | |
parent | Merge pull request #2162 from lkolbly/master (diff) | |
download | cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.gz cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.bz2 cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.lz cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.xz cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.tar.zst cuberite-d390214929f4b280cc66cdbc170694ec9b1fa8c4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BoundingBox.cpp | 13 |
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 |