Merge pull request #991 from daleglass-overte/fix-tests

Fix tests
This commit is contained in:
Dale Glass 2024-06-01 21:31:08 +02:00 committed by GitHub
commit 44d61e44e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 29 deletions

View file

@ -34,7 +34,7 @@ static void readWriteHelper(const std::vector<bool>& src) {
int numBits = (int)src.size();
int numBytes = calcBitVectorSize(numBits);
uint8_t* bytes = new uint8_t[numBytes];
memset(bytes, numBytes, sizeof(uint8_t));
memset(bytes, 0, numBytes);
int numBytesWritten = writeBitVector(bytes, numBits, [&](int i) {
return src[i];
});
@ -53,6 +53,8 @@ static void readWriteHelper(const std::vector<bool>& src) {
bool b = dst[i];
QCOMPARE(a, b);
}
delete[] bytes;
}
void BitVectorHelperTests::readWriteTest() {

View file

@ -132,6 +132,11 @@ void FileCacheTests::testFreeSpacePreservation() {
cache->setMinFreeSize(targetFreeSpace);
QCOMPARE(cache->getNumCachedFiles(), (size_t)5);
QCOMPARE(cache->getNumTotalFiles(), (size_t)5);
qDebug() << "Free space: " << getFreeSpace();
qDebug() << "Target : " << targetFreeSpace;
qInfo() << "The following test may fail if free disk space was changed by another program during the test's runtime";
QVERIFY(getFreeSpace() >= targetFreeSpace);
for (int i = 0; i < 95; ++i) {
std::string key = getFileKey(i);

View file

@ -18,6 +18,7 @@
#include <QtCore/QQueue>
#include <test-utils/GLMTestUtils.h>
#include <test-utils/QTestExtensions.h>
#include <QRandomGenerator64>
QTEST_MAIN(MovingPercentileTests)
@ -41,10 +42,7 @@ void MovingPercentileTests::testRunningMedian() {
int64_t MovingPercentileTests::random() {
return ((int64_t) rand() << 48) ^
((int64_t) rand() << 32) ^
((int64_t) rand() << 16) ^
((int64_t) rand());
return QRandomGenerator64::global()->generate();
}
void MovingPercentileTests::testRunningMinForN (int n) {