2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 21:45:37 +00:00

fixed compilation with unittests

This commit is contained in:
Razvan Becheriu
2019-03-11 07:40:07 +02:00
parent 1646cb296a
commit 7d8d91be21
2 changed files with 14 additions and 22 deletions

View File

@@ -22,16 +22,11 @@ libcql_unittests_SOURCES = cql_connection_unittest.cc
libcql_unittests_SOURCES += run_unittests.cc
libcql_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(CQL_CPPFLAGS)
libcql_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) $(CQL_LIBS)
libcql_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(CQL_LIBS) $(GTEST_LDFLAGS)
libcql_unittests_LDADD = $(top_builddir)/src/lib/cql/libkea-cql.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libkea-threads.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
libcql_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libcql_unittests_LDADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) $(GTEST_LDADD)
libcql_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(CQL_LIBS) $(BOOST_LIBS) $(GTEST_LDADD)
endif

View File

@@ -23,6 +23,7 @@ using isc::db::StatementMap;
using isc::db::StatementTag;
using isc::db::StatementTagHash;
using isc::db::exchangeType;
using isc::db::CqlConnection;
class CqlConnectionTest {
public:
@@ -60,21 +61,17 @@ TEST(CqlConnection, statementMapHash) {
ASSERT_EQ(map.size(), 1u);
}
/// @brief Check anything related to exchange types.
TEST(CqlConnection, exchangeTypeCoverage) {
// Check that const and non-const are supported and both point to the same
// exchange type.
int i = 1;
// non-const
int* pi = &i;
boost::any bi(pi);
// const
int* const cpi = &i;
boost::any bci(cpi);
ASSERT_EQ(exchangeType(bi), exchangeType(bci));
/// @brief Check that the parseConsistency function return proper values.
TEST(CqlConnection, parseConsistency) {
std::string consistency;
consistency = "quorum";
ASSERT_EQ(CqlConnection::parseConsistency(consistency), CASS_CONSISTENCY_QUORUM);
consistency = "serial";
ASSERT_EQ(CqlConnection::parseConsistency(consistency), CASS_CONSISTENCY_SERIAL);
consistency = "";
ASSERT_EQ(CqlConnection::parseConsistency(consistency), CASS_CONSISTENCY_UNKNOWN);
consistency = "unknown";
ASSERT_EQ(CqlConnection::parseConsistency(consistency), CASS_CONSISTENCY_UNKNOWN);
}
} // namespace