-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathtest_pool_null_params.cpp
More file actions
76 lines (66 loc) · 2.1 KB
/
Copy pathtest_pool_null_params.cpp
File metadata and controls
76 lines (66 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* Copyright (C) 2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include <gtest/gtest.h>
#include <umf/memory_pool.h>
#include <umf/memory_provider.h>
#include <umf/pools/pool_disjoint.h>
#include <umf/pools/pool_jemalloc.h>
#include <umf/pools/pool_proxy.h>
#include <umf/pools/pool_scalable.h>
#include "provider_null.h"
// Dummy provider implementation for testing
static umf_memory_provider_ops_t dummy_provider_ops = UMF_NULL_PROVIDER_OPS;
using PoolOpsFn = const umf_memory_pool_ops_t *(*)();
class PoolNullParamsTest : public ::testing::TestWithParam<PoolOpsFn> {
protected:
umf_memory_provider_handle_t provider = NULL;
void SetUp() override {
ASSERT_EQ(umfMemoryProviderCreate(&dummy_provider_ops, NULL, &provider),
UMF_RESULT_SUCCESS);
}
void TearDown() override {
if (provider) {
umfMemoryProviderDestroy(provider);
}
}
};
TEST_P(PoolNullParamsTest, CreateWithNullParams) {
umf_memory_pool_handle_t pool;
PoolOpsFn opsFn = GetParam();
umf_result_t res = umfPoolCreate(opsFn(), provider, NULL, 0, &pool);
ASSERT_EQ(res, UMF_RESULT_SUCCESS);
umfPoolDestroy(pool);
}
namespace {
const PoolOpsFn poolOpsList[] = {
#if defined(UMF_POOL_SCALABLE_ENABLED)
&umfScalablePoolOps,
#endif
#if defined(UMF_POOL_JEMALLOC_ENABLED)
&umfJemallocPoolOps,
#endif
#if defined(UMF_POOL_PROXY_ENABLED)
&umfProxyPoolOps
#endif
&umfDisjointPoolOps};
static const char *poolOpsNames[] = {
#if defined(UMF_POOL_SCALABLE_ENABLED)
"umfScalablePoolOps",
#endif
#if defined(UMF_POOL_JEMALLOC_ENABLED)
"umfJemallocPoolOps",
#endif
#if defined(UMF_POOL_PROXY_ENABLED)
"umfProxyPoolOps",
#endif
"umfDisjointPoolOps"};
} // namespace
INSTANTIATE_TEST_SUITE_P(poolNullParamsTest, PoolNullParamsTest,
::testing::ValuesIn(poolOpsList),
([](auto const &info) -> std::string {
return poolOpsNames[info.index];
}));