initial version

This commit is contained in:
2016-01-21 11:10:55 +01:00
parent 8818a9b216
commit a7dc0cabbb
21 changed files with 1397 additions and 0 deletions

47
tests/grid/TestBBox.cpp Executable file
View File

@@ -0,0 +1,47 @@
#ifdef WITH_TESTS
#include "../Tests.h"
#include "../../grid/GridNodeBBox.h"
TEST(BBox, equals) {
GridNodeBBox bb1(GridPoint(2,2,2), 2);
GridNodeBBox bb2(GridPoint(2,2,2), 2);
GridNodeBBox bb3(GridPoint(3,2,2), 2);
GridNodeBBox bb4(GridPoint(2,3,2), 2);
GridNodeBBox bb5(GridPoint(2,2,3), 2);
GridNodeBBox bb6(GridPoint(2,2,2), 4);
ASSERT_TRUE(bb1 == bb2);
ASSERT_TRUE(bb1 == bb5); // z doesnt matter for the bbox
ASSERT_FALSE(bb1 == bb3);
ASSERT_FALSE(bb1 == bb4);
ASSERT_FALSE(bb1 == bb6);
}
TEST(BBox, intersect) {
GridNodeBBox bb1(GridPoint(20,20,20), 20);
// left
ASSERT_FALSE(bb1.intersects( Line2D(9, -999, 9, +999) ));
ASSERT_TRUE (bb1.intersects( Line2D(11, -999, 11, +999) ));
// right
ASSERT_TRUE (bb1.intersects( Line2D(29, -999, 29, +999) ));
ASSERT_FALSE(bb1.intersects( Line2D(31, -999, 31, +999) ));
// top
ASSERT_FALSE(bb1.intersects( Line2D(-999, 9, +999, 9) ));
ASSERT_TRUE (bb1.intersects( Line2D(-999, 11, +999, 11) ));
// bottom
ASSERT_TRUE (bb1.intersects( Line2D(-999, 29, +999, 29) ));
ASSERT_FALSE(bb1.intersects( Line2D(-999, 31, +999, 31) ));
}
#endif