36 lines
951 B
C++
36 lines
951 B
C++
// #include <sp/protocol/packet/PacketSerializer.h>
|
|
|
|
// #include <sp/misc/Test.h>
|
|
// #include <sp/protocol/packet/PacketFactory.h>
|
|
|
|
// namespace tp = sp::protocol;
|
|
|
|
// template <typename Packet_T, typename Packet_Data_T = typename Packet_T::PacketDataType>
|
|
// static int TestPacket() {
|
|
// Packet_T packet;
|
|
|
|
// td::DataBuffer buffer = tp::PacketSerializer::Serialize(packet);
|
|
|
|
// auto abstractPacket = tp::PacketSerializer::Deserialize(buffer);
|
|
|
|
// td_test_assert(abstractPacket);
|
|
|
|
// Packet_T* packet2 = dynamic_cast<Packet_T*>(abstractPacket.get());
|
|
|
|
// td_test_assert(packet2);
|
|
// td_test_assert(packet.GetType() == packet2->GetType());
|
|
|
|
// return std::memcmp(&packet.m_Data, &packet2->m_Data, sizeof(Packet_Data_T));
|
|
// }
|
|
|
|
// #define DeclarePacket(Packet, ...) TestPacket<tp::packets::Packet>();
|
|
|
|
// static int TestAllPackets() {
|
|
// DeclareAllPacket()
|
|
|
|
// return TD_TEST_SUCCESSFUL;
|
|
// }
|
|
|
|
// int main() {
|
|
// return TestAllPackets();
|
|
// }
|