8 #include "flutter/shell/platform/linux/testing/fl_test.h"
9 #include "gtest/gtest.h"
17 g_autoptr(GError)
error =
nullptr;
18 g_autoptr(GBytes) message =
20 EXPECT_NE(message,
nullptr);
21 EXPECT_EQ(
error,
nullptr);
23 return bytes_to_hex_string(message);
36 FlMessageCodec* codec) {
37 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
38 g_autoptr(GError)
error =
nullptr;
41 EXPECT_EQ(
error,
nullptr);
42 EXPECT_NE(
value,
nullptr);
59 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
60 g_autoptr(GError)
error =
nullptr;
63 EXPECT_TRUE(
value ==
nullptr);
64 EXPECT_TRUE(g_error_matches(
error, domain, code));
67 TEST(FlStandardMessageCodecTest, EncodeNullptr) {
69 EXPECT_STREQ(hex_string,
"00");
72 TEST(FlStandardMessageCodecTest, EncodeNull) {
75 EXPECT_STREQ(hex_string,
"00");
78 TEST(FlStandardMessageCodecTest, DecodeNull) {
82 g_autoptr(GBytes) data = g_bytes_new(
nullptr, 0);
83 g_autoptr(GError)
error =
nullptr;
87 EXPECT_FALSE(
value ==
nullptr);
96 TEST(FlStandardMessageCodecTest, EncodeBoolFalse) {
98 EXPECT_STREQ(hex_string,
"02");
101 TEST(FlStandardMessageCodecTest, EncodeBoolTrue) {
103 EXPECT_STREQ(hex_string,
"01");
111 TEST(FlStandardMessageCodecTest, EncodeIntZero) {
113 EXPECT_STREQ(hex_string,
"0300000000");
116 TEST(FlStandardMessageCodecTest, EncodeIntOne) {
118 EXPECT_STREQ(hex_string,
"0301000000");
121 TEST(FlStandardMessageCodecTest, EncodeInt32) {
122 g_autofree gchar* hex_string =
encode_int(0x01234567);
123 EXPECT_STREQ(hex_string,
"0367452301");
126 TEST(FlStandardMessageCodecTest, EncodeInt32Min) {
127 g_autofree gchar* hex_string =
encode_int(G_MININT32);
128 EXPECT_STREQ(hex_string,
"0300000080");
131 TEST(FlStandardMessageCodecTest, EncodeInt32Max) {
132 g_autofree gchar* hex_string =
encode_int(G_MAXINT32);
133 EXPECT_STREQ(hex_string,
"03ffffff7f");
136 TEST(FlStandardMessageCodecTest, EncodeInt64) {
137 g_autofree gchar* hex_string =
encode_int(0x0123456789abcdef);
138 EXPECT_STREQ(hex_string,
"04efcdab8967452301");
141 TEST(FlStandardMessageCodecTest, EncodeInt64Min) {
142 g_autofree gchar* hex_string =
encode_int(G_MININT64);
143 EXPECT_STREQ(hex_string,
"040000000000000080");
146 TEST(FlStandardMessageCodecTest, EncodeInt64Max) {
147 g_autofree gchar* hex_string =
encode_int(G_MAXINT64);
148 EXPECT_STREQ(hex_string,
"04ffffffffffffff7f");
151 TEST(FlStandardMessageCodecTest, DecodeIntZero) {
157 TEST(FlStandardMessageCodecTest, DecodeIntOne) {
163 TEST(FlStandardMessageCodecTest, DecodeInt32) {
169 TEST(FlStandardMessageCodecTest, DecodeInt32Min) {
175 TEST(FlStandardMessageCodecTest, DecodeInt32Max) {
181 TEST(FlStandardMessageCodecTest, DecodeInt64) {
187 TEST(FlStandardMessageCodecTest, DecodeInt64Min) {
193 TEST(FlStandardMessageCodecTest, DecodeInt64Max) {
199 TEST(FlStandardMessageCodecTest, DecodeInt32NoData) {
204 TEST(FlStandardMessageCodecTest, DecodeIntShortData1) {
209 TEST(FlStandardMessageCodecTest, DecodeIntShortData2) {
214 TEST(FlStandardMessageCodecTest, DecodeInt64NoData) {
219 TEST(FlStandardMessageCodecTest, DecodeInt64ShortData1) {
224 TEST(FlStandardMessageCodecTest, DecodeInt64ShortData2) {
234 TEST(FlStandardMessageCodecTest, EncodeFloatZero) {
236 EXPECT_STREQ(hex_string,
"06000000000000000000000000000000");
239 TEST(FlStandardMessageCodecTest, EncodeFloatOne) {
241 EXPECT_STREQ(hex_string,
"0600000000000000000000000000f03f");
244 TEST(FlStandardMessageCodecTest, EncodeFloatMinusOne) {
246 EXPECT_STREQ(hex_string,
"0600000000000000000000000000f0bf");
249 TEST(FlStandardMessageCodecTest, EncodeFloatHalf) {
251 EXPECT_STREQ(hex_string,
"0600000000000000000000000000e03f");
254 TEST(FlStandardMessageCodecTest, EncodeFloatFraction) {
256 EXPECT_STREQ(hex_string,
"0600000000000000182d4454fb210940");
259 TEST(FlStandardMessageCodecTest, EncodeFloatMinusZero) {
261 EXPECT_STREQ(hex_string,
"06000000000000000000000000000080");
264 TEST(FlStandardMessageCodecTest, EncodeFloatNaN) {
266 EXPECT_STREQ(hex_string,
"0600000000000000000000000000f87f");
269 TEST(FlStandardMessageCodecTest, EncodeFloatInfinity) {
271 EXPECT_STREQ(hex_string,
"0600000000000000000000000000f07f");
274 TEST(FlStandardMessageCodecTest, DecodeFloatZero) {
280 TEST(FlStandardMessageCodecTest, DecodeFloatOne) {
286 TEST(FlStandardMessageCodecTest, DecodeFloatMinusOne) {
292 TEST(FlStandardMessageCodecTest, DecodeFloatHalf) {
298 TEST(FlStandardMessageCodecTest, DecodeFloatPi) {
304 TEST(FlStandardMessageCodecTest, DecodeFloatMinusZero) {
310 TEST(FlStandardMessageCodecTest, DecodeFloatNaN) {
316 TEST(FlStandardMessageCodecTest, DecodeFloatInfinity) {
322 TEST(FlStandardMessageCodecTest, DecodeFloatNoData) {
327 TEST(FlStandardMessageCodecTest, DecodeFloatShortData1) {
332 TEST(FlStandardMessageCodecTest, DecodeFloatShortData2) {
342 TEST(FlStandardMessageCodecTest, EncodeStringEmpty) {
344 EXPECT_STREQ(hex_string,
"0700");
347 TEST(FlStandardMessageCodecTest, EncodeStringHello) {
349 EXPECT_STREQ(hex_string,
"070568656c6c6f");
352 TEST(FlStandardMessageCodecTest, EncodeStringEmptySized) {
355 EXPECT_STREQ(hex_string,
"0700");
358 TEST(FlStandardMessageCodecTest, EncodeStringHelloSized) {
361 EXPECT_STREQ(hex_string,
"070548656c6c6f");
364 TEST(FlStandardMessageCodecTest, DecodeStringEmpty) {
370 TEST(FlStandardMessageCodecTest, DecodeStringHello) {
376 TEST(FlStandardMessageCodecTest, DecodeStringNoData) {
381 TEST(FlStandardMessageCodecTest, DecodeStringLengthNoData) {
386 TEST(FlStandardMessageCodecTest, DecodeStringShortData1) {
391 TEST(FlStandardMessageCodecTest, DecodeStringShortData2) {
396 TEST(FlStandardMessageCodecTest, EncodeUint8ListEmpty) {
399 EXPECT_STREQ(hex_string,
"0800");
402 TEST(FlStandardMessageCodecTest, EncodeUint8List) {
403 uint8_t data[] = {0, 1, 2, 3, 4};
406 EXPECT_STREQ(hex_string,
"08050001020304");
409 TEST(FlStandardMessageCodecTest, DecodeUint8ListEmpty) {
415 TEST(FlStandardMessageCodecTest, DecodeUint8List) {
420 EXPECT_EQ(data[0], 0);
421 EXPECT_EQ(data[1], 1);
422 EXPECT_EQ(data[2], 2);
423 EXPECT_EQ(data[3], 3);
424 EXPECT_EQ(data[4], 4);
427 TEST(FlStandardMessageCodecTest, DecodeUint8ListNoData) {
432 TEST(FlStandardMessageCodecTest, DecodeUint8ListLengthNoData) {
437 TEST(FlStandardMessageCodecTest, DecodeUint8ListShortData1) {
442 TEST(FlStandardMessageCodecTest, DecodeUint8ListShortData2) {
447 TEST(FlStandardMessageCodecTest, EncodeInt32ListEmpty) {
450 EXPECT_STREQ(hex_string,
"09000000");
453 TEST(FlStandardMessageCodecTest, EncodeInt32List) {
454 int32_t data[] = {0, -1, 2, -3, 4};
457 EXPECT_STREQ(hex_string,
"0905000000000000ffffffff02000000fdffffff04000000");
460 TEST(FlStandardMessageCodecTest, DecodeInt32ListEmpty) {
466 TEST(FlStandardMessageCodecTest, DecodeInt32List) {
468 decode_message(
"0905000000000000ffffffff02000000fdffffff04000000");
471 EXPECT_EQ(data[0], 0);
472 EXPECT_EQ(data[1], -1);
473 EXPECT_EQ(data[2], 2);
474 EXPECT_EQ(data[3], -3);
475 EXPECT_EQ(data[4], 4);
478 TEST(FlStandardMessageCodecTest, DecodeInt32ListNoData) {
483 TEST(FlStandardMessageCodecTest, DecodeInt32ListLengthNoData) {
488 TEST(FlStandardMessageCodecTest, DecodeInt32ListShortData1) {
493 TEST(FlStandardMessageCodecTest, DecodeInt32ListShortData2) {
499 TEST(FlStandardMessageCodecTest, EncodeInt64ListEmpty) {
502 EXPECT_STREQ(hex_string,
"0a00000000000000");
505 TEST(FlStandardMessageCodecTest, EncodeInt64List) {
506 int64_t data[] = {0, -1, 2, -3, 4};
511 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
512 "ffffffff0400000000000000");
515 TEST(FlStandardMessageCodecTest, DecodeInt64ListEmpty) {
521 TEST(FlStandardMessageCodecTest, DecodeInt64List) {
523 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
524 "ffffffff0400000000000000");
527 EXPECT_EQ(data[0], 0);
528 EXPECT_EQ(data[1], -1);
529 EXPECT_EQ(data[2], 2);
530 EXPECT_EQ(data[3], -3);
531 EXPECT_EQ(data[4], 4);
534 TEST(FlStandardMessageCodecTest, DecodeInt64ListNoData) {
539 TEST(FlStandardMessageCodecTest, DecodeInt64ListLengthNoData) {
544 TEST(FlStandardMessageCodecTest, DecodeInt64ListShortData1) {
549 TEST(FlStandardMessageCodecTest, DecodeInt64ListShortData2) {
551 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
557 TEST(FlStandardMessageCodecTest, EncodeFloat32ListEmpty) {
560 EXPECT_STREQ(hex_string,
"0e000000");
563 TEST(FlStandardMessageCodecTest, EncodeFloat32List) {
564 float data[] = {0.0f, -0.5f, 0.25f, -0.125f, 0.00625f};
567 EXPECT_STREQ(hex_string,
"0e05000000000000000000bf0000803e000000becdcccc3b");
570 TEST(FlStandardMessageCodecTest, DecodeFloat32ListEmpty) {
576 TEST(FlStandardMessageCodecTest, DecodeFloat32List) {
578 decode_message(
"0e05000000000000000000bf0000803e000000becdcccc3b");
581 EXPECT_FLOAT_EQ(data[0], 0.0f);
582 EXPECT_FLOAT_EQ(data[1], -0.5f);
583 EXPECT_FLOAT_EQ(data[2], 0.25f);
584 EXPECT_FLOAT_EQ(data[3], -0.125f);
585 EXPECT_FLOAT_EQ(data[4], 0.00625f);
588 TEST(FlStandardMessageCodecTest, DecodeFloat32ListNoData) {
593 TEST(FlStandardMessageCodecTest, DecodeFloat32ListLengthNoData) {
598 TEST(FlStandardMessageCodecTest, DecodeFloat32ListShortData1) {
603 TEST(FlStandardMessageCodecTest, DecodeFloat32ListShortData2) {
609 TEST(FlStandardMessageCodecTest, EncodeFloatListEmpty) {
612 EXPECT_STREQ(hex_string,
"0b00000000000000");
615 TEST(FlStandardMessageCodecTest, EncodeFloatList) {
616 double data[] = {0, -0.5, 0.25, -0.125, 0.00625};
621 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
622 "0000c0bf9a9999999999793f");
625 TEST(FlStandardMessageCodecTest, DecodeFloatListEmpty) {
631 TEST(FlStandardMessageCodecTest, DecodeFloatList) {
633 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
634 "0000c0bf9a9999999999793f");
637 EXPECT_FLOAT_EQ(data[0], 0.0);
638 EXPECT_FLOAT_EQ(data[1], -0.5);
639 EXPECT_FLOAT_EQ(data[2], 0.25);
640 EXPECT_FLOAT_EQ(data[3], -0.125);
641 EXPECT_FLOAT_EQ(data[4], 0.00625);
644 TEST(FlStandardMessageCodecTest, DecodeFloatListNoData) {
649 TEST(FlStandardMessageCodecTest, DecodeFloatListLengthNoData) {
654 TEST(FlStandardMessageCodecTest, DecodeFloatListShortData1) {
659 TEST(FlStandardMessageCodecTest, DecodeFloatListShortData2) {
661 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
667 TEST(FlStandardMessageCodecTest, EncodeListEmpty) {
670 EXPECT_STREQ(hex_string,
"0c00");
673 TEST(FlStandardMessageCodecTest, EncodeListTypes) {
685 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
688 TEST(FlStandardMessageCodecTest, EncodeListNested) {
691 for (
int i = 0;
i < 10;
i++) {
702 EXPECT_STREQ(hex_string,
703 "0c020c05030000000003020000000304000000030600000003080000000c"
704 "0503010000000303000000030500000003070000000309000000");
707 TEST(FlStandardMessageCodecTest, DecodeListEmpty) {
713 TEST(FlStandardMessageCodecTest, DecodeListTypes) {
715 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
735 static_cast<size_t>(0));
739 static_cast<size_t>(0));
742 TEST(FlStandardMessageCodecTest, DecodeListNested) {
744 "0c020c05030000000003020000000304000000030600000003080000000c"
745 "0503010000000303000000030500000003070000000309000000");
754 for (
int i = 0;
i < 5;
i++) {
765 TEST(FlStandardMessageCodecTest, DecodeListNoData) {
770 TEST(FlStandardMessageCodecTest, DecodeListLengthNoData) {
775 TEST(FlStandardMessageCodecTest, DecodeListShortData1) {
780 TEST(FlStandardMessageCodecTest, DecodeListShortData2) {
782 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d",
786 TEST(FlStandardMessageCodecTest, EncodeDecodeLargeList) {
790 for (
int i = 0;
i < 65535;
i++) {
794 g_autoptr(GError)
error =
nullptr;
795 g_autoptr(GBytes) message =
797 EXPECT_NE(message,
nullptr);
798 EXPECT_EQ(
error,
nullptr);
800 g_autoptr(
FlValue) decoded_value =
802 EXPECT_EQ(
error,
nullptr);
803 EXPECT_NE(
value,
nullptr);
808 TEST(FlStandardMessageCodecTest, EncodeMapEmpty) {
811 EXPECT_STREQ(hex_string,
"0d00");
814 TEST(FlStandardMessageCodecTest, EncodeMapKeyTypes) {
827 EXPECT_STREQ(hex_string,
828 "0d070007046e756c6c010704626f6f6c032a0000000703696e7406000000000"
829 "0182d4454fb2109400705666c6f6174070568656c6c6f0706737472696e670c"
830 "0007046c6973740d0007036d6170");
833 TEST(FlStandardMessageCodecTest, EncodeMapValueTypes) {
846 EXPECT_STREQ(hex_string,
847 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6"
848 "17406000000000000182d4454fb2109400706737472696e67070568656c6c6f"
849 "07046c6973740c0007036d61700d00");
852 TEST(FlStandardMessageCodecTest, EncodeMapNested) {
855 const char* numbers[] = {
"zero",
"one",
"two",
"three",
nullptr};
856 for (
int i = 0; numbers[
i] !=
nullptr;
i++) {
866 EXPECT_STREQ(hex_string,
867 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6"
868 "50301000000070374776f0302000000070574687265650303000000070a696e"
869 "742d746f2d7374720d04030000000007047a65726f030100000007036f6e650"
870 "302000000070374776f030300000007057468726565");
873 TEST(FlStandardMessageCodecTest, DecodeMapEmpty) {
879 TEST(FlStandardMessageCodecTest, DecodeMapKeyTypes) {
881 "0d070007046e756c6c010704626f6f6c032a0000000703696e74060000000000182d4454"
882 "fb2109400705666c6f6174070568656c6c6f0706737472696e670c0007046c6973740d00"
924 static_cast<size_t>(0));
932 static_cast<size_t>(0));
938 TEST(FlStandardMessageCodecTest, DecodeMapValueTypes) {
940 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
941 "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
986 static_cast<size_t>(0));
994 static_cast<size_t>(0));
997 TEST(FlStandardMessageCodecTest, DecodeMapNested) {
999 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6503010000"
1000 "00070374776f0302000000070574687265650303000000070a696e742d746f2d7374720d"
1001 "04030000000007047a65726f030100000007036f6e650302000000070374776f03030000"
1002 "0007057468726565");
1022 const char* numbers[] = {
"zero",
"one",
"two",
"three",
nullptr};
1023 for (
int i = 0; numbers[
i] !=
nullptr;
i++) {
1044 TEST(FlStandardMessageCodecTest, DecodeMapNoData) {
1049 TEST(FlStandardMessageCodecTest, DecodeMapLengthNoData) {
1054 TEST(FlStandardMessageCodecTest, DecodeMapShortData1) {
1059 TEST(FlStandardMessageCodecTest, DecodeMapShortData2) {
1061 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
1062 "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
1067 TEST(FlStandardMessageCodecTest, EncodeDecodeLargeMap) {
1071 for (
int i = 0;
i < 512;
i++) {
1072 g_autofree gchar* key = g_strdup_printf(
"key%d",
i);
1076 g_autoptr(GError)
error =
nullptr;
1077 g_autoptr(GBytes) message =
1079 EXPECT_NE(message,
nullptr);
1080 EXPECT_EQ(
error,
nullptr);
1082 g_autoptr(
FlValue) decoded_value =
1084 EXPECT_EQ(
error,
nullptr);
1085 EXPECT_NE(
value,
nullptr);
1090 TEST(FlStandardMessageCodecTest, DecodeUnknownType) {
1096 fl_test_standard_message_codec,
1098 TEST_STANDARD_MESSAGE_CODEC,
1099 FlStandardMessageCodec)
1101 struct _FlTestStandardMessageCodec {
1102 FlStandardMessageCodec parent_instance;
1106 fl_test_standard_message_codec,
1107 fl_standard_message_codec_get_type())
1109 static gboolean write_custom_value1(FlStandardMessageCodec* codec,
1134 FlStandardMessageCodec* codec,
1145 return FL_STANDARD_MESSAGE_CODEC_CLASS(
1146 fl_test_standard_message_codec_parent_class)
1167 g_strndup(
static_cast<const gchar*
>(g_bytes_get_data(
buffer,
nullptr)) +
1184 FlStandardMessageCodec* codec,
1191 }
else if (
type == 129) {
1194 return FL_STANDARD_MESSAGE_CODEC_CLASS(
1195 fl_test_standard_message_codec_parent_class)
1201 FlTestStandardMessageCodecClass* klass) {
1202 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->write_value =
1204 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->read_value_of_type =
1209 FlTestStandardMessageCodec*
self) {
1211 FL_IS_TEST_STANDARD_MESSAGE_CODEC(
self);
1215 return FL_TEST_STANDARD_MESSAGE_CODEC(
1216 g_object_new(fl_test_standard_message_codec_get_type(),
nullptr));
1219 TEST(FlStandardMessageCodecTest, DecodeCustomType) {
1220 g_autoptr(FlTestStandardMessageCodec) codec =
1230 TEST(FlStandardMessageCodecTest, DecodeCustomTypes) {
1231 g_autoptr(FlTestStandardMessageCodec) codec =
1234 FL_MESSAGE_CODEC(codec));
1247 TEST(FlStandardMessageCodecTest, EncodeCustomType) {
1249 g_autoptr(FlTestStandardMessageCodec) codec =
1251 g_autofree gchar* hex_string =
1253 EXPECT_STREQ(hex_string,
"800568656c6c6f");
1256 TEST(FlStandardMessageCodecTest, EncodeCustomTypes) {
1260 g_autoptr(FlTestStandardMessageCodec) codec =
1262 g_autofree gchar* hex_string =
1264 EXPECT_STREQ(hex_string,
"0c02800568656c6c6f81");
1267 TEST(FlStandardMessageCodecTest, EncodeDecode) {
1279 g_autoptr(GError)
error =
nullptr;
1280 g_autoptr(GBytes) message =
1282 EXPECT_NE(message,
nullptr);
1283 EXPECT_EQ(
error,
nullptr);
1287 EXPECT_EQ(
error,
nullptr);
1288 EXPECT_NE(output,
nullptr);
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
#define FL_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
static gchar * encode_message_with_codec(FlValue *value, FlMessageCodec *codec)
static gchar * encode_string(const gchar *value)
static void decode_error_value(const char *hex_string, GQuark domain, gint code)
static gchar * encode_message(FlValue *value)
G_DECLARE_FINAL_TYPE(FlTestStandardMessageCodec, fl_test_standard_message_codec, FL, TEST_STANDARD_MESSAGE_CODEC, FlStandardMessageCodec) struct _FlTestStandardMessageCodec
static gchar * encode_float(double value)
static void fl_test_standard_message_codec_class_init(FlTestStandardMessageCodecClass *klass)
fl_standard_message_codec_write_size(codec, buffer, length)
static FlValue * read_custom_value2(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
static FlValue * read_custom_value1(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
static gchar * encode_bool(gboolean value)
static FlTestStandardMessageCodec * fl_test_standard_message_codec_new()
static FlValue * decode_message_with_codec(const char *hex_string, FlMessageCodec *codec)
GByteArray FlValue GError ** error
static gchar * encode_int(int64_t value)
static gboolean fl_test_standard_message_codec_write_value(FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
GByteArray FlValue * value
static FlValue * fl_test_standard_message_codec_read_value_of_type(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, int type, GError **error)
G_DEFINE_TYPE(FlTestStandardMessageCodec, fl_test_standard_message_codec, fl_standard_message_codec_get_type()) static gboolean write_custom_value1(FlStandardMessageCodec *codec
TEST(FlStandardMessageCodecTest, EncodeNullptr)
g_byte_array_append(buffer, &type, sizeof(uint8_t))
static FlValue * decode_message(const char *hex_string)
static gboolean write_custom_value2(FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
static void fl_test_standard_message_codec_init(FlTestStandardMessageCodec *self)
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_custom(int type, gconstpointer value, GDestroyNotify destroy_notify)
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
G_MODULE_EXPORT const float * fl_value_get_float32_list(FlValue *self)
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
G_MODULE_EXPORT int fl_value_get_custom_type(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_list()
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
G_MODULE_EXPORT gconstpointer fl_value_get_custom_value(FlValue *self)
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
G_MODULE_EXPORT FlValue * fl_value_new_null()
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
typedefG_BEGIN_DECLS struct _FlValue FlValue
@ FL_VALUE_TYPE_FLOAT32_LIST
@ FL_VALUE_TYPE_INT32_LIST
@ FL_VALUE_TYPE_UINT8_LIST
@ FL_VALUE_TYPE_INT64_LIST
@ FL_VALUE_TYPE_FLOAT_LIST