| 20 | { |
| 21 | |
| 22 | bool 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. |
| 52 | bool TestConfig(vtkDataObjectTree* cds, vtk::DataObjectTreeOptions opts) |
no test coverage detected