Files
compute-runtime/opencl/test/unit_test/device/get_device_name_tests.cpp
Slawomir Milczarek eb8f5fa301 Get CL Device Name with device ID appended at the end
Related-To: NEO-4744

Change-Id: I8a9a791a634f9c0c444695036d96e3c959c90de0
Signed-off-by: Slawomir Milczarek <slawomir.milczarek@intel.com>
2020-10-13 14:00:33 +02:00

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 << defaultHwInfo->platform.usDeviceID << "]";
EXPECT_STREQ(clDeviceName.str().c_str(), clDevice->getClDeviceName(*defaultHwInfo.get()).c_str());
}