Skip to content

Commit a6459b0

Browse files
committed
Add test for GET_DEVICE_VERSION + clGetDeviceInfo.
Change-Id: I3894552237bb1c56efcd4da651c9b9be71980cc0
1 parent d8fa90a commit a6459b0

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

unit_tests/device/get_device_info_size_tests.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (c) 2017 - 2018, Intel Corporation
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a
55
* copy of this software and associated documentation files (the "Software"),
@@ -150,3 +150,25 @@ INSTANTIATE_TEST_CASE_P(
150150
Device_,
151151
GetDeviceInfoSize,
152152
testing::ValuesIn(deviceInfoParams2));
153+
154+
TEST(DeviceInfoTests, givenDefaultDeviceWhenQueriedForDeviceVersionThenProperSizeIsReturned) {
155+
auto device = std::unique_ptr<Device>(DeviceHelper<>::create());
156+
size_t sizeReturned = 0;
157+
auto retVal = device->getDeviceInfo(
158+
CL_DEVICE_VERSION,
159+
0,
160+
nullptr,
161+
&sizeReturned);
162+
163+
EXPECT_EQ(CL_SUCCESS, retVal);
164+
EXPECT_EQ(16u, sizeReturned);
165+
std::unique_ptr<char[]> deviceVersion(new char[sizeReturned]);
166+
167+
retVal = device->getDeviceInfo(
168+
CL_DEVICE_VERSION,
169+
sizeReturned,
170+
deviceVersion.get(),
171+
nullptr);
172+
173+
EXPECT_EQ(CL_SUCCESS, retVal);
174+
}

0 commit comments

Comments
 (0)