Code is compatible with gcc 4.8

This commit is contained in:
Sebastian Messmer 2015-11-24 14:39:32 +01:00
parent 8dc31b7a85
commit fb733929d8
3 changed files with 16 additions and 12 deletions

View File

@ -10,6 +10,7 @@
#include <future>
#include <messmer/cpp-utils/assert/assert.h>
#include <messmer/cpp-utils/lock/MutexPoolLock.h>
#include <messmer/cpp-utils/pointer/gcc_4_8_compatibility.h>
namespace blockstore {
namespace caching {

View File

@ -5,8 +5,8 @@
#include <future>
#include <messmer/cpp-utils/lock/ConditionBarrier.h>
using namespace std::chrono_literals;
using namespace blockstore::caching;
using std::chrono::seconds;
using std::string;
using cpputils::ConditionBarrier;
using std::unique_ptr;
@ -24,7 +24,7 @@ public:
: _onDestructorStarted(onDestructorStarted), _destructorFinished(destructorFinished) {}
~ObjectWithLongDestructor() {
_onDestructorStarted->release();
std::this_thread::sleep_for(1s);
std::this_thread::sleep_for(seconds(1));
*_destructorFinished = true;
}
private:

View File

@ -79,19 +79,22 @@ private:
EXPECT_DATA_READS_AS_OUTSIDE_OF(ZEROES, block, start, count);
}
};
constexpr std::initializer_list<DataRange> DATA_RANGES = {
DataRange{1024, 0, 1024}, // full size leaf, access beginning to end
DataRange{1024, 100, 1024-200}, // full size leaf, access middle to middle
DataRange{1024, 0, 1024-100}, // full size leaf, access beginning to middle
DataRange{1024, 100, 1024-100}, // full size leaf, access middle to end
DataRange{1024-100, 0, 1024-100}, // non-full size leaf, access beginning to end
DataRange{1024-100, 100, 1024-300}, // non-full size leaf, access middle to middle
DataRange{1024-100, 0, 1024-200}, // non-full size leaf, access beginning to middle
DataRange{1024-100, 100, 1024-200} // non-full size leaf, access middle to end
inline std::vector<DataRange> DATA_RANGES() {
return {
DataRange{1024, 0, 1024}, // full size leaf, access beginning to end
DataRange{1024, 100, 1024 - 200}, // full size leaf, access middle to middle
DataRange{1024, 0, 1024 - 100}, // full size leaf, access beginning to middle
DataRange{1024, 100, 1024 - 100}, // full size leaf, access middle to end
DataRange{1024 - 100, 0, 1024 - 100}, // non-full size leaf, access beginning to end
DataRange{1024 - 100, 100, 1024 - 300}, // non-full size leaf, access middle to middle
DataRange{1024 - 100, 0, 1024 - 200}, // non-full size leaf, access beginning to middle
DataRange{1024 - 100, 100, 1024 - 200} // non-full size leaf, access middle to end
};
};
#define TYPED_TEST_P_FOR_ALL_DATA_RANGES(TestName) \
TYPED_TEST_P(BlockStoreTest, TestName) { \
for (auto dataRange: DATA_RANGES) { \
for (auto dataRange: DATA_RANGES()) { \
BlockStoreDataParametrizedTest(this->fixture.createBlockStore(), dataRange) \
.Test##TestName(); \
} \