GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestPointInstantiate.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 9 9 100.0%
Functions: 1 1 100.0%
Branches: 7 30 23.3%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 // this removes the PointDataGrid and PointDataTree aliases
5 #define OPENVDB_DISABLE_POINT_DATA_TREE_ALIAS
6
7 // include all of the point headers and confirm that none are referring directly
8 // to the removed aliases
9
10 #include <openvdb/points/PointAdvect.h>
11 #include <openvdb/points/PointAttribute.h>
12 #include <openvdb/points/PointConversion.h>
13 #include <openvdb/points/PointCount.h>
14 #include <openvdb/points/PointDataGrid.h>
15 #include <openvdb/points/PointDelete.h>
16 #include <openvdb/points/PointGroup.h>
17 #include <openvdb/points/PointMask.h>
18 #include <openvdb/points/PointMove.h>
19 #include <openvdb/points/PointSample.h>
20 #include <openvdb/points/PointScatter.h>
21
22 #include <gtest/gtest.h>
23
24
25 1 class TestPointInstantiate: public ::testing::Test
26 {
27 }; // class TestPointInstantiate
28
29
30
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestPointInstantiate, test)
31 {
32 1 openvdb::initialize();
33
34 std::vector<openvdb::Vec3f> positions;
35
2/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
1 positions.emplace_back(1.0f, 2.0f, 3.0f);
36 openvdb::points::PointAttributeVector<openvdb::Vec3f> wrapper(positions);
37
38
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 auto transform = openvdb::math::Transform::createLinearTransform(0.5);
39
40 // these custom grid types use a 64-bit value type instead of a 32-bit value type
41 // and have a 16^3 leaf node instead of a 8^3 leaf node
42
43 using CustomPointIndexGrid = openvdb::Grid<openvdb::tree::Tree<openvdb::tree::RootNode<
44 openvdb::tree::InternalNode<openvdb::tree::InternalNode<
45 openvdb::tools::PointIndexLeafNode<openvdb::PointIndex64, 4>, 4>, 5>>>>;
46 using CustomPointDataGrid = openvdb::Grid<openvdb::tree::Tree<openvdb::tree::RootNode<
47 openvdb::tree::InternalNode<openvdb::tree::InternalNode<
48 openvdb::points::PointDataLeafNode<openvdb::PointDataIndex64, 4>, 4>, 5>>>>;
49
50 auto pointIndexGrid = openvdb::tools::createPointIndexGrid<CustomPointIndexGrid>(
51
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 wrapper, *transform);
52 auto points = openvdb::points::createPointDataGrid<openvdb::points::NullCodec, CustomPointDataGrid>(
53
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 *pointIndexGrid, wrapper, *transform);
54
55
1/16
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
1 EXPECT_TRUE(points);
56 1 }
57