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);
39 CPPUNIT_TEST_SUITE_END();
51 void testPlayerUpdate();
52 void testSpawnEntity();
53 void testDespawnEntity();
54 void testEntityUpdate();
55 void testPlayerCorrection();
56 void testChunkBegin();
58 void testBlockUpdate();
61 static void AssertPacket(
62 const std::string &name,
63 std::uint8_t expected_type,
64 std::size_t expected_length,
65 const Packet::Payload &actual);
66 static void AssertPacket(
67 const std::string &name,
68 std::uint8_t expected_type,
69 std::size_t min_length,
70 std::size_t max_length,
71 const Packet::Payload &actual);
73 static void AssertEqual(
74 const std::string &message,
75 const EntityState &expected,
76 const EntityState &actual);
77 static void AssertEqual(
78 const std::string &message,
81 static void AssertEqual(
82 const std::string &message,
83 const glm::ivec3 &expected,
84 const glm::ivec3 &actual);
85 static void AssertEqual(
86 const std::string &message,
87 const glm::vec3 &expected,
88 const glm::vec3 &actual,
89 float epsilon = std::numeric_limits<float>::epsilon());
90 static void AssertEqual(
91 const std::string &message,
92 const glm::quat &expected,
93 const glm::quat &actual);