| 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_; |
nothing calls this directly
no test coverage detected