From f96b8f865682e0bc27f6f61c34c5e75f76490ee4 Mon Sep 17 00:00:00 2001 From: piotr-wozniak-mobica <127202485+piotr-wozniak-mobica@users.noreply.github.com> Date: Wed, 15 Nov 2023 23:04:12 +0100 Subject: [PATCH] UT for getHostTimer (#253) --- tests/test_openclhpp.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/test_openclhpp.cpp b/tests/test_openclhpp.cpp index 1d958123..c564a469 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4571,4 +4571,25 @@ void testgetObjectInfo() { TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER); TEST_ASSERT_EQUAL(bufobj, 0); } +#if CL_HPP_TARGET_OPENCL_VERSION >= 210 +static cl_int clGetHostTimer_testgetHostTimer(cl_device_id device, + cl_ulong *host_timestamp, + int num_calls) { + TEST_ASSERT_EQUAL_PTR(devicePool[0](), device); + TEST_ASSERT_EQUAL(0, num_calls); + *host_timestamp = 1; + return 0; +} + +void testgetHostTimer() { + cl_ulong retVal = 0; + cl_int *error = nullptr; + + clGetHostTimer_StubWithCallback(clGetHostTimer_testgetHostTimer); + retVal = devicePool[0].getHostTimer(error); + TEST_ASSERT_EQUAL(retVal, 1); +} +#else +void testgetHostTimer() {} +#endif // CL_HPP_TARGET_OPENCL_VERSION >= 210 } // extern "C"