GCC Code Coverage Report


Directory: ./
File: openvdb/openvdb/unittest/TestPointDelete.cc
Date: 2022-07-25 17:40:05
Exec Total Coverage
Lines: 78 78 100.0%
Functions: 3 3 100.0%
Branches: 146 562 26.0%

Line Branch Exec Source
1 // Copyright Contributors to the OpenVDB Project
2 // SPDX-License-Identifier: MPL-2.0
3
4 #include <openvdb/points/PointGroup.h>
5 #include <openvdb/points/PointCount.h>
6 #include <openvdb/points/PointConversion.h>
7 #include <openvdb/points/PointDelete.h>
8
9 #include <gtest/gtest.h>
10
11 #include <string>
12 #include <vector>
13
14 #ifdef _WIN32
15 #include <windows.h>
16 #endif
17
18 using namespace openvdb::points;
19
20 1 class TestPointDelete: public ::testing::Test
21 {
22 public:
23 1 void SetUp() override { openvdb::initialize(); }
24 1 void TearDown() override { openvdb::uninitialize(); }
25 }; // class TestPointDelete
26
27
28 ////////////////////////////////////////
29
30
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 TEST_F(TestPointDelete, testDeleteFromGroups)
31 {
32 using openvdb::math::Vec3s;
33 using openvdb::tools::PointIndexGrid;
34 using openvdb::Index64;
35
36 const float voxelSize(1.0);
37 1 openvdb::math::Transform::Ptr transform(openvdb::math::Transform::createLinearTransform(voxelSize));
38
39 const std::vector<Vec3s> positions6Points = {
40 {1, 1, 1},
41 {1, 2, 1},
42 {2, 1, 1},
43 {2, 2, 1},
44 {100, 100, 100},
45 {100, 101, 100}
46
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 };
47 const PointAttributeVector<Vec3s> pointList6Points(positions6Points);
48
49 {
50 // delete from a tree with 2 leaves, checking that group membership is updated as
51 // expected
52
53 PointIndexGrid::Ptr pointIndexGrid =
54
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::createPointIndexGrid<PointIndexGrid>(pointList6Points, *transform);
55
56 PointDataGrid::Ptr grid =
57 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList6Points,
58
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 *transform);
59 PointDataTree& tree = grid->tree();
60
61 // first test will delete 3 groups, with the third one empty.
62
63
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test1");
64
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test2");
65
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test3");
66
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test4");
67
68
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(pointCount(tree), Index64(6));
69
70
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership1{1, 0, 0, 0, 0, 1};
71
72
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership1, "test1");
73
74
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership2{0, 0, 1, 1, 0, 1};
75
76
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership2, "test2");
77
78
4/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
2 std::vector<std::string> groupsToDelete{"test1", "test2", "test3"};
79
80
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 deleteFromGroups(tree, groupsToDelete);
81
82 // 4 points should have been deleted, so only 2 remain
83
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(pointCount(tree), Index64(2));
84
85 // check that first three groups are deleted but the last is not
86
87 const PointDataTree::LeafCIter leafIterAfterDeletion = tree.cbeginLeaf();
88
89
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 AttributeSet attributeSetAfterDeletion = leafIterAfterDeletion->attributeSet();
90 AttributeSet::Descriptor& descriptor = attributeSetAfterDeletion.descriptor();
91
92
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
1 EXPECT_TRUE(!descriptor.hasGroup("test1"));
93
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
1 EXPECT_TRUE(!descriptor.hasGroup("test2"));
94
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
1 EXPECT_TRUE(!descriptor.hasGroup("test3"));
95
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
2 EXPECT_TRUE(descriptor.hasGroup("test4"));
96 }
97
98 {
99 // check deletion from a single leaf tree and that attribute values are preserved
100 // correctly after deletion
101
102 std::vector<Vec3s> positions4Points = {
103 {1, 1, 1},
104 {1, 2, 1},
105 {2, 1, 1},
106 {2, 2, 1},
107
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 };
108
109 const PointAttributeVector<Vec3s> pointList4Points(positions4Points);
110
111 PointIndexGrid::Ptr pointIndexGrid =
112
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::createPointIndexGrid<PointIndexGrid>(pointList4Points, *transform);
113
114 PointDataGrid::Ptr grid =
115 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid,
116
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 pointList4Points, *transform);
117 PointDataTree& tree = grid->tree();
118
119
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendGroup(tree, "test");
120
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 appendAttribute(tree, "testAttribute", TypedAttributeArray<int32_t>::attributeType());
121
122
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(tree.beginLeaf());
123
124 const PointDataTree::LeafIter leafIter = tree.beginLeaf();
125
126 AttributeWriteHandle<int>
127
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 testAttributeWriteHandle(leafIter->attributeArray("testAttribute"));
128
129
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 1 times.
5 for(int i = 0; i < 4; i++) {
130
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 testAttributeWriteHandle.set(i,i+1);
131 }
132
133
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 std::vector<short> membership{0, 1, 1, 0};
134
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership, "test");
135
136
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 deleteFromGroup(tree, "test");
137
138
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
1 EXPECT_EQ(pointCount(tree), Index64(2));
139
140 const PointDataTree::LeafCIter leafIterAfterDeletion = tree.cbeginLeaf();
141
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 const AttributeSet attributeSetAfterDeletion = leafIterAfterDeletion->attributeSet();
142 const AttributeSet::Descriptor& descriptor = attributeSetAfterDeletion.descriptor();
143
144
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
1 EXPECT_TRUE(descriptor.find("testAttribute") != AttributeSet::INVALID_POS);
145
146
3/6
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
2 AttributeHandle<int> testAttributeHandle(*attributeSetAfterDeletion.get("testAttribute"));
147
148
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(1, testAttributeHandle.get(0));
149
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(4, testAttributeHandle.get(1));
150 }
151
152 {
153 // test the invert flag using data similar to that used in the first test
154
155 PointIndexGrid::Ptr pointIndexGrid =
156
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::createPointIndexGrid<PointIndexGrid>(pointList6Points, *transform);
157 PointDataGrid::Ptr grid =
158 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList6Points,
159
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 *transform);
160 PointDataTree& tree = grid->tree();
161
162
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test1");
163
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test2");
164
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test3");
165
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test4");
166
167
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(pointCount(tree), Index64(6));
168
169
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership1{1, 0, 1, 1, 0, 1};
170
171
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership1, "test1");
172
173
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership2{0, 0, 1, 1, 0, 1};
174
175
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership2, "test2");
176
177
3/8
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
2 std::vector<std::string> groupsToDelete{"test1", "test3"};
178
179
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 deleteFromGroups(tree, groupsToDelete, /*invert=*/ true);
180
181 const PointDataTree::LeafCIter leafIterAfterDeletion = tree.cbeginLeaf();
182
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 const AttributeSet attributeSetAfterDeletion = leafIterAfterDeletion->attributeSet();
183 const AttributeSet::Descriptor& descriptor = attributeSetAfterDeletion.descriptor();
184
185 // no groups should be dropped when invert = true
186
2/16
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ 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 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
1 EXPECT_EQ(static_cast<size_t>(descriptor.groupMap().size()),
187 static_cast<size_t>(4));
188
189 // 4 points should remain since test1 and test3 have 4 members between then
190
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(static_cast<size_t>(pointCount(tree)),
191 static_cast<size_t>(4));
192 }
193
194 {
195 // similar to first test, but don't drop groups
196
197 PointIndexGrid::Ptr pointIndexGrid =
198
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 openvdb::tools::createPointIndexGrid<PointIndexGrid>(pointList6Points, *transform);
199
200 PointDataGrid::Ptr grid =
201 createPointDataGrid<NullCodec, PointDataGrid>(*pointIndexGrid, pointList6Points,
202
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 *transform);
203 PointDataTree& tree = grid->tree();
204
205 // first test will delete 3 groups, with the third one empty.
206
207
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test1");
208
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test2");
209
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test3");
210
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 appendGroup(tree, "test4");
211
212
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership1{1, 0, 0, 0, 0, 1};
213
214
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership1, "test1");
215
216
1/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
1 std::vector<short> membership2{0, 0, 1, 1, 0, 1};
217
218
2/4
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
1 setGroup(tree, pointIndexGrid->tree(), membership2, "test2");
219
220
4/10
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
2 std::vector<std::string> groupsToDelete{"test1", "test2", "test3"};
221
222
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
1 deleteFromGroups(tree, groupsToDelete, /*invert=*/ false, /*drop=*/ false);
223
224 // 4 points should have been deleted, so only 2 remain
225
3/18
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
1 EXPECT_EQ(pointCount(tree), Index64(2));
226
227 // check that first three groups are deleted but the last is not
228
229 const PointDataTree::LeafCIter leafIterAfterDeletion = tree.cbeginLeaf();
230
231
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
2 AttributeSet attributeSetAfterDeletion = leafIterAfterDeletion->attributeSet();
232 AttributeSet::Descriptor& descriptor = attributeSetAfterDeletion.descriptor();
233
234 // all group should still be present
235
236
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
2 EXPECT_TRUE(descriptor.hasGroup("test1"));
237
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
2 EXPECT_TRUE(descriptor.hasGroup("test2"));
238
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
2 EXPECT_TRUE(descriptor.hasGroup("test3"));
239
3/20
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
2 EXPECT_TRUE(descriptor.hasGroup("test4"));
240 }
241
242 1 }
243