Sqlite: Move result count to class declaration

It move the magic number of column results to the sql statement
and improves the mock a little bit.

Change-Id: I101067444cf27ec5dea0c72de7fd484a7e8710f0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2021-03-24 18:10:55 +01:00
parent eb516063d3
commit 7785a3a651
58 changed files with 1038 additions and 1967 deletions

View File

@@ -25,7 +25,7 @@
#include "googletest.h"
#include "mocksqlitedatabase.h"
#include "sqlitedatabasemock.h"
#include <lastchangedrowid.h>
@@ -34,7 +34,7 @@ namespace {
class LastChangedRowId : public testing::Test
{
protected:
NiceMock<MockSqliteDatabase> mockSqliteDatabase;
NiceMock<SqliteDatabaseMock> mockSqliteDatabase;
Sqlite::LastChangedRowId<1> lastRowId{mockSqliteDatabase, "main", "foo"};
};
@@ -112,7 +112,7 @@ TEST_F(LastChangedRowId, TakeLastRowIdResetsRowIdToMinusOne)
class LastChangedRowIdWithTwoTables : public testing::Test
{
protected:
NiceMock<MockSqliteDatabase> mockSqliteDatabase;
NiceMock<SqliteDatabaseMock> mockSqliteDatabase;
Sqlite::LastChangedRowId<2> lastRowId{mockSqliteDatabase, "main", "foo", "bar"};
};
@@ -197,7 +197,7 @@ TEST_F(LastChangedRowIdWithTwoTables, TakeLastRowIdResetsRowIdToMinusOne)
class LastChangedRowIdWithThreeTables : public testing::Test
{
protected:
NiceMock<MockSqliteDatabase> mockSqliteDatabase;
NiceMock<SqliteDatabaseMock> mockSqliteDatabase;
Sqlite::LastChangedRowId<3> lastRowId{mockSqliteDatabase, "main", "foo", "bar", "too"};
};
@@ -290,7 +290,7 @@ TEST_F(LastChangedRowIdWithThreeTables, TakeLastRowIdResetsRowIdToMinusOne)
class LastChangedRowIdWithNoDatabaseAndTable : public testing::Test
{
protected:
NiceMock<MockSqliteDatabase> mockSqliteDatabase;
NiceMock<SqliteDatabaseMock> mockSqliteDatabase;
Sqlite::LastChangedRowId<> lastRowId{mockSqliteDatabase};
};
@@ -350,7 +350,7 @@ TEST_F(LastChangedRowIdWithNoDatabaseAndTable, TakeLastRowIdResetsRowIdToMinusOn
class LastChangedRowIdWithNoTable : public testing::Test
{
protected:
NiceMock<MockSqliteDatabase> mockSqliteDatabase;
NiceMock<SqliteDatabaseMock> mockSqliteDatabase;
Sqlite::LastChangedRowId<> lastRowId{mockSqliteDatabase, "main"};
};