diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/database.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/database.cpp b/tests/database.cpp index c9b8dc7..15c117b 100644 --- a/tests/database.cpp +++ b/tests/database.cpp @@ -7,6 +7,7 @@ #include <cstdlib> #include <database/database.hpp> +#include <database/save.hpp> #include <config/config.hpp> @@ -28,11 +29,11 @@ TEST_CASE("Database") { auto o = Database::get_irc_server_options("zouzou@example.com", "irc.example.com"); CHECK(Database::count(Database::irc_server_options) == 0); - o.save(Database::db); + save(o, *Database::db); CHECK(Database::count(Database::irc_server_options) == 1); o.col<Database::Realname>() = "Different realname"; CHECK(o.col<Database::Realname>() == "Different realname"); - o.save(Database::db); + save(o, *Database::db); CHECK(o.col<Database::Realname>() == "Different realname"); CHECK(Database::count(Database::irc_server_options) == 1); @@ -44,7 +45,7 @@ TEST_CASE("Database") // inserted CHECK(1 == Database::count(Database::irc_server_options)); - b.save(Database::db); + save(b, *Database::db); CHECK(2 == Database::count(Database::irc_server_options)); CHECK(b.col<Database::Pass>() == ""); @@ -58,7 +59,7 @@ TEST_CASE("Database") o.col<Database::EncodingIn>() = "ISO-8859-1"; CHECK(o.col<Database::RecordHistoryOptional>().is_set == false); o.col<Database::RecordHistoryOptional>().set_value(false); - o.save(Database::db); + save(o, *Database::db); auto b = Database::get_irc_channel_options("zouzou@example.com", "irc.example.com", "#foo"); CHECK(o.col<Database::EncodingIn>() == "ISO-8859-1"); CHECK(o.col<Database::RecordHistoryOptional>().is_set == true); @@ -77,7 +78,7 @@ TEST_CASE("Database") GIVEN("An option defined for the channel but not the server") { c.col<Database::EncodingIn>() = "channelEncoding"; - c.save(Database::db); + save(c, *Database::db); WHEN("we fetch that option") { auto r = Database::get_irc_channel_options_with_server_default(owner, server, chan1); @@ -88,7 +89,7 @@ TEST_CASE("Database") GIVEN("An option defined for the server but not the channel") { s.col<Database::EncodingIn>() = "serverEncoding"; - s.save(Database::db); + save(s, *Database::db); WHEN("we fetch that option") { auto r = Database::get_irc_channel_options_with_server_default(owner, server, chan1); @@ -99,9 +100,9 @@ TEST_CASE("Database") GIVEN("An option defined for both the server and the channel") { s.col<Database::EncodingIn>() = "serverEncoding"; - s.save(Database::db); + save(s, *Database::db); c.col<Database::EncodingIn>() = "channelEncoding"; - c.save(Database::db); + save(c, *Database::db); WHEN("we fetch that option") { auto r = Database::get_irc_channel_options_with_server_default(owner, server, chan1); @@ -129,8 +130,8 @@ TEST_CASE("Database") auto after_connection_commands = Database::get_after_connection_commands(soptions); CHECK(after_connection_commands.empty()); - soptions.save(Database::db); - soptions2.save(Database::db); + save(soptions, *Database::db); + save(soptions2, *Database::db); auto com = Database::after_connection_commands.row(); com.col<Database::AfterConnectionCommand>() = "first"; after_connection_commands.push_back(com); |