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

Method TestWithTypeFactory

cpp/src/arrow/c/bridge_test.cc:3620–3644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3618
3619 template <typename TypeFactory, typename ExpectedTypeFactory>
3620 void TestWithTypeFactory(TypeFactory&& factory,
3621 ExpectedTypeFactory&& factory_expected) {
3622 std::shared_ptr<DataType> type, actual;
3623 struct ArrowSchema c_schema {}; // zeroed
3624 SchemaExportGuard schema_guard(&c_schema);
3625
3626 auto orig_bytes = pool_->bytes_allocated();
3627
3628 type = factory();
3629 auto type_use_count = type.use_count();
3630 ASSERT_OK(ExportType(*type, &c_schema));
3631 ASSERT_GT(pool_->bytes_allocated(), orig_bytes);
3632 // Export stores no reference to the type
3633 ASSERT_EQ(type_use_count, type.use_count());
3634 type.reset();
3635
3636 // Recreate the type
3637 ASSERT_OK_AND_ASSIGN(actual, ImportType(&c_schema));
3638 type = factory_expected();
3639 AssertTypeEqual(*type, *actual, /*check_metadata=*/true);
3640 type.reset();
3641 actual.reset();
3642
3643 ASSERT_EQ(pool_->bytes_allocated(), orig_bytes);
3644 }
3645
3646 template <typename TypeFactory>
3647 void TestWithTypeFactory(TypeFactory&& factory) {

Callers

nothing calls this directly

Calls 6

factoryFunction · 0.85
ExportTypeFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.70
ImportTypeFunction · 0.70
bytes_allocatedMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected