Page MenuHomePhabricator

[libcxx][test][NFC] Add tests for C++14 constructors of unordered sets
ClosedPublic

Authored by kboyarinov on Feb 8 2022, 7:01 AM.

Details

Summary

Follow-up for D119236

Add (almost identical) tests for C++14 constructors in unordered_set and unordered_multiset:

unordered_[multi]set(size_type sz, const allocator_type& alloc);
unordered_[multi]set(size_type sz, const hasher& hash, const allocator_type& alloc);

template <class InputIt>
unordered_[multi]set(InputIt first, InputIt last, size_type sz, const allocator_type& alloc);

template <class InputIt>
unordered_[multi]set(InputIt first, InputIt last, size_type sz, const hasher& hash, const allocator_type& alloc);

unordered_[multi]set(initializer_list<value_type> init, size_type sz, const allocator_type& alloc);
unordered_[multi]set(initializer_list<value_type> init, size_type sz, const hasher& hash, const allocator_type& alloc);

Diff Detail

Event Timeline

kboyarinov requested review of this revision.Feb 8 2022, 7:01 AM
kboyarinov created this revision.

LGTM % comments — which are significant, but I don't particularly need to see this again if the comments are addressed.

libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/init_size_allocator.pass.cpp
60–61

Should #include <iterator> for std::distance. FWIW, I think these two lines are overkill and weakly suggest removing them, but whatever.

70

Nit: Unless there's a reason to use {} over () on line 69 specifically (and I can't imagine what that would be), I'd prefer to be consistent — use () everywhere.

libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/range_size_allocator.pass.cpp
1 ↗(On Diff #406810)

The name of this file should be iter_iter_size_allocator.pass.cpp — especially in C++20, the difference between "takes two iterators" and "takes a range" is potentially significant. Ditto throughout, basically every range_*.cpp should be renamed to iter_iter_*.cpp.
(Or iterator_iterator_*.cpp; I have no strong opinion there; iter_iter_ just seemed unambiguous and shorter.)

This revision is now accepted and ready to land.Feb 8 2022, 7:59 AM
kboyarinov updated this revision to Diff 407103.Feb 9 2022, 2:53 AM

Applying comments

kboyarinov marked 2 inline comments as done.Feb 9 2022, 2:55 AM

I have renamed tests that accept a pair of iterators: "range_*"->"iter_iter_*" for all such tests for sets

ldionne accepted this revision.Feb 10 2022, 7:17 AM
rarutyun accepted this revision.Mar 3 2022, 3:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2022, 3:50 AM