From 6d5162552ba06af48673d4798d20d85ecf7651c9 Mon Sep 17 00:00:00 2001 From: "Mrozek, Michal" Date: Tue, 31 Jul 2018 11:38:09 +0200 Subject: [PATCH] Use make_unique to create mock devices. Change-Id: Ifd3cb1e7594d736d9f783c08b947637de6a876ea --- unit_tests/kernel/debug_kernel_tests.cpp | 8 ++++---- unit_tests/sharings/sharing_factory_tests.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/unit_tests/kernel/debug_kernel_tests.cpp b/unit_tests/kernel/debug_kernel_tests.cpp index aaddc150a9..d5df0ee847 100644 --- a/unit_tests/kernel/debug_kernel_tests.cpp +++ b/unit_tests/kernel/debug_kernel_tests.cpp @@ -31,7 +31,7 @@ using namespace OCLRT; TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCalledThenCorrectValueIsReturned) { - std::unique_ptr device(new MockDevice(*platformDevices[0])); + auto device = std::make_unique(*platformDevices[0]); MockProgram program; program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); @@ -40,7 +40,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetDebugSurfaceBtiIsCal } TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenCorrectValueIsReturned) { - std::unique_ptr device(new MockDevice(*platformDevices[0])); + auto device = std::make_unique(*platformDevices[0]); MockProgram program; program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); @@ -49,7 +49,7 @@ TEST(DebugKernelTest, givenKernelCompiledForDebuggingWhenGetPerThreadSystemThrea } TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledThenInvalidIndexValueIsReturned) { - std::unique_ptr device(new MockDevice(*platformDevices[0])); + auto device = std::make_unique(*platformDevices[0]); MockProgram program; program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); @@ -58,7 +58,7 @@ TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetDebugSurfaceBtiIsCalledT } TEST(DebugKernelTest, givenKernelWithoutDebugFlagWhenGetPerThreadSystemThreadSurfaceSizeIsCalledThenZeroIsReturned) { - std::unique_ptr device(new MockDevice(*platformDevices[0])); + auto device = std::make_unique(*platformDevices[0]); MockProgram program; program.enableKernelDebug(); std::unique_ptr kernel(MockKernel::create(*device.get(), &program)); diff --git a/unit_tests/sharings/sharing_factory_tests.cpp b/unit_tests/sharings/sharing_factory_tests.cpp index 2f18bf34dd..2c2df1bf6d 100644 --- a/unit_tests/sharings/sharing_factory_tests.cpp +++ b/unit_tests/sharings/sharing_factory_tests.cpp @@ -211,7 +211,7 @@ TEST(Context, givenMockSharingBuilderWhenContextWithInvalidPropertiesThenContext stateRestore.clearCurrentState(); stateRestore.registerSharing(SharingType::CLGL_SHARING); - std::unique_ptr device(new MockDevice(*platformDevices[0])); + auto device = std::make_unique(*platformDevices[0]); cl_device_id clDevice = static_cast(device.get()); DeviceVector deviceVector((cl_device_id *)&clDevice, 1); cl_int retVal; @@ -242,7 +242,7 @@ TEST(Context, GivenVaContextWhenItIsCreatedItInitializesPowerSavingMode) { stateRestore.clearCurrentState(); stateRestore.registerSharing(SharingType::VA_SHARING); - std::unique_ptr device(new MockDevice(*platformDevices[0])); + auto device = std::make_unique(*platformDevices[0]); cl_device_id clDevice = static_cast(device.get()); DeviceVector deviceVector((cl_device_id *)&clDevice, 1); cl_int retVal;