MCPcopy Create free account
hub / github.com/apache/arrow / Check

Method Check

cpp/src/arrow/array/array_test.cc:1347–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1345 }
1346
1347 void Check(const std::unique_ptr<BuilderType>& builder, bool nullable) {
1348 int64_t size = builder->length();
1349 auto ex_data = Buffer::Wrap(draws_.data(), size);
1350
1351 std::shared_ptr<Buffer> ex_null_bitmap;
1352 int64_t ex_null_count = 0;
1353
1354 if (nullable) {
1355 ASSERT_OK_AND_ASSIGN(ex_null_bitmap, internal::BytesToBits(valid_bytes_));
1356 ex_null_count = CountNulls(valid_bytes_);
1357 } else {
1358 ex_null_bitmap = nullptr;
1359 }
1360
1361 auto expected =
1362 std::make_shared<ArrayType>(size, ex_data, ex_null_bitmap, ex_null_count);
1363
1364 std::shared_ptr<Array> out;
1365 FinishAndCheckPadding(builder.get(), &out);
1366
1367 std::shared_ptr<ArrayType> result = checked_pointer_cast<ArrayType>(out);
1368
1369 // Builder is now reset
1370 ASSERT_EQ(0, builder->length());
1371 ASSERT_EQ(0, builder->capacity());
1372 ASSERT_EQ(0, builder->null_count());
1373
1374 ASSERT_EQ(ex_null_count, result->null_count());
1375 ASSERT_TRUE(result->Equals(*expected));
1376 }
1377
1378 void FlipValue(CType* ptr) {
1379 auto byteptr = reinterpret_cast<uint8_t*>(ptr);

Callers 1

TYPED_TESTFunction · 0.45

Calls 11

WrapFunction · 0.85
BytesToBitsFunction · 0.85
CountNullsFunction · 0.85
FinishAndCheckPaddingFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
lengthMethod · 0.45
dataMethod · 0.45
getMethod · 0.45
capacityMethod · 0.45
null_countMethod · 0.45
EqualsMethod · 0.45

Tested by

no test coverage detected