MCPcopy Create free account
hub / github.com/Kitware/VTK / TestCopy

Function TestCopy

Common/DataModel/Testing/Cxx/TestDataObjectTreeRange.cxx:22–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20{
21
22bool TestCopy(vtkDataObjectTree* src)
23{
24 // Clone dataset:
25 auto dst = vtkSmartPointer<vtkDataObjectTree>::Take(src->NewInstance());
26
27 // Create tree structure:
28 dst->CopyStructure(src);
29
30 using Opts = vtk::DataObjectTreeOptions;
31 const Opts opts = Opts::TraverseSubTree | Opts::VisitOnlyLeaves;
32
33 { // Copy dataset pointers into new dataset:
34 const auto srcRange = vtk::Range(src, opts);
35 const auto dstRange = vtk::Range(dst, opts);
36 std::copy(srcRange.begin(), srcRange.end(), dstRange.begin());
37 }
38
39 { // Verify that the dataset pointers are correct:
40 const auto srcRange = vtk::Range(src, opts);
41 const auto dstRange = vtk::Range(dst, opts);
42 if (!std::equal(srcRange.begin(), srcRange.end(), dstRange.begin()))
43 {
44 TEST_FAIL("Range iterators failed with std::copy/std::equal.");
45 }
46 }
47
48 return true;
49}
50
51// Test that the for-range iterators behave the same as the regular iterators.
52bool TestConfig(vtkDataObjectTree* cds, vtk::DataObjectTreeOptions opts)

Callers 6

TestOptionsFunction · 0.70
TestValueReferenceMethod · 0.50

Calls 8

TakeFunction · 0.85
RangeClass · 0.50
copyFunction · 0.50
equalFunction · 0.50
NewInstanceMethod · 0.45
CopyStructureMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected