Пример #1
0
// This test crashes because Offset has no
// divide by zero checking.
TEST_F(BBoxTest, OffsetDegenerateWorks) {
    BBox b (Point (0, 0, 0), Point (0, 0, 0));

    Vector v = b.Offset (Point (1, 1, 1));

    EXPECT_EQ (.5, v.x);
    EXPECT_EQ (.5, v.y);
    EXPECT_EQ (.5, v.z);
}
Пример #2
0
TEST_F(BBoxTest, OffsetCornerWorks) {
    BBox b (Point (0, 0, 0), Point (2, 2, 2));

    Vector v = b.Offset (Point (2, 2, 2));

    EXPECT_EQ (1, v.x);
    EXPECT_EQ (1, v.y);
    EXPECT_EQ (1, v.z);
}
Пример #3
0
TEST_F(BBoxTest, OffsetOutsideOfTheBoxWorks) {
    BBox b (Point (0, 0, 0), Point (2, 2, 2));

    Vector v = b.Offset (Point (3, 3, 3));

    EXPECT_EQ (1.5, v.x);
    EXPECT_EQ (1.5, v.y);
    EXPECT_EQ (1.5, v.z);
}
Пример #4
0
// Offset Tests
TEST_F(BBoxTest, OffsetMidwayWorks) {
    BBox b (Point (0, 0, 0), Point (2, 2, 2));

    Vector v = b.Offset (Point (1, 1, 1));

    EXPECT_EQ (.5, v.x);
    EXPECT_EQ (.5, v.y);
    EXPECT_EQ (.5, v.z);
}