-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Marshall core unit tests #44797
Marshall core unit tests #44797
Conversation
Ah, has just noticed the requirement about intermediate commits. Also, if I plan to add |
Indeed, that would be good. See PR workflow for instructions.
If it's tests which should be part of the Marshall unit tests, they should likely be in this PR too. Could be a separate commit, or squash into the original one, depending on how "separate" they are in scope and implementation. |
1a39333
to
7130760
Compare
tests/test_marshalls.h
Outdated
uint8_t arr[] = { 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f }; | ||
|
||
// See floating point encoding test case for details behind expected values | ||
CHECK(Math::is_equal_approx(decode_double(arr), 0.333333333333333314829616256247390992939472198486328125)); |
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.
Since we are testing the validity of an encoded value, this should be exact equality, not approximate equality.
Also, you don't need to use the exact decimal value for the literal. Any decimal literal will automatically become the closest possible double, so we just need to put enough threes (17 digits is the safe amount) for it to become 0.333333333333333314829616256247390992939472198486328125
.
CHECK(Math::is_equal_approx(decode_double(arr), 0.333333333333333314829616256247390992939472198486328125)); | |
CHECK(decode_double(arr) == 0.33333333333333333)); |
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.
I agree, done.
7130760
to
d3034da
Compare
15e36d8
to
d588623
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.
Looks good to me. Someone else should also review this though.
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.
Looks good enough to me!
9681662
to
69b554e
Compare
Thanks! And congrats for your first merged Godot contribution 🎉 |
Actually it was an interesting dig to become more familiar with the engine. |
First-time contributor here!
Added unit tests for core functions from
marshalls.h
as discussed in #43440.Haven't created ones for encode/decode. In process of creating tests for different cases ofVariant
functions yetVariant
types.Thanks.