33 Commits

Author SHA1 Message Date
Daniil Kovalev
77045f13bb Add tests for std::span adaptor 2021-05-10 22:41:10 +03:00
Takatoshi Kondo
c8a053557c Propagated CXXFLAGS.
Fixed warnings.
2020-07-02 16:15:08 +09:00
Takatoshi Kondo
6eaf7fd38d Added steady_clock and high_resolution_clock support. 2020-06-12 22:16:19 +09:00
James McCoy
f8b0ad1766
Skip timespec_pack_convert_64bit_sec_max_nano on systems where tv_sec <= 32-bit 2020-01-05 21:38:52 -05:00
James McCoy
7ed7af90b6
Fix timespec_object.*_32bit_sec tests on 32-bit platforms
On 32-bit unix platforms, 0xffffffffUL is a 32-bit value so the compiler
complains about converting it to a signed value.

    /home/runner/work/msgpack-c/msgpack-c/test/msgpack_cpp11.cpp:1085:20: error: constant expression evaluates to 4294967295 which cannot be narrowed to type '__time_t' (aka 'long') [-Wc++11-narrowing]
        timespec val1{ 0xffffffffUL, 0 };
                       ^~~~~~~~~~~~
    /home/runner/work/msgpack-c/msgpack-c/test/msgpack_cpp11.cpp:1085:20: note: insert an explicit cast to silence this issue
        timespec val1{ 0xffffffffUL, 0 };
                       ^~~~~~~~~~~~
                       static_cast<__time_t>( )
    /home/runner/work/msgpack-c/msgpack-c/test/msgpack_cpp11.cpp:1085:20: warning: implicit conversion changes signedness: 'unsigned long' to '__time_t' (aka 'long') [-Wsign-conversion]
        timespec val1{ 0xffffffffUL, 0 };
                     ~ ^~~~~~~~~~~~

Since we're trying to test how the maximum 32-bit value that fits in
timespec.tv_sec is handled, directly use the maximum 32-bit value for
the appropriate (un)signed type used for timespec.tv_sec.

We don't just cast to the value, as the compiler suggests, because that
would result in an extremely negative value.
2020-01-05 21:38:45 -05:00
Takatoshi Kondo
befc3cdd0c Supressed C4309 on MSVC. 2019-12-25 14:59:40 +09:00
Takatoshi Kondo
2e2e93ba2e Added compiler checking to pragma. 2019-12-25 14:39:57 +09:00
David Carlier
698a482b67 c++11 unit tests silent warning fixes proposal. 2019-11-16 13:36:37 +00:00
Takatoshi Kondo
70f950ac05 Fixed #806.
Removed `ss.str().data()` (the type of ss is std::stringstream).
Introduced variable that is const reference of `ss.str()`.
2019-08-29 20:22:10 +09:00
Takatoshi Kondo
d3fecce359 Added timespec support for C++11 or later. 2019-05-09 14:46:45 +09:00
Takatoshi Kondo
17267ed475 Added -Wconversion support for C++. 2019-03-25 19:48:39 +09:00
Takatoshi Kondo
cb2dcb19b9 Implemented #638.
Added Time Stamp support.
2018-07-22 16:25:23 +09:00
Takatoshi Kondo
5d69c22bf9 Use OR instead of AND for all classes that have multiple types.
Revert example. Combination of has_as and not has_as are move to tests.
2016-08-29 22:12:01 +09:00
Takatoshi Kondo
90c2e35694 Fixed warnings on clang on OSX. 2016-06-20 17:30:51 +09:00
Takatoshi Kondo
4ffdc01135 Added converting support for different size tuples. 2016-06-20 17:12:53 +09:00
Takatoshi Kondo
1b87018a0a Fixed #390.
Added size_equal_only class template to check converted container size
strictly.
Relaxed std::array size checking by default.
Fixed std::tuple and msgpack::type::tuple size checking problem.
2016-06-20 15:32:24 +09:00
Takatoshi Kondo
1bfcf55469 Replaced msgpack::unpacked with msgpack::object_handle.
msgpack::unpacked is a typedef of the msgpack::object_handle.
I recommend using msgpack::object_handle. It can be used not only
holding unpacked msgpack objects but also msgpack::objects that are
created by any types.

Replaced unpack() APIs in test codes and examples. They used to use old
APIs.
2016-03-21 15:22:50 +09:00
Takatoshi Kondo
60d4b2833d Fixed #433.
Added zero size check before calling std::vector<T>::front().
Added empty checking tests for all containers.
2016-02-26 15:08:18 +09:00
Takatoshi Kondo
96f145812f Fixed #243.
std::vector<unsigned char> and std::array<unsigned char> are mapped to BIN.
std::vector<uint8_t> and std::array<uint8_t> are mapped to BIN if uint8_t is the same type of unsigned char, otherwise mapped to ARRAY.

Added array_ref. When client wraps BIN mapped types above with array_ref as msgpack::type::array_ref<std::vector<char> >, the type is mapped to ARRAY.
2015-08-31 14:06:39 +09:00
Takatoshi Kondo
018c6c819e Updated comments to describe #if !define(_MSC_VER) reason. 2015-08-18 00:06:36 +09:00
Takatoshi Kondo
1c810bcb74 Removed the tests that contain std::tuple with non default constructible class on MSVC2015.
It seems that MSVC2015 requires tuple elements' default constructor during 'as' process.
I don't know why.
2015-08-15 21:01:12 +09:00
Takatoshi Kondo
78b3e8adad Added 'as' support for std::deque. 2015-08-03 17:57:46 +09:00
Takatoshi Kondo
298c97ec08 Added all template parameters support for containers.
e.g.) allocator.
Added tests.
Replaced variadic template parameters with individual template parameters on C++11 unordered containers.
2015-08-03 16:54:05 +09:00
Takatoshi Kondo
a746afa7cc Added 'as' support for containers. 2015-07-30 16:18:20 +09:00
Takatoshi Kondo
45b57c292c Added no default constructible classes support. 2015-06-18 16:15:20 +09:00
Takatoshi Kondo
7cd77292fc Refined base class pack/unpack support.
Not only C++11 but also C++03 supported.
2015-05-01 22:05:23 +09:00
Takatoshi Kondo
d3e6f017be Base classes packing/converting/creating object::with_zone support in C++11. 2015-04-06 17:14:17 +09:00
Takatoshi Kondo
e8d3c8d6c5 Re-designed user types dispatching mechanism.
msgpakc-c 0.5.9 or older uses ADL.
msgpack-c 1.0.x uses overloading with header files ordering.
msgpack-c 1.1.x uses functor with class template specialization.
2015-04-02 18:23:37 +09:00
Takatoshi Kondo
c4fb47c00d Fixed #204, #202.
enum support had been incomplete.
This fix made enum support complete.

Replaced int with auto on c++11 scoped enum.
Replaced template specializations with function overloads on operator<< and operator>> for enum.

enum can convert to object with and without zone.

When you want to adapt enum, you need to write as follows:

// NOT msgpack.hpp

enum yourenum {
    elem
};

MSGPACK_ADD_ENUM(yourenum);

// msgpack.hpp should be included after MSGPACK_ADD_ENUM(...)

int main() {
    msgpack::object obj(yourenum::elem);
}
2015-01-31 22:19:31 +09:00
Takatoshi Kondo
9162610682 Added adaptors for the C++11 version of unordered containers.
(Fixed https://github.com/msgpack/msgpack-c/issues/168)
2014-12-05 15:40:33 +09:00
Takatoshi Kondo
6e810df2a4 Added zero size tuple support. 2014-09-14 20:50:57 +09:00
Takatoshi Kondo
dd4043a616 Removed unused variables. 2014-09-09 14:29:10 +09:00
Takatoshi Kondo
6a8412d6de Separated msgpack_test.cpp.
Renamed test files.
Decreased test's loop counter to avoid travis-ci no output timeout.
The number of loops is not so meaningful.
2014-09-09 14:15:21 +09:00