-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: minor fixes and introduce some test cases for VertexResource #4885
Conversation
18314bc
to
cf9fa56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for tests and docs. The tests look straightforward, making it clear what they're going for.
I notice a lot of tests creating a builder, calling exactly one method on it, and then build()
, which suggests we might want to add a more convenient API for that later.
I'm not merging this immediately, so you have a chance to decide if there's anything in these comments you want to add, but feel free to merge when ready.
a1.put(15.5f); | ||
a1.put(2.0f); | ||
a1.put(-100.0f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun ways to test floating-point data structures include: -0
(negative zero), NaN
, POSITIVE_INFINITY
.
(This may or may not actually be relevant for this application.)
resource.writeBuffer(buffer -> { | ||
assertEquals(4 * Byte.BYTES, buffer.limit()); | ||
|
||
assertEquals(10, Byte.toUnsignedInt(buffer.get(Byte.BYTES * 0))); | ||
assertEquals(150, Byte.toUnsignedInt(buffer.get(Byte.BYTES * 1))); | ||
assertEquals(255, Byte.toUnsignedInt(buffer.get(Byte.BYTES * 2))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this 255
case is the one that goes with that clamp()
you added. I suggest pointing that out with a comment, it's pretty easy to miss when scanning through these lines and numbers that are mostly all the same.
Should this test a negative value too?
some basic test cases for VertexResource.