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:
Daniil Kovalev
2021-07-01 11:17:20 -04:00
committed by GitHub
parent 0af15e45de
commit 7b7615a6d9
80 changed files with 3451 additions and 3799 deletions

View File

@@ -2,18 +2,10 @@
#include <fstream>
#include <sstream>
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wconversion"
#endif //defined(__GNUC__)
#define BOOST_TEST_MODULE json
#include <boost/test/unit_test.hpp>
#include <gtest/gtest.h>
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif //defined(__GNUC__)
TEST(json, basic_elements)
BOOST_AUTO_TEST_CASE(basic_elements)
{
typedef std::map<std::string, int> map_s_i;
map_s_i msi;
@@ -27,10 +19,10 @@ TEST(json, basic_elements)
msgpack::object o(t1, z);
std::stringstream ss;
ss << o;
EXPECT_EQ(ss.str(), "[12,-34,1.23,-4.56,true,false,\"ABC\",{\"Hello\":789,\"World\":-789}]");
BOOST_CHECK_EQUAL(ss.str(), "[12,-34,1.23,-4.56,true,false,\"ABC\",{\"Hello\":789,\"World\":-789}]");
}
TEST(json, escape)
BOOST_AUTO_TEST_CASE(escape)
{
std::string s = "\"\\/\b\f\n\r\tabc";
@@ -38,10 +30,10 @@ TEST(json, escape)
msgpack::object o(s, z);
std::stringstream ss;
ss << o;
EXPECT_EQ(ss.str(), "\"\\\"\\\\\\/\\b\\f\\n\\r\\tabc\"");
BOOST_CHECK_EQUAL(ss.str(), "\"\\\"\\\\\\/\\b\\f\\n\\r\\tabc\"");
}
TEST(json, escape_cc)
BOOST_AUTO_TEST_CASE(escape_cc)
{
std::string s;
for (int i = 0; i < 0x20; ++i)
@@ -52,5 +44,5 @@ TEST(json, escape_cc)
msgpack::object o(s, z);
std::stringstream ss;
ss << o;
EXPECT_EQ(ss.str(), "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f\\u007f \"");
BOOST_CHECK_EQUAL(ss.str(), "\"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\f\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f\\u007f \"");
}