123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include <gtest/gtest.h>
- #include <QByteArray>
- #include <QString>
- #include <simplefixedint32message.h>
- #include <qprotobufjsonserializer.h>
- using namespace qtprotobufnamespace::tests;
- namespace QtProtobuf {
- namespace tests {
- class JsonSerializationTest : public ::testing::Test
- {
- public:
- JsonSerializationTest() = default;
- void SetUp() override;
- protected:
- std::unique_ptr<QProtobufJsonSerializer> serializer;
- };
- void JsonSerializationTest::SetUp() {
- serializer.reset(new QProtobufJsonSerializer);
- }
- TEST_F(JsonSerializationTest, FixedInt32MessageDeserializeTest)
- {
- SimpleFixedInt32Message msg;
- msg.setTestFieldFixedInt32(555);
- QByteArray result = msg.serialize(serializer.get());
- ASSERT_STREQ(QString::fromUtf8(result).toStdString().c_str(), "{\"testFieldFixedInt32\":555}");
- }
- }
- }
|