From 0af57e2595922c9ee59d7cd489daf37a3550496c Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 18 Nov 2020 16:55:31 +0000 Subject: Clang format --- libsqlitepp/sqlite-mock.cpp | 70 +++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 34 deletions(-) (limited to 'libsqlitepp/sqlite-mock.cpp') 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 & 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 & ss) : - Mock("/tmp/sqliteut", name, ss) -{ -} - -DB::ConnectionPtr -Mock::openConnection() const -{ - return std::make_shared(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 & 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 & ss) : + Mock("/tmp/sqliteut", name, ss) + { + } + + DB::ConnectionPtr + Mock::openConnection() const + { + return std::make_shared(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 } - -} - -- cgit v1.2.3