summaryrefslogtreecommitdiff
path: root/libsqlitepp/sqlite-mock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsqlitepp/sqlite-mock.cpp')
-rw-r--r--libsqlitepp/sqlite-mock.cpp70
1 files changed, 36 insertions, 34 deletions
diff --git a/libsqlitepp/sqlite-mock.cpp b/libsqlitepp/sqlite-mock.cpp
index 18f7df8..4772bcc 100644
--- a/libsqlitepp/sqlite-mock.cpp
+++ b/libsqlitepp/sqlite-mock.cpp
@@ -6,39 +6,41 @@ NAMEDFACTORY("sqlite", SQLite::Mock, DB::MockDatabaseFactory);
namespace SQLite {
-Mock::Mock(const std::string & root, const std::string & name, const std::vector<std::filesystem::path> & ss) :
- testDbPath(std::filesystem::path(root) / name / std::to_string(getpid()) / std::to_string(++DB::MockDatabase::mocked))
-{
- Mock::CreateNewDatabase();
- PlaySchemaScripts(ss);
-}
-
-Mock::Mock(const std::string & name, const std::vector<std::filesystem::path> & ss) :
- Mock("/tmp/sqliteut", name, ss)
-{
-}
-
-DB::ConnectionPtr
-Mock::openConnection() const
-{
- return std::make_shared<Connection>(testDbPath.string());
-}
-
-Mock::~Mock()
-{
- Mock::DropDatabase();
-}
-
-void Mock::DropDatabase() const
-{
- std::filesystem::remove(testDbPath);
-}
+ Mock::Mock(const std::string & root, const std::string & name, const std::vector<std::filesystem::path> & ss) :
+ testDbPath(std::filesystem::path(root) / name / std::to_string(getpid())
+ / std::to_string(++DB::MockDatabase::mocked))
+ {
+ Mock::CreateNewDatabase();
+ PlaySchemaScripts(ss);
+ }
+
+ Mock::Mock(const std::string & name, const std::vector<std::filesystem::path> & ss) :
+ Mock("/tmp/sqliteut", name, ss)
+ {
+ }
+
+ DB::ConnectionPtr
+ Mock::openConnection() const
+ {
+ return std::make_shared<Connection>(testDbPath.string());
+ }
+
+ Mock::~Mock()
+ {
+ Mock::DropDatabase();
+ }
+
+ void
+ Mock::DropDatabase() const
+ {
+ std::filesystem::remove(testDbPath);
+ }
+
+ void
+ Mock::CreateNewDatabase() const
+ {
+ std::filesystem::create_directories(testDbPath.parent_path());
+ (void)Mock::openConnection(); // Triggers file creation
+ }
-void Mock::CreateNewDatabase() const
-{
- std::filesystem::create_directories(testDbPath.parent_path());
- (void) Mock::openConnection(); // Triggers file creation
}
-
-}
-