Commit e42d7ff4 authored by Francis Dupont's avatar Francis Dupont

[406-update-cb_cmds-with-get-commands] Expend runToElementTest which is built later

parent a69c0def
......@@ -30,7 +30,6 @@ libdatabase_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
libdatabase_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
libdatabase_unittests_LDADD = $(top_builddir)/src/lib/database/libkea-database.la
libdatabase_unittests_LDADD += $(top_builddir)/src/lib/testutils/libkea-testutils.la
libdatabase_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libdatabase_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libdatabase_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
......
......@@ -7,7 +7,6 @@
#include <config.h>
#include <database/backend_selector.h>
#include <testutils/test_to_element.h>
#include <boost/scoped_ptr.hpp>
#include <gtest/gtest.h>
......@@ -171,6 +170,7 @@ TEST(BackendSelectorTest, backendTypeToString) {
}
// Tests toElement from backend selectors.
// Can't be use runToElementTest because it is defined in a later library...
TEST(BackendSelectorTest, backendToElement) {
// Unspecified.
boost::scoped_ptr<BackendSelector> sel(new BackendSelector());
......@@ -184,17 +184,24 @@ TEST(BackendSelectorTest, backendToElement) {
EXPECT_NO_THROW(sel.reset(new BackendSelector(BackendSelector::Type::MYSQL)));
ElementPtr expected = Element::createMap();
expected->set("type", Element::create("mysql"));
test::runToElementTest<BackendSelector>(expected, *sel);
ConstElementPtr unparsed;
ASSERT_NO_THROW(unparsed = sel->toElement());
ASSERT_TRUE(unparsed);
EXPECT_TRUE(isEquivalent(expected, unparsed));
// Add host.
expected->set("host", Element::create("myhost"));
EXPECT_NO_THROW(sel.reset(new BackendSelector(expected)));
test::runToElementTest<BackendSelector>(expected, *sel);
ASSERT_NO_THROW(unparsed = sel->toElement());
ASSERT_TRUE(unparsed);
EXPECT_TRUE(isEquivalent(expected, unparsed));
// Add port.
expected->set("port", Element::create(1234L));
EXPECT_NO_THROW(sel.reset(new BackendSelector(expected)));
test::runToElementTest<BackendSelector>(expected, *sel);
ASSERT_NO_THROW(unparsed = sel->toElement());
ASSERT_TRUE(unparsed);
EXPECT_TRUE(isEquivalent(expected, unparsed));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment