Skip to content

Commit af8e2ce

Browse files
committed
Unit test using a Builder function to showcase the Database move contructor
1 parent 678562e commit af8e2ce

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/Database_test.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,17 @@ TEST(Database, ctorExecCreateDropExist) {
6464
}
6565

6666
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
67+
68+
SQLite::Database DatabaseBuilder(const char* apName)
69+
{
70+
return SQLite::Database(apName, SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
71+
}
72+
6773
TEST(Database, moveConstructor) {
6874
remove("test.db3");
6975
{
70-
// Create a new database
71-
SQLite::Database db("test.db3", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE);
76+
// Create a new database, using the move constructor
77+
SQLite::Database db = DatabaseBuilder("test.db3");
7278
EXPECT_FALSE(db.tableExists("test"));
7379
EXPECT_TRUE(db.getHandle() != NULL);
7480
SQLite::Database moved = std::move(db);
@@ -78,6 +84,7 @@ TEST(Database, moveConstructor) {
7884
} // Close DB test.db3
7985
remove("test.db3");
8086
}
87+
8188
#endif
8289

8390
TEST(Database, createCloseReopen) {

0 commit comments

Comments
 (0)