Clean core-test and fix linkage errors on older gcc

This commit is contained in:
Victor Zverovich
2018-09-19 08:55:45 -07:00
parent d43665056d
commit 3f4984fb36
8 changed files with 636 additions and 607 deletions
+11 -10
View File
@@ -9,23 +9,24 @@
#define FMT_MOCK_ALLOCATOR_H_
#include "gmock.h"
#include "fmt/format.h"
template <typename T>
class MockAllocator {
class mock_allocator {
public:
MockAllocator() {}
MockAllocator(const MockAllocator &) {}
mock_allocator() {}
mock_allocator(const mock_allocator &) {}
typedef T value_type;
MOCK_METHOD1_T(allocate, T* (std::size_t n));
MOCK_METHOD2_T(deallocate, void (T* p, std::size_t n));
};
template <typename Allocator>
class AllocatorRef {
class allocator_ref {
private:
Allocator *alloc_;
void move(AllocatorRef &other) {
void move(allocator_ref &other) {
alloc_ = other.alloc_;
other.alloc_ = nullptr;
}
@@ -33,18 +34,18 @@ class AllocatorRef {
public:
typedef typename Allocator::value_type value_type;
explicit AllocatorRef(Allocator *alloc = nullptr) : alloc_(alloc) {}
explicit allocator_ref(Allocator *alloc = nullptr) : alloc_(alloc) {}
AllocatorRef(const AllocatorRef &other) : alloc_(other.alloc_) {}
AllocatorRef(AllocatorRef &&other) { move(other); }
allocator_ref(const allocator_ref &other) : alloc_(other.alloc_) {}
allocator_ref(allocator_ref &&other) { move(other); }
AllocatorRef& operator=(AllocatorRef &&other) {
allocator_ref& operator=(allocator_ref &&other) {
assert(this != &other);
move(other);
return *this;
}
AllocatorRef& operator=(const AllocatorRef &other) {
allocator_ref& operator=(const allocator_ref &other) {
alloc_ = other.alloc_;
return *this;
}