Improve compatibility with older compilers (GCC 4.8); Fix bug with string comparison; Improve compatibility with different Boost versions (testing).

This commit is contained in:
Marko Zivanovic
2015-10-09 11:28:55 +02:00
parent 2e39070287
commit 65832925b8
6 changed files with 39 additions and 14 deletions
+4 -4
View File
@@ -71,8 +71,8 @@ BOOST_AUTO_TEST_CASE(parse_prerel_ids_types) {
BOOST_AUTO_TEST_CASE(parse_prerel_legal_chars) {
CHECK_PREREL("1.2.3-test-1-2-3-CAP", 1, 2, 3, Prerelease_identifiers({ { "test-1-2-3-CAP", A } }));
CHECK_PARSE_ERROR("1.2.3-test#1");
CHECK_PARSE_ERROR("1.2.3-test.©2015");
CHECK_PARSE_ERROR("1.2.3-????-????-1");
CHECK_PARSE_ERROR("1.2.3-test.©2015");
CHECK_PARSE_ERROR("1.2.3-ћирилица-1");
}
// prerel ids may not be empty
@@ -107,8 +107,8 @@ BOOST_AUTO_TEST_CASE(parse_build_ids) {
BOOST_AUTO_TEST_CASE(parse_build_legal_chars) {
CHECK_BUILD("1.2.3+test-1-2-3-CAP", 1, 2, 3, Build_identifiers({ "test-1-2-3-CAP" }));
CHECK_PARSE_ERROR("1.2.3+test#1");
CHECK_PARSE_ERROR("1.2.3+test.©2015");
CHECK_PARSE_ERROR("1.2.3+????-????-1");
CHECK_PARSE_ERROR("1.2.3+test.©2015");
CHECK_PARSE_ERROR("1.2.3+ћирилица-1");
}
// build ids may not be empty
+23
View File
@@ -35,9 +35,14 @@ const version::Build_identifiers no_build_ids;
#define N Identifier_type::num
#define A Identifier_type::alnum
#define BOOST_PATCH BOOST_VERSION % 100
#define BOOST_MINOR BOOST_VERSION / 100 % 1000
#define BOOST_MAJOR BOOST_VERSION / 100000
namespace boost {
namespace test_tools {
namespace tt_detail {
#if BOOST_MAJOR == 1 && BOOST_MINOR < 56
template<>
void print_log_value<version::Build_identifiers>::operator()(std::ostream& os,
const version::Build_identifiers& ids) {
@@ -53,6 +58,24 @@ namespace boost {
os << id.first << "|" << static_cast<int>(id.second) << "|" << ",";
}
}
#else
template<>
inline std::ostream& operator<<(std::ostream& os, const print_helper_t<version::Build_identifiers>& ph) {
for (const auto& id: ph.m_t) {
os << id << ",";
}
return os;
}
template<>
inline std::ostream& operator<<(std::ostream& os, const print_helper_t<version::Prerelease_identifiers>& ph) {
for (const auto& id : ph.m_t) {
os << id.first << "|" << static_cast<int>(id.second) << "|" << ",";
}
return os;
}
#endif
}
}
}