@@ -356,6 +356,57 @@ TEST_F(test, disjointPoolName) {
356356 umfDisjointPoolParamsDestroy (params);
357357}
358358
359+ TEST_F (test, disjointPoolDefaultParams) {
360+ umf_disjoint_pool_params_handle_t params = nullptr ;
361+ umf_memory_pool_handle_t pool = nullptr ;
362+ umf_memory_provider_handle_t provider_handle = nullptr ;
363+
364+ // Create disjoint pool parameters with default settings
365+ umf_result_t res = umfDisjointPoolParamsCreate (¶ms);
366+ EXPECT_EQ (res, UMF_RESULT_SUCCESS);
367+
368+ struct memory_provider : public umf_test ::provider_base_t {
369+ umf_result_t alloc (size_t size, size_t alignment, void **ptr) noexcept {
370+ *ptr = umf_ba_global_aligned_alloc (size, alignment);
371+ return UMF_RESULT_SUCCESS;
372+ }
373+
374+ umf_result_t free (void *ptr, [[maybe_unused]] size_t size) noexcept {
375+ // do the actual free only when we expect the success
376+ umf_ba_global_free (ptr);
377+ return UMF_RESULT_SUCCESS;
378+ }
379+ };
380+
381+ umf_memory_provider_ops_t provider_ops =
382+ umf_test::providerMakeCOps<memory_provider, void >();
383+
384+ auto providerUnique =
385+ wrapProviderUnique (createProviderChecked (&provider_ops, nullptr ));
386+ provider_handle = providerUnique.get ();
387+
388+ umf_result_t ret =
389+ umfPoolCreate (umfDisjointPoolOps (), provider_handle, params,
390+ UMF_POOL_CREATE_FLAG_DISABLE_TRACKING, &pool);
391+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
392+
393+ // Test allocation and deallocation
394+ // This will use the default disjoint pool parameters
395+ void *ptr = umfPoolMalloc (pool, 64 );
396+ ASSERT_NE (ptr, nullptr );
397+ ret = umfPoolFree (pool, ptr);
398+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
399+
400+ // Test allocation and deallocation with a different size
401+ ptr = umfPoolMalloc (pool, 1024 );
402+ ASSERT_NE (ptr, nullptr );
403+ ret = umfPoolFree (pool, ptr);
404+ ASSERT_EQ (ret, UMF_RESULT_SUCCESS);
405+
406+ umfPoolDestroy (pool);
407+ umfDisjointPoolParamsDestroy (params);
408+ }
409+
359410INSTANTIATE_TEST_SUITE_P (disjointPoolTests, umfPoolTest,
360411 ::testing::Values (poolCreateExtParams{
361412 umfDisjointPoolOps (), defaultDisjointPoolConfig,
0 commit comments