MCPcopy Create free account
hub / github.com/PixarAnimationStudios/OpenUSD / TestPointerIterators

Function TestPointerIterators

pxr/base/tf/testenv/iterator.cpp:146–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146static bool TestPointerIterators() {
147 // Ensure that TF_FOR_ALL works with iterators that are raw pointers.
148
149 static const int data[] = { 3, 2, 1 };
150 TfSpan<const int> span(data, TfArraySize(data));
151
152 int sum = 0;
153 int count = 0;
154 TF_FOR_ALL(it, span) {
155 sum += *it;
156 ++count;
157 }
158 TF_AXIOM(sum == 6);
159 TF_AXIOM(count == 3);
160
161 TfSpan<std::string> empty(nullptr, nullptr);
162
163 sum = 0;
164 count = 0;
165 TF_FOR_ALL(it, empty) {
166 sum += it->size();
167 ++count;
168 }
169 TF_AXIOM(sum == 0);
170 TF_AXIOM(count == 0);
171
172 return true;
173}
174
175static bool
176Test_TfIterator()

Callers 1

Test_TfIteratorFunction · 0.85

Calls 1

TfArraySizeFunction · 0.85

Tested by

no test coverage detected