1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Add unit tests for MapDatabase implementations

This commit is contained in:
sfan5 2025-02-10 19:11:31 +01:00
parent 215b000793
commit cc352f3b66
4 changed files with 198 additions and 2 deletions

View file

@ -30,8 +30,7 @@ void Database_Dummy::loadBlock(const v3s16 &pos, std::string *block)
bool Database_Dummy::deleteBlock(const v3s16 &pos)
{
m_database.erase(getBlockAsInteger(pos));
return true;
return m_database.erase(getBlockAsInteger(pos)) > 0;
}
void Database_Dummy::listAllLoadableBlocks(std::vector<v3s16> &dst)

View file

@ -316,6 +316,7 @@ void MapDatabaseSQLite3::loadBlock(const v3s16 &pos, std::string *block)
bindPos(m_stmt_read, pos);
if (sqlite3_step(m_stmt_read) != SQLITE_ROW) {
block->clear();
sqlite3_reset(m_stmt_read);
return;
}