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

Property-based tests for sets, ordsets and gb_sets #7256

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

Maria-12648430
Copy link
Contributor

This PR provides property-based tests for the sets module.

It does not test sets:new/0,1, since there isn't much that could be property-tested there.

@github-actions
Copy link
Contributor

github-actions bot commented May 17, 2023

CT Test Results

       2 files       90 suites   40m 3s ⏱️
1 920 tests 1 657 ✔️ 263 💤 0
2 221 runs  1 942 ✔️ 279 💤 0

Results for commit cc63f8c.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@Maria-12648430
Copy link
Contributor Author

Maria-12648430 commented May 17, 2023

If #7232 and/or #7183 get accepted and merged earlier, this PR should be updated to include the functions introduced there.

@juhlig
Copy link
Contributor

juhlig commented May 17, 2023

If #7232 and/or #7183 get accepted and merged earlier, this PR should be updated to include the functions introduced there.

The equality check functions from #7232 would be pretty handy in this PR I guess 🙂

@bjorng bjorng self-assigned this May 22, 2023
@bjorng bjorng added the team:VM Assigned to OTP team VM label May 22, 2023
@Maria-12648430
Copy link
Contributor Author

The last commit refactors a lot of what has been done before, going for a model-like approach. It also tests all functions on all set implementations (the ones they have in common, that is).

@Maria-12648430
Copy link
Contributor Author

The last commit does some cleanup (ordering/grouping of functions, comments) and adds another property to test sequences of modifying operations.

@Maria-12648430
Copy link
Contributor Author

On a side note, this suite makes heavy use of the any() generator (explicit and implicit via the list() generator), which contains the atom() generator. The atom() generator produces atoms at random, which can become a problem re the atom limit.

@Maria-12648430 Maria-12648430 changed the title Property-based tests for the sets module Property-based tests for sets, ordsets and gb_sets May 24, 2023
@Maria-12648430 Maria-12648430 changed the title Property-based tests for sets, ordsets and gb_sets WIP: Property-based tests for sets, ordsets and gb_sets May 30, 2023
@Maria-12648430
Copy link
Contributor Author

I marked the PR as WIP, as it still needs some touching up :)

@Maria-12648430
Copy link
Contributor Author

Last commit adds tests for the new functions map/2, filtermap/2 and is_equal/2.

@Maria-12648430
Copy link
Contributor Author

As it stands, this suite alone generates ~800,000 new atoms. Waiting for #7364 which should remedy this.

@Maria-12648430
Copy link
Contributor Author

The last commit uses the atomlimit-safe generators of ct_proper_ext, provided by #7364.

@Maria-12648430 Maria-12648430 changed the title WIP: Property-based tests for sets, ordsets and gb_sets Property-based tests for sets, ordsets and gb_sets Jun 29, 2023
@bjorng
Copy link
Contributor

bjorng commented Jun 29, 2023

Please squash your commits.

@Maria-12648430
Copy link
Contributor Author

Please squash your commits.

Done 😉

@bjorng bjorng added the testing currently being tested, tag is used by OTP internal CI label Jun 29, 2023
@bjorng
Copy link
Contributor

bjorng commented Jun 29, 2023

Thanks! Added to our daily builds.

@bjorng
Copy link
Contributor

bjorng commented Jun 29, 2023

I will now go on vacation and probably be back in about four weeks. @jhogberg will take care of merging this pull request if no problems turn up in our daily builds.

@Maria-12648430
Copy link
Contributor Author

I will now go on vacation

Enjoy 👋

@jhogberg will take care of merging this pull request if no problems turn up in our daily builds.

And hi John 🤝

@Maria-12648430
Copy link
Contributor Author

Rebased on current master to make use of #7495.

@jhogberg jhogberg removed the testing currently being tested, tag is used by OTP internal CI label Jul 28, 2023
@Maria-12648430
Copy link
Contributor Author

@jhogberg @bjorng I wonder, what is the status of this PR? I just now noticed that the testing label was removed shortly after I pushed the last update 🤔

On another note, I realized that the tests in this suite cover only the functions that the three set implementations have in common, but gb_sets has some additional functions that the other two don't have, like singleton, delete, smallest, take_largest, iterator and some more. Should I add them to this suite (like in sets_SUITE) or put up another property test suite for the additional functions of gb_sets), what do you think?

@jhogberg jhogberg added the testing currently being tested, tag is used by OTP internal CI label Aug 14, 2023
@jhogberg
Copy link
Contributor

@jhogberg @bjorng I wonder, what is the status of this PR? I just now noticed that the testing label was removed shortly after I pushed the last update 🤔

The status is that it fell between the cracks. 😅

I'll merge this in the next few days if the tests pass. :)

On another note, I realized that the tests in this suite cover only the functions that the three set implementations have in common, but gb_sets has some additional functions that the other two don't have, like singleton, delete, smallest, take_largest, iterator and some more. Should I add them to this suite (like in sets_SUITE) or put up another property test suite for the additional functions of gb_sets), what do you think?

Feel free to do the latter in a separate PR.

@Maria-12648430
Copy link
Contributor Author

The status is that it fell between the cracks. 😅

Ah, no problem 😉

Feel free to do the latter in a separate PR.

Will do 👍

@Maria-12648430
Copy link
Contributor Author

@bjorng so, with @jhogberg going on vacation, it seems that this PR has come back to haunt you 😁

I noticed that I forgot the copyright header and added it in the last commit.

@bjorng bjorng merged commit d3aa6c0 into erlang:master Aug 18, 2023
@bjorng
Copy link
Contributor

bjorng commented Aug 18, 2023

Thanks for your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants