X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=tst%2Fnet%2FPacketTest.hpp;h=81cdd8280d0ac9a2c5011a65aff646f66d482ea1;hb=1b3b7203d0db35236108869961c77eaf31881d4b;hp=12b93da38372779330246f4c86bed21d0d0e055b;hpb=80941c619984ce7632e2846d0115913f2a64842e;p=blank.git diff --git a/tst/net/PacketTest.hpp b/tst/net/PacketTest.hpp index 12b93da..81cdd82 100644 --- a/tst/net/PacketTest.hpp +++ b/tst/net/PacketTest.hpp @@ -1,6 +1,14 @@ #ifndef BLANK_TEST_NET_PACKETTEST_HPP_ #define BLANK_TEST_NET_PACKETTEST_HPP_ +#include "geometry/primitive.hpp" +#include "graphics/glm.hpp" +#include "net/Packet.hpp" +#include "world/EntityState.hpp" + +#include +#include +#include #include #include @@ -13,11 +21,21 @@ class PacketTest CPPUNIT_TEST_SUITE(PacketTest); +CPPUNIT_TEST(testSizes); CPPUNIT_TEST(testControl); CPPUNIT_TEST(testPing); CPPUNIT_TEST(testLogin); CPPUNIT_TEST(testJoin); CPPUNIT_TEST(testPart); +CPPUNIT_TEST(testPlayerUpdate); +CPPUNIT_TEST(testSpawnEntity); +CPPUNIT_TEST(testDespawnEntity); +CPPUNIT_TEST(testEntityUpdate); +CPPUNIT_TEST(testPlayerCorrection); +CPPUNIT_TEST(testChunkBegin); +CPPUNIT_TEST(testChunkData); +CPPUNIT_TEST(testBlockUpdate); +CPPUNIT_TEST(testMessage); CPPUNIT_TEST_SUITE_END(); @@ -25,11 +43,56 @@ public: void setUp(); void tearDown(); + void testSizes(); void testControl(); void testPing(); void testLogin(); void testJoin(); void testPart(); + void testPlayerUpdate(); + void testSpawnEntity(); + void testDespawnEntity(); + void testEntityUpdate(); + void testPlayerCorrection(); + void testChunkBegin(); + void testChunkData(); + void testBlockUpdate(); + void testMessage(); + +private: + static void AssertPacket( + const std::string &name, + std::uint8_t expected_type, + std::size_t expected_length, + const Packet::Payload &actual); + static void AssertPacket( + const std::string &name, + std::uint8_t expected_type, + std::size_t min_length, + std::size_t max_length, + const Packet::Payload &actual); + + static void AssertEqual( + const std::string &message, + const EntityState &expected, + const EntityState &actual); + static void AssertEqual( + const std::string &message, + const AABB &expected, + const AABB &actual); + static void AssertEqual( + const std::string &message, + const glm::ivec3 &expected, + const glm::ivec3 &actual); + static void AssertEqual( + const std::string &message, + const glm::vec3 &expected, + const glm::vec3 &actual, + float epsilon = std::numeric_limits::epsilon()); + static void AssertEqual( + const std::string &message, + const glm::quat &expected, + const glm::quat &actual); private: UDPpacket udp_pack;