mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 15:12:56 +08:00
Related-To: NEO-4744 Change-Id: Iedca3cb68c015e70bcebbeb2a45fdc2a8563518d Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
35 lines
1.1 KiB
C++
35 lines
1.1 KiB
C++
/*
|
|
* Copyright (C) 2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/test/unit_test/helpers/default_hw_info.h"
|
|
#include "shared/test/unit_test/mocks/mock_device.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace NEO {
|
|
extern const char *familyName[];
|
|
} // namespace NEO
|
|
|
|
using namespace NEO;
|
|
|
|
using DeviceNameTest = ::testing::Test;
|
|
|
|
TEST_F(DeviceNameTest, WhenCallingGetClDeviceNameThenReturnDeviceNameWithDeviceIdAppendedAtTheEnd) {
|
|
auto clDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get()));
|
|
|
|
std::string deviceName = "Intel(R) Graphics ";
|
|
deviceName += familyName[defaultHwInfo->platform.eRenderCoreFamily];
|
|
EXPECT_STREQ(deviceName.c_str(), clDevice->device.getDeviceName(*defaultHwInfo.get()).c_str());
|
|
|
|
std::stringstream clDeviceName;
|
|
clDeviceName << deviceName;
|
|
clDeviceName << " [0x" << std::hex << std::setw(4) << std::setfill('0') << defaultHwInfo->platform.usDeviceID << "]";
|
|
EXPECT_STREQ(clDeviceName.str().c_str(), clDevice->getClDeviceName(*defaultHwInfo.get()).c_str());
|
|
}
|