Skip to content

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

Merged
merged 8 commits into from
Dec 26, 2023
Merged

Conversation

jorgsowa
Copy link
Contributor

This PR intends to improve the function pow() tests to be able perform more changes to it in the future.

Copy link
Member

@Girgias Girgias left a 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()
Copy link
Member

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

Copy link
Contributor Author

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.

Comment on lines 63 to 66
'abcxyz',
$heredoc,
'5.5',
'2',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'abcxyz',
$heredoc,
'5.5',
'2',
'5.5',
'2',

Frankly we don't care about testing "different ways to write strings"

Copy link
Contributor Author

@jorgsowa jorgsowa Dec 23, 2023

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.

Copy link
Member

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.

Copy link
Contributor Author

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 😉

@jorgsowa jorgsowa force-pushed the improve-pow-function-tests branch from 3782a36 to 02a08ce Compare December 23, 2023 17:20
@Girgias Girgias merged commit f5f44bb into php:master Dec 26, 2023
@jorgsowa jorgsowa deleted the improve-pow-function-tests branch February 8, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants