From a6459b0496d2b7eeb25dd8bcd19d8c69f2d289a7 Mon Sep 17 00:00:00 2001 From: "Mrozek, Michal" Date: Fri, 13 Apr 2018 06:35:05 +0200 Subject: [PATCH] Add test for GET_DEVICE_VERSION + clGetDeviceInfo. Change-Id: I3894552237bb1c56efcd4da651c9b9be71980cc0 --- .../device/get_device_info_size_tests.cpp | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/unit_tests/device/get_device_info_size_tests.cpp b/unit_tests/device/get_device_info_size_tests.cpp index 8eb4a56fa4..a691d7281b 100644 --- a/unit_tests/device/get_device_info_size_tests.cpp +++ b/unit_tests/device/get_device_info_size_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Intel Corporation + * Copyright (c) 2017 - 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"), @@ -150,3 +150,25 @@ INSTANTIATE_TEST_CASE_P( Device_, GetDeviceInfoSize, testing::ValuesIn(deviceInfoParams2)); + +TEST(DeviceInfoTests, givenDefaultDeviceWhenQueriedForDeviceVersionThenProperSizeIsReturned) { + auto device = std::unique_ptr(DeviceHelper<>::create()); + size_t sizeReturned = 0; + auto retVal = device->getDeviceInfo( + CL_DEVICE_VERSION, + 0, + nullptr, + &sizeReturned); + + EXPECT_EQ(CL_SUCCESS, retVal); + EXPECT_EQ(16u, sizeReturned); + std::unique_ptr deviceVersion(new char[sizeReturned]); + + retVal = device->getDeviceInfo( + CL_DEVICE_VERSION, + sizeReturned, + deviceVersion.get(), + nullptr); + + EXPECT_EQ(CL_SUCCESS, retVal); +} \ No newline at end of file