From 3cd2887a089ad752f6c6d6f04a7743158cd1aeeb Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 14 Jul 2015 16:11:29 -0700 Subject: [PATCH 1/2] add initial packet tests --- tests/networking/src/PacketTests.cpp | 14 ++++++++++++++ tests/networking/src/PacketTests.h | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 tests/networking/src/PacketTests.cpp create mode 100644 tests/networking/src/PacketTests.h diff --git a/tests/networking/src/PacketTests.cpp b/tests/networking/src/PacketTests.cpp new file mode 100644 index 0000000000..c8c88679fb --- /dev/null +++ b/tests/networking/src/PacketTests.cpp @@ -0,0 +1,14 @@ +// +// PacketTests.cpp +// tests/networking/src +// +// Created by Stephen Birarda on 07/14/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "PacketTests.h" + +QTEST_MAIN(PacketTests) diff --git a/tests/networking/src/PacketTests.h b/tests/networking/src/PacketTests.h new file mode 100644 index 0000000000..498fddf39a --- /dev/null +++ b/tests/networking/src/PacketTests.h @@ -0,0 +1,25 @@ +// +// PacketTests.h +// tests/networking/src +// +// Created by Stephen Birarda on 07/14/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_PacketTests_h +#define hifi_PacketTests_h + +#pragma once + +#include + +class PacketTests : public QObject { + Q_OBJECT +private slots: + void readTest(); +}; + +#endif // hifi_PacketTests_h From 3b8a335c8c5ac424ea8ddccf6b713fd5d54b9472 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 15 Jul 2015 10:51:40 -0700 Subject: [PATCH 2/2] Fix bytesLeftToRead --- libraries/networking/src/udt/Packet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/udt/Packet.h b/libraries/networking/src/udt/Packet.h index c7933606be..70a11137db 100644 --- a/libraries/networking/src/udt/Packet.h +++ b/libraries/networking/src/udt/Packet.h @@ -53,7 +53,7 @@ public: qint64 getSizeUsed() const { return _sizeUsed; } void setSizeUsed(qint64 sizeUsed) { _sizeUsed = sizeUsed; } - void bytesLeftToRead() const { return _capacity - pos(); } + qint64 bytesLeftToRead() const { return _capacity - pos(); } qint64 bytesAvailableForWrite() const { return _capacity - pos(); } HifiSockAddr& getSenderSockAddr() { return _senderSockAddr; }