mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 15:53:13 +08:00
- extend AllocationType to code necessary flags - remove redundant args - refactor Buffer::create() Change-Id: Ic4b2e0931fad8198ad1cf4f79de210d815048ccf
49 lines
2.1 KiB
C++
49 lines
2.1 KiB
C++
/*
|
|
* Copyright (c) 2018, Intel Corporation
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included
|
|
* in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#include "runtime/helpers/array_count.h"
|
|
#include "runtime/memory_manager/memory_pool.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
TEST(MemoryPool, givenSystemMemoryPoolTypesWhenIsSystemMemoryPoolIsCalledThenTrueIsReturned) {
|
|
|
|
MemoryPool::Type systemMemoryTypes[] = {MemoryPool::System4KBPages,
|
|
MemoryPool::System4KBPagesWith32BitGpuAddressing,
|
|
MemoryPool::System64KBPages,
|
|
MemoryPool::System64KBPagesWith32BitGpuAddressing};
|
|
|
|
for (size_t i = 0; i < arrayCount(systemMemoryTypes); i++) {
|
|
EXPECT_TRUE(MemoryPool::isSystemMemoryPool(systemMemoryTypes[i]));
|
|
}
|
|
}
|
|
|
|
TEST(MemoryPool, givenNonSystemMemoryPoolTypesWhenIsSystemMemoryPoolIsCalledThenFalseIsReturned) {
|
|
|
|
MemoryPool::Type memoryTypes[] = {MemoryPool::MemoryNull,
|
|
MemoryPool::SystemCpuInaccessible};
|
|
|
|
for (size_t i = 0; i < arrayCount(memoryTypes); i++) {
|
|
EXPECT_FALSE(MemoryPool::isSystemMemoryPool(memoryTypes[i]));
|
|
}
|
|
}
|