UT for createSubBuffer#254
Open
piotr-wozniak-mobica wants to merge 3 commits intoKhronosGroup:mainfrom
Open
Conversation
dbbf919 to
41289ab
Compare
bashbaug
requested changes
Nov 15, 2023
tests/test_openclhpp.cpp
Outdated
Comment on lines
4540
to
4547
| static cl::Buffer ret; | ||
|
|
||
| clCreateSubBuffer_StubWithCallback(clCreateSubBuffer_testCreateSubBuffer); | ||
| ret = bufferPool[0].createSubBuffer(flags, buffer_create_type, | ||
| buffer_create_info, err); | ||
|
|
||
| TEST_ASSERT_EQUAL_PTR(make_mem(1), ret()); | ||
| ret() = nullptr; |
Contributor
There was a problem hiding this comment.
Please make this variable non-static:
Suggested change
| static cl::Buffer ret; | |
| clCreateSubBuffer_StubWithCallback(clCreateSubBuffer_testCreateSubBuffer); | |
| ret = bufferPool[0].createSubBuffer(flags, buffer_create_type, | |
| buffer_create_info, err); | |
| TEST_ASSERT_EQUAL_PTR(make_mem(1), ret()); | |
| ret() = nullptr; | |
| clCreateSubBuffer_StubWithCallback(clCreateSubBuffer_testCreateSubBuffer); | |
| clReleaseMemObject_ExpectAndReturn(make_mem(1), CL_SUCCESS); | |
| cl::Buffer ret = bufferPool[0].createSubBuffer(flags, buffer_create_type, | |
| buffer_create_info, err); | |
| TEST_ASSERT_EQUAL_PTR(make_mem(1), ret()); |
tests/test_openclhpp.cpp
Outdated
Comment on lines
4525
to
4528
| TEST_ASSERT_EQUAL(make_mem(0), buffer); | ||
| TEST_ASSERT_EQUAL(0, flags); | ||
| TEST_ASSERT_EQUAL(0, buffer_create_type); | ||
| TEST_ASSERT_EQUAL_PTR(nullptr, buffer_create_info); |
Contributor
There was a problem hiding this comment.
We really ought to be testing more real-world values here:
buffer- this one is OK.flags- a value of0is legal, but it's not a very useful value to test to see if the flags are being passed through properly. Maybe pass something likeCL_MEM_READ_ONLYinstead?buffer_create_type- this should beCL_BUFFER_CREATE_TYPE_REGION, since this is the only buffer creation type described in the spec.buffer_create_info- this should be a non-NULL pointer to acl_buffer_regionstructure. Ideally, we should check that the pointer is non-NULL, and that the contents of the structure are what we expect.
Contributor
|
@bashbaug Added corrections. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.