Refactor that fixes a compilation issue in Release mode

Some template specialization were not found, because they were not declared
at the point they were used.

We moved things around, things are less inter-dependant, and also now it
works.
This commit is contained in:
louiz’
2018-04-13 23:35:06 +02:00
parent de8267fa3f
commit 4bd7b6981b
13 changed files with 162 additions and 148 deletions
+11 -10
View File
@@ -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);