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

Method TestWithTypeFactory

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

Source from the content-addressed store, hash-verified

3685
3686 template <typename TypeFactory, typename ExpectedTypeFactory>
3687 void TestWithTypeFactory(TypeFactory&& factory,
3688 ExpectedTypeFactory&& factory_expected) {
3689 std::shared_ptr<DataType> type, actual;
3690 struct ArrowSchema c_schema {}; // zeroed
3691 SchemaExportGuard schema_guard(&c_schema);
3692
3693 auto orig_bytes = pool_->bytes_allocated();
3694
3695 type = factory();
3696 auto type_use_count = type.use_count();
3697 ASSERT_OK(ExportType(*type, &c_schema));
3698 ASSERT_GT(pool_->bytes_allocated(), orig_bytes);
3699 // Export stores no reference to the type
3700 ASSERT_EQ(type_use_count, type.use_count());
3701 type.reset();
3702
3703 // Recreate the type
3704 ASSERT_OK_AND_ASSIGN(actual, ImportType(&c_schema));
3705 type = factory_expected();
3706 AssertTypeEqual(*type, *actual, /*check_metadata=*/true);
3707 type.reset();
3708 actual.reset();
3709
3710 ASSERT_EQ(pool_->bytes_allocated(), orig_bytes);
3711 }
3712
3713 template <typename TypeFactory>
3714 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