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(testControl);
25 CPPUNIT_TEST(testPing);
26 CPPUNIT_TEST(testLogin);
27 CPPUNIT_TEST(testJoin);
28 CPPUNIT_TEST(testPart);
29 CPPUNIT_TEST(testPlayerUpdate);
30 CPPUNIT_TEST(testSpawnEntity);
31 CPPUNIT_TEST(testDespawnEntity);
32 CPPUNIT_TEST(testEntityUpdate);
33 CPPUNIT_TEST(testPlayerCorrection);
34 CPPUNIT_TEST(testChunkBegin);
35 CPPUNIT_TEST(testChunkData);
37 CPPUNIT_TEST_SUITE_END();
48 void testPlayerUpdate();
49 void testSpawnEntity();
50 void testDespawnEntity();
51 void testEntityUpdate();
52 void testPlayerCorrection();
53 void testChunkBegin();
57 static void AssertPacket(
58 const std::string &name,
59 std::uint8_t expected_type,
60 std::size_t expected_length,
61 const Packet::Payload &actual);
62 static void AssertPacket(
63 const std::string &name,
64 std::uint8_t expected_type,
65 std::size_t min_length,
66 std::size_t max_length,
67 const Packet::Payload &actual);
69 static void AssertEqual(
70 const std::string &message,
71 const EntityState &expected,
72 const EntityState &actual);
73 static void AssertEqual(
74 const std::string &message,
77 static void AssertEqual(
78 const std::string &message,
79 const glm::ivec3 &expected,
80 const glm::ivec3 &actual);
81 static void AssertEqual(
82 const std::string &message,
83 const glm::vec3 &expected,
84 const glm::vec3 &actual,
85 float epsilon = std::numeric_limits<float>::epsilon());
86 static void AssertEqual(
87 const std::string &message,
88 const glm::quat &expected,
89 const glm::quat &actual);