MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / iterateOverPartialPatchColumnWise

Function iterateOverPartialPatchColumnWise

test/PatchIterators.cpp:150–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148}
149
150void iterateOverPartialPatchColumnWise(IPatch& patch, int startCol, int endCol, bool rowBackwards)
151{
152 std::vector<Vector3> expectedValues;
153
154 // Fill the vector with the expected values
155 int step = startCol <= endCol ? +1 : -1;
156
157 for (auto col = startCol; col != endCol + step; col += step)
158 {
159 if (rowBackwards)
160 {
161 for (auto row = static_cast<int>(patch.getHeight()) - 1; row >= 0; --row)
162 {
163 expectedValues.push_back(patch.ctrlAt(row, col).vertex);
164 }
165 }
166 else
167 {
168 for (auto row = 0; row < patch.getHeight(); ++row)
169 {
170 expectedValues.push_back(patch.ctrlAt(row, col).vertex);
171 }
172 }
173 }
174
175 auto it = !rowBackwards ?
176 static_cast<patch::PatchControlIterator>(patch::ColumnWisePatchIterator(patch, startCol, endCol)) :
177 patch::ColumnWisePatchReverseIterator(patch, startCol, endCol);
178
179 auto expected = expectedValues.begin();
180
181 while (it.isValid())
182 {
183 EXPECT_EQ((it++)->vertex, *(expected++));
184 }
185
186 EXPECT_EQ(expected, expectedValues.end()); // assume no underflow
187}
188
189TEST_F(PatchIteratorTest, IterateOverPartialPatchColumnWise)
190{

Callers 1

TEST_FFunction · 0.85

Calls 7

getHeightMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
isValidMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected