| Flutter Linux Embedder |

Functions | Variables
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_with_codec (FlValue *value, FlMessageCodec *codec)
static gchar * | encode_message (FlValue *value)
static FlValue * | decode_message_with_codec (const char *hex_string, FlMessageCodec *codec)
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)
| G_DECLARE_FINAL_TYPE (FlTestStandardMessageCodec, fl_test_standard_message_codec, FL, TEST_STANDARD_MESSAGE_CODEC, FlStandardMessageCodec) struct _FlTestStandardMessageCodec
| G_DEFINE_TYPE (FlTestStandardMessageCodec, fl_test_standard_message_codec, fl_standard_message_codec_get_type()) static gboolean write_custom_value1(FlStandardMessageCodec *codec
| g_byte_array_append (buffer, &type, sizeof(uint8_t))
| fl_standard_message_codec_write_size (codec, buffer, length)
| g_byte_array_append (buffer, reinterpret_cast< const uint8_t * >(text), length)
static gboolean | write_custom_value2 (FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
static gboolean | fl_test_standard_message_codec_write_value (FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
static FlValue * | read_custom_value1 (FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
static FlValue * | read_custom_value2 (FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
static FlValue * | fl_test_standard_message_codec_read_value_of_type (FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, int type, GError **error)
static void | fl_test_standard_message_codec_class_init (FlTestStandardMessageCodecClass *klass)
static void | fl_test_standard_message_codec_init (FlTestStandardMessageCodec *self)
static FlTestStandardMessageCodec * | fl_test_standard_message_codec_new ()
| TEST (FlStandardMessageCodecTest, DecodeCustomType)
| TEST (FlStandardMessageCodecTest, DecodeCustomTypes)
| TEST (FlStandardMessageCodecTest, EncodeCustomType)
| TEST (FlStandardMessageCodecTest, EncodeCustomTypes)
| TEST (FlStandardMessageCodecTest, EncodeDecode)

## Variables
GByteArray * | buffer
GByteArray FlValue * | value
GByteArray FlValue GError ** | error
size_t | length = strlen(text)
uint8_t | type = 128
return | TRUE

## Function Documentation

## ◆ decode_error_value()

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

Definition at line 53 of file fl_standard_message_codec_test.cc.

55 {
56 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
57 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
58 g_autoptr(GError) error = nullptr;
59 g_autoptr(FlValue) value =
60 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
61 EXPECT_TRUE(value == nullptr);
62 EXPECT_TRUE(g_error_matches(error, domain, code));
63 }
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_standard_message_codec_new
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
Definition: fl_standard_message_codec.cc:637
error
GByteArray FlValue GError ** error
Definition: fl_standard_message_codec_test.cc:1110
value
GByteArray FlValue * value
Definition: fl_standard_message_codec_test.cc:1109
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

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 46 of file fl_standard_message_codec_test.cc.

46 {
47 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
48 return decode_message_with_codec(hex_string, FL_MESSAGE_CODEC(codec));
49 }
decode_message_with_codec
static FlValue * decode_message_with_codec(const char *hex_string, FlMessageCodec *codec)
Definition: fl_standard_message_codec_test.cc:33

References decode_message_with_codec(), and fl_standard_message_codec_new().

Referenced by TEST().

## ◆ decode_message_with_codec()

static FlValue* decode_message_with_codec | ( | const char * | hex_string,
|  | FlMessageCodec * | codec
| ) |  |
| static

Definition at line 33 of file fl_standard_message_codec_test.cc.

34 {
35 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
36 g_autoptr(GError) error = nullptr;
37 g_autoptr(FlValue) value =
38 fl_message_codec_decode_message(codec, data, &error);
39 EXPECT_EQ(error, nullptr);
40 EXPECT_NE(value, nullptr);
41 return fl_value_ref(value);
42 }
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394

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

Referenced by decode_message(), and TEST().

## ◆ encode_bool()

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

Definition at line 89 of file fl_standard_message_codec_test.cc.

89 {
90 g_autoptr(FlValue) v = fl_value_new_bool(value);
91 return encode_message(v);
92 }
encode_message
static gchar * encode_message(FlValue *value)
Definition: fl_standard_message_codec_test.cc:26
fl_value_new_bool
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255

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

Referenced by TEST().

## ◆ encode_float()

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

Definition at line 227 of file fl_standard_message_codec_test.cc.

227 {
228 g_autoptr(FlValue) v = fl_value_new_float(value);
229 return encode_message(v);
230 }
fl_value_new_float
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:269

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 104 of file fl_standard_message_codec_test.cc.

104 {
105 g_autoptr(FlValue) v = fl_value_new_int(value);
106 return encode_message(v);
107 }
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262

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

Referenced by TEST().

## ◆ encode_message()

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

Definition at line 26 of file fl_standard_message_codec_test.cc.

26 {
27 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
28 return encode_message_with_codec(value, FL_MESSAGE_CODEC(codec));
29 }
encode_message_with_codec
static gchar * encode_message_with_codec(FlValue *value, FlMessageCodec *codec)
Definition: fl_standard_message_codec_test.cc:14

References encode_message_with_codec(), fl_standard_message_codec_new(), and value.

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

## ◆ encode_message_with_codec()

static gchar* encode_message_with_codec | ( | FlValue * | value,
|  | FlMessageCodec * | codec
| ) |  |
| static

Definition at line 14 of file fl_standard_message_codec_test.cc.

14 {
15 g_autoptr(GError) error = nullptr;
16 g_autoptr(GBytes) message =
17 fl_message_codec_encode_message(codec, value, &error);
18 EXPECT_NE(message, nullptr);
19 EXPECT_EQ(error, nullptr);
20
21 return bytes_to_hex_string(message);
22 }
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

References error, fl_message_codec_encode_message(), and value.

Referenced by encode_message(), and TEST().

## ◆ encode_string()

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

Definition at line 335 of file fl_standard_message_codec_test.cc.

335 {
336 g_autoptr(FlValue) v = fl_value_new_string(value);
337 return encode_message(v);
338 }
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276

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

Referenced by TEST().

## ◆ fl_standard_message_codec_write_size()

fl_standard_message_codec_write_size | ( | codec | ,
|  | buffer | ,
|  | length |
| ) |  |

## ◆ fl_test_standard_message_codec_class_init()

static void fl_test_standard_message_codec_class_init | ( | FlTestStandardMessageCodecClass * | klass | ) |
| static

Definition at line 1198 of file fl_standard_message_codec_test.cc.

1199 {
1200 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->write_value =
1201 fl_test_standard_message_codec_write_value;
1202 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->read_value_of_type =
1203 fl_test_standard_message_codec_read_value_of_type;
1204 }
fl_test_standard_message_codec_write_value
static gboolean fl_test_standard_message_codec_write_value(FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
Definition: fl_standard_message_codec_test.cc:1131
fl_test_standard_message_codec_read_value_of_type
static FlValue * fl_test_standard_message_codec_read_value_of_type(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, int type, GError **error)
Definition: fl_standard_message_codec_test.cc:1181

References fl_test_standard_message_codec_read_value_of_type(), and fl_test_standard_message_codec_write_value().

## ◆ fl_test_standard_message_codec_init()

static void fl_test_standard_message_codec_init | ( | FlTestStandardMessageCodec * | self | ) |
| static

Definition at line 1206 of file fl_standard_message_codec_test.cc.

1207 {
1208 // The following line suppresses a warning for unused function
1209 FL_IS_TEST_STANDARD_MESSAGE_CODEC(self);
1210 }

## ◆ fl_test_standard_message_codec_new()

static FlTestStandardMessageCodec* fl_test_standard_message_codec_new | ( |  | ) |
| static

Definition at line 1212 of file fl_standard_message_codec_test.cc.

1212 {
1213 return FL_TEST_STANDARD_MESSAGE_CODEC(
1214 g_object_new(fl_test_standard_message_codec_get_type(), nullptr));
1215 }

Referenced by TEST().

## ◆ fl_test_standard_message_codec_read_value_of_type()

static FlValue* fl_test_standard_message_codec_read_value_of_type | ( | FlStandardMessageCodec * | codec,
|  | GBytes * | buffer,
|  | size_t * | offset,
|  | int | type,
|  | GError ** | error
| ) |  |
| static

Definition at line 1181 of file fl_standard_message_codec_test.cc.

1186 {
1187 if (type == 128) {
1188 return read_custom_value1(codec, buffer, offset, error);
1189 } else if (type == 129) {
1190 return read_custom_value2(codec, buffer, offset, error);
1191 } else {
1192 return FL_STANDARD_MESSAGE_CODEC_CLASS(
1193 fl_test_standard_message_codec_parent_class)
1194 ->read_value_of_type(codec, buffer, offset, type, error);
1195 }
1196 }
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1115
read_custom_value2
static FlValue * read_custom_value2(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
Definition: fl_standard_message_codec_test.cc:1174
read_custom_value1
static FlValue * read_custom_value1(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
Definition: fl_standard_message_codec_test.cc:1149
buffer
GByteArray * buffer
Definition: fl_standard_message_codec_test.cc:1108

References buffer, error, read_custom_value1(), read_custom_value2(), and type.

Referenced by fl_test_standard_message_codec_class_init().

## ◆ fl_test_standard_message_codec_write_value()

static gboolean fl_test_standard_message_codec_write_value | ( | FlStandardMessageCodec * | codec,
|  | GByteArray * | buffer,
|  | FlValue * | value,
|  | GError ** | error
| ) |  |
| static

Definition at line 1131 of file fl_standard_message_codec_test.cc.

1135 {
1136 if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM &&
1137 fl_value_get_custom_type(value) == 128) {
1138 return write_custom_value1(codec, buffer, value, error);
1139 } else if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM &&
1140 fl_value_get_custom_type(value) == 129) {
1141 return write_custom_value2(codec, buffer, value, error);
1142 } else {
1143 return FL_STANDARD_MESSAGE_CODEC_CLASS(
1144 fl_test_standard_message_codec_parent_class)
1145 ->write_value(codec, buffer, value, error);
1146 }
1147 }
write_custom_value2
static gboolean write_custom_value2(FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
Definition: fl_standard_message_codec_test.cc:1122
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
fl_value_get_custom_type
G_MODULE_EXPORT int fl_value_get_custom_type(FlValue *self)
Definition: fl_value.cc:822
FL_VALUE_TYPE_CUSTOM
@ FL_VALUE_TYPE_CUSTOM
Definition: fl_value.h:76

References buffer, error, fl_value_get_custom_type(), fl_value_get_type(), FL_VALUE_TYPE_CUSTOM, value, and write_custom_value2().

Referenced by fl_test_standard_message_codec_class_init().

## ◆ g_byte_array_append() [1/2]

g_byte_array_append | ( | buffer | ,
|  | & | type,
|  | sizeof(uint8_t) |
| ) |  |

Referenced by fl_standard_message_codec_real_write_value(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_success_envelope(), write_custom_value2(), write_float64(), write_int32(), write_int64(), write_uint16(), and write_uint32().

## ◆ g_byte_array_append() [2/2]

g_byte_array_append | ( | buffer | ,
|  | reinterpret_cast< const uint8_t * > | text,
|  | length |
| ) |  |

## ◆ G_DECLARE_FINAL_TYPE()

G_DECLARE_FINAL_TYPE | ( | FlTestStandardMessageCodec | ,
|  | fl_test_standard_message_codec | ,
|  | FL | ,
|  | TEST_STANDARD_MESSAGE_CODEC | ,
|  | FlStandardMessageCodec |
| ) |  |

Definition at line 1093 of file fl_standard_message_codec_test.cc.

1099 {
1100 FlStandardMessageCodec parent_instance;
1101 };

## ◆ G_DEFINE_TYPE()

G_DEFINE_TYPE | ( | FlTestStandardMessageCodec | ,
|  | fl_test_standard_message_codec | ,
|  | fl_standard_message_codec_get_type() |
| ) |  |

## ◆ read_custom_value1()

static FlValue* read_custom_value1 | ( | FlStandardMessageCodec * | codec,
|  | GBytes * | buffer,
|  | size_t * | offset,
|  | GError ** | error
| ) |  |
| static

Definition at line 1149 of file fl_standard_message_codec_test.cc.

1152 {
1153 uint32_t length;
1154 if (!fl_standard_message_codec_read_size(codec, buffer, offset, &length,
1155 error)) {
1156 return nullptr;
1157 }
1158 if (*offset + length > g_bytes_get_size(buffer)) {
1159 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
1160 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, "Unexpected end of data");
1161 return nullptr;
1162 }
1163 FlValue* value = fl_value_new_custom(
1164 128,
1165 g_strndup(static_cast<const gchar*>(g_bytes_get_data(buffer, nullptr)) +
1166 *offset,
1167 length),
1168 g_free);
1169 *offset += length;
1170
1171 return value;
1172 }
FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
@ FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA
Definition: fl_message_codec.h:34
FL_MESSAGE_CODEC_ERROR
#define FL_MESSAGE_CODEC_ERROR
Definition: fl_message_codec.h:30
fl_standard_message_codec_read_size
G_MODULE_EXPORT gboolean fl_standard_message_codec_read_size(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, uint32_t *value, GError **error)
Definition: fl_standard_message_codec.cc:657
length
size_t length
Definition: fl_standard_message_codec_test.cc:1113
fl_value_new_custom
G_MODULE_EXPORT FlValue * fl_value_new_custom(int type, gconstpointer value, GDestroyNotify destroy_notify)
Definition: fl_value.cc:374

References buffer, error, FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, fl_standard_message_codec_read_size(), fl_value_new_custom(), length, and value.

Referenced by fl_test_standard_message_codec_read_value_of_type().

## ◆ read_custom_value2()

static FlValue* read_custom_value2 | ( | FlStandardMessageCodec * | codec,
|  | GBytes * | buffer,
|  | size_t * | offset,
|  | GError ** | error
| ) |  |
| static

Definition at line 1174 of file fl_standard_message_codec_test.cc.

1177 {
1178 return fl_value_new_custom(129, nullptr, nullptr);
1179 }

References fl_value_new_custom().

Referenced by fl_test_standard_message_codec_read_value_of_type().

## ◆ TEST() [1/126]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeCustomType |
| ) |  |

Definition at line 1217 of file fl_standard_message_codec_test.cc.

1217 {
1218 g_autoptr(FlTestStandardMessageCodec) codec =
1219 fl_test_standard_message_codec_new();
1220 g_autoptr(FlValue) value =
1221 decode_message_with_codec("800568656c6c6f", FL_MESSAGE_CODEC(codec));
1222 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_CUSTOM);
1223 ASSERT_EQ(fl_value_get_custom_type(value), 128);
1224 EXPECT_STREQ(static_cast<const gchar*>(fl_value_get_custom_value(value)),
1225 "hello");
1226 }
fl_test_standard_message_codec_new
static FlTestStandardMessageCodec * fl_test_standard_message_codec_new()
Definition: fl_standard_message_codec_test.cc:1212
fl_value_get_custom_value
G_MODULE_EXPORT gconstpointer fl_value_get_custom_value(FlValue *self)
Definition: fl_value.cc:830

References decode_message_with_codec(), fl_test_standard_message_codec_new(), fl_value_get_custom_type(), fl_value_get_custom_value(), fl_value_get_type(), FL_VALUE_TYPE_CUSTOM, and value.

## ◆ TEST() [2/126]

TEST | ( | FlStandardMessageCodecTest | ,
|  | DecodeCustomTypes |
| ) |  |

Definition at line 1228 of file fl_standard_message_codec_test.cc.

1228 {
1229 g_autoptr(FlTestStandardMessageCodec) codec =
1230 fl_test_standard_message_codec_new();
1231 g_autoptr(FlValue) value = decode_message_with_codec("0c02800568656c6c6f81",
1232 FL_MESSAGE_CODEC(codec));
1233 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
1234 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
1235 FlValue* value1 = fl_value_get_list_value(value, 0);
1236 ASSERT_EQ(fl_value_get_type(value1), FL_VALUE_TYPE_CUSTOM);
1237 ASSERT_EQ(fl_value_get_custom_type(value1), 128);
1238 EXPECT_STREQ(static_cast<const gchar*>(fl_value_get_custom_value(value1)),
1239 "hello");
1240 FlValue* value2 = fl_value_get_list_value(value, 1);
1241 ASSERT_EQ(fl_value_get_type(value2), FL_VALUE_TYPE_CUSTOM);
1242 ASSERT_EQ(fl_value_get_custom_type(value2), 129);
1243 }
fl_value_get_list_value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:776
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:73

References decode_message_with_codec(), fl_test_standard_message_codec_new(), fl_value_get_custom_type(), fl_value_get_custom_value(), fl_value_get_length(), fl_value_get_list_value(), fl_value_get_type(), FL_VALUE_TYPE_CUSTOM, FL_VALUE_TYPE_LIST, and value.

## ◆ TEST() [3/126]

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

Definition at line 574 of file fl_standard_message_codec_test.cc.

574 {
575 g_autoptr(FlValue) value =
576 decode_message("0e05000000000000000000bf0000803e000000becdcccc3b");
577 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT32_LIST);
578 const float* data = fl_value_get_float32_list(value);
579 EXPECT_FLOAT_EQ(data[0], 0.0f);
580 EXPECT_FLOAT_EQ(data[1], -0.5f);
581 EXPECT_FLOAT_EQ(data[2], 0.25f);
582 EXPECT_FLOAT_EQ(data[3], -0.125f);
583 EXPECT_FLOAT_EQ(data[4], 0.00625f);
584 }
decode_message
static FlValue * decode_message(const char *hex_string)
Definition: fl_standard_message_codec_test.cc:46
fl_value_get_float32_list
G_MODULE_EXPORT const float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:710
FL_VALUE_TYPE_FLOAT32_LIST
@ FL_VALUE_TYPE_FLOAT32_LIST
Definition: fl_value.h:75

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

## ◆ TEST() [4/126]

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

Definition at line 568 of file fl_standard_message_codec_test.cc.

568 {
569 g_autoptr(FlValue) value = decode_message("0e000000");
570 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT32_LIST);
571 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
572 }

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

## ◆ TEST() [5/126]

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

Definition at line 591 of file fl_standard_message_codec_test.cc.

591 {
592 decode_error_value("0e050000", FL_MESSAGE_CODEC_ERROR,
593 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
594 }
decode_error_value
static void decode_error_value(const char *hex_string, GQuark domain, gint code)
Definition: fl_standard_message_codec_test.cc:53

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [6/126]

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

Definition at line 586 of file fl_standard_message_codec_test.cc.

586 {
587 decode_error_value("0e", FL_MESSAGE_CODEC_ERROR,
588 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
589 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [7/126]

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

Definition at line 596 of file fl_standard_message_codec_test.cc.

596 {
597 decode_error_value("0e05000000", FL_MESSAGE_CODEC_ERROR,
598 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
599 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [8/126]

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

Definition at line 601 of file fl_standard_message_codec_test.cc.

601 {
602 decode_error_value("0e05000000000000000000bf0000803e000000becdcccc",
603 FL_MESSAGE_CODEC_ERROR,
604 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
605 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [9/126]

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

Definition at line 290 of file fl_standard_message_codec_test.cc.

290 {
291 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000e03f");
292 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
293 EXPECT_EQ(fl_value_get_float(value), 0.5);
294 }
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
FL_VALUE_TYPE_FLOAT
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:67

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

## ◆ TEST() [10/126]

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

Definition at line 314 of file fl_standard_message_codec_test.cc.

314 {
315 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f07f");
316 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
317 EXPECT_TRUE(isinf(fl_value_get_float(value)));
318 }

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

## ◆ TEST() [11/126]

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

Definition at line 629 of file fl_standard_message_codec_test.cc.

629 {
630 g_autoptr(FlValue) value = decode_message(
631 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
632 "0000c0bf9a9999999999793f");
633 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT_LIST);
634 const double* data = fl_value_get_float_list(value);
635 EXPECT_FLOAT_EQ(data[0], 0.0);
636 EXPECT_FLOAT_EQ(data[1], -0.5);
637 EXPECT_FLOAT_EQ(data[2], 0.25);
638 EXPECT_FLOAT_EQ(data[3], -0.125);
639 EXPECT_FLOAT_EQ(data[4], 0.00625);
640 }
fl_value_get_float_list
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:717
FL_VALUE_TYPE_FLOAT_LIST
@ FL_VALUE_TYPE_FLOAT_LIST
Definition: fl_value.h:72

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

## ◆ TEST() [12/126]

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

Definition at line 623 of file fl_standard_message_codec_test.cc.

623 {
624 g_autoptr(FlValue) value = decode_message("0b00000000000000");
625 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT_LIST);
626 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
627 }

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

## ◆ TEST() [13/126]

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

Definition at line 647 of file fl_standard_message_codec_test.cc.

647 {
648 decode_error_value("0b05000000000000", FL_MESSAGE_CODEC_ERROR,
649 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() [14/126]

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

Definition at line 642 of file fl_standard_message_codec_test.cc.

642 {
643 decode_error_value("0b", FL_MESSAGE_CODEC_ERROR,
644 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
645 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [15/126]

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

Definition at line 652 of file fl_standard_message_codec_test.cc.

652 {
653 decode_error_value("0b0500000000000000", FL_MESSAGE_CODEC_ERROR,
654 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
655 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [16/126]

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

Definition at line 657 of file fl_standard_message_codec_test.cc.

657 {
658 decode_error_value(
659 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
660 "0000c0bf9a99"
661 "9999999979",
662 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
663 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [17/126]

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

Definition at line 284 of file fl_standard_message_codec_test.cc.

284 {
285 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f0bf");
286 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
287 EXPECT_EQ(fl_value_get_float(value), -1.0);
288 }

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

## ◆ TEST() [18/126]

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

Definition at line 302 of file fl_standard_message_codec_test.cc.

302 {
303 g_autoptr(FlValue) value = decode_message("06000000000000000000000000000080");
304 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
305 EXPECT_EQ(fl_value_get_float(value), -0.0);
306 }

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

## ◆ TEST() [19/126]

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

Definition at line 308 of file fl_standard_message_codec_test.cc.

308 {
309 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f87f");
310 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
311 EXPECT_TRUE(isnan(fl_value_get_float(value)));
312 }

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

## ◆ TEST() [20/126]

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

Definition at line 320 of file fl_standard_message_codec_test.cc.

320 {
321 decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
322 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
323 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [21/126]

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

Definition at line 278 of file fl_standard_message_codec_test.cc.

278 {
279 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f03f");
280 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
281 EXPECT_EQ(fl_value_get_float(value), 1.0);
282 }

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

## ◆ TEST() [22/126]

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

Definition at line 296 of file fl_standard_message_codec_test.cc.

296 {
297 g_autoptr(FlValue) value = decode_message("0600000000000000182d4454fb210940");
298 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
299 EXPECT_EQ(fl_value_get_float(value), M_PI);
300 }

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

## ◆ TEST() [23/126]

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

Definition at line 325 of file fl_standard_message_codec_test.cc.

325 {
326 decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
327 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
328 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [24/126]

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

Definition at line 330 of file fl_standard_message_codec_test.cc.

330 {
331 decode_error_value("060000000000000000000000000000", FL_MESSAGE_CODEC_ERROR,
332 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
333 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [25/126]

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

Definition at line 272 of file fl_standard_message_codec_test.cc.

272 {
273 g_autoptr(FlValue) value = decode_message("06000000000000000000000000000000");
274 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
275 EXPECT_EQ(fl_value_get_float(value), 0.0);
276 }

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

## ◆ TEST() [26/126]

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

Definition at line 161 of file fl_standard_message_codec_test.cc.

161 {
162 g_autoptr(FlValue) value = decode_message("0367452301");
163 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
164 EXPECT_EQ(fl_value_get_int(value), 0x01234567);
165 }
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:66

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

## ◆ TEST() [27/126]

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

Definition at line 464 of file fl_standard_message_codec_test.cc.

464 {
465 g_autoptr(FlValue) value =
466 decode_message("0905000000000000ffffffff02000000fdffffff04000000");
467 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT32_LIST);
468 const int32_t* data = fl_value_get_int32_list(value);
469 EXPECT_EQ(data[0], 0);
470 EXPECT_EQ(data[1], -1);
471 EXPECT_EQ(data[2], 2);
472 EXPECT_EQ(data[3], -3);
473 EXPECT_EQ(data[4], 4);
474 }
fl_value_get_int32_list
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:696
FL_VALUE_TYPE_INT32_LIST
@ FL_VALUE_TYPE_INT32_LIST
Definition: fl_value.h:70

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

## ◆ TEST() [28/126]

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

Definition at line 458 of file fl_standard_message_codec_test.cc.

458 {
459 g_autoptr(FlValue) value = decode_message("09000000");
460 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT32_LIST);
461 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
462 }

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

## ◆ TEST() [29/126]

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

Definition at line 481 of file fl_standard_message_codec_test.cc.

481 {
482 decode_error_value("09050000", FL_MESSAGE_CODEC_ERROR,
483 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
484 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [30/126]

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

Definition at line 476 of file fl_standard_message_codec_test.cc.

476 {
477 decode_error_value("09", FL_MESSAGE_CODEC_ERROR,
478 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
479 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [31/126]

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

Definition at line 486 of file fl_standard_message_codec_test.cc.

486 {
487 decode_error_value("0905000000", FL_MESSAGE_CODEC_ERROR,
488 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
489 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [32/126]

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

Definition at line 491 of file fl_standard_message_codec_test.cc.

491 {
492 decode_error_value("090500000000ffffffff02000000fdffffff040000",
493 FL_MESSAGE_CODEC_ERROR,
494 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
495 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [33/126]

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

Definition at line 173 of file fl_standard_message_codec_test.cc.

173 {
174 g_autoptr(FlValue) value = decode_message("03ffffff7f");
175 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
176 EXPECT_EQ(fl_value_get_int(value), G_MAXINT32);
177 }

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

## ◆ TEST() [34/126]

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

Definition at line 167 of file fl_standard_message_codec_test.cc.

167 {
168 g_autoptr(FlValue) value = decode_message("0300000080");
169 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
170 EXPECT_EQ(fl_value_get_int(value), G_MININT32);
171 }

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

## ◆ TEST() [35/126]

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

Definition at line 197 of file fl_standard_message_codec_test.cc.

197 {
198 decode_error_value("03", FL_MESSAGE_CODEC_ERROR,
199 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
200 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [36/126]

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

Definition at line 179 of file fl_standard_message_codec_test.cc.

179 {
180 g_autoptr(FlValue) value = decode_message("04efcdab8967452301");
181 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
182 EXPECT_EQ(fl_value_get_int(value), 0x0123456789abcdef);
183 }

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

## ◆ TEST() [37/126]

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

Definition at line 519 of file fl_standard_message_codec_test.cc.

519 {
520 g_autoptr(FlValue) value = decode_message(
521 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
522 "ffffffff0400000000000000");
523 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT64_LIST);
524 const int64_t* data = fl_value_get_int64_list(value);
525 EXPECT_EQ(data[0], 0);
526 EXPECT_EQ(data[1], -1);
527 EXPECT_EQ(data[2], 2);
528 EXPECT_EQ(data[3], -3);
529 EXPECT_EQ(data[4], 4);
530 }
fl_value_get_int64_list
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:703
FL_VALUE_TYPE_INT64_LIST
@ FL_VALUE_TYPE_INT64_LIST
Definition: fl_value.h:71

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

## ◆ TEST() [38/126]

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

Definition at line 513 of file fl_standard_message_codec_test.cc.

513 {
514 g_autoptr(FlValue) value = decode_message("0a00000000000000");
515 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT64_LIST);
516 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
517 }

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

## ◆ TEST() [39/126]

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

Definition at line 537 of file fl_standard_message_codec_test.cc.

537 {
538 decode_error_value("0a05000000000000", FL_MESSAGE_CODEC_ERROR,
539 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() [40/126]

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

Definition at line 532 of file fl_standard_message_codec_test.cc.

532 {
533 decode_error_value("0a", FL_MESSAGE_CODEC_ERROR,
534 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
535 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [41/126]

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

Definition at line 542 of file fl_standard_message_codec_test.cc.

542 {
543 decode_error_value("0a0500000000000000", FL_MESSAGE_CODEC_ERROR,
544 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
545 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [42/126]

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

Definition at line 547 of file fl_standard_message_codec_test.cc.

547 {
548 decode_error_value(
549 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
550 "ffffffff0400"
551 "0000000000",
552 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
553 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [43/126]

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

Definition at line 191 of file fl_standard_message_codec_test.cc.

191 {
192 g_autoptr(FlValue) value = decode_message("04ffffffffffffff7f");
193 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
194 EXPECT_EQ(fl_value_get_int(value), G_MAXINT64);
195 }

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

## ◆ TEST() [44/126]

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

Definition at line 185 of file fl_standard_message_codec_test.cc.

185 {
186 g_autoptr(FlValue) value = decode_message("040000000000000080");
187 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
188 EXPECT_EQ(fl_value_get_int(value), G_MININT64);
189 }

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

## ◆ TEST() [45/126]

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

Definition at line 212 of file fl_standard_message_codec_test.cc.

212 {
213 decode_error_value("04", FL_MESSAGE_CODEC_ERROR,
214 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
215 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [46/126]

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

Definition at line 217 of file fl_standard_message_codec_test.cc.

217 {
218 decode_error_value("04ef", FL_MESSAGE_CODEC_ERROR,
219 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
220 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [47/126]

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

Definition at line 222 of file fl_standard_message_codec_test.cc.

222 {
223 decode_error_value("04efcdab89674523", FL_MESSAGE_CODEC_ERROR,
224 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
225 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [48/126]

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

Definition at line 155 of file fl_standard_message_codec_test.cc.

155 {
156 g_autoptr(FlValue) value = decode_message("0301000000");
157 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
158 EXPECT_EQ(fl_value_get_int(value), 1);
159 }

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

## ◆ TEST() [49/126]

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

Definition at line 202 of file fl_standard_message_codec_test.cc.

202 {
203 decode_error_value("0367", FL_MESSAGE_CODEC_ERROR,
204 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
205 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [50/126]

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

Definition at line 207 of file fl_standard_message_codec_test.cc.

207 {
208 decode_error_value("03674523", FL_MESSAGE_CODEC_ERROR,
209 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
210 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [51/126]

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

Definition at line 149 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [52/126]

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

Definition at line 705 of file fl_standard_message_codec_test.cc.

705 {
706 g_autoptr(FlValue) value = decode_message("0c00");
707 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
708 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
709 }

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

## ◆ TEST() [53/126]

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

Definition at line 768 of file fl_standard_message_codec_test.cc.

768 {
769 decode_error_value("0c07", FL_MESSAGE_CODEC_ERROR,
770 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
771 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [54/126]

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

Definition at line 740 of file fl_standard_message_codec_test.cc.

740 {
741 g_autoptr(FlValue) value = decode_message(
742 "0c020c05030000000003020000000304000000030600000003080000000c"
743 "0503010000000303000000030500000003070000000309000000");
744 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
745 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
746 FlValue* even_list = fl_value_get_list_value(value, 0);
747 ASSERT_EQ(fl_value_get_type(even_list), FL_VALUE_TYPE_LIST);
748 ASSERT_EQ(fl_value_get_length(even_list), static_cast<size_t>(5));
749 FlValue* odd_list = fl_value_get_list_value(value, 1);
750 ASSERT_EQ(fl_value_get_type(odd_list), FL_VALUE_TYPE_LIST);
751 ASSERT_EQ(fl_value_get_length(odd_list), static_cast<size_t>(5));
752 for (int i = 0; i < 5; i++) {
753 FlValue* v = fl_value_get_list_value(even_list, i);
754 ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
755 EXPECT_EQ(fl_value_get_int(v), i * 2);
756
757 v = fl_value_get_list_value(odd_list, i);
758 ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
759 EXPECT_EQ(fl_value_get_int(v), i * 2 + 1);
760 }
761 }
i
int i
Definition: fl_socket_accessible.cc:18

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, i, and value.

## ◆ TEST() [55/126]

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

Definition at line 763 of file fl_standard_message_codec_test.cc.

763 {
764 decode_error_value("0c", FL_MESSAGE_CODEC_ERROR,
765 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
766 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [56/126]

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

Definition at line 773 of file fl_standard_message_codec_test.cc.

773 {
774 decode_error_value("0c0700", FL_MESSAGE_CODEC_ERROR,
775 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
776 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [57/126]

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

Definition at line 778 of file fl_standard_message_codec_test.cc.

778 {
779 decode_error_value(
780 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d",
781 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
782 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [58/126]

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

Definition at line 711 of file fl_standard_message_codec_test.cc.

711 {
712 g_autoptr(FlValue) value = decode_message(
713 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
714 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
715 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
716 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 0)),
717 FL_VALUE_TYPE_NULL);
718 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 1)),
719 FL_VALUE_TYPE_BOOL);
720 EXPECT_TRUE(fl_value_get_bool(fl_value_get_list_value(value, 1)));
721 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 2)),
722 FL_VALUE_TYPE_INT);
723 EXPECT_EQ(fl_value_get_int(fl_value_get_list_value(value, 2)), 42);
724 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 3)),
725 FL_VALUE_TYPE_FLOAT);
726 EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_list_value(value, 3)), M_PI);
727 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 4)),
728 FL_VALUE_TYPE_STRING);
729 EXPECT_STREQ(fl_value_get_string(fl_value_get_list_value(value, 4)), "hello");
730 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 5)),
731 FL_VALUE_TYPE_LIST);
732 ASSERT_EQ(fl_value_get_length(fl_value_get_list_value(value, 5)),
733 static_cast<size_t>(0));
734 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 6)),
735 FL_VALUE_TYPE_MAP);
736 ASSERT_EQ(fl_value_get_length(fl_value_get_list_value(value, 6)),
737 static_cast<size_t>(0));
738 }
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
fl_value_get_string
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:68
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:64
FL_VALUE_TYPE_BOOL
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:65
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:74

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() [59/126]

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

Definition at line 871 of file fl_standard_message_codec_test.cc.

871 {
872 g_autoptr(FlValue) value = decode_message("0d00");
873 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
874 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
875 }

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

## ◆ TEST() [60/126]

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

Definition at line 877 of file fl_standard_message_codec_test.cc.

877 {
878 g_autoptr(FlValue) value = decode_message(
879 "0d070007046e756c6c010704626f6f6c032a0000000703696e74060000000000182d4454"
880 "fb2109400705666c6f6174070568656c6c6f0706737472696e670c0007046c6973740d00"
881 "07036d6170");
882 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
883 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
884
885 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 0)),
886 FL_VALUE_TYPE_NULL);
887 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 0)),
888 FL_VALUE_TYPE_STRING);
889 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 0)), "null");
890
891 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 1)),
892 FL_VALUE_TYPE_BOOL);
893 EXPECT_TRUE(fl_value_get_bool(fl_value_get_map_key(value, 1)));
894 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 1)),
895 FL_VALUE_TYPE_STRING);
896 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 1)), "bool");
897
898 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 2)),
899 FL_VALUE_TYPE_INT);
900 EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(value, 2)), 42);
901 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 2)),
902 FL_VALUE_TYPE_STRING);
903 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 2)), "int");
904
905 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 3)),
906 FL_VALUE_TYPE_FLOAT);
907 EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_key(value, 3)), M_PI);
908 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 3)),
909 FL_VALUE_TYPE_STRING);
910 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 3)), "float");
911
912 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 4)),
913 FL_VALUE_TYPE_STRING);
914 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "hello");
915 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 4)),
916 FL_VALUE_TYPE_STRING);
917 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "string");
918
919 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 5)),
920 FL_VALUE_TYPE_LIST);
921 ASSERT_EQ(fl_value_get_length(fl_value_get_map_key(value, 5)),
922 static_cast<size_t>(0));
923 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 5)),
924 FL_VALUE_TYPE_STRING);
925 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 5)), "list");
926
927 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 6)),
928 FL_VALUE_TYPE_MAP);
929 ASSERT_EQ(fl_value_get_length(fl_value_get_map_key(value, 6)),
930 static_cast<size_t>(0));
931 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(value, 6)),
932 FL_VALUE_TYPE_STRING);
933 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 6)), "map");
934 }
fl_value_get_map_value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:792
fl_value_get_map_key
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:784

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() [61/126]

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

Definition at line 1047 of file fl_standard_message_codec_test.cc.

1047 {
1048 decode_error_value("0d07", FL_MESSAGE_CODEC_ERROR,
1049 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() [62/126]

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

Definition at line 995 of file fl_standard_message_codec_test.cc.

995 {
996 g_autoptr(FlValue) value = decode_message(
997 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6503010000"
998 "00070374776f0302000000070574687265650303000000070a696e742d746f2d7374720d"
999 "04030000000007047a65726f030100000007036f6e650302000000070374776f03030000"
1000 "0007057468726565");
1001 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
1002 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
1003
1004 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 0)),
1005 FL_VALUE_TYPE_STRING);
1006 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 0)),
1007 "str-to-int");
1008 FlValue* str_to_int = fl_value_get_map_value(value, 0);
1009 ASSERT_EQ(fl_value_get_type(str_to_int), FL_VALUE_TYPE_MAP);
1010 ASSERT_EQ(fl_value_get_length(str_to_int), static_cast<size_t>(4));
1011
1012 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(value, 1)),
1013 FL_VALUE_TYPE_STRING);
1014 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 1)),
1015 "int-to-str");
1016 FlValue* int_to_str = fl_value_get_map_value(value, 1);
1017 ASSERT_EQ(fl_value_get_type(int_to_str), FL_VALUE_TYPE_MAP);
1018 ASSERT_EQ(fl_value_get_length(int_to_str), static_cast<size_t>(4));
1019
1020 const char* numbers[] = {"zero", "one", "two", "three", nullptr};
1021 for (int i = 0; numbers[i] != nullptr; i++) {
1022 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(str_to_int, i)),
1023 FL_VALUE_TYPE_STRING);
1024 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(str_to_int, i)),
1025 numbers[i]);
1026
1027 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(str_to_int, i)),
1028 FL_VALUE_TYPE_INT);
1029 EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(str_to_int, i)), i);
1030
1031 ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(int_to_str, i)),
1032 FL_VALUE_TYPE_INT);
1033 EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(int_to_str, i)), i);
1034
1035 ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(int_to_str, i)),
1036 FL_VALUE_TYPE_STRING);
1037 EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(int_to_str, i)),
1038 numbers[i]);
1039 }
1040 }

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, i, and value.

## ◆ TEST() [63/126]

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

Definition at line 1042 of file fl_standard_message_codec_test.cc.

1042 {
1043 decode_error_value("0d", FL_MESSAGE_CODEC_ERROR,
1044 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1045 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [64/126]

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

Definition at line 1052 of file fl_standard_message_codec_test.cc.

1052 {
1053 decode_error_value("0d0707", FL_MESSAGE_CODEC_ERROR,
1054 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1055 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [65/126]

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

Definition at line 1057 of file fl_standard_message_codec_test.cc.

1057 {
1058 decode_error_value(
1059 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
1060 "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
1061 "036d61700d",
1062 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1063 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [66/126]

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

Definition at line 936 of file fl_standard_message_codec_test.cc.

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

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() [67/126]

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

Definition at line 76 of file fl_standard_message_codec_test.cc.

76 {
77 // Regression test for https://github.com/flutter/flutter/issues/128704.
78
79 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
80 g_autoptr(GBytes) data = g_bytes_new(nullptr, 0);
81 g_autoptr(GError) error = nullptr;
82 g_autoptr(FlValue) value =
83 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
84
85 EXPECT_FALSE(value == nullptr);
86 EXPECT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_NULL);
87 }

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

## ◆ TEST() [68/126]

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

Definition at line 362 of file fl_standard_message_codec_test.cc.

362 {
363 g_autoptr(FlValue) value = decode_message("0700");
364 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
365 EXPECT_STREQ(fl_value_get_string(value), "");
366 }

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

## ◆ TEST() [69/126]

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

Definition at line 368 of file fl_standard_message_codec_test.cc.

368 {
369 g_autoptr(FlValue) value = decode_message("070568656c6c6f");
370 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
371 EXPECT_STREQ(fl_value_get_string(value), "hello");
372 }

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

## ◆ TEST() [70/126]

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

Definition at line 379 of file fl_standard_message_codec_test.cc.

379 {
380 decode_error_value("0705", FL_MESSAGE_CODEC_ERROR,
381 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
382 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [71/126]

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

Definition at line 374 of file fl_standard_message_codec_test.cc.

374 {
375 decode_error_value("07", FL_MESSAGE_CODEC_ERROR,
376 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
377 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [72/126]

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

Definition at line 384 of file fl_standard_message_codec_test.cc.

384 {
385 decode_error_value("070568", FL_MESSAGE_CODEC_ERROR,
386 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
387 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [73/126]

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

Definition at line 389 of file fl_standard_message_codec_test.cc.

389 {
390 decode_error_value("070568656c6c", FL_MESSAGE_CODEC_ERROR,
391 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
392 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [74/126]

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

Definition at line 413 of file fl_standard_message_codec_test.cc.

413 {
414 g_autoptr(FlValue) value = decode_message("08050001020304");
415 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_UINT8_LIST);
416 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(5));
417 const uint8_t* data = fl_value_get_uint8_list(value);
418 EXPECT_EQ(data[0], 0);
419 EXPECT_EQ(data[1], 1);
420 EXPECT_EQ(data[2], 2);
421 EXPECT_EQ(data[3], 3);
422 EXPECT_EQ(data[4], 4);
423 }
fl_value_get_uint8_list
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:689
FL_VALUE_TYPE_UINT8_LIST
@ FL_VALUE_TYPE_UINT8_LIST
Definition: fl_value.h:69

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

## ◆ TEST() [75/126]

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

Definition at line 407 of file fl_standard_message_codec_test.cc.

407 {
408 g_autoptr(FlValue) value = decode_message("0800");
409 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_UINT8_LIST);
410 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
411 }

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

## ◆ TEST() [76/126]

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

Definition at line 430 of file fl_standard_message_codec_test.cc.

430 {
431 decode_error_value("0805", FL_MESSAGE_CODEC_ERROR,
432 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
433 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [77/126]

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

Definition at line 425 of file fl_standard_message_codec_test.cc.

425 {
426 decode_error_value("08", FL_MESSAGE_CODEC_ERROR,
427 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
428 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [78/126]

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

Definition at line 435 of file fl_standard_message_codec_test.cc.

435 {
436 decode_error_value("080500", FL_MESSAGE_CODEC_ERROR,
437 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
438 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [79/126]

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

Definition at line 440 of file fl_standard_message_codec_test.cc.

440 {
441 decode_error_value("080500010203", FL_MESSAGE_CODEC_ERROR,
442 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
443 }

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [80/126]

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

Definition at line 1088 of file fl_standard_message_codec_test.cc.

1088 {
1089 decode_error_value("0f", FL_MESSAGE_CODEC_ERROR,
1090 FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE);
1091 }
FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
@ FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE
Definition: fl_message_codec.h:36

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE.

## ◆ TEST() [81/126]

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

Definition at line 94 of file fl_standard_message_codec_test.cc.

94 {
95 g_autofree gchar* hex_string = encode_bool(FALSE);
96 EXPECT_STREQ(hex_string, "02");
97 }
encode_bool
static gchar * encode_bool(gboolean value)
Definition: fl_standard_message_codec_test.cc:89

References encode_bool().

## ◆ TEST() [82/126]

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

Definition at line 99 of file fl_standard_message_codec_test.cc.

99 {
100 g_autofree gchar* hex_string = encode_bool(TRUE);
101 EXPECT_STREQ(hex_string, "01");
102 }
TRUE
return TRUE
Definition: fl_standard_message_codec_test.cc:1119

References encode_bool(), and TRUE.

## ◆ TEST() [83/126]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeCustomType |
| ) |  |

Definition at line 1245 of file fl_standard_message_codec_test.cc.

1245 {
1246 g_autoptr(FlValue) value = fl_value_new_custom(128, "hello", nullptr);
1247 g_autoptr(FlTestStandardMessageCodec) codec =
1248 fl_test_standard_message_codec_new();
1249 g_autofree gchar* hex_string =
1250 encode_message_with_codec(value, FL_MESSAGE_CODEC(codec));
1251 EXPECT_STREQ(hex_string, "800568656c6c6f");
1252 }

References encode_message_with_codec(), fl_test_standard_message_codec_new(), fl_value_new_custom(), and value.

## ◆ TEST() [84/126]

TEST | ( | FlStandardMessageCodecTest | ,
|  | EncodeCustomTypes |
| ) |  |

Definition at line 1254 of file fl_standard_message_codec_test.cc.

1254 {
1255 g_autoptr(FlValue) value = fl_value_new_list();
1256 fl_value_append_take(value, fl_value_new_custom(128, "hello", nullptr));
1257 fl_value_append_take(value, fl_value_new_custom(129, nullptr, nullptr));
1258 g_autoptr(FlTestStandardMessageCodec) codec =
1259 fl_test_standard_message_codec_new();
1260 g_autofree gchar* hex_string =
1261 encode_message_with_codec(value, FL_MESSAGE_CODEC(codec));
1262 EXPECT_STREQ(hex_string, "0c02800568656c6c6f81");
1263 }
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600

References encode_message_with_codec(), fl_test_standard_message_codec_new(), fl_value_append_take(), fl_value_new_custom(), fl_value_new_list(), and value.

## ◆ TEST() [85/126]

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

Definition at line 1265 of file fl_standard_message_codec_test.cc.

1265 {
1266 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1267
1268 g_autoptr(FlValue) input = fl_value_new_list();
1269 fl_value_append_take(input, fl_value_new_null());
1270 fl_value_append_take(input, fl_value_new_bool(TRUE));
1271 fl_value_append_take(input, fl_value_new_int(42));
1272 fl_value_append_take(input, fl_value_new_float(M_PI));
1273 fl_value_append_take(input, fl_value_new_string("hello"));
1274 fl_value_append_take(input, fl_value_new_list());
1275 fl_value_append_take(input, fl_value_new_map());
1276
1277 g_autoptr(GError) error = nullptr;
1278 g_autoptr(GBytes) message =
1279 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), input, &error);
1280 EXPECT_NE(message, nullptr);
1281 EXPECT_EQ(error, nullptr);
1282
1283 g_autoptr(FlValue) output =
1284 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1285 EXPECT_EQ(error, nullptr);
1286 EXPECT_NE(output, nullptr);
1287
1288 ASSERT_TRUE(fl_value_equal(input, output));
1289 }
fl_value_new_null
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
fl_value_new_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366

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() [86/126]

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

Definition at line 784 of file fl_standard_message_codec_test.cc.

784 {
785 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
786
787 g_autoptr(FlValue) value = fl_value_new_list();
788 for (int i = 0; i < 65535; i++) {
789 fl_value_append_take(value, fl_value_new_int(i));
790 }
791
792 g_autoptr(GError) error = nullptr;
793 g_autoptr(GBytes) message =
794 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
795 EXPECT_NE(message, nullptr);
796 EXPECT_EQ(error, nullptr);
797
798 g_autoptr(FlValue) decoded_value =
799 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
800 EXPECT_EQ(error, nullptr);
801 EXPECT_NE(value, nullptr);
802
803 ASSERT_TRUE(fl_value_equal(value, decoded_value));
804 }

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(), i, and value.

## ◆ TEST() [87/126]

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

Definition at line 1065 of file fl_standard_message_codec_test.cc.

1065 {
1066 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1067
1068 g_autoptr(FlValue) value = fl_value_new_map();
1069 for (int i = 0; i < 512; i++) {
1070 g_autofree gchar* key = g_strdup_printf("key%d", i);
1071 fl_value_set_string_take(value, key, fl_value_new_int(i));
1072 }
1073
1074 g_autoptr(GError) error = nullptr;
1075 g_autoptr(GBytes) message =
1076 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
1077 EXPECT_NE(message, nullptr);
1078 EXPECT_EQ(error, nullptr);
1079
1080 g_autoptr(FlValue) decoded_value =
1081 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1082 EXPECT_EQ(error, nullptr);
1083 EXPECT_NE(value, nullptr);
1084
1085 ASSERT_TRUE(fl_value_equal(value, decoded_value));
1086 }
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:650

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(), i, and value.

## ◆ TEST() [88/126]

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

Definition at line 561 of file fl_standard_message_codec_test.cc.

561 {
562 float data[] = {0.0f, -0.5f, 0.25f, -0.125f, 0.00625f};
563 g_autoptr(FlValue) value = fl_value_new_float32_list(data, 5);
564 g_autofree gchar* hex_string = encode_message(value);
565 EXPECT_STREQ(hex_string, "0e05000000000000000000bf0000803e000000becdcccc3b");
566 }
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:329

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

## ◆ TEST() [89/126]

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

Definition at line 555 of file fl_standard_message_codec_test.cc.

555 {
556 g_autoptr(FlValue) value = fl_value_new_float32_list(nullptr, 0);
557 g_autofree gchar* hex_string = encode_message(value);
558 EXPECT_STREQ(hex_string, "0e000000");
559 }

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

## ◆ TEST() [90/126]

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

Definition at line 252 of file fl_standard_message_codec_test.cc.

252 {
253 g_autofree gchar* hex_string = encode_float(M_PI);
254 EXPECT_STREQ(hex_string, "0600000000000000182d4454fb210940");
255 }
encode_float
static gchar * encode_float(double value)
Definition: fl_standard_message_codec_test.cc:227

References encode_float().

## ◆ TEST() [91/126]

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

Definition at line 247 of file fl_standard_message_codec_test.cc.

247 {
248 g_autofree gchar* hex_string = encode_float(0.5);
249 EXPECT_STREQ(hex_string, "0600000000000000000000000000e03f");
250 }

References encode_float().

## ◆ TEST() [92/126]

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

Definition at line 267 of file fl_standard_message_codec_test.cc.

267 {
268 g_autofree gchar* hex_string = encode_float(INFINITY);
269 EXPECT_STREQ(hex_string, "0600000000000000000000000000f07f");
270 }

References encode_float().

## ◆ TEST() [93/126]

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

Definition at line 613 of file fl_standard_message_codec_test.cc.

613 {
614 double data[] = {0, -0.5, 0.25, -0.125, 0.00625};
615 g_autoptr(FlValue) value = fl_value_new_float_list(data, 5);
616 g_autofree gchar* hex_string = encode_message(value);
617 EXPECT_STREQ(
618 hex_string,
619 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
620 "0000c0bf9a9999999999793f");
621 }
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:339

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

## ◆ TEST() [94/126]

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

Definition at line 607 of file fl_standard_message_codec_test.cc.

607 {
608 g_autoptr(FlValue) value = fl_value_new_float_list(nullptr, 0);
609 g_autofree gchar* hex_string = encode_message(value);
610 EXPECT_STREQ(hex_string, "0b00000000000000");
611 }

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

## ◆ TEST() [95/126]

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

Definition at line 242 of file fl_standard_message_codec_test.cc.

242 {
243 g_autofree gchar* hex_string = encode_float(-1);
244 EXPECT_STREQ(hex_string, "0600000000000000000000000000f0bf");
245 }

References encode_float().

## ◆ TEST() [96/126]

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

Definition at line 257 of file fl_standard_message_codec_test.cc.

257 {
258 g_autofree gchar* hex_string = encode_float(-0.0);
259 EXPECT_STREQ(hex_string, "06000000000000000000000000000080");
260 }

References encode_float().

## ◆ TEST() [97/126]

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

Definition at line 262 of file fl_standard_message_codec_test.cc.

262 {
263 g_autofree gchar* hex_string = encode_float(NAN);
264 EXPECT_STREQ(hex_string, "0600000000000000000000000000f87f");
265 }

References encode_float().

## ◆ TEST() [98/126]

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

Definition at line 237 of file fl_standard_message_codec_test.cc.

237 {
238 g_autofree gchar* hex_string = encode_float(1);
239 EXPECT_STREQ(hex_string, "0600000000000000000000000000f03f");
240 }

References encode_float().

## ◆ TEST() [99/126]

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

Definition at line 232 of file fl_standard_message_codec_test.cc.

232 {
233 g_autofree gchar* hex_string = encode_float(0);
234 EXPECT_STREQ(hex_string, "06000000000000000000000000000000");
235 }

References encode_float().

## ◆ TEST() [100/126]

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

Definition at line 119 of file fl_standard_message_codec_test.cc.

119 {
120 g_autofree gchar* hex_string = encode_int(0x01234567);
121 EXPECT_STREQ(hex_string, "0367452301");
122 }
encode_int
static gchar * encode_int(int64_t value)
Definition: fl_standard_message_codec_test.cc:104

References encode_int().

## ◆ TEST() [101/126]

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

Definition at line 451 of file fl_standard_message_codec_test.cc.

451 {
452 int32_t data[] = {0, -1, 2, -3, 4};
453 g_autoptr(FlValue) value = fl_value_new_int32_list(data, 5);
454 g_autofree gchar* hex_string = encode_message(value);
455 EXPECT_STREQ(hex_string, "0905000000000000ffffffff02000000fdffffff04000000");
456 }
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:309

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

## ◆ TEST() [102/126]

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

Definition at line 445 of file fl_standard_message_codec_test.cc.

445 {
446 g_autoptr(FlValue) value = fl_value_new_int32_list(nullptr, 0);
447 g_autofree gchar* hex_string = encode_message(value);
448 EXPECT_STREQ(hex_string, "09000000");
449 }

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

## ◆ TEST() [103/126]

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

Definition at line 129 of file fl_standard_message_codec_test.cc.

129 {
130 g_autofree gchar* hex_string = encode_int(G_MAXINT32);
131 EXPECT_STREQ(hex_string, "03ffffff7f");
132 }

References encode_int().

## ◆ TEST() [104/126]

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

Definition at line 124 of file fl_standard_message_codec_test.cc.

124 {
125 g_autofree gchar* hex_string = encode_int(G_MININT32);
126 EXPECT_STREQ(hex_string, "0300000080");
127 }

References encode_int().

## ◆ TEST() [105/126]

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

Definition at line 134 of file fl_standard_message_codec_test.cc.

134 {
135 g_autofree gchar* hex_string = encode_int(0x0123456789abcdef);
136 EXPECT_STREQ(hex_string, "04efcdab8967452301");
137 }

References encode_int().

## ◆ TEST() [106/126]

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

Definition at line 503 of file fl_standard_message_codec_test.cc.

503 {
504 int64_t data[] = {0, -1, 2, -3, 4};
505 g_autoptr(FlValue) value = fl_value_new_int64_list(data, 5);
506 g_autofree gchar* hex_string = encode_message(value);
507 EXPECT_STREQ(
508 hex_string,
509 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
510 "ffffffff0400000000000000");
511 }
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:319

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

## ◆ TEST() [107/126]

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

Definition at line 497 of file fl_standard_message_codec_test.cc.

497 {
498 g_autoptr(FlValue) value = fl_value_new_int64_list(nullptr, 0);
499 g_autofree gchar* hex_string = encode_message(value);
500 EXPECT_STREQ(hex_string, "0a00000000000000");
501 }

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

## ◆ TEST() [108/126]

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

Definition at line 144 of file fl_standard_message_codec_test.cc.

144 {
145 g_autofree gchar* hex_string = encode_int(G_MAXINT64);
146 EXPECT_STREQ(hex_string, "04ffffffffffffff7f");
147 }

References encode_int().

## ◆ TEST() [109/126]

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

Definition at line 139 of file fl_standard_message_codec_test.cc.

139 {
140 g_autofree gchar* hex_string = encode_int(G_MININT64);
141 EXPECT_STREQ(hex_string, "040000000000000080");
142 }

References encode_int().

## ◆ TEST() [110/126]

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

Definition at line 114 of file fl_standard_message_codec_test.cc.

114 {
115 g_autofree gchar* hex_string = encode_int(1);
116 EXPECT_STREQ(hex_string, "0301000000");
117 }

References encode_int().

## ◆ TEST() [111/126]

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

Definition at line 109 of file fl_standard_message_codec_test.cc.

109 {
110 g_autofree gchar* hex_string = encode_int(0);
111 EXPECT_STREQ(hex_string, "0300000000");
112 }

References encode_int().

## ◆ TEST() [112/126]

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

Definition at line 665 of file fl_standard_message_codec_test.cc.

665 {
666 g_autoptr(FlValue) value = fl_value_new_list();
667 g_autofree gchar* hex_string = encode_message(value);
668 EXPECT_STREQ(hex_string, "0c00");
669 }

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

## ◆ TEST() [113/126]

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

Definition at line 686 of file fl_standard_message_codec_test.cc.

686 {
687 g_autoptr(FlValue) even_numbers = fl_value_new_list();
688 g_autoptr(FlValue) odd_numbers = fl_value_new_list();
689 for (int i = 0; i < 10; i++) {
690 if (i % 2 == 0) {
691 fl_value_append_take(even_numbers, fl_value_new_int(i));
692 } else {
693 fl_value_append_take(odd_numbers, fl_value_new_int(i));
694 }
695 }
696 g_autoptr(FlValue) value = fl_value_new_list();
697 fl_value_append(value, even_numbers);
698 fl_value_append(value, odd_numbers);
699 g_autofree gchar* hex_string = encode_message(value);
700 EXPECT_STREQ(hex_string,
701 "0c020c05030000000003020000000304000000030600000003080000000c"
702 "0503010000000303000000030500000003070000000309000000");
703 }
fl_value_append
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592

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

## ◆ TEST() [114/126]

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

Definition at line 671 of file fl_standard_message_codec_test.cc.

671 {
672 g_autoptr(FlValue) value = fl_value_new_list();
673 fl_value_append_take(value, fl_value_new_null());
674 fl_value_append_take(value, fl_value_new_bool(TRUE));
675 fl_value_append_take(value, fl_value_new_int(42));
676 fl_value_append_take(value, fl_value_new_float(M_PI));
677 fl_value_append_take(value, fl_value_new_string("hello"));
678 fl_value_append_take(value, fl_value_new_list());
679 fl_value_append_take(value, fl_value_new_map());
680 g_autofree gchar* hex_string = encode_message(value);
681 EXPECT_STREQ(
682 hex_string,
683 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
684 }

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() [115/126]

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

Definition at line 806 of file fl_standard_message_codec_test.cc.

806 {
807 g_autoptr(FlValue) value = fl_value_new_map();
808 g_autofree gchar* hex_string = encode_message(value);
809 EXPECT_STREQ(hex_string, "0d00");
810 }

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

## ◆ TEST() [116/126]

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

Definition at line 812 of file fl_standard_message_codec_test.cc.

812 {
813 g_autoptr(FlValue) value = fl_value_new_map();
814 fl_value_set_take(value, fl_value_new_null(), fl_value_new_string("null"));
815 fl_value_set_take(value, fl_value_new_bool(TRUE),
816 fl_value_new_string("bool"));
817 fl_value_set_take(value, fl_value_new_int(42), fl_value_new_string("int"));
818 fl_value_set_take(value, fl_value_new_float(M_PI),
819 fl_value_new_string("float"));
820 fl_value_set_take(value, fl_value_new_string("hello"),
821 fl_value_new_string("string"));
822 fl_value_set_take(value, fl_value_new_list(), fl_value_new_string("list"));
823 fl_value_set_take(value, fl_value_new_map(), fl_value_new_string("map"));
824 g_autofree gchar* hex_string = encode_message(value);
825 EXPECT_STREQ(hex_string,
826 "0d070007046e756c6c010704626f6f6c032a0000000703696e7406000000000"
827 "0182d4454fb2109400705666c6f6174070568656c6c6f0706737472696e670c"
828 "0007046c6973740d0007036d6170");
829 }
fl_value_set_take
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:618

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() [117/126]

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

Definition at line 850 of file fl_standard_message_codec_test.cc.

850 {
851 g_autoptr(FlValue) str_to_int = fl_value_new_map();
852 g_autoptr(FlValue) int_to_str = fl_value_new_map();
853 const char* numbers[] = {"zero", "one", "two", "three", nullptr};
854 for (int i = 0; numbers[i] != nullptr; i++) {
855 fl_value_set_take(str_to_int, fl_value_new_string(numbers[i]),
856 fl_value_new_int(i));
857 fl_value_set_take(int_to_str, fl_value_new_int(i),
858 fl_value_new_string(numbers[i]));
859 }
860 g_autoptr(FlValue) value = fl_value_new_map();
861 fl_value_set_string(value, "str-to-int", str_to_int);
862 fl_value_set_string(value, "int-to-str", int_to_str);
863 g_autofree gchar* hex_string = encode_message(value);
864 EXPECT_STREQ(hex_string,
865 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6"
866 "50301000000070374776f0302000000070574687265650303000000070a696e"
867 "742d746f2d7374720d04030000000007047a65726f030100000007036f6e650"
868 "302000000070374776f030300000007057468726565");
869 }
fl_value_set_string
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:639

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

## ◆ TEST() [118/126]

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

Definition at line 831 of file fl_standard_message_codec_test.cc.

831 {
832 g_autoptr(FlValue) value = fl_value_new_map();
833 fl_value_set_take(value, fl_value_new_string("null"), fl_value_new_null());
834 fl_value_set_take(value, fl_value_new_string("bool"),
835 fl_value_new_bool(TRUE));
836 fl_value_set_take(value, fl_value_new_string("int"), fl_value_new_int(42));
837 fl_value_set_take(value, fl_value_new_string("float"),
838 fl_value_new_float(M_PI));
839 fl_value_set_take(value, fl_value_new_string("string"),
840 fl_value_new_string("hello"));
841 fl_value_set_take(value, fl_value_new_string("list"), fl_value_new_list());
842 fl_value_set_take(value, fl_value_new_string("map"), fl_value_new_map());
843 g_autofree gchar* hex_string = encode_message(value);
844 EXPECT_STREQ(hex_string,
845 "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6"
846 "17406000000000000182d4454fb2109400706737472696e67070568656c6c6f"
847 "07046c6973740c0007036d61700d00");
848 }

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() [119/126]

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

Definition at line 70 of file fl_standard_message_codec_test.cc.

70 {
71 g_autoptr(FlValue) value = fl_value_new_null();
72 g_autofree gchar* hex_string = encode_message(value);
73 EXPECT_STREQ(hex_string, "00");
74 }

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

## ◆ TEST() [120/126]

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

Definition at line 65 of file fl_standard_message_codec_test.cc.

65 {
66 g_autofree gchar* hex_string = encode_message(nullptr);
67 EXPECT_STREQ(hex_string, "00");
68 }

References encode_message().

## ◆ TEST() [121/126]

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

Definition at line 340 of file fl_standard_message_codec_test.cc.

340 {
341 g_autofree gchar* hex_string = encode_string("");
342 EXPECT_STREQ(hex_string, "0700");
343 }
encode_string
static gchar * encode_string(const gchar *value)
Definition: fl_standard_message_codec_test.cc:335

References encode_string().

## ◆ TEST() [122/126]

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

Definition at line 350 of file fl_standard_message_codec_test.cc.

350 {
351 g_autoptr(FlValue) value = fl_value_new_string_sized(nullptr, 0);
352 g_autofree gchar* hex_string = encode_message(value);
353 EXPECT_STREQ(hex_string, "0700");
354 }
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:283

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

## ◆ TEST() [123/126]

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

Definition at line 345 of file fl_standard_message_codec_test.cc.

345 {
346 g_autofree gchar* hex_string = encode_string("hello");
347 EXPECT_STREQ(hex_string, "070568656c6c6f");
348 }

References encode_string().

## ◆ TEST() [124/126]

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

Definition at line 356 of file fl_standard_message_codec_test.cc.

356 {
357 g_autoptr(FlValue) value = fl_value_new_string_sized("Hello World", 5);
358 g_autofree gchar* hex_string = encode_message(value);
359 EXPECT_STREQ(hex_string, "070548656c6c6f");
360 }

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

## ◆ TEST() [125/126]

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

Definition at line 400 of file fl_standard_message_codec_test.cc.

400 {
401 uint8_t data[] = {0, 1, 2, 3, 4};
402 g_autoptr(FlValue) value = fl_value_new_uint8_list(data, 5);
403 g_autofree gchar* hex_string = encode_message(value);
404 EXPECT_STREQ(hex_string, "08050001020304");
405 }
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:292

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

## ◆ TEST() [126/126]

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

Definition at line 394 of file fl_standard_message_codec_test.cc.

394 {
395 g_autoptr(FlValue) value = fl_value_new_uint8_list(nullptr, 0);
396 g_autofree gchar* hex_string = encode_message(value);
397 EXPECT_STREQ(hex_string, "0800");
398 }

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

## ◆ write_custom_value2()

static gboolean write_custom_value2 | ( | FlStandardMessageCodec * | codec,
|  | GByteArray * | buffer,
|  | FlValue * | value,
|  | GError ** | error
| ) |  |
| static

Definition at line 1122 of file fl_standard_message_codec_test.cc.

1125 {
1126 uint8_t type = 129;
1127 g_byte_array_append(buffer, &type, sizeof(uint8_t));
1128 return TRUE;
1129 }
g_byte_array_append
g_byte_array_append(buffer, &type, sizeof(uint8_t))

References buffer, g_byte_array_append(), TRUE, and type.

Referenced by fl_test_standard_message_codec_write_value().

## Variable Documentation

## ◆ buffer

GByteArray* buffer

Definition at line 1108 of file fl_standard_message_codec_test.cc.

Referenced by fl_test_standard_message_codec_read_value_of_type(), fl_test_standard_message_codec_write_value(), read_custom_value1(), and write_custom_value2().

## ◆ error

GByteArray FlValue GError** error

Initial value:
{
const gchar* text =
static_cast<const gchar*>(fl_value_get_custom_value(value))

Definition at line 1110 of file fl_standard_message_codec_test.cc.

Referenced by decode_error_value(), decode_message_with_codec(), encode_message_with_codec(), fl_test_standard_message_codec_read_value_of_type(), fl_test_standard_message_codec_write_value(), read_custom_value1(), and TEST().

## ◆ length

size_t length = strlen(text)

Definition at line 1113 of file fl_standard_message_codec_test.cc.

Referenced by fl_accessible_text_field_insert_text(), fl_json_method_codec_decode_response(), fl_standard_message_codec_real_write_value(), fl_value_new_uint8_list_from_bytes(), flutter::GetExecutableDirectory(), FlValueHandler::Key(), read_custom_value1(), read_float32_list_value(), read_float64_list_value(), read_int32_list_value(), read_int64_list_value(), read_list_value(), read_map_value(), read_string_value(), read_uint8_list_value(), flutter::ByteBufferStreamReader::ReadBytes(), flutter::StandardCodecSerializer::ReadValueOfType(), FlValueHandler::String(), synchronize_pressed_states_loop_body(), and flutter::ByteBufferStreamWriter::WriteBytes().

## ◆ TRUE

return TRUE

Definition at line 1119 of file fl_standard_message_codec_test.cc.

Referenced by TEST(), and write_custom_value2().

## ◆ type

uint8_t type = 128

Definition at line 1115 of file fl_standard_message_codec_test.cc.

Referenced by fl_key_channel_responder_handle_event(), fl_key_event_channel_send(), fl_key_event_hash(), fl_key_event_new_from_gdk_event(), fl_platform_channel_system_request_app_exit(), fl_standard_message_codec_read_value(), fl_standard_message_codec_read_value_of_type(), fl_standard_method_codec_decode_response(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_success_envelope(), fl_test_standard_message_codec_read_value_of_type(), fl_value_new(), fl_value_new_custom(), fl_value_new_custom_object(), fl_value_new_custom_object_take(), G_DECLARE_DERIVABLE_TYPE(), flutter::StandardCodecSerializer::ReadValue(), flutter::StandardCodecSerializer::ReadValueOfType(), request_app_exit(), synchronize_lock_states_loop_body(), synthesize_simple_event(), system_exit_application(), system_sound_play(), TEST(), and write_custom_value2().

## ◆ value

GByteArray FlValue* value

Definition at line 1109 of file fl_standard_message_codec_test.cc.

Referenced by decode_error_value(), decode_message_with_codec(), encode_bool(), encode_float(), encode_int(), encode_message(), encode_message_with_codec(), encode_string(), fl_test_standard_message_codec_write_value(), read_custom_value1(), and TEST().