diff --git a/tests/smshelpertest.cpp b/tests/smshelpertest.cpp index 6c17dae8d..27027d03b 100644 --- a/tests/smshelpertest.cpp +++ b/tests/smshelpertest.cpp @@ -5,6 +5,7 @@ */ #include "smsapp/smshelper.h" +#include "networkpacket.h" #include @@ -35,6 +36,25 @@ private Q_SLOTS: void testDifferentPhoneNumbers2(); void testAllZeros(); void testEmptyInput(); + void benchmark_serialize() + { + NetworkPacket pack(QStringLiteral("bla"), QVariantMap{{QStringLiteral("test"), 54321}}); + pack.setPayloadTransferInfo({{QStringLiteral("testme"), 123}}); + QBENCHMARK { + pack.serialize(); + } + } + + void benchmark_deserialize() + { + NetworkPacket pack(QStringLiteral("bla"), QVariantMap{{QStringLiteral("test"), 54321}}); + pack.setPayloadTransferInfo({{QStringLiteral("testme"), 123}}); + auto serialized = pack.serialize(); + QBENCHMARK { + NetworkPacket packet; + NetworkPacket::unserialize(serialized, &packet); + } + } }; /**