mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-14 06:55:50 +02:00
Modernize codebase
- Enhance CMakeLists.txt files. - Move to Boost Test from Google Test to support pre-C++11 compilers. - Add more configurations on CI matrix builds. - Other minor fixes
This commit is contained in:
@@ -2,16 +2,8 @@
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif //defined(__GNUC__)
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif //defined(__GNUC__)
|
||||
#define BOOST_TEST_MODULE MSGPACK_BOOST
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
@@ -19,7 +11,7 @@
|
||||
|
||||
#if (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 61
|
||||
|
||||
TEST(MSGPACK_BOOST, pack_convert_string_view)
|
||||
BOOST_AUTO_TEST_CASE(pack_convert_string_view)
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::string s = "ABC";
|
||||
@@ -31,26 +23,26 @@ TEST(MSGPACK_BOOST, pack_convert_string_view)
|
||||
std::string const& str = ss.str();
|
||||
msgpack::unpack(oh, str.data(), str.size());
|
||||
boost::string_view val2 = oh.get().as<boost::string_view>();
|
||||
EXPECT_TRUE(val1 == val2);
|
||||
BOOST_CHECK(val1 == val2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_BOOST, object_strinf_view)
|
||||
BOOST_AUTO_TEST_CASE(object_strinf_view)
|
||||
{
|
||||
std::string s = "ABC";
|
||||
boost::string_view val1(s);
|
||||
msgpack::object obj(val1);
|
||||
boost::string_view val2 = obj.as<boost::string_view>();
|
||||
EXPECT_TRUE(val1 == val2);
|
||||
BOOST_CHECK(val1 == val2);
|
||||
}
|
||||
|
||||
TEST(MSGPACK_BOOST, object_with_zone_string_view)
|
||||
BOOST_AUTO_TEST_CASE(object_with_zone_string_view)
|
||||
{
|
||||
msgpack::zone z;
|
||||
std::string s = "ABC";
|
||||
boost::string_view val1(s);
|
||||
msgpack::object obj(val1, z);
|
||||
boost::string_view val2 = obj.as<boost::string_view>();
|
||||
EXPECT_TRUE(val1 == val2);
|
||||
BOOST_CHECK(val1 == val2);
|
||||
}
|
||||
|
||||
#endif // (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 61
|
||||
|
Reference in New Issue
Block a user