fix API bitrot and remove extra whitespace

This commit is contained in:
Andrew Meadows 2018-02-07 16:48:43 -08:00
parent 572edab79f
commit f0bb4d3da7

View file

@ -33,7 +33,7 @@ size_t FileCacheTests::getCacheDirectorySize() const {
return result; return result;
} }
FileCachePointer makeFileCache(QString& location) { FileCachePointer makeFileCache(QString location) {
auto result = std::make_shared<FileCache>(location.toStdString(), "tmp"); auto result = std::make_shared<FileCache>(location.toStdString(), "tmp");
result->initialize(); result->initialize();
result->setMaxSize(MAX_UNUSED_SIZE); result->setMaxSize(MAX_UNUSED_SIZE);
@ -53,7 +53,7 @@ void FileCacheTests::testUnusedFiles() {
auto file = cache->writeFile(TEST_DATA.data(), FileCache::Metadata(key, TEST_DATA.size())); auto file = cache->writeFile(TEST_DATA.data(), FileCache::Metadata(key, TEST_DATA.size()));
QVERIFY(file->_locked); QVERIFY(file->_locked);
inUseFiles.push_back(file); inUseFiles.push_back(file);
QThread::msleep(10); QThread::msleep(10);
} }
QCOMPARE(cache->getNumCachedFiles(), (size_t)0); QCOMPARE(cache->getNumCachedFiles(), (size_t)0);
@ -100,13 +100,13 @@ void FileCacheTests::testUnusedFiles() {
inUseFiles.push_back(file); inUseFiles.push_back(file);
if (i == 94) { if (i == 94) {
// Each access touches the file, so we need to sleep here to ensure that the the last 5 files // Each access touches the file, so we need to sleep here to ensure that the the last 5 files
// have later times for cache ejection priority, otherwise the test runs too fast to reliably // have later times for cache ejection priority, otherwise the test runs too fast to reliably
// differentiate // differentiate
QThread::msleep(1000); QThread::msleep(1000);
} }
} }
QCOMPARE(cache->getNumCachedFiles(), (size_t)0); QCOMPARE(cache->getNumCachedFiles(), (size_t)0);
QCOMPARE(cache->getNumTotalFiles(), (size_t)10); QCOMPARE(cache->getNumTotalFiles(), (size_t)10);
inUseFiles.clear(); inUseFiles.clear();
@ -119,7 +119,7 @@ size_t FileCacheTests::getFreeSpace() const {
return QStorageInfo(_testDir.path()).bytesFree(); return QStorageInfo(_testDir.path()).bytesFree();
} }
// FIXME if something else is changing the amount of free space on the target drive concurrently with this test // FIXME if something else is changing the amount of free space on the target drive concurrently with this test
// running, then it may fail // running, then it may fail
void FileCacheTests::testFreeSpacePreservation() { void FileCacheTests::testFreeSpacePreservation() {
QCOMPARE(getCacheDirectorySize(), MAX_UNUSED_SIZE); QCOMPARE(getCacheDirectorySize(), MAX_UNUSED_SIZE);