Sha256: 9da50f4da82f777011e6c0438790922809bbef3baf699661d67ff2ae03e3a4ab

Contents?: true

Size: 955 Bytes

Versions: 8

Compression:

Stored size: 955 Bytes

Contents

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

TEST(fixint, size)
{
    msgpack_sbuffer* sbuf = msgpack_sbuffer_new();
    msgpack_packer* pk = msgpack_packer_new(sbuf, msgpack_sbuffer_write);

    size_t sum = 0;

    EXPECT_EQ(0, msgpack_pack_fix_int8(pk, 0));
    EXPECT_EQ(sum+=2, sbuf->size);
    EXPECT_EQ(0, msgpack_pack_fix_int16(pk, 0));
    EXPECT_EQ(sum+=3, sbuf->size);
    EXPECT_EQ(0, msgpack_pack_fix_int32(pk, 0));
    EXPECT_EQ(sum+=5, sbuf->size);
    EXPECT_EQ(0, msgpack_pack_fix_int64(pk, 0));
    EXPECT_EQ(sum+=9, sbuf->size);

    EXPECT_EQ(0, msgpack_pack_fix_uint8(pk, 0));
    EXPECT_EQ(sum+=2, sbuf->size);
    EXPECT_EQ(0, msgpack_pack_fix_uint16(pk, 0));
    EXPECT_EQ(sum+=3, sbuf->size);
    EXPECT_EQ(0, msgpack_pack_fix_uint32(pk, 0));
    EXPECT_EQ(sum+=5, sbuf->size);
    EXPECT_EQ(0, msgpack_pack_fix_uint64(pk, 0));
    EXPECT_EQ(sum+=9, sbuf->size);

    msgpack_sbuffer_free(sbuf);
    msgpack_packer_free(pk);
}

Version data entries

8 entries across 8 versions & 1 rubygems

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