diff options
author | Marco Bubke <marco.bubke@qt.io> | 2020-05-26 20:31:07 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2020-05-27 13:09:20 +0000 |
commit | 22c33fb859a4c0d9d694edca2076708b1cf2f087 (patch) | |
tree | 2b3e8016f52ac653fe8e7940cc3a6ea79800e5ea /tests/unit | |
parent | 49dc889c7f88f4a130849896bde57f7e72b4900e (diff) |
Sqlite: Improve LastChangedRowId
Change-Id: I2fe559d4b40f93561e44eb138119416291dc7d41
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/unittest/lastchangedrowid-test.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/unittest/lastchangedrowid-test.cpp b/tests/unit/unittest/lastchangedrowid-test.cpp index 7214955eda..07b29bee57 100644 --- a/tests/unit/unittest/lastchangedrowid-test.cpp +++ b/tests/unit/unittest/lastchangedrowid-test.cpp @@ -442,4 +442,30 @@ TEST_F(LastChangedRowIdWithNoTable, TakeLastRowIdResetsRowIdToMinusOne) ASSERT_THAT(id, -1); } + +TEST_F(LastChangedRowIdWithNoTable, LastRowIdIsNotValidForNegativeValues) +{ + auto isValid = lastRowId.lastRowIdIsValid(); + + ASSERT_FALSE(isValid); +} + +TEST_F(LastChangedRowIdWithNoTable, LastRowIdIsValidForNull) +{ + lastRowId.callback(Sqlite::ChangeType::Update, "main", "foo", 0); + + auto isValid = lastRowId.lastRowIdIsValid(); + + ASSERT_TRUE(isValid); +} + +TEST_F(LastChangedRowIdWithNoTable, LastRowIdIsValidForPositiveValues) +{ + lastRowId.callback(Sqlite::ChangeType::Update, "main", "foo", 777); + + auto isValid = lastRowId.lastRowIdIsValid(); + + ASSERT_TRUE(isValid); +} + } // namespace |