diff options
author | Sergey Yershov <syershov@maps.me> | 2016-11-03 18:36:07 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2016-11-03 18:58:25 +0300 |
commit | f7f919196a304f0a605a6f35c80696e8aea215f7 (patch) | |
tree | ab2d198bf79785122e80eb5877c44a8652eb273a /tracking/tracking_tests | |
parent | dd7fce49f693edd4019552bede68bb878ae72b77 (diff) |
[tracking] Fix skipping absent packet header
Diffstat (limited to 'tracking/tracking_tests')
-rw-r--r-- | tracking/tracking_tests/protocol_test.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tracking/tracking_tests/protocol_test.cpp b/tracking/tracking_tests/protocol_test.cpp index 3bdbf1798d..268f375f65 100644 --- a/tracking/tracking_tests/protocol_test.cpp +++ b/tracking/tracking_tests/protocol_test.cpp @@ -52,7 +52,8 @@ UNIT_TEST(Protocol_DecodeAuthPacket) TEST_EQUAL(packet.size(), 7, ()); TEST_EQUAL(Protocol::PacketType(packet[0]), Protocol::PacketType::CurrentAuth, ()); - auto result = Protocol::DecodeAuthPacket(Protocol::PacketType::CurrentAuth, packet); + auto payload = vector<uint8_t>(begin(packet) + sizeof(uint32_t /* header */), end(packet)); + auto result = Protocol::DecodeAuthPacket(Protocol::PacketType::CurrentAuth, payload); TEST_EQUAL(result, "ABC", ()); } @@ -69,7 +70,8 @@ UNIT_TEST(Protocol_DecodeDataPacket) TEST_EQUAL(packet.size(), 26, ()); TEST_EQUAL(Protocol::PacketType(packet[0]), Protocol::PacketType::CurrentData, ()); - Container result = Protocol::DecodeDataPacket(Protocol::PacketType::CurrentData, packet); + auto payload = vector<uint8_t>(begin(packet) + sizeof(uint32_t /* header */), end(packet)); + Container result = Protocol::DecodeDataPacket(Protocol::PacketType::CurrentData, payload); TEST_EQUAL(points.size(), result.size(), ()); for (size_t i = 0; i < points.size(); ++i) |