1 #ifndef BLANK_TEST_NET_PACKETTEST_HPP_
2 #define BLANK_TEST_NET_PACKETTEST_HPP_
4 #include "model/geometry.hpp"
5 #include "net/Packet.hpp"
6 #include "world/EntityState.hpp"
12 #include <glm/glm.hpp>
13 #include <cppunit/extensions/HelperMacros.h>
20 : public CppUnit::TestFixture {
22 CPPUNIT_TEST_SUITE(PacketTest);
24 CPPUNIT_TEST(testSizes);
25 CPPUNIT_TEST(testControl);
26 CPPUNIT_TEST(testPing);
27 CPPUNIT_TEST(testLogin);
28 CPPUNIT_TEST(testJoin);
29 CPPUNIT_TEST(testPart);
30 CPPUNIT_TEST(testPlayerUpdate);
31 CPPUNIT_TEST(testSpawnEntity);
32 CPPUNIT_TEST(testDespawnEntity);
33 CPPUNIT_TEST(testEntityUpdate);
34 CPPUNIT_TEST(testPlayerCorrection);
35 CPPUNIT_TEST(testChunkBegin);
36 CPPUNIT_TEST(testChunkData);
37 CPPUNIT_TEST(testBlockUpdate);
38 CPPUNIT_TEST(testMessage);
40 CPPUNIT_TEST_SUITE_END();
52 void testPlayerUpdate();
53 void testSpawnEntity();
54 void testDespawnEntity();
55 void testEntityUpdate();
56 void testPlayerCorrection();
57 void testChunkBegin();
59 void testBlockUpdate();
63 static void AssertPacket(
64 const std::string &name,
65 std::uint8_t expected_type,
66 std::size_t expected_length,
67 const Packet::Payload &actual);
68 static void AssertPacket(
69 const std::string &name,
70 std::uint8_t expected_type,
71 std::size_t min_length,
72 std::size_t max_length,
73 const Packet::Payload &actual);
75 static void AssertEqual(
76 const std::string &message,
77 const EntityState &expected,
78 const EntityState &actual);
79 static void AssertEqual(
80 const std::string &message,
83 static void AssertEqual(
84 const std::string &message,
85 const glm::ivec3 &expected,
86 const glm::ivec3 &actual);
87 static void AssertEqual(
88 const std::string &message,
89 const glm::vec3 &expected,
90 const glm::vec3 &actual,
91 float epsilon = std::numeric_limits<float>::epsilon());
92 static void AssertEqual(
93 const std::string &message,
94 const glm::quat &expected,
95 const glm::quat &actual);