Skip to content
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

new test for shuffle #636

Merged
merged 2 commits into from
Apr 15, 2017
Merged

new test for shuffle #636

merged 2 commits into from
Apr 15, 2017

Conversation

Dorbedo
Copy link
Contributor

@Dorbedo Dorbedo commented Apr 10, 2017

commys wish from #635 (depending on this pull request)

@@ -21,18 +21,14 @@ TEST_OP(count _result,==,count _original,_fn);
TEST_OP(_x,in,_original,_fn);
} forEach _result;

// Test depecated version.
// test modify original
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't remove what the old test checked. Add a new one that modifies the input array.

Copy link
Contributor Author

@Dorbedo Dorbedo Apr 11, 2017

Choose a reason for hiding this comment

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

The behavior of the functions will change. It won't support the old deprecated Version anymore.
mentioned from commy #635 (comment)

Copy link
Contributor

@Killswitch00 Killswitch00 Apr 11, 2017

Choose a reason for hiding this comment

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

Refactorise the old tests to do what they did before and add a new one that checks if the original array is modified if the function is asked to do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

[1,2,3,4,5,6,7] call CBA_fnc_shuffle;
Old version returns: [4,7,2,1,3,5,6]
New version returns: []

Old version threw a warning to rpt, but still worked.
I am a little worried some people would use it like that.

Copy link
Contributor

Choose a reason for hiding this comment

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

That aswell - use of the "direct array" parameter form is discouraged, but the function still works. Why break it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The warning has been in there since 2009.
My personal opinion is, that the CBA-users should have changed their functions after 8 years of warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Killswitch00 the new feature is not compatible with the old deprecated behavior

Copy link
Contributor

@Killswitch00 Killswitch00 Apr 11, 2017

Choose a reason for hiding this comment

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

Fair enough (re 8 year warning). The unit test refactorisation need remains, though.

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'm sorry, but I don't understand, what you want from me.
Could you please be so kind and point it out for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Look at the last unit test you altered (line 31). That one is refactorised for the new parameter format. The first two tests in the original version should be kept, but updated in the same way. Then add the new test you added for the "modify input array" option.

@@ -21,18 +21,17 @@ TEST_OP(count _result,==,count _original,_fn);
TEST_OP(_x,in,_original,_fn);
} forEach _result;

// Test depecated version.
_original = [1, 2, 3];
_result = _original call CBA_fnc_shuffle;
Copy link
Contributor

Choose a reason for hiding this comment

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

No. Update the way the function is called and then do the same two checks that the original unit test performs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But it would be the same test like in line 16. So you run the test twice

Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't see that one. Good. All cases are covered.

@commy2 commy2 added this to the 3.4 milestone Apr 12, 2017
@commy2 commy2 merged commit 34b1ecc into CBATeam:master Apr 15, 2017
@Dorbedo Dorbedo deleted the new_shuffle_test branch April 15, 2017 14:48
@commy2 commy2 modified the milestones: 3.3, 3.4 Apr 16, 2017
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.

None yet

4 participants