mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(test): Don't rely on row IDs after moving tables
Row ID's are not guaranteed to match those from the original peer table. New checking method is equally strict since we already verify the number of entries, and the SQL schema guarantees that entries are unique.
This commit is contained in:
parent
46ef31293c
commit
dc46267833
|
@ -71,11 +71,9 @@ void appendVerifyChatsQueries(QVector<RawDatabase::Query>& verifyQueries)
|
||||||
}});
|
}});
|
||||||
|
|
||||||
struct Functor {
|
struct Functor {
|
||||||
int index = 0;
|
|
||||||
const std::vector<QByteArray> chatIds{aPk.getByteArray(), bPk.getByteArray(), cPk.getByteArray()};
|
const std::vector<QByteArray> chatIds{aPk.getByteArray(), bPk.getByteArray(), cPk.getByteArray()};
|
||||||
void operator()(const QVector<QVariant>& row) {
|
void operator()(const QVector<QVariant>& row) {
|
||||||
QVERIFY(row[0].toByteArray() == chatIds[index]);
|
QVERIFY(std::find(chatIds.begin(), chatIds.end(), row[0].toByteArray()) != chatIds.end());
|
||||||
++index;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,11 +91,9 @@ void appendVerifyAuthorsQueries(QVector<RawDatabase::Query>& verifyQueries)
|
||||||
}});
|
}});
|
||||||
|
|
||||||
struct Functor {
|
struct Functor {
|
||||||
int index = 0;
|
const std::vector<QByteArray> authorIds{selfPk.getByteArray(), aPk.getByteArray(), bPk.getByteArray()};
|
||||||
const std::vector<QByteArray> chatIds{selfPk.getByteArray(), aPk.getByteArray(), bPk.getByteArray()};
|
|
||||||
void operator()(const QVector<QVariant>& row) {
|
void operator()(const QVector<QVariant>& row) {
|
||||||
QVERIFY(row[0].toByteArray() == chatIds[index]);
|
QVERIFY(std::find(authorIds.begin(), authorIds.end(), row[0].toByteArray()) != authorIds.end());
|
||||||
++index;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,11 +124,9 @@ void appendVerifyAliasesQueries(QVector<RawDatabase::Query>& verifyQueries)
|
||||||
}});
|
}});
|
||||||
|
|
||||||
struct Functor {
|
struct Functor {
|
||||||
int index = 0;
|
|
||||||
const std::vector<QByteArray> names{selfName.toUtf8(), aName.toUtf8(), bName.toUtf8()};
|
const std::vector<QByteArray> names{selfName.toUtf8(), aName.toUtf8(), bName.toUtf8()};
|
||||||
void operator()(const QVector<QVariant>& row) {
|
void operator()(const QVector<QVariant>& row) {
|
||||||
QVERIFY(row[0].toByteArray() == names[index]);
|
QVERIFY(std::find(names.begin(), names.end(), row[0].toByteArray()) != names.end());
|
||||||
++index;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user