| 687 | |
| 688 | template <typename ArrayFactory, typename ExportCheckFunc> |
| 689 | void TestWithArrayFactory(ArrayFactory&& factory, ExportCheckFunc&& check_func) { |
| 690 | auto orig_bytes = pool_->bytes_allocated(); |
| 691 | |
| 692 | std::shared_ptr<Array> arr; |
| 693 | ASSERT_OK_AND_ASSIGN(arr, ToResult(factory())); |
| 694 | ARROW_SCOPED_TRACE("type = ", arr->type()->ToString(), |
| 695 | ", array data = ", arr->ToString()); |
| 696 | const ArrayData& data = *arr->data(); // non-owning reference |
| 697 | struct ArrowArray c_export; |
| 698 | ASSERT_OK(ExportArray(*arr, &c_export)); |
| 699 | |
| 700 | ArrayExportGuard guard(&c_export); |
| 701 | auto new_bytes = pool_->bytes_allocated(); |
| 702 | ASSERT_GT(new_bytes, orig_bytes); |
| 703 | |
| 704 | // Release the shared_ptr<Array>, underlying data should be held alive |
| 705 | arr.reset(); |
| 706 | ASSERT_EQ(pool_->bytes_allocated(), new_bytes); |
| 707 | check_func(&c_export, data); |
| 708 | |
| 709 | // Release the ArrowArray, underlying data should be destroyed |
| 710 | guard.Release(); |
| 711 | ASSERT_EQ(pool_->bytes_allocated(), orig_bytes); |
| 712 | } |
| 713 | |
| 714 | template <typename ArrayFactory> |
| 715 | void TestNested(ArrayFactory&& factory) { |
nothing calls this directly
no test coverage detected