Sha256: a6af24736eab889b3459fb3fdde4bf69e008d6f859db9343bcd8f297dc8f03d6

Contents?: true

Size: 908 Bytes

Versions: 6

Compression:

Stored size: 908 Bytes

Contents

#include <msgpack.hpp>
#include <fstream>
#include <gtest/gtest.h>

static void feed_file(msgpack::unpacker& pac, const char* path)
{
    std::ifstream fin(path);
    while(true) {
        pac.reserve_buffer(32*1024);
        fin.read(pac.buffer(), pac.buffer_capacity());
        if(fin.bad()) {
            throw std::runtime_error("read failed");
        }
        pac.buffer_consumed(static_cast<size_t>(fin.gcount()));
        if(fin.fail()) {
            break;
        }
    }
}

TEST(cases, format)
{
    msgpack::unpacker pac;
    msgpack::unpacker pac_compact;

    feed_file(pac, "cases.mpac");
    feed_file(pac_compact, "cases_compact.mpac");

    msgpack::object_handle oh;
    while(pac.next(oh)) {
        msgpack::object_handle oh_compact;
        EXPECT_TRUE( pac_compact.next(oh_compact) );
        EXPECT_EQ(oh_compact.get(), oh.get());
    }

    EXPECT_FALSE( pac_compact.next(oh) );
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
script_core-0.0.6 ext/enterprise_script_service/msgpack/test/cases.cpp
script_core-0.0.5 ext/enterprise_script_service/msgpack/test/cases.cpp
script_core-0.0.4 ext/enterprise_script_service/msgpack/test/cases.cpp
script_core-0.0.3 ext/enterprise_script_service/msgpack/test/cases.cpp
script_core-0.0.2 ext/enterprise_script_service/msgpack/test/cases.cpp
script_core-0.0.1 ext/enterprise_script_service/msgpack/test/cases.cpp