-
Notifications
You must be signed in to change notification settings - Fork 34
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
test: Check the types of execution arguments #655
Conversation
Codecov Report
@@ Coverage Diff @@
## master #655 +/- ##
=======================================
Coverage 99.27% 99.28%
=======================================
Files 71 72 +1
Lines 9855 9918 +63
=======================================
+ Hits 9784 9847 +63
Misses 71 71
Flags with carried forward coverage won't be shown. Click here to find out more.
|
f924bd4
to
7b9631b
Compare
4b29dd7
to
65f595f
Compare
e637ff1
to
43de6ca
Compare
43de6ca
to
2047266
Compare
acdec1b
to
678af2f
Compare
I only changed the values required to compile and pass the test. The This variant is "middle-ground" for convenience and type safety - it implements constructors for The less strict variant is to conditionally at runtime zero extend the The more strict variant is to only implement constructors for That's why I stayed with minimal changes to focus on design discussion rather than esthetics. My personal opinions is that this variant is good enough and definitely good for stating point to experiment with other variants on top of it. I also want to consider the option to promote this API to public type safe API. I prefer having one common type-safe API. |
The set of constructors looks good and logical. It shouldn't be less strict, because then tests wouldn't show what types are really expected. It shouldn't be more more strict, because signed->unsigned conversion is already handled by But I still don't get why it's better to rely on implicit conversion (which might theoretically be different for different platform).
) Is it just to minimize changes in this PR? What is you preference for the new tests that will execute functions with two parameters? |
The Keep in mind that |
678af2f
to
0812562
Compare
4452038
to
e0b7bd2
Compare
e0b7bd2
to
0796203
Compare
EXPECT_EQ(1_u64, uint64_t{1}); | ||
EXPECT_EQ(0xffffffff_u64, uint64_t{0xffffffff}); | ||
EXPECT_EQ(0x100000000_u64, uint64_t{0x100000000}); | ||
EXPECT_EQ(0xffffffffffffffff_u64, uint64_t{0xffffffffffffffff}); |
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.
What happens to literals larger than 64-bit? Are 128-bit literals supported where __uint128_t
is supported?
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.
There are no builtin integer literals bigger than unsigned long long
. The __int128
does not have its own literal.
// >32-bits set | ||
EXPECT_THAT( | ||
execute_unary_operation(Instr::i32_wrap_i64, 0xffffffffffffffff), Result(0xffffffff)); | ||
execute_unary_operation(Instr::i32_wrap_i64, 0xffffffffffffffff_u64), Result(0xffffffff)); |
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.
Hmm, perhaps result could be also using the _u32
/_u64
literals.
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.
This is separate issue being handled in #659.
979b997
to
b96047f
Compare
b96047f
to
9c42204
Compare
After previously introducing
TypedValue
in #658, this PR adds type checking for execution arguments in unit tests. The type checking is done infizzy::test::execute()
so can be bypassed by usingfizzy::execute()
directly. Still most of the tests uses the former.Later we will add type checking to the execution result and the
Result()
matcher. We will be also able to see the type-checking bypassing cases and correct these if needed.