1
0
mirror of https://github.com/codership/wsrep-lib.git synced 2025-07-24 10:42:31 +03:00

Reorganized coverage report, missing test cases for id.

This commit is contained in:
Teemu Ollakka
2018-06-12 19:00:05 +03:00
parent 174ecfe578
commit 292072bf56
3 changed files with 19 additions and 11 deletions

View File

@ -51,7 +51,7 @@ if (WITH_TSAN)
endif()
add_custom_target(coverage_report
lcov --capture --directory src --output lcov.info --no-external
lcov --capture --directory src --directory test --directory include --output lcov.info --no-external
COMMAND genhtml --output-directory coverage_report lcov.info)

View File

@ -5,7 +5,6 @@
#include "wsrep/provider.hpp"
#include "wsrep/logger.hpp"
#include "../test/mock_provider.hpp"
#include "wsrep_provider_v26.hpp"
wsrep::provider* wsrep::provider::make_provider(
@ -15,15 +14,8 @@ wsrep::provider* wsrep::provider::make_provider(
{
try
{
if (provider_spec == "mock")
{
return new wsrep::mock_provider(server_context);
}
else
{
return new wsrep::wsrep_provider_v26(
server_context, provider_options, provider_spec);
}
return new wsrep::wsrep_provider_v26(
server_context, provider_options, provider_spec);
}
catch (const wsrep::runtime_error& e)
{

View File

@ -36,3 +36,19 @@ BOOST_AUTO_TEST_CASE(id_test_string_too_long)
BOOST_REQUIRE_EXCEPTION(wsrep::id id(id_str), wsrep::runtime_error,
exception_check);
}
BOOST_AUTO_TEST_CASE(id_test_binary)
{
char data[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4 ,5 ,6};
wsrep::id id(data, sizeof(data));
std::ostringstream os;
os << id;
BOOST_REQUIRE(os.str() == "01020304-0506-0708-0900-010203040506");
}
BOOST_AUTO_TEST_CASE(id_test_binary_too_long)
{
char data[17] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4 ,5 ,6, 7};
BOOST_REQUIRE_EXCEPTION(wsrep::id id(data, sizeof(data)),
wsrep::runtime_error, exception_check);;
}