Commit Graph

439 Commits

Author SHA1 Message Date
Daniel James
8c139940e7 More merge tests between compatible containers 2017-04-30 14:29:05 +01:00
Daniel James
cae6b121b2 Improve test coverage a little 2017-04-28 21:26:21 +01:00
Daniel James
bfcdd51b4a Fix try_emplace overload 2017-04-28 09:53:50 +01:00
Daniel James
a1b1df84a0 Store bucket + whether first in group in node
Instead of the hash value.
2017-04-27 18:22:44 +01:00
Daniel James
ea64f2e46e Remove the grouped node stuff 2017-04-27 18:22:43 +01:00
Daniel James
9c8980e6a1 Write out epoint that threw an exception after failure 2017-04-25 01:21:44 +01:00
Daniel James
60127d86e0 After 5 failures stop running an exception test 2017-04-25 01:10:53 +01:00
Daniel James
0c3c738614 Better C++ version info 2017-04-25 01:09:07 +01:00
Daniel James
b070bb5e49 Move everything from table_unique/table_equiv into table 2017-04-24 09:46:05 +01:00
Daniel James
8229aa6b3c Stop throwing exception in allocator copy/assignment
The standard specifies that all of these "shall not exit via an
exception". The containers have been exception safe when these throw,
but the 'noexcept' attribute on 'get_allocator' will terminate if an
exception is thrown in the copy constructor.

The standard doesn't specify a default constructor, so that is allowed
to throw an exception (not just pedantry, this makes sense if an
allocator has shared data that's allocated in the initial constructor).
2017-04-23 11:01:04 +01:00
Daniel James
3117611a55 New tuple implementation
Adjusts to use less arguments on Visual C++ 11, which will hopefully fix
it on that compiler. Also changed to be a little less preprocessor
heavy. I'm not sure about the __SUNPRO_CC support, hopefully recent
versions of that compiler will have better support, and can use the
normal implementation. Will check that later.
2017-04-22 18:31:10 +01:00
Daniel James
1e491533fa More consistent std::tuple configuration
Was getting a weird test failure for Visual C++ 11,
BOOST_NO_CXX11_HDR_TUPLE is defined, so the code doesn't support
std::tuple, but BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT was also
true, and so there are functions for constructing using
std::piecewise_construct/std::tuple, which don't work.

So, I'm assuming that if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT is true,
then there must be a std::tuple. I guess it doesn't have full C++11 support,
which is why BOOST_NO_CXX11_HDR_TUPLE is defined, but it appears to be
good enough for us. If not, this will break things.
2017-04-21 20:32:56 +01:00
Daniel James
de5373413b Missing rvalue overload of at 2017-04-20 22:59:00 +01:00
Daniel James
9cd673c71d Specify clear as noexcept 2017-04-20 22:59:00 +01:00
Daniel James
bf7a65010c Add new erase(iterator) overloads
Not for unordered_set/unordered_multiset as they use the same type for
iterator and const_iterator.
2017-04-20 22:59:00 +01:00
Daniel James
ee73a53497 Disable failing tests on gcc 4.6/4.7 c++11 mode
Works fine on later versions of GCC, I suspect it's a bug in their
noexcept support.
2017-04-20 10:11:01 +01:00
Daniel James
d47754acac Include unordered macro values in test output 2017-04-19 10:21:13 +01:00
Daniel James
ef05493c83 Test that construct/destroy aren't used when C++11 isn't available 2017-04-18 10:14:26 +01:00
Daniel James
7a0a598649 Don't track construction when using boost::tuple
Because it doesn't quiet work on C++11 compilers onwards.
2017-04-18 10:14:26 +01:00
Daniel James
cafd236a18 Test more memory tracking 2017-04-18 10:14:26 +01:00
Daniel James
7e5520f974 Increase template depth for GCC
This appears to be an unavoidable problem with GCC's tuple
implementation. For example:

http://stackoverflow.com/q/23374953/2434

Appears to be okay in later versions of GCC though.
2017-04-18 10:14:26 +01:00
Daniel James
ed8c0f9ecd Add deprecated attributes to deprecated functions 2017-04-15 17:35:09 +01:00
Daniel James
2bfc59c461 Make node_handler constructor private + additional compile tests 2017-04-15 17:35:09 +01:00
Daniel James
c2d2be021a Don't test inserting from initializer list in old clang
There's a problem with it causing an ambiguous overload. I don't think
there's anything we can do to fix that, so just don't test it.

There's another bug where a std::pair doesn't get correctly constructed
from an rvalue when using Clang 3.1 in C++11 mode. But I can't see any
way to easily fix that, and it's a pretty old compiler now.
2017-04-08 06:17:43 +01:00
Daniel James
c18f57f62b Add missing copyright/license to a couple of files 2017-04-04 22:06:15 +01:00
Daniel James
0af2c732ab Fix use of BOOST_STATIC_ASSERT for older preprocessors 2017-03-01 16:52:43 +00:00
Daniel James
68fe365f5b Try to avoid Visual C++ warning C4800 2017-03-01 16:50:05 +00:00
Daniel James
4aa74e5feb Merge between set/multiset and map/multimap 2017-02-27 03:59:02 +00:00
Daniel James
13322fe858 Option to use same node type everywhere.
Will allow me to implement merge and extract fully.
2017-02-27 03:59:02 +00:00
Daniel James
d89aadc56c Implement merge 2017-02-27 03:59:02 +00:00
Daniel James
21a24d6cd7 Support node_handle 2017-02-27 03:59:02 +00:00
Daniel James
5f5f8ef1e4 Implement try_emplace 2017-02-27 03:59:02 +00:00
Daniel James
958d206bb6 Implement insert_or_assign. 2017-02-27 03:59:02 +00:00
Daniel James
c0b72d97b3 Stricter about rebinding the allocator 2017-02-23 20:14:27 +00:00
Daniel James
13063abce5 Move friend function outside of class
The use of std::pair was causing issues with the sun compiler.
2017-02-23 20:10:40 +00:00
Daniel James
bf5ef9824d Reformat with clang-format 2017-02-19 13:05:17 +00:00
Daniel James
b2f2fdc2f3 Prevent clang-format sorting some test includes 2017-02-19 13:05:17 +00:00
Daniel James
3bf664ad31 Add a missing header 2017-02-19 13:05:17 +00:00
Daniel James
67ab88b064 Combine most of the detail headers into a single header 2017-02-19 13:05:17 +00:00
Daniel James
57cc6d4bac Fix exception safety when constructing pairs 2017-01-01 18:35:50 +00:00
Daniel James
e416cafd49 Count instances constructed/destructed in exception tests 2017-01-01 18:35:50 +00:00
Daniel James
33f701dd09 Fix assigning hash/key equality functions for empty containers 2016-11-21 10:24:51 +00:00
Daniel James
a7546e298e Support 10 arguments in emplace_args
Which was the intent, but only supported up to 9 arguments. I doubt
this will make much of a difference.
2016-11-02 07:30:41 +00:00
Daniel James
a34785fa0d Don't 'sink' uncopyable container
Calling sink was causing older versions of gcc to copy the container,
resulting in a compile error. So instead just disambiguate by putting
brackets around the expression.
2016-10-25 18:04:34 +01:00
Daniel James
14ccdbc7b6 Add guards against exceptions that shouldn't happen
I'm getting a couple of "terminate called after throwing an instance of
'test::lightweight::test_exception'" errors on the sun platform. Not
sure where they're happening, so I've made the code a tad more resilient
against exceptions that should not really be thrown.
2016-10-24 09:46:13 +01:00
Daniel James
5b5b46ea1c Disable Visual C++ __declspec(allocator) warning
Visual C++ is warning that memory can't be tracked for allocators whose
pointer types aren't actually pointers, which is a correct warning but
not relevant for our concerns, and is caused by the unit tests, not the
container implementation.
2016-10-23 13:51:58 +01:00
Daniel James
e3f534a148 Allocator aware constructors 2016-10-23 13:33:25 +01:00
Daniel James
1bcd5b0003 Make no argument constructor implicit 2016-10-23 13:32:52 +01:00
Daniel James
6071f9a08b Stop testing no arg emplace when not available 2016-10-22 09:49:14 +01:00
Daniel James
ad2256b13c Add const cast for piecewise construction 2016-10-22 09:42:56 +01:00
Daniel James
dad0d48c9c Support containers with const value type
Currently just storing the value without a const. Can do better with
C++11 constructors, so maybe should do that, and cast away const on
compilers without support.

Another problem is that std::allocator<const int> doesn't compile for
libstdc++ (and potentially other standard libraries), so
boost::unordered_set<const int> can't compile. I'm not sure if I should
work around that, as it means changing the type of the container
(i.e. to boost::unordered_set<const int,... , std::allocator<int>>).
2016-10-17 08:06:19 +01:00
Daniel James
7da307c696 Supply explicit test::cxx11_allocator::rebind for old GCC
The rebind mechanism doesn't work for templates with multiple template
parameters on old versions of GCC. But allocators written for that
compiler will have an explicit rebind, so that should be acceptable.
2016-10-17 07:54:06 +01:00
Daniel James
82438a513b Fix allocator traits macro 2016-10-17 07:54:06 +01:00
Daniel James
b907cee691 Use std::allocator_traits where available.
Might have to revert this when implementing C++17 features.
2016-10-14 09:27:40 +01:00
Daniel James
da6e8e8041 Better allocator rebind support 2016-10-14 09:27:40 +01:00
Daniel James
04607dc9f3 Fix for clang. 2016-10-13 17:03:31 +01:00
Daniel James
ece4116329 Try to fix another warning 2016-10-13 10:00:26 +01:00
Daniel James
74abdd6973 Replace boost::next with a simpler version
Less optimized, but hopefully it won't cause any warnings.
2016-10-11 13:36:41 +01:00
Daniel James
a316d3fa46 Fix more warnings 2016-10-11 10:07:07 +01:00
Daniel James
147885fec4 Add another random generation style.
This time for a more limited range of values so that equal values turn
up more often.  This is a bit shoddy, but seems like the best way to
improve the existing tests without too much effort.
2016-10-06 21:52:19 +01:00
Daniel James
65aaf27380 Fix accidental fallthrough in switch cases.
This was causing the hash function to be different to the equality
function. For some reason this resulted in a lot of windows test
failures, but none on linux or os x. I'm a bit confused and worried
about that.
2016-10-06 10:53:10 +01:00
Daniel James
b1588929cc Fix another sign conversion warning. 2016-10-05 13:52:33 +01:00
Daniel James
094fa38360 Remove -Wsign-conversion, old gcc doesn't support it. 2016-10-05 13:52:17 +01:00
Daniel James
71d19820ac Fix signed conversion warnings. 2016-10-05 09:45:53 +01:00
Daniel James
982685d3a0 Adjust order of variables to see if intel failure changes.
So currently on one intel tester find_tests is failing the 'pos !=
x.end()' test, but not the 'const_pos != x_const.end()' test for
unordered_set (and possibly others, the test results are truncated). I'm
a bit stumped as to why this should be, as for unordered_set the const
and non-const versions are basically the exact same code. See if
changing the order makes any difference to what fails.
2016-10-05 00:57:58 +01:00
Daniel James
dadb4486ee Fix calls to std::rand in tests 2016-10-04 15:52:47 +01:00
Daniel James
d14c1dec59 Revert "Allocator aware constructors."
This reverts commit b00bc15c3e.

I messed that up a bit, will get back to it later.
2016-10-03 20:58:15 +01:00
Daniel James
21d6d7bc21 Fix detection of is_nothrow_move_constructible support.
I should possibly also check how it handles `throw()`?
2016-10-03 10:49:49 +01:00
Daniel James
b00bc15c3e Allocator aware constructors. 2016-10-02 17:56:01 +01:00
Daniel James
50c4cbe06c Try to fix the failures in noxcept_tests 2016-10-02 13:04:25 +01:00
Daniel James
573e10665c Use standard boost move style in noexcept_tests. 2016-10-02 13:04:25 +01:00
Daniel James
e7b20d2877 Fix exception bug in asssignment.
The hash and key equality functions were assigned before allocating new
buckets. If that allocation failed, then the existing elements would be
left in place - so if accessed after the exception they could be in the
wrong buckets or equivalent elements could be incorrectly grouped
together.
2016-10-02 13:04:25 +01:00
Daniel James
98462fbcc3 Avoid conversion warning. 2016-10-01 13:53:05 +01:00
Daniel James
a93331dd96 Fix new emplace tests. 2016-10-01 13:51:25 +01:00
Daniel James
021817f2b4 Fix Visual C++ version number + use BOOST_WORKAROUND. 2016-09-18 22:56:23 +01:00
Daniel James
13ff69efbf Make 'ordered' container independent. 2016-09-18 12:22:48 +01:00
Daniel James
8fda9113b8 Make 'has_unique_keys' container independent. 2016-09-18 12:22:48 +01:00
Daniel James
b881bcfee3 More insert and erase tests 2016-09-18 12:22:48 +01:00
Daniel James
1c606980ec Update tests for standard changes involving bucket count.
It seems my defect report was accepted at some point, and they tweaked
the requirements involving bucket counts. This also makes it possible to
have a bucket count of 0, which I think wasn't allowed in the past. I
don't think I'll change this implementation to do so, but I'd like to be
able to run these tests against standard implementations, so I'm
starting to take that into account.

I believe these changes were made after the C++14 standard, but I've
always been tracking the draft standards, so that doesn't really matter.
2016-09-18 12:22:48 +01:00
Daniel James
0d6e58d9fd Write out some compiler info before test results. 2016-09-18 12:22:48 +01:00
Daniel James
95e477902e Special case for Visual C++ 12 test failure.
Plus some extra tests while I'm at it.
2016-09-18 10:28:21 +01:00
Daniel James
7c2f11f8e1 Fix signed/unsigned comparisons. 2016-09-07 09:26:25 +01:00
Daniel James
86a8a0429a Merge branch 'fixes' into develop 2016-09-04 08:23:52 +01:00
Daniel James
4b00548138 Test+document insertion from initializer lists. 2016-09-04 08:23:32 +01:00
Daniel James
7434e116a7 Try using boost::long_long_type to avoid warning. 2016-08-29 23:03:06 +01:00
Daniel James
9debeadee7 Fix some test warnings.
And turn on warnings as errors in Travis.
2016-08-17 12:08:16 +01:00
Daniel James
cae72eec2f Insert/emplace with hint. 2016-08-17 12:08:15 +01:00
Daniel James
e250fb44f6 Merge local develop branch develop
Oops, I merged the wrong 'develop' branch into master. Luckily, there's
not much of a difference, so I'm resolving the merge here, and will
merge into master soon.
2016-08-14 20:02:13 +01:00
Daniel James
cdb887e880 Clean up a memory leak in a test. 2016-08-04 13:35:47 +01:00
Daniel James
0769ecd70d Some more checks.
The intel-linux failures I'm getting now are odd. This find test is
failing for iterator, but not const_iterator. So maybe it's a problem
with the iterator object. The failures I was getting before have
disappeared, so I'm not sure about that.
2016-07-29 12:19:50 +01:00
Daniel James
2be69b3eb9 A little more information in the find_tests.
Now the intel-linux tester that was failing for erase_tests is passing,
but has started failing for find_tests instead. Oddly the test for
non-const find is failing, but the const find is fine - this doesn't
make much sense as they should be the same. Not sure, but it suggests
the problem might be in the way iterators are handled, rather than the
data structure?

Checking the iterators before checking that the keys are equal in order
to tell which part of the test is failing.
2016-07-27 06:51:05 +01:00
Daniel James
bc601e34d2 More info on test failure on intel-linux.
The count check is reporting errors, but everything else appears to work
okay.
2016-07-25 15:03:39 +01:00
Daniel James
59cbe3d483 Also move exception tests into test/Jamfile.v2
Moving the tests successfully restored the test results, so do it for
the exception tests as well.
2016-07-03 08:42:17 +01:00
Daniel James
21f2522695 Try running the tests from unordered/test. 2016-07-02 22:11:43 +01:00
Daniel James
3720b0be58 Try creating a project for test.
For some reason the unordered test results are not showing up any more.
This is odd, as when I try locally they do run. I don't know why this
is, but it's possible that it's because there isn't an actual project in
the test directory, so try adding one.
2016-07-01 11:12:29 +01:00
Daniel James
b4a3c6f460 Fix exception safety in assignment for multimap/multiset.
The assignment code seemed like a bit of a premature optimization, I
replaced it with a slightly slower but much simpler implementation.
2016-05-30 15:02:04 +01:00
Daniel James
1d4845d6b8 Stop using predef in test. 2016-05-26 22:39:47 +01:00
Daniel James
cc2b1a1ef1 Stop using deprecated boost::iterator. 2016-05-26 09:24:21 +01:00
Daniel James
0273ec59d7 Fix Visual C++ 9.0 workaround. 2014-12-03 18:28:40 +00:00
Daniel James
9090d87725 Restore ampersand workaround for Visual C++ 9 2014-11-16 10:01:29 +00:00