| Flutter Linux Embedder |

Functions
fl_standard_message_codec_test.cc File Reference
`#include "flutter/shell/platform/linux/public/flutter_linux/fl_standard_message_codec.h"`
`#include "flutter/shell/platform/linux/testing/fl_test.h"`
`#include "gtest/gtest.h"`

Go to the source code of this file.

## Functions
static gchar * | encode_message (FlValue *value)
static FlValue * | decode_message (const char *hex_string)
static void | decode_error_value (const char *hex_string, GQuark domain, gint code)
| TEST (FlStandardMessageCodecTest, EncodeNullptr)
| TEST (FlStandardMessageCodecTest, EncodeNull)
| TEST (FlStandardMessageCodecTest, DecodeNull)
static gchar * | encode_bool (gboolean value)
| TEST (FlStandardMessageCodecTest, EncodeBoolFalse)
| TEST (FlStandardMessageCodecTest, EncodeBoolTrue)
static gchar * | encode_int (int64_t value)
| TEST (FlStandardMessageCodecTest, EncodeIntZero)
| TEST (FlStandardMessageCodecTest, EncodeIntOne)
| TEST (FlStandardMessageCodecTest, EncodeInt32)
| TEST (FlStandardMessageCodecTest, EncodeInt32Min)
| TEST (FlStandardMessageCodecTest, EncodeInt32Max)
| TEST (FlStandardMessageCodecTest, EncodeInt64)
| TEST (FlStandardMessageCodecTest, EncodeInt64Min)
| TEST (FlStandardMessageCodecTest, EncodeInt64Max)
| TEST (FlStandardMessageCodecTest, DecodeIntZero)
| TEST (FlStandardMessageCodecTest, DecodeIntOne)
| TEST (FlStandardMessageCodecTest, DecodeInt32)
| TEST (FlStandardMessageCodecTest, DecodeInt32Min)
| TEST (FlStandardMessageCodecTest, DecodeInt32Max)
| TEST (FlStandardMessageCodecTest, DecodeInt64)
| TEST (FlStandardMessageCodecTest, DecodeInt64Min)
| TEST (FlStandardMessageCodecTest, DecodeInt64Max)
| TEST (FlStandardMessageCodecTest, DecodeInt32NoData)
| TEST (FlStandardMessageCodecTest, DecodeIntShortData1)
| TEST (FlStandardMessageCodecTest, DecodeIntShortData2)
| TEST (FlStandardMessageCodecTest, DecodeInt64NoData)
| TEST (FlStandardMessageCodecTest, DecodeInt64ShortData1)
| TEST (FlStandardMessageCodecTest, DecodeInt64ShortData2)
static gchar * | encode_float (double value)
| TEST (FlStandardMessageCodecTest, EncodeFloatZero)
| TEST (FlStandardMessageCodecTest, EncodeFloatOne)
| TEST (FlStandardMessageCodecTest, EncodeFloatMinusOne)
| TEST (FlStandardMessageCodecTest, EncodeFloatHalf)
| TEST (FlStandardMessageCodecTest, EncodeFloatFraction)
| TEST (FlStandardMessageCodecTest, EncodeFloatMinusZero)
| TEST (FlStandardMessageCodecTest, EncodeFloatNaN)
| TEST (FlStandardMessageCodecTest, EncodeFloatInfinity)
| TEST (FlStandardMessageCodecTest, DecodeFloatZero)
| TEST (FlStandardMessageCodecTest, DecodeFloatOne)
| TEST (FlStandardMessageCodecTest, DecodeFloatMinusOne)
| TEST (FlStandardMessageCodecTest, DecodeFloatHalf)
| TEST (FlStandardMessageCodecTest, DecodeFloatPi)
| TEST (FlStandardMessageCodecTest, DecodeFloatMinusZero)
| TEST (FlStandardMessageCodecTest, DecodeFloatNaN)
| TEST (FlStandardMessageCodecTest, DecodeFloatInfinity)
| TEST (FlStandardMessageCodecTest, DecodeFloatNoData)
| TEST (FlStandardMessageCodecTest, DecodeFloatShortData1)
| TEST (FlStandardMessageCodecTest, DecodeFloatShortData2)
static gchar * | encode_string (const gchar *value)
| TEST (FlStandardMessageCodecTest, EncodeStringEmpty)
| TEST (FlStandardMessageCodecTest, EncodeStringHello)
| TEST (FlStandardMessageCodecTest, EncodeStringEmptySized)
| TEST (FlStandardMessageCodecTest, EncodeStringHelloSized)
| TEST (FlStandardMessageCodecTest, DecodeStringEmpty)
| TEST (FlStandardMessageCodecTest, DecodeStringHello)
| TEST (FlStandardMessageCodecTest, DecodeStringNoData)
| TEST (FlStandardMessageCodecTest, DecodeStringLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeStringShortData1)
| TEST (FlStandardMessageCodecTest, DecodeStringShortData2)
| TEST (FlStandardMessageCodecTest, EncodeUint8ListEmpty)
| TEST (FlStandardMessageCodecTest, EncodeUint8List)
| TEST (FlStandardMessageCodecTest, DecodeUint8ListEmpty)
| TEST (FlStandardMessageCodecTest, DecodeUint8List)
| TEST (FlStandardMessageCodecTest, DecodeUint8ListNoData)
| TEST (FlStandardMessageCodecTest, DecodeUint8ListLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeUint8ListShortData1)
| TEST (FlStandardMessageCodecTest, DecodeUint8ListShortData2)
| TEST (FlStandardMessageCodecTest, EncodeInt32ListEmpty)
| TEST (FlStandardMessageCodecTest, EncodeInt32List)
| TEST (FlStandardMessageCodecTest, DecodeInt32ListEmpty)
| TEST (FlStandardMessageCodecTest, DecodeInt32List)
| TEST (FlStandardMessageCodecTest, DecodeInt32ListNoData)
| TEST (FlStandardMessageCodecTest, DecodeInt32ListLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeInt32ListShortData1)
| TEST (FlStandardMessageCodecTest, DecodeInt32ListShortData2)
| TEST (FlStandardMessageCodecTest, EncodeInt64ListEmpty)
| TEST (FlStandardMessageCodecTest, EncodeInt64List)
| TEST (FlStandardMessageCodecTest, DecodeInt64ListEmpty)
| TEST (FlStandardMessageCodecTest, DecodeInt64List)
| TEST (FlStandardMessageCodecTest, DecodeInt64ListNoData)
| TEST (FlStandardMessageCodecTest, DecodeInt64ListLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeInt64ListShortData1)
| TEST (FlStandardMessageCodecTest, DecodeInt64ListShortData2)
| TEST (FlStandardMessageCodecTest, EncodeFloat32ListEmpty)
| TEST (FlStandardMessageCodecTest, EncodeFloat32List)
| TEST (FlStandardMessageCodecTest, DecodeFloat32ListEmpty)
| TEST (FlStandardMessageCodecTest, DecodeFloat32List)
| TEST (FlStandardMessageCodecTest, DecodeFloat32ListNoData)
| TEST (FlStandardMessageCodecTest, DecodeFloat32ListLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeFloat32ListShortData1)
| TEST (FlStandardMessageCodecTest, DecodeFloat32ListShortData2)
| TEST (FlStandardMessageCodecTest, EncodeFloatListEmpty)
| TEST (FlStandardMessageCodecTest, EncodeFloatList)
| TEST (FlStandardMessageCodecTest, DecodeFloatListEmpty)
| TEST (FlStandardMessageCodecTest, DecodeFloatList)
| TEST (FlStandardMessageCodecTest, DecodeFloatListNoData)
| TEST (FlStandardMessageCodecTest, DecodeFloatListLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeFloatListShortData1)
| TEST (FlStandardMessageCodecTest, DecodeFloatListShortData2)
| TEST (FlStandardMessageCodecTest, EncodeListEmpty)
| TEST (FlStandardMessageCodecTest, EncodeListTypes)
| TEST (FlStandardMessageCodecTest, EncodeListNested)
| TEST (FlStandardMessageCodecTest, DecodeListEmpty)
| TEST (FlStandardMessageCodecTest, DecodeListTypes)
| TEST (FlStandardMessageCodecTest, DecodeListNested)
| TEST (FlStandardMessageCodecTest, DecodeListNoData)
| TEST (FlStandardMessageCodecTest, DecodeListLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeListShortData1)
| TEST (FlStandardMessageCodecTest, DecodeListShortData2)
| TEST (FlStandardMessageCodecTest, EncodeDecodeLargeList)
| TEST (FlStandardMessageCodecTest, EncodeMapEmpty)
| TEST (FlStandardMessageCodecTest, EncodeMapKeyTypes)
| TEST (FlStandardMessageCodecTest, EncodeMapValueTypes)
| TEST (FlStandardMessageCodecTest, EncodeMapNested)
| TEST (FlStandardMessageCodecTest, DecodeMapEmpty)
| TEST (FlStandardMessageCodecTest, DecodeMapKeyTypes)
| TEST (FlStandardMessageCodecTest, DecodeMapValueTypes)
| TEST (FlStandardMessageCodecTest, DecodeMapNested)
| TEST (FlStandardMessageCodecTest, DecodeMapNoData)
| TEST (FlStandardMessageCodecTest, DecodeMapLengthNoData)
| TEST (FlStandardMessageCodecTest, DecodeMapShortData1)
| TEST (FlStandardMessageCodecTest, DecodeMapShortData2)
| TEST (FlStandardMessageCodecTest, EncodeDecodeLargeMap)
| TEST (FlStandardMessageCodecTest, DecodeUnknownType)
| TEST (FlStandardMessageCodecTest, EncodeDecode)

## Function Documentation

## ◆ decode_error_value()

static void decode_error_value | ( | const char * | hex_string,
|  | GQuark | domain,
|  | gint | code
| ) |  |
| static

Definition at line 40 of file fl_standard_message_codec_test.cc.

42 {
43 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
44 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
45 g_autoptr(GError) error = nullptr;
46 g_autoptr(FlValue) value =
47 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
48 EXPECT_TRUE(value == nullptr);
49 EXPECT_TRUE(g_error_matches(error, domain, code));
50 }

References error, fl_message_codec_decode_message(), fl_standard_message_codec_new(), and value.

Referenced by TEST().

## ◆ decode_message()

static FlValue* decode_message | ( | const char * | hex_string | ) |
| static

Definition at line 27 of file fl_standard_message_codec_test.cc.

27 {
28 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
29 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
30 g_autoptr(GError) error = nullptr;
31 g_autoptr(FlValue) value =
32 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
33 EXPECT_EQ(error, nullptr);
34 EXPECT_NE(value, nullptr);
35 return fl_value_ref(value);
36 }

References error, fl_message_codec_decode_message(), fl_standard_message_codec_new(), fl_value_ref(), and value.

Referenced by TEST().

## ◆ encode_bool()

static gchar* encode_bool | ( | gboolean | value | ) |
| static

Definition at line 76 of file fl_standard_message_codec_test.cc.

76 {
77 g_autoptr(FlValue) v = fl_value_new_bool(value);
78 return encode_message(v);
79 }

References encode_message(), fl_value_new_bool(), and value.

Referenced by TEST().

## ◆ encode_float()

static gchar* encode_float | ( | double | value | ) |
| static

Definition at line 214 of file fl_standard_message_codec_test.cc.

214 {
215 g_autoptr(FlValue) v = fl_value_new_float(value);
216 return encode_message(v);
217 }

References encode_message(), fl_value_new_float(), and value.

Referenced by TEST().

## ◆ encode_int()

static gchar* encode_int | ( | int64_t | value | ) |
| static

Definition at line 91 of file fl_standard_message_codec_test.cc.

91 {
92 g_autoptr(FlValue) v = fl_value_new_int(value);
93 return encode_message(v);
94 }

References encode_message(), fl_value_new_int(), and value.

Referenced by TEST().

## ◆ encode_message()

static gchar* encode_message | ( | FlValue * | value | ) |
| static

Definition at line 14 of file fl_standard_message_codec_test.cc.

14 {
15 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
16 g_autoptr(GError) error = nullptr;
17 g_autoptr(GBytes) message =
18 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
19 EXPECT_NE(message, nullptr);
20 EXPECT_EQ(error, nullptr);
21
22 return bytes_to_hex_string(message);
23 }

References error, fl_message_codec_encode_message(), fl_standard_message_codec_new(), and value.

Referenced by encode_bool(), encode_float(), encode_int(), encode_string(), and TEST().

## ◆ encode_string()

static gchar* encode_string | ( | const gchar * | value | ) |
| static

Definition at line 322 of file fl_standard_message_codec_test.cc.

322 {
323 g_autoptr(FlValue) v = fl_value_new_string(value);
324 return encode_message(v);
325 }

References encode_message(), fl_value_new_string(), and value.

Referenced by TEST().

## ◆ TEST() [1/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloat32List |
| ) |  |

Definition at line 561 of file fl_standard_message_codec_test.cc.

561 {
562 g_autoptr(FlValue) value =
563 decode_message("0e05000000000000000000bf0000803e000000becdcccc3b");
564 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT32_LIST);
565 const float* data = fl_value_get_float32_list(value);
566 EXPECT_FLOAT_EQ(data[0], 0.0f);
567 EXPECT_FLOAT_EQ(data[1], -0.5f);
568 EXPECT_FLOAT_EQ(data[2], 0.25f);
569 EXPECT_FLOAT_EQ(data[3], -0.125f);
570 EXPECT_FLOAT_EQ(data[4], 0.00625f);
571 }

References decode_message(), fl_value_get_float32_list(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT32_LIST, and value.

## ◆ TEST() [2/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloat32ListEmpty |
| ) |  |

Definition at line 555 of file fl_standard_message_codec_test.cc.

555 {
556 g_autoptr(FlValue) value = decode_message("0e000000");
557 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT32_LIST);
558 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
559 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT32_LIST, and value.

## ◆ TEST() [3/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloat32ListLengthNoData |
| ) |  |

Definition at line 578 of file fl_standard_message_codec_test.cc.

578 {
579 decode_error_value("0e050000", FL_MESSAGE_CODEC_ERROR,
580 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
581 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [4/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloat32ListNoData |
| ) |  |

Definition at line 573 of file fl_standard_message_codec_test.cc.

573 {
574 decode_error_value("0e", FL_MESSAGE_CODEC_ERROR,
575 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
576 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [5/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloat32ListShortData1 |
| ) |  |

Definition at line 583 of file fl_standard_message_codec_test.cc.

583 {
584 decode_error_value("0e05000000", FL_MESSAGE_CODEC_ERROR,
585 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
586 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [6/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloat32ListShortData2 |
| ) |  |

Definition at line 588 of file fl_standard_message_codec_test.cc.

588 {
589 decode_error_value("0e05000000000000000000bf0000803e000000becdcccc",
590 FL_MESSAGE_CODEC_ERROR,
591 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
592 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [7/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatHalf |
| ) |  |

Definition at line 277 of file fl_standard_message_codec_test.cc.

277 {
278 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000e03f");
279 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
280 EXPECT_EQ(fl_value_get_float(value), 0.5);
281 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [8/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatInfinity |
| ) |  |

Definition at line 301 of file fl_standard_message_codec_test.cc.

301 {
302 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f07f");
303 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
304 EXPECT_TRUE(isinf(fl_value_get_float(value)));
305 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [9/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatList |
| ) |  |

Definition at line 616 of file fl_standard_message_codec_test.cc.

616 {
617 g_autoptr(FlValue) value = decode_message(
618 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
619 "0000c0bf9a9999999999793f");
620 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT_LIST);
621 const double* data = fl_value_get_float_list(value);
622 EXPECT_FLOAT_EQ(data[0], 0.0);
623 EXPECT_FLOAT_EQ(data[1], -0.5);
624 EXPECT_FLOAT_EQ(data[2], 0.25);
625 EXPECT_FLOAT_EQ(data[3], -0.125);
626 EXPECT_FLOAT_EQ(data[4], 0.00625);
627 }

References decode_message(), fl_value_get_float_list(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT_LIST, and value.

## ◆ TEST() [10/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatListEmpty |
| ) |  |

Definition at line 610 of file fl_standard_message_codec_test.cc.

610 {
611 g_autoptr(FlValue) value = decode_message("0b00000000000000");
612 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT_LIST);
613 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
614 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT_LIST, and value.

## ◆ TEST() [11/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatListLengthNoData |
| ) |  |

Definition at line 634 of file fl_standard_message_codec_test.cc.

634 {
635 decode_error_value("0b05000000000000", FL_MESSAGE_CODEC_ERROR,
636 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
637 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [12/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatListNoData |
| ) |  |

Definition at line 629 of file fl_standard_message_codec_test.cc.

629 {
630 decode_error_value("0b", FL_MESSAGE_CODEC_ERROR,
631 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
632 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [13/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatListShortData1 |
| ) |  |

Definition at line 639 of file fl_standard_message_codec_test.cc.

639 {
640 decode_error_value("0b0500000000000000", FL_MESSAGE_CODEC_ERROR,
641 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
642 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [14/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatListShortData2 |
| ) |  |

Definition at line 644 of file fl_standard_message_codec_test.cc.

644 {
645 decode_error_value(
646 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
647 "0000c0bf9a99"
648 "9999999979",
649 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
650 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [15/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatMinusOne |
| ) |  |

Definition at line 271 of file fl_standard_message_codec_test.cc.

271 {
272 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f0bf");
273 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
274 EXPECT_EQ(fl_value_get_float(value), -1.0);
275 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [16/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatMinusZero |
| ) |  |

Definition at line 289 of file fl_standard_message_codec_test.cc.

289 {
290 g_autoptr(FlValue) value = decode_message("06000000000000000000000000000080");
291 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
292 EXPECT_EQ(fl_value_get_float(value), -0.0);
293 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [17/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatNaN |
| ) |  |

Definition at line 295 of file fl_standard_message_codec_test.cc.

295 {
296 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f87f");
297 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
298 EXPECT_TRUE(isnan(fl_value_get_float(value)));
299 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [18/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatNoData |
| ) |  |

Definition at line 307 of file fl_standard_message_codec_test.cc.

307 {
308 decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
309 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
310 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [19/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatOne |
| ) |  |

Definition at line 265 of file fl_standard_message_codec_test.cc.

265 {
266 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f03f");
267 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
268 EXPECT_EQ(fl_value_get_float(value), 1.0);
269 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [20/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatPi |
| ) |  |

Definition at line 283 of file fl_standard_message_codec_test.cc.

283 {
284 g_autoptr(FlValue) value = decode_message("0600000000000000182d4454fb210940");
285 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
286 EXPECT_EQ(fl_value_get_float(value), M_PI);
287 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [21/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatShortData1 |
| ) |  |

Definition at line 312 of file fl_standard_message_codec_test.cc.

312 {
313 decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
314 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
315 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [22/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatShortData2 |
| ) |  |

Definition at line 317 of file fl_standard_message_codec_test.cc.

317 {
318 decode_error_value("060000000000000000000000000000", FL_MESSAGE_CODEC_ERROR,
319 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
320 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [23/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeFloatZero |
| ) |  |

Definition at line 259 of file fl_standard_message_codec_test.cc.

259 {
260 g_autoptr(FlValue) value = decode_message("06000000000000000000000000000000");
261 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
262 EXPECT_EQ(fl_value_get_float(value), 0.0);
263 }

References decode_message(), fl_value_get_float(), fl_value_get_type(), FL_VALUE_TYPE_FLOAT, and value.

## ◆ TEST() [24/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32 |
| ) |  |

Definition at line 148 of file fl_standard_message_codec_test.cc.

148 {
149 g_autoptr(FlValue) value = decode_message("0367452301");
150 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
151 EXPECT_EQ(fl_value_get_int(value), 0x01234567);
152 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [25/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32List |
| ) |  |

Definition at line 451 of file fl_standard_message_codec_test.cc.

451 {
452 g_autoptr(FlValue) value =
453 decode_message("0905000000000000ffffffff02000000fdffffff04000000");
454 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT32_LIST);
455 const int32_t* data = fl_value_get_int32_list(value);
456 EXPECT_EQ(data[0], 0);
457 EXPECT_EQ(data[1], -1);
458 EXPECT_EQ(data[2], 2);
459 EXPECT_EQ(data[3], -3);
460 EXPECT_EQ(data[4], 4);
461 }

References decode_message(), fl_value_get_int32_list(), fl_value_get_type(), FL_VALUE_TYPE_INT32_LIST, and value.

## ◆ TEST() [26/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32ListEmpty |
| ) |  |

Definition at line 445 of file fl_standard_message_codec_test.cc.

445 {
446 g_autoptr(FlValue) value = decode_message("09000000");
447 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT32_LIST);
448 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
449 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_INT32_LIST, and value.

## ◆ TEST() [27/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32ListLengthNoData |
| ) |  |

Definition at line 468 of file fl_standard_message_codec_test.cc.

468 {
469 decode_error_value("09050000", FL_MESSAGE_CODEC_ERROR,
470 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
471 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [28/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32ListNoData |
| ) |  |

Definition at line 463 of file fl_standard_message_codec_test.cc.

463 {
464 decode_error_value("09", FL_MESSAGE_CODEC_ERROR,
465 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
466 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [29/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32ListShortData1 |
| ) |  |

Definition at line 473 of file fl_standard_message_codec_test.cc.

473 {
474 decode_error_value("0905000000", FL_MESSAGE_CODEC_ERROR,
475 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
476 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [30/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32ListShortData2 |
| ) |  |

Definition at line 478 of file fl_standard_message_codec_test.cc.

478 {
479 decode_error_value("090500000000ffffffff02000000fdffffff040000",
480 FL_MESSAGE_CODEC_ERROR,
481 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
482 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [31/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32Max |
| ) |  |

Definition at line 160 of file fl_standard_message_codec_test.cc.

160 {
161 g_autoptr(FlValue) value = decode_message("03ffffff7f");
162 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
163 EXPECT_EQ(fl_value_get_int(value), G_MAXINT32);
164 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [32/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32Min |
| ) |  |

Definition at line 154 of file fl_standard_message_codec_test.cc.

154 {
155 g_autoptr(FlValue) value = decode_message("0300000080");
156 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
157 EXPECT_EQ(fl_value_get_int(value), G_MININT32);
158 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [33/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt32NoData |
| ) |  |

Definition at line 184 of file fl_standard_message_codec_test.cc.

184 {
185 decode_error_value("03", FL_MESSAGE_CODEC_ERROR,
186 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
187 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [34/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64 |
| ) |  |

Definition at line 166 of file fl_standard_message_codec_test.cc.

166 {
167 g_autoptr(FlValue) value = decode_message("04efcdab8967452301");
168 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
169 EXPECT_EQ(fl_value_get_int(value), 0x0123456789abcdef);
170 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [35/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64List |
| ) |  |

Definition at line 506 of file fl_standard_message_codec_test.cc.

506 {
507 g_autoptr(FlValue) value = decode_message(
508 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
509 "ffffffff0400000000000000");
510 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT64_LIST);
511 const int64_t* data = fl_value_get_int64_list(value);
512 EXPECT_EQ(data[0], 0);
513 EXPECT_EQ(data[1], -1);
514 EXPECT_EQ(data[2], 2);
515 EXPECT_EQ(data[3], -3);
516 EXPECT_EQ(data[4], 4);
517 }

References decode_message(), fl_value_get_int64_list(), fl_value_get_type(), FL_VALUE_TYPE_INT64_LIST, and value.

## ◆ TEST() [36/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ListEmpty |
| ) |  |

Definition at line 500 of file fl_standard_message_codec_test.cc.

500 {
501 g_autoptr(FlValue) value = decode_message("0a00000000000000");
502 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT64_LIST);
503 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
504 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_INT64_LIST, and value.

## ◆ TEST() [37/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ListLengthNoData |
| ) |  |

Definition at line 524 of file fl_standard_message_codec_test.cc.

524 {
525 decode_error_value("0a05000000000000", FL_MESSAGE_CODEC_ERROR,
526 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
527 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [38/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ListNoData |
| ) |  |

Definition at line 519 of file fl_standard_message_codec_test.cc.

519 {
520 decode_error_value("0a", FL_MESSAGE_CODEC_ERROR,
521 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
522 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [39/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ListShortData1 |
| ) |  |

Definition at line 529 of file fl_standard_message_codec_test.cc.

529 {
530 decode_error_value("0a0500000000000000", FL_MESSAGE_CODEC_ERROR,
531 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
532 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [40/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ListShortData2 |
| ) |  |

Definition at line 534 of file fl_standard_message_codec_test.cc.

534 {
535 decode_error_value(
536 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
537 "ffffffff0400"
538 "0000000000",
539 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
540 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [41/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64Max |
| ) |  |

Definition at line 178 of file fl_standard_message_codec_test.cc.

178 {
179 g_autoptr(FlValue) value = decode_message("04ffffffffffffff7f");
180 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
181 EXPECT_EQ(fl_value_get_int(value), G_MAXINT64);
182 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [42/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64Min |
| ) |  |

Definition at line 172 of file fl_standard_message_codec_test.cc.

172 {
173 g_autoptr(FlValue) value = decode_message("040000000000000080");
174 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
175 EXPECT_EQ(fl_value_get_int(value), G_MININT64);
176 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [43/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64NoData |
| ) |  |

Definition at line 199 of file fl_standard_message_codec_test.cc.

199 {
200 decode_error_value("04", FL_MESSAGE_CODEC_ERROR,
201 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
202 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [44/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ShortData1 |
| ) |  |

Definition at line 204 of file fl_standard_message_codec_test.cc.

204 {
205 decode_error_value("04ef", FL_MESSAGE_CODEC_ERROR,
206 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
207 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [45/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeInt64ShortData2 |
| ) |  |

Definition at line 209 of file fl_standard_message_codec_test.cc.

209 {
210 decode_error_value("04efcdab89674523", FL_MESSAGE_CODEC_ERROR,
211 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
212 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [46/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeIntOne |
| ) |  |

Definition at line 142 of file fl_standard_message_codec_test.cc.

142 {
143 g_autoptr(FlValue) value = decode_message("0301000000");
144 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
145 EXPECT_EQ(fl_value_get_int(value), 1);
146 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [47/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeIntShortData1 |
| ) |  |

Definition at line 189 of file fl_standard_message_codec_test.cc.

189 {
190 decode_error_value("0367", FL_MESSAGE_CODEC_ERROR,
191 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
192 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [48/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeIntShortData2 |
| ) |  |

Definition at line 194 of file fl_standard_message_codec_test.cc.

194 {
195 decode_error_value("03674523", FL_MESSAGE_CODEC_ERROR,
196 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
197 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [49/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeIntZero |
| ) |  |

Definition at line 136 of file fl_standard_message_codec_test.cc.

136 {
137 g_autoptr(FlValue) value = decode_message("0300000000");
138 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
139 EXPECT_EQ(fl_value_get_int(value), 0);
140 }

References decode_message(), fl_value_get_int(), fl_value_get_type(), FL_VALUE_TYPE_INT, and value.

## ◆ TEST() [50/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListEmpty |
| ) |  |

Definition at line 692 of file fl_standard_message_codec_test.cc.

692 {
693 g_autoptr(FlValue) value = decode_message("0c00");
694 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
695 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
696 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_LIST, and value.

## ◆ TEST() [51/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListLengthNoData |
| ) |  |

Definition at line 755 of file fl_standard_message_codec_test.cc.

755 {
756 decode_error_value("0c07", FL_MESSAGE_CODEC_ERROR,
757 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
758 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [52/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListNested |
| ) |  |

Definition at line 727 of file fl_standard_message_codec_test.cc.

727 {
728 g_autoptr(FlValue) value = decode_message(
729 "0c020c05030000000003020000000304000000030600000003080000000c"
730 "0503010000000303000000030500000003070000000309000000");
731 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
732 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
733 FlValue* even_list = fl_value_get_list_value(value, 0);
734 ASSERT_EQ(fl_value_get_type(even_list), FL_VALUE_TYPE_LIST);
735 ASSERT_EQ(fl_value_get_length(even_list), static_cast<size_t>(5));
736 FlValue* odd_list = fl_value_get_list_value(value, 1);
737 ASSERT_EQ(fl_value_get_type(odd_list), FL_VALUE_TYPE_LIST);
738 ASSERT_EQ(fl_value_get_length(odd_list), static_cast<size_t>(5));
739 for (int i = 0; i < 5; i++) {
740 FlValue* v = fl_value_get_list_value(even_list, i);
741 ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
742 EXPECT_EQ(fl_value_get_int(v), i * 2);
743
744 v = fl_value_get_list_value(odd_list, i);
745 ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
746 EXPECT_EQ(fl_value_get_int(v), i * 2 + 1);
747 }
748 }

References decode_message(), fl_value_get_int(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_type(), FL_VALUE_TYPE_INT, FL_VALUE_TYPE_LIST, and value.

## ◆ TEST() [53/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListNoData |
| ) |  |

Definition at line 750 of file fl_standard_message_codec_test.cc.

750 {
751 decode_error_value("0c", FL_MESSAGE_CODEC_ERROR,
752 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
753 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [54/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListShortData1 |
| ) |  |

Definition at line 760 of file fl_standard_message_codec_test.cc.

760 {
761 decode_error_value("0c0700", FL_MESSAGE_CODEC_ERROR,
762 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
763 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [55/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListShortData2 |
| ) |  |

Definition at line 765 of file fl_standard_message_codec_test.cc.

765 {
766 decode_error_value(
767 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d",
768 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
769 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [56/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeListTypes |
| ) |  |

Definition at line 698 of file fl_standard_message_codec_test.cc.

698 {
699 g_autoptr(FlValue) value = decode_message(
700 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
701 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
702 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
703 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 0)),
704 FL_VALUE_TYPE_NULL);
705 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 1)),
706 FL_VALUE_TYPE_BOOL);
707 EXPECT_TRUE(fl_value_get_bool(fl_value_get_list_value(value, 1)));
708 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 2)),
709 FL_VALUE_TYPE_INT);
710 EXPECT_EQ(fl_value_get_int(fl_value_get_list_value(value, 2)), 42);
711 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 3)),
712 FL_VALUE_TYPE_FLOAT);
713 EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_list_value(value, 3)), M_PI);
714 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 4)),
715 FL_VALUE_TYPE_STRING);
716 EXPECT_STREQ(fl_value_get_string(fl_value_get_list_value(value, 4)), "hello");
717 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 5)),
718 FL_VALUE_TYPE_LIST);
719 ASSERT_EQ(fl_value_get_length(fl_value_get_list_value(value, 5)),
720 static_cast<size_t>(0));
721 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 6)),
722 FL_VALUE_TYPE_MAP);
723 ASSERT_EQ(fl_value_get_length(fl_value_get_list_value(value, 6)),
724 static_cast<size_t>(0));
725 }

References decode_message(), fl_value_get_bool(), fl_value_get_float(), fl_value_get_int(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, and value.

## ◆ TEST() [57/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapEmpty |
| ) |  |

Definition at line 858 of file fl_standard_message_codec_test.cc.

858 {
859 g_autoptr(FlValue) value = decode_message("0d00");
860 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
861 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
862 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_MAP, and value.

## ◆ TEST() [58/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapKeyTypes |
| ) |  |

Definition at line 864 of file fl_standard_message_codec_test.cc.

864 {
865 g_autoptr(FlValue) value = decode_message(
866 "0d070007046e756c6c010704626f6f6c032a0000000703696e74060000000000182d4454"
867 "fb2109400705666c6f6174070568656c6c6f0706737472696e670c0007046c6973740d00"
868 "07036d6170");
869 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
870 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
871
872 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 0)),
873 FL_VALUE_TYPE_NULL);
874 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 0)),
875 FL_VALUE_TYPE_STRING);
876 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 0)), "null");
877
878 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 1)),
879 FL_VALUE_TYPE_BOOL);
880 EXPECT_TRUE(fl_value_get_bool(fl_value_get_map_key(value, 1)));
881 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 1)),
882 FL_VALUE_TYPE_STRING);
883 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 1)), "bool");
884
885 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 2)),
886 FL_VALUE_TYPE_INT);
887 EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(value, 2)), 42);
888 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 2)),
889 FL_VALUE_TYPE_STRING);
890 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 2)), "int");
891
892 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 3)),
893 FL_VALUE_TYPE_FLOAT);
894 EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_key(value, 3)), M_PI);
895 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 3)),
896 FL_VALUE_TYPE_STRING);
897 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 3)), "float");
898
899 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 4)),
900 FL_VALUE_TYPE_STRING);
901 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "hello");
902 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 4)),
903 FL_VALUE_TYPE_STRING);
904 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "string");
905
906 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 5)),
907 FL_VALUE_TYPE_LIST);
908 ASSERT_EQ(fl_value_get_length(fl_value_get_map_key(value, 5)),
909 static_cast<size_t>(0));
910 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 5)),
911 FL_VALUE_TYPE_STRING);
912 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 5)), "list");
913
914 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 6)),
915 FL_VALUE_TYPE_MAP);
916 ASSERT_EQ(fl_value_get_length(fl_value_get_map_key(value, 6)),
917 static_cast<size_t>(0));
918 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 6)),
919 FL_VALUE_TYPE_STRING);
920 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 6)), "map");
921 }

References decode_message(), fl_value_get_bool(), fl_value_get_float(), fl_value_get_int(), fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, and value.

## ◆ TEST() [59/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapLengthNoData |
| ) |  |

Definition at line 1034 of file fl_standard_message_codec_test.cc.

1034 {
1035 decode_error_value("0d07", FL_MESSAGE_CODEC_ERROR,
1036 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1037 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [60/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapNested |
| ) |  |

Definition at line 982 of file fl_standard_message_codec_test.cc.

982 {
983 g_autoptr(FlValue) value = decode_message(
984 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6503010000"
985 "00070374776f0302000000070574687265650303000000070a696e742d746f2d7374720d"
986 "04030000000007047a65726f030100000007036f6e650302000000070374776f03030000"
987 "0007057468726565");
988 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
989 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
990
991 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 0)),
992 FL_VALUE_TYPE_STRING);
993 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 0)),
994 "str-to-int");
995 FlValue* str_to_int = fl_value_get_map_value(value, 0);
996 ASSERT_EQ(fl_value_get_type(str_to_int), FL_VALUE_TYPE_MAP);
997 ASSERT_EQ(fl_value_get_length(str_to_int), static_cast<size_t>(4));
998
999 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 1)),
1000 FL_VALUE_TYPE_STRING);
1001 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 1)),
1002 "int-to-str");
1003 FlValue* int_to_str = fl_value_get_map_value(value, 1);
1004 ASSERT_EQ(fl_value_get_type(int_to_str), FL_VALUE_TYPE_MAP);
1005 ASSERT_EQ(fl_value_get_length(int_to_str), static_cast<size_t>(4));
1006
1007 const char* numbers[] = {"zero", "one", "two", "three", nullptr};
1008 for (int i = 0; numbers[i] != nullptr; i++) {
1009 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(str_to_int, i)),
1010 FL_VALUE_TYPE_STRING);
1011 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(str_to_int, i)),
1012 numbers[i]);
1013
1014 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(str_to_int, i)),
1015 FL_VALUE_TYPE_INT);
1016 EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(str_to_int, i)), i);
1017
1018 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(int_to_str, i)),
1019 FL_VALUE_TYPE_INT);
1020 EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(int_to_str, i)), i);
1021
1022 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(int_to_str, i)),
1023 FL_VALUE_TYPE_STRING);
1024 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(int_to_str, i)),
1025 numbers[i]);
1026 }
1027 }

References decode_message(), fl_value_get_int(), fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_INT, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_STRING, and value.

## ◆ TEST() [61/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapNoData |
| ) |  |

Definition at line 1029 of file fl_standard_message_codec_test.cc.

1029 {
1030 decode_error_value("0d", FL_MESSAGE_CODEC_ERROR,
1031 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1032 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [62/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapShortData1 |
| ) |  |

Definition at line 1039 of file fl_standard_message_codec_test.cc.

1039 {
1040 decode_error_value("0d0707", FL_MESSAGE_CODEC_ERROR,
1041 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1042 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [63/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapShortData2 |
| ) |  |

Definition at line 1044 of file fl_standard_message_codec_test.cc.

1044 {
1045 decode_error_value(
1046 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
1047 "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
1048 "036d61700d",
1049 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1050 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [64/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeMapValueTypes |
| ) |  |

Definition at line 923 of file fl_standard_message_codec_test.cc.

923 {
924 g_autoptr(FlValue) value = decode_message(
925 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
926 "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
927 "036d61700d00");
928 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
929 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
930
931 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 0)),
932 FL_VALUE_TYPE_STRING);
933 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 0)), "null");
934 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 0)),
935 FL_VALUE_TYPE_NULL);
936
937 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 1)),
938 FL_VALUE_TYPE_STRING);
939 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 1)), "bool");
940 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 1)),
941 FL_VALUE_TYPE_BOOL);
942 EXPECT_TRUE(fl_value_get_bool(fl_value_get_map_value(value, 1)));
943
944 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 2)),
945 FL_VALUE_TYPE_STRING);
946 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 2)), "int");
947 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 2)),
948 FL_VALUE_TYPE_INT);
949 EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(value, 2)), 42);
950
951 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 3)),
952 FL_VALUE_TYPE_STRING);
953 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 3)), "float");
954 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 3)),
955 FL_VALUE_TYPE_FLOAT);
956 EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_value(value, 3)), M_PI);
957
958 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 4)),
959 FL_VALUE_TYPE_STRING);
960 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "string");
961 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 4)),
962 FL_VALUE_TYPE_STRING);
963 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "hello");
964
965 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 5)),
966 FL_VALUE_TYPE_STRING);
967 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 5)), "list");
968 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 5)),
969 FL_VALUE_TYPE_LIST);
970 ASSERT_EQ(fl_value_get_length(fl_value_get_map_value(value, 5)),
971 static_cast<size_t>(0));
972
973 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 6)),
974 FL_VALUE_TYPE_STRING);
975 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 6)), "map");
976 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 6)),
977 FL_VALUE_TYPE_MAP);
978 ASSERT_EQ(fl_value_get_length(fl_value_get_map_value(value, 6)),
979 static_cast<size_t>(0));
980 }

References decode_message(), fl_value_get_bool(), fl_value_get_float(), fl_value_get_int(), fl_value_get_length(), fl_value_get_map_key(), fl_value_get_map_value(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_BOOL, FL_VALUE_TYPE_FLOAT, FL_VALUE_TYPE_INT, FL_VALUE_TYPE_LIST, FL_VALUE_TYPE_MAP, FL_VALUE_TYPE_NULL, FL_VALUE_TYPE_STRING, and value.

## ◆ TEST() [65/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeNull |
| ) |  |

Definition at line 63 of file fl_standard_message_codec_test.cc.

63 {
64 // Regression test for https://github.com/flutter/flutter/issues/128704.
65
66 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
67 g_autoptr(GBytes) data = g_bytes_new(nullptr, 0);
68 g_autoptr(GError) error = nullptr;
69 g_autoptr(FlValue) value =
70 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
71
72 EXPECT_FALSE(value == nullptr);
73 EXPECT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_NULL);
74 }

References error, fl_message_codec_decode_message(), fl_standard_message_codec_new(), fl_value_get_type(), FL_VALUE_TYPE_NULL, and value.

## ◆ TEST() [66/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeStringEmpty |
| ) |  |

Definition at line 349 of file fl_standard_message_codec_test.cc.

349 {
350 g_autoptr(FlValue) value = decode_message("0700");
351 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
352 EXPECT_STREQ(fl_value_get_string(value), "");
353 }

References decode_message(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, and value.

## ◆ TEST() [67/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeStringHello |
| ) |  |

Definition at line 355 of file fl_standard_message_codec_test.cc.

355 {
356 g_autoptr(FlValue) value = decode_message("070568656c6c6f");
357 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
358 EXPECT_STREQ(fl_value_get_string(value), "hello");
359 }

References decode_message(), fl_value_get_string(), fl_value_get_type(), FL_VALUE_TYPE_STRING, and value.

## ◆ TEST() [68/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeStringLengthNoData |
| ) |  |

Definition at line 366 of file fl_standard_message_codec_test.cc.

366 {
367 decode_error_value("0705", FL_MESSAGE_CODEC_ERROR,
368 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
369 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [69/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeStringNoData |
| ) |  |

Definition at line 361 of file fl_standard_message_codec_test.cc.

361 {
362 decode_error_value("07", FL_MESSAGE_CODEC_ERROR,
363 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
364 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [70/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeStringShortData1 |
| ) |  |

Definition at line 371 of file fl_standard_message_codec_test.cc.

371 {
372 decode_error_value("070568", FL_MESSAGE_CODEC_ERROR,
373 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
374 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [71/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeStringShortData2 |
| ) |  |

Definition at line 376 of file fl_standard_message_codec_test.cc.

376 {
377 decode_error_value("070568656c6c", FL_MESSAGE_CODEC_ERROR,
378 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
379 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [72/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUint8List |
| ) |  |

Definition at line 400 of file fl_standard_message_codec_test.cc.

400 {
401 g_autoptr(FlValue) value = decode_message("08050001020304");
402 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_UINT8_LIST);
403 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(5));
404 const uint8_t* data = fl_value_get_uint8_list(value);
405 EXPECT_EQ(data[0], 0);
406 EXPECT_EQ(data[1], 1);
407 EXPECT_EQ(data[2], 2);
408 EXPECT_EQ(data[3], 3);
409 EXPECT_EQ(data[4], 4);
410 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), fl_value_get_uint8_list(), FL_VALUE_TYPE_UINT8_LIST, and value.

## ◆ TEST() [73/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUint8ListEmpty |
| ) |  |

Definition at line 394 of file fl_standard_message_codec_test.cc.

394 {
395 g_autoptr(FlValue) value = decode_message("0800");
396 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_UINT8_LIST);
397 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
398 }

References decode_message(), fl_value_get_length(), fl_value_get_type(), FL_VALUE_TYPE_UINT8_LIST, and value.

## ◆ TEST() [74/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUint8ListLengthNoData |
| ) |  |

Definition at line 417 of file fl_standard_message_codec_test.cc.

417 {
418 decode_error_value("0805", FL_MESSAGE_CODEC_ERROR,
419 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
420 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [75/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUint8ListNoData |
| ) |  |

Definition at line 412 of file fl_standard_message_codec_test.cc.

412 {
413 decode_error_value("08", FL_MESSAGE_CODEC_ERROR,
414 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
415 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [76/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUint8ListShortData1 |
| ) |  |

Definition at line 422 of file fl_standard_message_codec_test.cc.

422 {
423 decode_error_value("080500", FL_MESSAGE_CODEC_ERROR,
424 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
425 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [77/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUint8ListShortData2 |
| ) |  |

Definition at line 427 of file fl_standard_message_codec_test.cc.

427 {
428 decode_error_value("080500010203", FL_MESSAGE_CODEC_ERROR,
429 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
430 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [78/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeUnknownType |
| ) |  |

Definition at line 1075 of file fl_standard_message_codec_test.cc.

1075 {
1076 decode_error_value("0f", FL_MESSAGE_CODEC_ERROR,
1077 FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE);
1078 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE.

## ◆ TEST() [79/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeBoolFalse |
| ) |  |

Definition at line 81 of file fl_standard_message_codec_test.cc.

81 {
82 g_autofree gchar* hex_string = encode_bool(FALSE);
83 EXPECT_STREQ(hex_string, "02");
84 }

References encode_bool().

## ◆ TEST() [80/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeBoolTrue |
| ) |  |

Definition at line 86 of file fl_standard_message_codec_test.cc.

86 {
87 g_autofree gchar* hex_string = encode_bool(TRUE);
88 EXPECT_STREQ(hex_string, "01");
89 }

References encode_bool(), and TRUE.

## ◆ TEST() [81/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeDecode |
| ) |  |

Definition at line 1080 of file fl_standard_message_codec_test.cc.

1080 {
1081 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1082
1083 g_autoptr(FlValue) input = fl_value_new_list();
1084 fl_value_append_take(input, fl_value_new_null());
1085 fl_value_append_take(input, fl_value_new_bool(TRUE));
1086 fl_value_append_take(input, fl_value_new_int(42));
1087 fl_value_append_take(input, fl_value_new_float(M_PI));
1088 fl_value_append_take(input, fl_value_new_string("hello"));
1089 fl_value_append_take(input, fl_value_new_list());
1090 fl_value_append_take(input, fl_value_new_map());
1091
1092 g_autoptr(GError) error = nullptr;
1093 g_autoptr(GBytes) message =
1094 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), input, &error);
1095 EXPECT_NE(message, nullptr);
1096 EXPECT_EQ(error, nullptr);
1097
1098 g_autoptr(FlValue) output =
1099 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1100 EXPECT_EQ(error, nullptr);
1101 EXPECT_NE(output, nullptr);
1102
1103 ASSERT_TRUE(fl_value_equal(input, output));
1104 }

References error, fl_message_codec_decode_message(), fl_message_codec_encode_message(), fl_standard_message_codec_new(), fl_value_append_take(), fl_value_equal(), fl_value_new_bool(), fl_value_new_float(), fl_value_new_int(), fl_value_new_list(), fl_value_new_map(), fl_value_new_null(), fl_value_new_string(), and TRUE.

## ◆ TEST() [82/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeDecodeLargeList |
| ) |  |

Definition at line 771 of file fl_standard_message_codec_test.cc.

771 {
772 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
773
774 g_autoptr(FlValue) value = fl_value_new_list();
775 for (int i = 0; i < 65535; i++) {
776 fl_value_append_take(value, fl_value_new_int(i));
777 }
778
779 g_autoptr(GError) error = nullptr;
780 g_autoptr(GBytes) message =
781 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
782 EXPECT_NE(message, nullptr);
783 EXPECT_EQ(error, nullptr);
784
785 g_autoptr(FlValue) decoded_value =
786 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
787 EXPECT_EQ(error, nullptr);
788 EXPECT_NE(value, nullptr);
789
790 ASSERT_TRUE(fl_value_equal(value, decoded_value));
791 }

References error, fl_message_codec_decode_message(), fl_message_codec_encode_message(), fl_standard_message_codec_new(), fl_value_append_take(), fl_value_equal(), fl_value_new_int(), fl_value_new_list(), and value.

## ◆ TEST() [83/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeDecodeLargeMap |
| ) |  |

Definition at line 1052 of file fl_standard_message_codec_test.cc.

1052 {
1053 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1054
1055 g_autoptr(FlValue) value = fl_value_new_map();
1056 for (int i = 0; i < 512; i++) {
1057 g_autofree gchar* key = g_strdup_printf("key%d", i);
1058 fl_value_set_string_take(value, key, fl_value_new_int(i));
1059 }
1060
1061 g_autoptr(GError) error = nullptr;
1062 g_autoptr(GBytes) message =
1063 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
1064 EXPECT_NE(message, nullptr);
1065 EXPECT_EQ(error, nullptr);
1066
1067 g_autoptr(FlValue) decoded_value =
1068 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1069 EXPECT_EQ(error, nullptr);
1070 EXPECT_NE(value, nullptr);
1071
1072 ASSERT_TRUE(fl_value_equal(value, decoded_value));
1073 }

References error, fl_message_codec_decode_message(), fl_message_codec_encode_message(), fl_standard_message_codec_new(), fl_value_equal(), fl_value_new_int(), fl_value_new_map(), fl_value_set_string_take(), and value.

## ◆ TEST() [84/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloat32List |
| ) |  |

Definition at line 548 of file fl_standard_message_codec_test.cc.

548 {
549 float data[] = {0.0f, -0.5f, 0.25f, -0.125f, 0.00625f};
550 g_autoptr(FlValue) value = fl_value_new_float32_list(data, 5);
551 g_autofree gchar* hex_string = encode_message(value);
552 EXPECT_STREQ(hex_string, "0e05000000000000000000bf0000803e000000becdcccc3b");
553 }

References encode_message(), fl_value_new_float32_list(), and value.

## ◆ TEST() [85/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloat32ListEmpty |
| ) |  |

Definition at line 542 of file fl_standard_message_codec_test.cc.

542 {
543 g_autoptr(FlValue) value = fl_value_new_float32_list(nullptr, 0);
544 g_autofree gchar* hex_string = encode_message(value);
545 EXPECT_STREQ(hex_string, "0e000000");
546 }

References encode_message(), fl_value_new_float32_list(), and value.

## ◆ TEST() [86/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatFraction |
| ) |  |

Definition at line 239 of file fl_standard_message_codec_test.cc.

239 {
240 g_autofree gchar* hex_string = encode_float(M_PI);
241 EXPECT_STREQ(hex_string, "0600000000000000182d4454fb210940");
242 }

References encode_float().

## ◆ TEST() [87/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatHalf |
| ) |  |

Definition at line 234 of file fl_standard_message_codec_test.cc.

234 {
235 g_autofree gchar* hex_string = encode_float(0.5);
236 EXPECT_STREQ(hex_string, "0600000000000000000000000000e03f");
237 }

References encode_float().

## ◆ TEST() [88/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatInfinity |
| ) |  |

Definition at line 254 of file fl_standard_message_codec_test.cc.

254 {
255 g_autofree gchar* hex_string = encode_float(INFINITY);
256 EXPECT_STREQ(hex_string, "0600000000000000000000000000f07f");
257 }

References encode_float().

## ◆ TEST() [89/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatList |
| ) |  |

Definition at line 600 of file fl_standard_message_codec_test.cc.

600 {
601 double data[] = {0, -0.5, 0.25, -0.125, 0.00625};
602 g_autoptr(FlValue) value = fl_value_new_float_list(data, 5);
603 g_autofree gchar* hex_string = encode_message(value);
604 EXPECT_STREQ(
605 hex_string,
606 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
607 "0000c0bf9a9999999999793f");
608 }

References encode_message(), fl_value_new_float_list(), and value.

## ◆ TEST() [90/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatListEmpty |
| ) |  |

Definition at line 594 of file fl_standard_message_codec_test.cc.

594 {
595 g_autoptr(FlValue) value = fl_value_new_float_list(nullptr, 0);
596 g_autofree gchar* hex_string = encode_message(value);
597 EXPECT_STREQ(hex_string, "0b00000000000000");
598 }

References encode_message(), fl_value_new_float_list(), and value.

## ◆ TEST() [91/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatMinusOne |
| ) |  |

Definition at line 229 of file fl_standard_message_codec_test.cc.

229 {
230 g_autofree gchar* hex_string = encode_float(-1);
231 EXPECT_STREQ(hex_string, "0600000000000000000000000000f0bf");
232 }

References encode_float().

## ◆ TEST() [92/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatMinusZero |
| ) |  |

Definition at line 244 of file fl_standard_message_codec_test.cc.

244 {
245 g_autofree gchar* hex_string = encode_float(-0.0);
246 EXPECT_STREQ(hex_string, "06000000000000000000000000000080");
247 }

References encode_float().

## ◆ TEST() [93/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatNaN |
| ) |  |

Definition at line 249 of file fl_standard_message_codec_test.cc.

249 {
250 g_autofree gchar* hex_string = encode_float(NAN);
251 EXPECT_STREQ(hex_string, "0600000000000000000000000000f87f");
252 }

References encode_float().

## ◆ TEST() [94/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatOne |
| ) |  |

Definition at line 224 of file fl_standard_message_codec_test.cc.

224 {
225 g_autofree gchar* hex_string = encode_float(1);
226 EXPECT_STREQ(hex_string, "0600000000000000000000000000f03f");
227 }

References encode_float().

## ◆ TEST() [95/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeFloatZero |
| ) |  |

Definition at line 219 of file fl_standard_message_codec_test.cc.

219 {
220 g_autofree gchar* hex_string = encode_float(0);
221 EXPECT_STREQ(hex_string, "06000000000000000000000000000000");
222 }

References encode_float().

## ◆ TEST() [96/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt32 |
| ) |  |

Definition at line 106 of file fl_standard_message_codec_test.cc.

106 {
107 g_autofree gchar* hex_string = encode_int(0x01234567);
108 EXPECT_STREQ(hex_string, "0367452301");
109 }

References encode_int().

## ◆ TEST() [97/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt32List |
| ) |  |

Definition at line 438 of file fl_standard_message_codec_test.cc.

438 {
439 int32_t data[] = {0, -1, 2, -3, 4};
440 g_autoptr(FlValue) value = fl_value_new_int32_list(data, 5);
441 g_autofree gchar* hex_string = encode_message(value);
442 EXPECT_STREQ(hex_string, "0905000000000000ffffffff02000000fdffffff04000000");
443 }

References encode_message(), fl_value_new_int32_list(), and value.

## ◆ TEST() [98/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt32ListEmpty |
| ) |  |

Definition at line 432 of file fl_standard_message_codec_test.cc.

432 {
433 g_autoptr(FlValue) value = fl_value_new_int32_list(nullptr, 0);
434 g_autofree gchar* hex_string = encode_message(value);
435 EXPECT_STREQ(hex_string, "09000000");
436 }

References encode_message(), fl_value_new_int32_list(), and value.

## ◆ TEST() [99/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt32Max |
| ) |  |

Definition at line 116 of file fl_standard_message_codec_test.cc.

116 {
117 g_autofree gchar* hex_string = encode_int(G_MAXINT32);
118 EXPECT_STREQ(hex_string, "03ffffff7f");
119 }

References encode_int().

## ◆ TEST() [100/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt32Min |
| ) |  |

Definition at line 111 of file fl_standard_message_codec_test.cc.

111 {
112 g_autofree gchar* hex_string = encode_int(G_MININT32);
113 EXPECT_STREQ(hex_string, "0300000080");
114 }

References encode_int().

## ◆ TEST() [101/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt64 |
| ) |  |

Definition at line 121 of file fl_standard_message_codec_test.cc.

121 {
122 g_autofree gchar* hex_string = encode_int(0x0123456789abcdef);
123 EXPECT_STREQ(hex_string, "04efcdab8967452301");
124 }

References encode_int().

## ◆ TEST() [102/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt64List |
| ) |  |

Definition at line 490 of file fl_standard_message_codec_test.cc.

490 {
491 int64_t data[] = {0, -1, 2, -3, 4};
492 g_autoptr(FlValue) value = fl_value_new_int64_list(data, 5);
493 g_autofree gchar* hex_string = encode_message(value);
494 EXPECT_STREQ(
495 hex_string,
496 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
497 "ffffffff0400000000000000");
498 }

References encode_message(), fl_value_new_int64_list(), and value.

## ◆ TEST() [103/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt64ListEmpty |
| ) |  |

Definition at line 484 of file fl_standard_message_codec_test.cc.

484 {
485 g_autoptr(FlValue) value = fl_value_new_int64_list(nullptr, 0);
486 g_autofree gchar* hex_string = encode_message(value);
487 EXPECT_STREQ(hex_string, "0a00000000000000");
488 }

References encode_message(), fl_value_new_int64_list(), and value.

## ◆ TEST() [104/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt64Max |
| ) |  |

Definition at line 131 of file fl_standard_message_codec_test.cc.

131 {
132 g_autofree gchar* hex_string = encode_int(G_MAXINT64);
133 EXPECT_STREQ(hex_string, "04ffffffffffffff7f");
134 }

References encode_int().

## ◆ TEST() [105/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeInt64Min |
| ) |  |

Definition at line 126 of file fl_standard_message_codec_test.cc.

126 {
127 g_autofree gchar* hex_string = encode_int(G_MININT64);
128 EXPECT_STREQ(hex_string, "040000000000000080");
129 }

References encode_int().

## ◆ TEST() [106/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeIntOne |
| ) |  |

Definition at line 101 of file fl_standard_message_codec_test.cc.

101 {
102 g_autofree gchar* hex_string = encode_int(1);
103 EXPECT_STREQ(hex_string, "0301000000");
104 }

References encode_int().

## ◆ TEST() [107/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeIntZero |
| ) |  |

Definition at line 96 of file fl_standard_message_codec_test.cc.

96 {
97 g_autofree gchar* hex_string = encode_int(0);
98 EXPECT_STREQ(hex_string, "0300000000");
99 }

References encode_int().

## ◆ TEST() [108/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeListEmpty |
| ) |  |

Definition at line 652 of file fl_standard_message_codec_test.cc.

652 {
653 g_autoptr(FlValue) value = fl_value_new_list();
654 g_autofree gchar* hex_string = encode_message(value);
655 EXPECT_STREQ(hex_string, "0c00");
656 }

References encode_message(), fl_value_new_list(), and value.

## ◆ TEST() [109/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeListNested |
| ) |  |

Definition at line 673 of file fl_standard_message_codec_test.cc.

673 {
674 g_autoptr(FlValue) even_numbers = fl_value_new_list();
675 g_autoptr(FlValue) odd_numbers = fl_value_new_list();
676 for (int i = 0; i < 10; i++) {
677 if (i % 2 == 0) {
678 fl_value_append_take(even_numbers, fl_value_new_int(i));
679 } else {
680 fl_value_append_take(odd_numbers, fl_value_new_int(i));
681 }
682 }
683 g_autoptr(FlValue) value = fl_value_new_list();
684 fl_value_append(value, even_numbers);
685 fl_value_append(value, odd_numbers);
686 g_autofree gchar* hex_string = encode_message(value);
687 EXPECT_STREQ(hex_string,
688 "0c020c05030000000003020000000304000000030600000003080000000c"
689 "0503010000000303000000030500000003070000000309000000");
690 }

References encode_message(), fl_value_append(), fl_value_append_take(), fl_value_new_int(), fl_value_new_list(), and value.

## ◆ TEST() [110/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeListTypes |
| ) |  |

Definition at line 658 of file fl_standard_message_codec_test.cc.

658 {
659 g_autoptr(FlValue) value = fl_value_new_list();
660 fl_value_append_take(value, fl_value_new_null());
661 fl_value_append_take(value, fl_value_new_bool(TRUE));
662 fl_value_append_take(value, fl_value_new_int(42));
663 fl_value_append_take(value, fl_value_new_float(M_PI));
664 fl_value_append_take(value, fl_value_new_string("hello"));
665 fl_value_append_take(value, fl_value_new_list());
666 fl_value_append_take(value, fl_value_new_map());
667 g_autofree gchar* hex_string = encode_message(value);
668 EXPECT_STREQ(
669 hex_string,
670 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
671 }

References encode_message(), fl_value_append_take(), fl_value_new_bool(), fl_value_new_float(), fl_value_new_int(), fl_value_new_list(), fl_value_new_map(), fl_value_new_null(), fl_value_new_string(), TRUE, and value.

## ◆ TEST() [111/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeMapEmpty |
| ) |  |

Definition at line 793 of file fl_standard_message_codec_test.cc.

793 {
794 g_autoptr(FlValue) value = fl_value_new_map();
795 g_autofree gchar* hex_string = encode_message(value);
796 EXPECT_STREQ(hex_string, "0d00");
797 }

References encode_message(), fl_value_new_map(), and value.

## ◆ TEST() [112/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeMapKeyTypes |
| ) |  |

Definition at line 799 of file fl_standard_message_codec_test.cc.

799 {
800 g_autoptr(FlValue) value = fl_value_new_map();
801 fl_value_set_take(value, fl_value_new_null(), fl_value_new_string("null"));
802 fl_value_set_take(value, fl_value_new_bool(TRUE),
803 fl_value_new_string("bool"));
804 fl_value_set_take(value, fl_value_new_int(42), fl_value_new_string("int"));
805 fl_value_set_take(value, fl_value_new_float(M_PI),
806 fl_value_new_string("float"));
807 fl_value_set_take(value, fl_value_new_string("hello"),
808 fl_value_new_string("string"));
809 fl_value_set_take(value, fl_value_new_list(), fl_value_new_string("list"));
810 fl_value_set_take(value, fl_value_new_map(), fl_value_new_string("map"));
811 g_autofree gchar* hex_string = encode_message(value);
812 EXPECT_STREQ(hex_string,
813 "0d070007046e756c6c010704626f6f6c032a0000000703696e7406000000000"
814 "0182d4454fb2109400705666c6f6174070568656c6c6f0706737472696e670c"
815 "0007046c6973740d0007036d6170");
816 }

References encode_message(), fl_value_new_bool(), fl_value_new_float(), fl_value_new_int(), fl_value_new_list(), fl_value_new_map(), fl_value_new_null(), fl_value_new_string(), fl_value_set_take(), TRUE, and value.

## ◆ TEST() [113/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeMapNested |
| ) |  |

Definition at line 837 of file fl_standard_message_codec_test.cc.

837 {
838 g_autoptr(FlValue) str_to_int = fl_value_new_map();
839 g_autoptr(FlValue) int_to_str = fl_value_new_map();
840 const char* numbers[] = {"zero", "one", "two", "three", nullptr};
841 for (int i = 0; numbers[i] != nullptr; i++) {
842 fl_value_set_take(str_to_int, fl_value_new_string(numbers[i]),
843 fl_value_new_int(i));
844 fl_value_set_take(int_to_str, fl_value_new_int(i),
845 fl_value_new_string(numbers[i]));
846 }
847 g_autoptr(FlValue) value = fl_value_new_map();
848 fl_value_set_string(value, "str-to-int", str_to_int);
849 fl_value_set_string(value, "int-to-str", int_to_str);
850 g_autofree gchar* hex_string = encode_message(value);
851 EXPECT_STREQ(hex_string,
852 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6"
853 "50301000000070374776f0302000000070574687265650303000000070a696e"
854 "742d746f2d7374720d04030000000007047a65726f030100000007036f6e650"
855 "302000000070374776f030300000007057468726565");
856 }

References encode_message(), fl_value_new_int(), fl_value_new_map(), fl_value_new_string(), fl_value_set_string(), fl_value_set_take(), and value.

## ◆ TEST() [114/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeMapValueTypes |
| ) |  |

Definition at line 818 of file fl_standard_message_codec_test.cc.

818 {
819 g_autoptr(FlValue) value = fl_value_new_map();
820 fl_value_set_take(value, fl_value_new_string("null"), fl_value_new_null());
821 fl_value_set_take(value, fl_value_new_string("bool"),
822 fl_value_new_bool(TRUE));
823 fl_value_set_take(value, fl_value_new_string("int"), fl_value_new_int(42));
824 fl_value_set_take(value, fl_value_new_string("float"),
825 fl_value_new_float(M_PI));
826 fl_value_set_take(value, fl_value_new_string("string"),
827 fl_value_new_string("hello"));
828 fl_value_set_take(value, fl_value_new_string("list"), fl_value_new_list());
829 fl_value_set_take(value, fl_value_new_string("map"), fl_value_new_map());
830 g_autofree gchar* hex_string = encode_message(value);
831 EXPECT_STREQ(hex_string,
832 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6"
833 "17406000000000000182d4454fb2109400706737472696e67070568656c6c6f"
834 "07046c6973740c0007036d61700d00");
835 }

References encode_message(), fl_value_new_bool(), fl_value_new_float(), fl_value_new_int(), fl_value_new_list(), fl_value_new_map(), fl_value_new_null(), fl_value_new_string(), fl_value_set_take(), TRUE, and value.

## ◆ TEST() [115/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeNull |
| ) |  |

Definition at line 57 of file fl_standard_message_codec_test.cc.

57 {
58 g_autoptr(FlValue) value = fl_value_new_null();
59 g_autofree gchar* hex_string = encode_message(value);
60 EXPECT_STREQ(hex_string, "00");
61 }

References encode_message(), fl_value_new_null(), and value.

## ◆ TEST() [116/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeNullptr |
| ) |  |

Definition at line 52 of file fl_standard_message_codec_test.cc.

52 {
53 g_autofree gchar* hex_string = encode_message(nullptr);
54 EXPECT_STREQ(hex_string, "00");
55 }

References encode_message().

## ◆ TEST() [117/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeStringEmpty |
| ) |  |

Definition at line 327 of file fl_standard_message_codec_test.cc.

327 {
328 g_autofree gchar* hex_string = encode_string("");
329 EXPECT_STREQ(hex_string, "0700");
330 }

References encode_string().

## ◆ TEST() [118/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeStringEmptySized |
| ) |  |

Definition at line 337 of file fl_standard_message_codec_test.cc.

337 {
338 g_autoptr(FlValue) value = fl_value_new_string_sized(nullptr, 0);
339 g_autofree gchar* hex_string = encode_message(value);
340 EXPECT_STREQ(hex_string, "0700");
341 }

References encode_message(), fl_value_new_string_sized(), and value.

## ◆ TEST() [119/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeStringHello |
| ) |  |

Definition at line 332 of file fl_standard_message_codec_test.cc.

332 {
333 g_autofree gchar* hex_string = encode_string("hello");
334 EXPECT_STREQ(hex_string, "070568656c6c6f");
335 }

References encode_string().

## ◆ TEST() [120/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeStringHelloSized |
| ) |  |

Definition at line 343 of file fl_standard_message_codec_test.cc.

343 {
344 g_autoptr(FlValue) value = fl_value_new_string_sized("Hello World", 5);
345 g_autofree gchar* hex_string = encode_message(value);
346 EXPECT_STREQ(hex_string, "070548656c6c6f");
347 }

References encode_message(), fl_value_new_string_sized(), and value.

## ◆ TEST() [121/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeUint8List |
| ) |  |

Definition at line 387 of file fl_standard_message_codec_test.cc.

387 {
388 uint8_t data[] = {0, 1, 2, 3, 4};
389 g_autoptr(FlValue) value = fl_value_new_uint8_list(data, 5);
390 g_autofree gchar* hex_string = encode_message(value);
391 EXPECT_STREQ(hex_string, "08050001020304");
392 }

References encode_message(), fl_value_new_uint8_list(), and value.

## ◆ TEST() [122/122]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeUint8ListEmpty |
| ) |  |

Definition at line 381 of file fl_standard_message_codec_test.cc.

381 {
382 g_autoptr(FlValue) value = fl_value_new_uint8_list(nullptr, 0);
383 g_autofree gchar* hex_string = encode_message(value);
384 EXPECT_STREQ(hex_string, "0800");
385 }

References encode_message(), fl_value_new_uint8_list(), and value.

fl_value_get_int32_list
const G_MODULE_EXPORT int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:656
FL_VALUE_TYPE_UINT8_LIST
@ FL_VALUE_TYPE_UINT8_LIST
Definition: fl_value.h:65
fl_value_new_string_sized
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:272
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:70
fl_standard_message_codec_new
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
Definition: fl_standard_message_codec.cc:458
fl_value_set_string_take
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:610
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
fl_value_new_float32_list
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
Definition: fl_value.cc:318
fl_value_get_float_list
const G_MODULE_EXPORT double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:677
fl_value_new_bool
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
encode_string
static gchar * encode_string(const gchar *value)
Definition: fl_standard_message_codec_test.cc:322
fl_value_set_take
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:578
fl_value_new_null
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:240
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:69
encode_int
static gchar * encode_int(int64_t value)
Definition: fl_standard_message_codec_test.cc:91
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:621
fl_value_get_uint8_list
const G_MODULE_EXPORT uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:649
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
fl_value_get_string
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
fl_value_get_float32_list
const G_MODULE_EXPORT float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:670
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:60
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
fl_message_codec_decode_message
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
Definition: fl_message_codec.cc:33
fl_value_new_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
fl_value_get_list_value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:735
FL_VALUE_TYPE_FLOAT32_LIST
@ FL_VALUE_TYPE_FLOAT32_LIST
Definition: fl_value.h:71
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:64
fl_value_new_float_list
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:328
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_value_new_int32_list
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:298
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:560
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
FL_VALUE_TYPE_INT64_LIST
@ FL_VALUE_TYPE_INT64_LIST
Definition: fl_value.h:67
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:433
fl_value_set_string
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:599
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:62
encode_message
static gchar * encode_message(FlValue *value)
Definition: fl_standard_message_codec_test.cc:14
fl_value_new_int64_list
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:308
encode_bool
static gchar * encode_bool(gboolean value)
Definition: fl_standard_message_codec_test.cc:76
FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
Definition: fl_message_codec.h:34
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
FL_VALUE_TYPE_FLOAT_LIST
@ FL_VALUE_TYPE_FLOAT_LIST
Definition: fl_value.h:68
fl_value_new_uint8_list
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:281
fl_message_codec_encode_message
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
Definition: fl_message_codec.cc:17
fl_value_append
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:552
FL_VALUE_TYPE_FLOAT
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:63
FL_VALUE_TYPE_INT32_LIST
@ FL_VALUE_TYPE_INT32_LIST
Definition: fl_value.h:66
FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
Definition: fl_message_codec.h:36
fl_value_new_float
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:258
fl_value_get_map_key
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:743
fl_value_get_int64_list
const G_MODULE_EXPORT int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:663
decode_error_value
static void decode_error_value(const char *hex_string, GQuark domain, gint code)
Definition: fl_standard_message_codec_test.cc:40
FL_VALUE_TYPE_BOOL
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:61
decode_message
static FlValue * decode_message(const char *hex_string)
Definition: fl_standard_message_codec_test.cc:27
value
uint8_t value
Definition: fl_standard_message_codec.cc:41
encode_float
static gchar * encode_float(double value)
Definition: fl_standard_message_codec_test.cc:214
fl_value_get_map_value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:751
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265
FL_MESSAGE_CODEC_ERROR
#define FL_MESSAGE_CODEC_ERROR
Definition: fl_message_codec.h:30