diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-12-19 11:41:50 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-03-06 17:21:58 +0100 |
commit | 01f9c3449a88748722dd51c7b54305fd1ba87359 (patch) | |
tree | e903a2035f511f55e3f9662c0fa0513a2522e19c /src/test/serialize_tests.cpp | |
parent | 4e853aa163ddb978d25bd8b8ecfd730a1d09e051 (diff) |
src/serialize.h: base serialization level endianness neutrality
Serialization type-safety and endianness compatibility.
Diffstat (limited to 'src/test/serialize_tests.cpp')
-rw-r--r-- | src/test/serialize_tests.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp index fe49af711b..e2d19ce5cc 100644 --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -13,6 +13,30 @@ using namespace std; BOOST_AUTO_TEST_SUITE(serialize_tests) +BOOST_AUTO_TEST_CASE(sizes) +{ + BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(char(0), 0)); + BOOST_CHECK_EQUAL(sizeof(int8_t), GetSerializeSize(int8_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(uint8_t), GetSerializeSize(uint8_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(int16_t), GetSerializeSize(int16_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(uint16_t), GetSerializeSize(uint16_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(int32_t), GetSerializeSize(int32_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(uint32_t), GetSerializeSize(uint32_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(int64_t), GetSerializeSize(int64_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(uint64_t), GetSerializeSize(uint64_t(0), 0)); + BOOST_CHECK_EQUAL(sizeof(float), GetSerializeSize(float(0), 0)); + BOOST_CHECK_EQUAL(sizeof(double), GetSerializeSize(double(0), 0)); + + // Bool is serialized as char + BOOST_CHECK_EQUAL(sizeof(char), GetSerializeSize(bool(0), 0)); +} + +BOOST_AUTO_TEST_CASE(floats) +{ + // TODO ser_uint32_to_float, ser_uint64_to_double + // TODO ser_float_to_uint32, ser_double_to_uint64 +} + BOOST_AUTO_TEST_CASE(varints) { // encode |