-
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: Refactor utils for binop/unop tests #651
Conversation
I think some of these changes are in conflict with (or duplicated in) #655, lets wait for that. |
3d14850
to
8b6b953
Compare
Codecov Report
@@ Coverage Diff @@
## master #651 +/- ##
=======================================
Coverage 99.30% 99.30%
=======================================
Files 72 72
Lines 10067 10090 +23
=======================================
+ Hits 9997 10020 +23
Misses 70 70
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
TypedExecutionResult execute_unary_operation(Instr instr, TypedValue arg) | ||
{ | ||
return create_unary_operation_executor(instr)(arg); |
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.
Will these create helpers used later in other PRs?
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.
The i64_eqz
is using it.
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.
The point is to avoid type check or why is it needed?
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.
It is not needed, but it is lame to create module+instance for every test case. Here we create a lambda capturing the instance and we can execute multiple test cases.
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.
Well, the fresh instance gives the benefit, that nothing is dirty anywhere in the instance. However this way perhaps we could catch other bugs/problems caused by some uncleaned state.
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.
It is not needed, but it is lame to create module+instance for every test case. Here we create a lambda capturing the instance and we can execute multiple test cases.
But there are many tests still using execute_unary_operation
/ execute_binary_operation
, why leave it inconsistent?
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 PR mostly enables you to do the change. I needed it for more eqz
test cases. For other instructions I prefer to go one-by-one later and add more test cases (something more than 42
). But I can syntactically replace the code right now if you prefer all at once (will not add more cases 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.
I would prefer to replace all of them here, if it's easy. (and remove execute_*
functions)
8b6b953
to
56bdff1
Compare
d975992
to
57fcaf4
Compare
56bdff1
to
ed9f016
Compare
{ | ||
const auto& instr_type = get_instruction_type_table()[static_cast<uint8_t>(instr)]; | ||
EXPECT_EQ(instr_type.inputs.size(), 1); | ||
EXPECT_EQ(instr_type.outputs.size(), 1); | ||
EXPECT_EQ(instr_type.inputs[0], arg.type); |
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.
Should this check go inside lambda now?
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.
The test::execute()
checks types inside.
c381438
to
9e96129
Compare
|
57fcaf4
to
97ff588
Compare
9e96129
to
23672b7
Compare
97ff588
to
603aca8
Compare
23672b7
to
ff747ef
Compare
No description provided.