aboutsummaryrefslogtreecommitdiff
path: root/absl/container/btree_test.cc
diff options
context:
space:
mode:
authorEvan Brown <ezb@google.com>2023-09-15 09:05:25 -0700
committerCopybara-Service <copybara-worker@google.com>2023-09-15 09:06:19 -0700
commit49be2e68de5b063bce5d0757078c62906a2674ea (patch)
tree00680ea209b60588f6f7c249fcdc2c7746a9c195 /absl/container/btree_test.cc
parente68f1412e2cebdd5af106721007335ca45d51f83 (diff)
downloadabseil-49be2e68de5b063bce5d0757078c62906a2674ea.tar.gz
abseil-49be2e68de5b063bce5d0757078c62906a2674ea.tar.bz2
abseil-49be2e68de5b063bce5d0757078c62906a2674ea.zip
Move CountingAllocator into test_allocator.h and add some other allocators that can be shared between different container tests.
PiperOrigin-RevId: 565693736 Change-Id: I59af987e30da03a805ce59ff0fb7eeae3fc08293
Diffstat (limited to 'absl/container/btree_test.cc')
-rw-r--r--absl/container/btree_test.cc25
1 files changed, 5 insertions, 20 deletions
diff --git a/absl/container/btree_test.cc b/absl/container/btree_test.cc
index a204c6d5..3e239c50 100644
--- a/absl/container/btree_test.cc
+++ b/absl/container/btree_test.cc
@@ -37,7 +37,7 @@
#include "absl/base/macros.h"
#include "absl/container/btree_map.h"
#include "absl/container/btree_set.h"
-#include "absl/container/internal/counting_allocator.h"
+#include "absl/container/internal/test_allocator.h"
#include "absl/container/internal/test_instance_tracker.h"
#include "absl/flags/flag.h"
#include "absl/hash/hash_testing.h"
@@ -667,25 +667,10 @@ void BtreeMultiTest() {
DoTest("identical: ", &container, identical_values);
}
-template <typename T>
-struct PropagatingCountingAlloc : public CountingAllocator<T> {
- using propagate_on_container_copy_assignment = std::true_type;
- using propagate_on_container_move_assignment = std::true_type;
- using propagate_on_container_swap = std::true_type;
-
- using Base = CountingAllocator<T>;
- using Base::Base;
-
- template <typename U>
- explicit PropagatingCountingAlloc(const PropagatingCountingAlloc<U> &other)
- : Base(other.bytes_used_) {}
-
- template <typename U>
- struct rebind {
- using other = PropagatingCountingAlloc<U>;
- };
-};
-
+// TODO(ezb): get rid of BtreeAllocatorTest and replace with test cases using
+// specific propagating allocs (e.g. CopyAssignPropagatingCountingAlloc) and
+// also a test for MinimumAlignmentAlloc. Motivation is better test coverage and
+// faster compilation time.
template <typename T>
void BtreeAllocatorTest() {
using value_type = typename T::value_type;