diff options
Diffstat (limited to 'test/std/containers/sequences/vector.bool/move.pass.cpp')
-rw-r--r-- | test/std/containers/sequences/vector.bool/move.pass.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/std/containers/sequences/vector.bool/move.pass.cpp b/test/std/containers/sequences/vector.bool/move.pass.cpp index f189e2b97092..ab2b7ce6d316 100644 --- a/test/std/containers/sequences/vector.bool/move.pass.cpp +++ b/test/std/containers/sequences/vector.bool/move.pass.cpp @@ -15,6 +15,7 @@ #include <vector> #include <cassert> +#include "test_macros.h" #include "test_allocator.h" #include "min_allocator.h" @@ -59,4 +60,34 @@ int main() assert(l.empty()); assert(l2.get_allocator() == lo.get_allocator()); } + { + test_alloc_base::clear(); + using Vect = std::vector<bool, test_allocator<bool> >; + using AllocT = Vect::allocator_type; + Vect v(test_allocator<bool>(42, 101)); + assert(test_alloc_base::count == 1); + { + const AllocT& a = v.get_allocator(); + assert(test_alloc_base::count == 2); + assert(a.get_data() == 42); + assert(a.get_id() == 101); + } + assert(test_alloc_base::count == 1); + test_alloc_base::clear_ctor_counters(); + + Vect v2 = std::move(v); + assert(test_alloc_base::count == 2); + assert(test_alloc_base::copied == 0); + assert(test_alloc_base::moved == 1); + { + const AllocT& a = v.get_allocator(); + assert(a.get_id() == test_alloc_base::moved_value); + assert(a.get_data() == test_alloc_base::moved_value); + } + { + const AllocT& a = v2.get_allocator(); + assert(a.get_id() == 101); + assert(a.get_data() == 42); + } + } } |