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

Method TestWithSchemaFactory

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

Source from the content-addressed store, hash-verified

3717
3718 template <typename SchemaFactory>
3719 void TestWithSchemaFactory(SchemaFactory&& factory) {
3720 std::shared_ptr<Schema> schema, actual;
3721 struct ArrowSchema c_schema {}; // zeroed
3722 SchemaExportGuard schema_guard(&c_schema);
3723
3724 auto orig_bytes = pool_->bytes_allocated();
3725
3726 schema = factory();
3727 auto schema_use_count = schema.use_count();
3728 ASSERT_OK(ExportSchema(*schema, &c_schema));
3729 ASSERT_GT(pool_->bytes_allocated(), orig_bytes);
3730 // Export stores no reference to the schema
3731 ASSERT_EQ(schema_use_count, schema.use_count());
3732 schema.reset();
3733
3734 // Recreate the schema
3735 ASSERT_OK_AND_ASSIGN(actual, ImportSchema(&c_schema));
3736 schema = factory();
3737 AssertSchemaEqual(*schema, *actual, /*check_metadata=*/true);
3738 schema.reset();
3739 actual.reset();
3740
3741 ASSERT_EQ(pool_->bytes_allocated(), orig_bytes);
3742 }
3743
3744 protected:
3745 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