MCPcopy Create free account
hub / github.com/bytedance/bolt / iteratorAdditionTest

Method iteratorAdditionTest

bolt/expression/tests/ArrayViewTest.cpp:202–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200 }
201
202 void iteratorAdditionTest() {
203 std::vector<std::vector<std::optional<int32_t>>> intArray{
204 {1}, {2, 3}, {4, 5, 6}, {7, 8, 9, 10}, {11, 12, 13, 14, 15}};
205 auto arrayVector = makeNullableArrayVector(intArray);
206 DecodedVector decoded;
207 exec::VectorReader<Array<int32_t>> reader(
208 decode(decoded, *arrayVector.get()));
209
210 for (auto i = 0; i < arrayVector->size(); i++) {
211 auto arrayView = read(reader, i);
212 auto it = arrayView.begin();
213
214 for (int j = 0; j < arrayView.size(); j++) {
215 auto it2 = arrayView.begin();
216 for (int k = 0; k < arrayView.size(); k++) {
217 ASSERT_EQ(it, it2 + (j - k));
218 ASSERT_EQ(it, (j - k) + it2);
219 auto it3 = it2;
220 it3 += j - k;
221 ASSERT_EQ(it, it3);
222 it2++;
223 }
224 it++;
225 }
226 }
227 }
228
229 void iteratorSubtractionTest() {
230 std::vector<std::vector<std::optional<int32_t>>> intArray{

Callers

nothing calls this directly

Calls 5

decodeFunction · 0.70
readFunction · 0.50
getMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected