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

Method TestWithSchemaFactory

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

Source from the content-addressed store, hash-verified

3709
3710 template <typename SchemaFactory>
3711 void TestWithSchemaFactory(SchemaFactory&& factory) {
3712 std::shared_ptr<Schema> schema, actual;
3713 struct ArrowSchema c_schema {}; // zeroed
3714 SchemaExportGuard schema_guard(&c_schema);
3715
3716 auto orig_bytes = pool_->bytes_allocated();
3717
3718 schema = factory();
3719 auto schema_use_count = schema.use_count();
3720 ASSERT_OK(ExportSchema(*schema, &c_schema));
3721 ASSERT_GT(pool_->bytes_allocated(), orig_bytes);
3722 // Export stores no reference to the schema
3723 ASSERT_EQ(schema_use_count, schema.use_count());
3724 schema.reset();
3725
3726 // Recreate the schema
3727 ASSERT_OK_AND_ASSIGN(actual, ImportSchema(&c_schema));
3728 schema = factory();
3729 AssertSchemaEqual(*schema, *actual, /*check_metadata=*/true);
3730 schema.reset();
3731 actual.reset();
3732
3733 ASSERT_EQ(pool_->bytes_allocated(), orig_bytes);
3734 }
3735
3736 protected:
3737 MemoryPool* pool_;

Callers

nothing calls this directly

Calls 6

factoryFunction · 0.85
ExportSchemaFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.70
ImportSchemaFunction · 0.70
bytes_allocatedMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected