This is an archive of the discontinued LLVM Phabricator instance.

[libcxx][test][NFC] Extend get_allocator() testing for containers
ClosedPublic

Authored by kboyarinov on Nov 30 2021, 3:01 AM.

Details

Summary

Add separate tests for get_allocator() method for sequence, ordered and unordered associative containers.
Current tests are intended to test postcondition of constructors that accepts allocator.
Also, new tests covers constancy of the method.

Diff Detail

Event Timeline

kboyarinov requested review of this revision.Nov 30 2021, 3:01 AM
kboyarinov created this revision.
ldionne accepted this revision.Nov 30 2021, 3:12 AM

Thanks a lot for improving the tests! I have some comments, but LGTM otherwise.

libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
24

Suggestion -- in these tests, you could use typedef std::pair<const int, std::string> Pair to make things a little bit less verbose.

29

Just curious, but why are those only enabled in C++11 and later? What is C++11 specific about those?

33

This is going to be needed for the test to pass in C++03 mode (applies elsewhere too).

This revision is now accepted and ready to land.Nov 30 2021, 3:12 AM

Added type aliases for associative containers value_types.
Removed C++11 mode for other_allocator
Fixed C++03

kboyarinov marked 2 inline comments as done.Nov 30 2021, 5:17 AM
kboyarinov added inline comments.
libcxx/test/std/containers/associative/map/get_allocator.pass.cpp
29

You are right, there is no specific C++11 code here, I confused other_allocator with min_allocator, which is wrapped into C++11 macros everywhere. Thank you!

ldionne accepted this revision.Nov 30 2021, 6:54 AM
Mordante accepted this revision.Nov 30 2021, 8:54 AM

Thanks for working on this! LGTM!

rarutyun accepted this revision.Dec 1 2021, 5:03 AM

LGTM