This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Fix order checking in unordered_multimap tests.
ClosedPublic

Authored by amakc11 on Nov 22 2018, 12:36 PM.

Details

Reviewers
EricWF
ldionne
Summary

Some tests assume that iteration through an unordered multimap elements will return them in the same order as at the container creation. This assumption is not true since the container is unordered, so that no specific order of elements is ever guaranteed for such container. This patch introduces checks verifying that any iteration will return elements exactly from a set of valid values and without repetition, but in no particular order.

Diff Detail

Event Timeline

amakc11 created this revision.Nov 22 2018, 12:36 PM
ldionne requested changes to this revision.Nov 26 2018, 11:45 AM

Please make sure you can run the test suite with your patch in C++03 mode.

test/std/containers/unord/unord.multimap/reserve.pass.cpp
31

This is going to fail in C++03 mode because you're using initializer-list construction.

This revision now requires changes to proceed.Nov 26 2018, 11:45 AM

Hmm, I'm confused by this change request. All the tests I patched are intended to test unordered_multimap container, which was introduced in C++11. So, they won't compile in C++03 mode in any case. Please, clarify the reason for the patch change.

Hmm, I'm confused by this change request. All the tests I patched are intended to test unordered_multimap container, which was introduced in C++11. So, they won't compile in C++03 mode in any case. Please, clarify the reason for the patch change.

We seem to be supporting those containers in C++03 mode, as an extension.

I just had a discussion with other libc++ maintainers and we'd like to conserve the order-dependent tests, but only for libc++. Could you please keep the order-dependent tests in a suitably-named file under test/libcxx/<...> instead of test/std/<...>? Tests under test/libcxx/ are libc++-specific.

Hmm, I'm confused by this change request. All the tests I patched are intended to test unordered_multimap container, which was introduced in C++11. So, they won't compile in C++03 mode in any case. Please, clarify the reason for the patch change.

Libc++ was never a c++03 standard library implementation.
It started out as C++11. We support most of the C++11 features even if the user specifies -std=c++98 or -std=c++03

amakc11 updated this revision to Diff 175480.Nov 27 2018, 7:42 AM

Initializer-list construction replaced with insert() throughout the tests.

Could you please keep the order-dependent tests in a suitably-named file under test/libcxx/<...> instead of test/std/<...>? Tests under test/libcxx/ are libc++-specific.

I would suggest someone from libc++ test suite developers/maintainers team to do this, if it is necessary for them, before the patch is applied to test/std/<...> tests. I'm not a member of this team, but just yet another external user of test/std/<...> tests. So, I'd like to avoid intervening into another expert team's job by trying to solve their internal tasks having no sufficient expertize to do this.

Is this patch rejected? BTW, since git repository is used to store tests, the copy of any previous version of the patched tests can be made any time after the patch is applied.

ldionne accepted this revision.Dec 20 2018, 9:58 AM

Merged in r349780.

This revision is now accepted and ready to land.Dec 20 2018, 9:58 AM
ldionne closed this revision.Dec 20 2018, 9:58 AM