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

Method TestWithTypeFactory

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

Source from the content-addressed store, hash-verified

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