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