-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Improve pow function tests #13005
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
Improve pow function tests #13005
Conversation
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 fine, but the test is kinda bad already might be worth to properly clean it up
|
||
// resource variable | ||
/*26*/ $fp | ||
/*28*/ $fp | ||
); | ||
|
||
// loop through each element of $inputs to check the behaviour of pow() |
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.
Can't the two variation tets just be combined into 1?
Running a double foreach loop seems more sensible? Also, not sure having the iteration numbers is that useful. Compared to knowing what were the operands.
A bunch of the "data" is also repeated, we don't care about the capitalization of null
or the boolean values
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 have removed all redundant use cases. I left two separate tests but may combine it later. I just wanted to add missing numerical strings to the tests.
'abcxyz', | ||
$heredoc, | ||
'5.5', | ||
'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.
'abcxyz', | |
$heredoc, | |
'5.5', | |
'2', | |
'5.5', | |
'2', |
Frankly we don't care about testing "different ways to write strings"
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.
As this is the function power
, I think it's relevant that it works fine for numerical strings. I want to propose later setting up parameter types for this function, but wanted to fix the tests first.
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 was talking about the heredoc and usage of single quote instead of double. The numeric string cases make sense, although you are missing a numeric string in scientific notation.
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 understand, thank you. Removed the heredoc string and added numeric string in scientific notation 😉
3782a36
to
02a08ce
Compare
This PR intends to improve the function
pow()
tests to be able perform more changes to it in the future.