|
| 1 | +// Copyright (C) 2023 Intel Corporation |
| 2 | +// SPDX-License-Identifier: MIT |
| 3 | + |
| 4 | +#include <uur/fixtures.h> |
| 5 | + |
| 6 | +using urUSMPoolCreateTest = uur::urContextTest; |
| 7 | + |
| 8 | +TEST_F(urUSMPoolCreateTest, Success) { |
| 9 | + ur_usm_pool_desc_t pool_desc{UR_STRUCTURE_TYPE_USM_POOL_DESC, nullptr, |
| 10 | + UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK}; |
| 11 | + ur_usm_pool_handle_t pool = nullptr; |
| 12 | + ASSERT_SUCCESS(urUSMPoolCreate(context, &pool_desc, &pool)); |
| 13 | + ASSERT_NE(pool, nullptr); |
| 14 | + EXPECT_SUCCESS(urUSMPoolDestroy(context, pool)); |
| 15 | +} |
| 16 | + |
| 17 | +TEST_F(urUSMPoolCreateTest, InvalidNullHandleContext) { |
| 18 | + ur_usm_pool_desc_t pool_desc{UR_STRUCTURE_TYPE_USM_POOL_DESC, nullptr, |
| 19 | + UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK}; |
| 20 | + ur_usm_pool_handle_t pool = nullptr; |
| 21 | + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, |
| 22 | + urUSMPoolCreate(nullptr, &pool_desc, &pool)); |
| 23 | +} |
| 24 | + |
| 25 | +TEST_F(urUSMPoolCreateTest, InvalidNullPointerPoolDesc) { |
| 26 | + ur_usm_pool_handle_t pool = nullptr; |
| 27 | + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER, |
| 28 | + urUSMPoolCreate(context, nullptr, &pool)); |
| 29 | +} |
| 30 | + |
| 31 | +TEST_F(urUSMPoolCreateTest, InvalidNullPointerPool) { |
| 32 | + ur_usm_pool_desc_t pool_desc{UR_STRUCTURE_TYPE_USM_POOL_DESC, nullptr, |
| 33 | + UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK}; |
| 34 | + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER, |
| 35 | + urUSMPoolCreate(context, &pool_desc, nullptr)); |
| 36 | +} |
| 37 | + |
| 38 | +TEST_F(urUSMPoolCreateTest, InvalidEnumerationFlags) { |
| 39 | + ur_usm_pool_desc_t pool_desc{UR_STRUCTURE_TYPE_USM_POOL_DESC, nullptr, |
| 40 | + UR_USM_POOL_FLAG_FORCE_UINT32}; |
| 41 | + ur_usm_pool_handle_t pool = nullptr; |
| 42 | + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, |
| 43 | + urUSMPoolCreate(context, &pool_desc, &pool)); |
| 44 | +} |
0 commit comments