diff --git a/tests/test_openclhpp.cpp b/tests/test_openclhpp.cpp index 0bc79820..19360a0b 100644 --- a/tests/test_openclhpp.cpp +++ b/tests/test_openclhpp.cpp @@ -4343,7 +4343,16 @@ static cl_mem clCreateFromGLBuffer_testgetObjectInfo(cl_context context, cl_int *errcode_ret, int num_calls) { - (void)num_calls; + switch (num_calls) { + case 0: + TEST_ASSERT_EQUAL(0, bufobj); + break; + case 1: + TEST_ASSERT_EQUAL(1, bufobj); + break; + default: + break; + } TEST_ASSERT_EQUAL_PTR(make_context(0), context); TEST_ASSERT_EQUAL(0, flags); @@ -4357,10 +4366,24 @@ static cl_int clGetGLObjectInfo_testgetObjectInfo(cl_mem memobj, cl_GLuint *gl_object_name, int num) { - memobj = make_mem(0); - *type = CL_GL_OBJECT_TEXTURE2D_ARRAY; + cl_int ret = CL_SUCCESS; + TEST_ASSERT_EQUAL(memobj, make_mem(0)); + switch (num) { + case 0: + TEST_ASSERT_EQUAL(CL_GL_OBJECT_TEXTURE2D_ARRAY, *type); + *type = CL_GL_OBJECT_BUFFER; + break; + case 1: + TEST_ASSERT_EQUAL(CL_GL_OBJECT_BUFFER, *type); + *type = CL_GL_OBJECT_TEXTURE2D_ARRAY; + ret = CL_DEVICE_NOT_FOUND; + break; + default: + break; + } + *gl_object_name = 0; - return CL_SUCCESS; + return ret; } cl_int clReleaseMemObject_testgetObjectInfo(cl_mem memobj, int ret) @@ -4380,9 +4403,17 @@ void testgetObjectInfo() { clReleaseMemObject_StubWithCallback(clReleaseMemObject_testgetObjectInfo); cl::BufferGL buffer(contextPool[0], flags, bufobj, &err); - buffer.getObjectInfo(&type, &bufobj); - TEST_ASSERT_EQUAL_PTR(make_mem(0), buffer()); TEST_ASSERT_EQUAL(CL_SUCCESS, err); + + TEST_ASSERT_EQUAL(buffer.getObjectInfo(&type, &bufobj), CL_SUCCESS); + TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_BUFFER); + TEST_ASSERT_EQUAL(bufobj, 0); + type = CL_GL_OBJECT_BUFFER; + bufobj = 1; + + TEST_ASSERT_EQUAL(buffer.getObjectInfo(&type, &bufobj), CL_DEVICE_NOT_FOUND); + TEST_ASSERT_EQUAL(type, CL_GL_OBJECT_TEXTURE2D_ARRAY); + TEST_ASSERT_EQUAL(bufobj, 0); } } // extern "C"