| 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 <cmath>`
`#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 55 of file fl_standard_message_codec_test.cc.

57 {
58 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
59 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
60 g_autoptr(GError) error = nullptr;
61 g_autoptr(FlValue) value =
62 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
63 EXPECT_TRUE(value == nullptr);
64 EXPECT_TRUE(g_error_matches(error, domain, code));
65 }
g_autoptr
g_autoptr(GMutexLocker) locker
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:1112
value
GByteArray FlValue * value
Definition: fl_standard_message_codec_test.cc:1111
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42

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

Referenced by TEST().

## ◆ decode_message()

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

Definition at line 48 of file fl_standard_message_codec_test.cc.

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

References decode_message_with_codec(), fl_standard_message_codec_new(), and g_autoptr().

Referenced by TEST().

## ◆ decode_message_with_codec()

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

Definition at line 35 of file fl_standard_message_codec_test.cc.

36 {
37 g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
38 g_autoptr(GError) error = nullptr;
39 g_autoptr(FlValue) value =
40 fl_message_codec_decode_message(codec, data, &error);
41 EXPECT_EQ(error, nullptr);
42 EXPECT_NE(value, nullptr);
43 return fl_value_ref(value);
44 }
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(), g_autoptr(), and value.

Referenced by decode_message(), and TEST().

## ◆ encode_bool()

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

Definition at line 91 of file fl_standard_message_codec_test.cc.

91 {
92 g_autoptr(FlValue) v = fl_value_new_bool(value);
93 return encode_message(v);
94 }
encode_message
static gchar * encode_message(FlValue *value)
Definition: fl_standard_message_codec_test.cc:28
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(), g_autoptr(), and value.

Referenced by TEST().

## ◆ encode_float()

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

Definition at line 229 of file fl_standard_message_codec_test.cc.

229 {
230 g_autoptr(FlValue) v = fl_value_new_float(value);
231 return encode_message(v);
232 }
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(), g_autoptr(), and value.

Referenced by TEST().

## ◆ encode_int()

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

Definition at line 106 of file fl_standard_message_codec_test.cc.

106 {
107 g_autoptr(FlValue) v = fl_value_new_int(value);
108 return encode_message(v);
109 }
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(), g_autoptr(), and value.

Referenced by TEST().

## ◆ encode_message()

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

Definition at line 28 of file fl_standard_message_codec_test.cc.

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

References encode_message_with_codec(), fl_standard_message_codec_new(), g_autoptr(), 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 16 of file fl_standard_message_codec_test.cc.

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

Referenced by encode_message(), and TEST().

## ◆ encode_string()

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

Definition at line 337 of file fl_standard_message_codec_test.cc.

337 {
338 g_autoptr(FlValue) v = fl_value_new_string(value);
339 return encode_message(v);
340 }
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(), g_autoptr(), 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 1200 of file fl_standard_message_codec_test.cc.

1201 {
1202 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->write_value =
1203 fl_test_standard_message_codec_write_value;
1204 FL_STANDARD_MESSAGE_CODEC_CLASS(klass)->read_value_of_type =
1205 fl_test_standard_message_codec_read_value_of_type;
1206 }
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:1133
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:1183

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

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

## ◆ fl_test_standard_message_codec_new()

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

Definition at line 1214 of file fl_standard_message_codec_test.cc.

1214 {
1215 return FL_TEST_STANDARD_MESSAGE_CODEC(
1216 g_object_new(fl_test_standard_message_codec_get_type(), nullptr));
1217 }

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

1188 {
1189 if (type == 128) {
1190 return read_custom_value1(codec, buffer, offset, error);
1191 } else if (type == 129) {
1192 return read_custom_value2(codec, buffer, offset, error);
1193 } else {
1194 return FL_STANDARD_MESSAGE_CODEC_CLASS(
1195 fl_test_standard_message_codec_parent_class)
1196 ->read_value_of_type(codec, buffer, offset, type, error);
1197 }
1198 }
type
uint8_t type
Definition: fl_standard_message_codec_test.cc:1117
read_custom_value2
static FlValue * read_custom_value2(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
Definition: fl_standard_message_codec_test.cc:1176
read_custom_value1
static FlValue * read_custom_value1(FlStandardMessageCodec *codec, GBytes *buffer, size_t *offset, GError **error)
Definition: fl_standard_message_codec_test.cc:1151
buffer
GByteArray * buffer
Definition: fl_standard_message_codec_test.cc:1110

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

1137 {
1138 if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM &&
1139 fl_value_get_custom_type(value) == 128) {
1140 return write_custom_value1(codec, buffer, value, error);
1141 } else if (fl_value_get_type(value) == FL_VALUE_TYPE_CUSTOM &&
1142 fl_value_get_custom_type(value) == 129) {
1143 return write_custom_value2(codec, buffer, value, error);
1144 } else {
1145 return FL_STANDARD_MESSAGE_CODEC_CLASS(
1146 fl_test_standard_message_codec_parent_class)
1147 ->write_value(codec, buffer, value, error);
1148 }
1149 }
write_custom_value2
static gboolean write_custom_value2(FlStandardMessageCodec *codec, GByteArray *buffer, FlValue *value, GError **error)
Definition: fl_standard_message_codec_test.cc:1124
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 1095 of file fl_standard_message_codec_test.cc.

1101 {
1102 FlStandardMessageCodec parent_instance;
1103 };

## ◆ 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 1151 of file fl_standard_message_codec_test.cc.

1154 {
1155 uint32_t length;
1156 if (!fl_standard_message_codec_read_size(codec, buffer, offset, &length,
1157 error)) {
1158 return nullptr;
1159 }
1160 if (*offset + length > g_bytes_get_size(buffer)) {
1161 g_set_error(error, FL_MESSAGE_CODEC_ERROR,
1162 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA, "Unexpected end of data");
1163 return nullptr;
1164 }
1165 FlValue* value = fl_value_new_custom(
1166 128,
1167 g_strndup(static_cast<const gchar*>(g_bytes_get_data(buffer, nullptr)) +
1168 *offset,
1169 length),
1170 g_free);
1171 *offset += length;
1172
1173 return value;
1174 }
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:1115
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 1176 of file fl_standard_message_codec_test.cc.

1179 {
1180 return fl_value_new_custom(129, nullptr, nullptr);
1181 }

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

1219 {
1220 g_autoptr(FlTestStandardMessageCodec) codec =
1221 fl_test_standard_message_codec_new();
1222 g_autoptr(FlValue) value =
1223 decode_message_with_codec("800568656c6c6f", FL_MESSAGE_CODEC(codec));
1224 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_CUSTOM);
1225 ASSERT_EQ(fl_value_get_custom_type(value), 128);
1226 EXPECT_STREQ(static_cast<const gchar*>(fl_value_get_custom_value(value)),
1227 "hello");
1228 }
fl_test_standard_message_codec_new
static FlTestStandardMessageCodec * fl_test_standard_message_codec_new()
Definition: fl_standard_message_codec_test.cc:1214
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, g_autoptr(), and value.

## ◆ TEST() [2/126]

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

Definition at line 1230 of file fl_standard_message_codec_test.cc.

1230 {
1231 g_autoptr(FlTestStandardMessageCodec) codec =
1232 fl_test_standard_message_codec_new();
1233 g_autoptr(FlValue) value = decode_message_with_codec("0c02800568656c6c6f81",
1234 FL_MESSAGE_CODEC(codec));
1235 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
1236 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
1237 FlValue* value1 = fl_value_get_list_value(value, 0);
1238 ASSERT_EQ(fl_value_get_type(value1), FL_VALUE_TYPE_CUSTOM);
1239 ASSERT_EQ(fl_value_get_custom_type(value1), 128);
1240 EXPECT_STREQ(static_cast<const gchar*>(fl_value_get_custom_value(value1)),
1241 "hello");
1242 FlValue* value2 = fl_value_get_list_value(value, 1);
1243 ASSERT_EQ(fl_value_get_type(value2), FL_VALUE_TYPE_CUSTOM);
1244 ASSERT_EQ(fl_value_get_custom_type(value2), 129);
1245 }
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, g_autoptr(), and value.

## ◆ TEST() [3/126]

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

Definition at line 576 of file fl_standard_message_codec_test.cc.

576 {
577 g_autoptr(FlValue) value =
578 decode_message("0e05000000000000000000bf0000803e000000becdcccc3b");
579 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT32_LIST);
580 const float* data = fl_value_get_float32_list(value);
581 EXPECT_FLOAT_EQ(data[0], 0.0f);
582 EXPECT_FLOAT_EQ(data[1], -0.5f);
583 EXPECT_FLOAT_EQ(data[2], 0.25f);
584 EXPECT_FLOAT_EQ(data[3], -0.125f);
585 EXPECT_FLOAT_EQ(data[4], 0.00625f);
586 }
decode_message
static FlValue * decode_message(const char *hex_string)
Definition: fl_standard_message_codec_test.cc:48
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, g_autoptr(), and value.

## ◆ TEST() [4/126]

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

Definition at line 570 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [5/126]

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

Definition at line 593 of file fl_standard_message_codec_test.cc.

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

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

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

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

598 {
599 decode_error_value("0e05000000", FL_MESSAGE_CODEC_ERROR,
600 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
601 }

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

603 {
604 decode_error_value("0e05000000000000000000bf0000803e000000becdcccc",
605 FL_MESSAGE_CODEC_ERROR,
606 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
607 }

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

292 {
293 g_autoptr(FlValue) value = decode_message("0600000000000000000000000000e03f");
294 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
295 EXPECT_EQ(fl_value_get_float(value), 0.5);
296 }
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, g_autoptr(), and value.

## ◆ TEST() [10/126]

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

Definition at line 316 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [11/126]

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

Definition at line 631 of file fl_standard_message_codec_test.cc.

631 {
632 g_autoptr(FlValue) value = decode_message(
633 "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
634 "0000c0bf9a9999999999793f");
635 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT_LIST);
636 const double* data = fl_value_get_float_list(value);
637 EXPECT_FLOAT_EQ(data[0], 0.0);
638 EXPECT_FLOAT_EQ(data[1], -0.5);
639 EXPECT_FLOAT_EQ(data[2], 0.25);
640 EXPECT_FLOAT_EQ(data[3], -0.125);
641 EXPECT_FLOAT_EQ(data[4], 0.00625);
642 }
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, g_autoptr(), and value.

## ◆ TEST() [12/126]

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

Definition at line 625 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [13/126]

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

Definition at line 649 of file fl_standard_message_codec_test.cc.

649 {
650 decode_error_value("0b05000000000000", FL_MESSAGE_CODEC_ERROR,
651 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
652 }

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

644 {
645 decode_error_value("0b", FL_MESSAGE_CODEC_ERROR,
646 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
647 }

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

654 {
655 decode_error_value("0b0500000000000000", FL_MESSAGE_CODEC_ERROR,
656 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
657 }

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

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

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

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

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

## ◆ TEST() [18/126]

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

Definition at line 304 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [19/126]

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

Definition at line 310 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [20/126]

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

Definition at line 322 of file fl_standard_message_codec_test.cc.

322 {
323 decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
324 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
325 }

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

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

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

## ◆ TEST() [22/126]

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

Definition at line 298 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [23/126]

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

Definition at line 327 of file fl_standard_message_codec_test.cc.

327 {
328 decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
329 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
330 }

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

332 {
333 decode_error_value("060000000000000000000000000000", FL_MESSAGE_CODEC_ERROR,
334 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
335 }

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

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

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

## ◆ TEST() [26/126]

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

Definition at line 163 of file fl_standard_message_codec_test.cc.

163 {
164 g_autoptr(FlValue) value = decode_message("0367452301");
165 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
166 EXPECT_EQ(fl_value_get_int(value), 0x01234567);
167 }
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, g_autoptr(), and value.

## ◆ TEST() [27/126]

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

Definition at line 466 of file fl_standard_message_codec_test.cc.

466 {
467 g_autoptr(FlValue) value =
468 decode_message("0905000000000000ffffffff02000000fdffffff04000000");
469 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT32_LIST);
470 const int32_t* data = fl_value_get_int32_list(value);
471 EXPECT_EQ(data[0], 0);
472 EXPECT_EQ(data[1], -1);
473 EXPECT_EQ(data[2], 2);
474 EXPECT_EQ(data[3], -3);
475 EXPECT_EQ(data[4], 4);
476 }
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, g_autoptr(), and value.

## ◆ TEST() [28/126]

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

Definition at line 460 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [29/126]

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

Definition at line 483 of file fl_standard_message_codec_test.cc.

483 {
484 decode_error_value("09050000", FL_MESSAGE_CODEC_ERROR,
485 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
486 }

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

478 {
479 decode_error_value("09", FL_MESSAGE_CODEC_ERROR,
480 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
481 }

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

488 {
489 decode_error_value("0905000000", FL_MESSAGE_CODEC_ERROR,
490 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
491 }

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

493 {
494 decode_error_value("090500000000ffffffff02000000fdffffff040000",
495 FL_MESSAGE_CODEC_ERROR,
496 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
497 }

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

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

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

## ◆ TEST() [34/126]

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

Definition at line 169 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [35/126]

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

Definition at line 199 of file fl_standard_message_codec_test.cc.

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

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [36/126]

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

Definition at line 181 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [37/126]

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

Definition at line 521 of file fl_standard_message_codec_test.cc.

521 {
522 g_autoptr(FlValue) value = decode_message(
523 "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
524 "ffffffff0400000000000000");
525 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT64_LIST);
526 const int64_t* data = fl_value_get_int64_list(value);
527 EXPECT_EQ(data[0], 0);
528 EXPECT_EQ(data[1], -1);
529 EXPECT_EQ(data[2], 2);
530 EXPECT_EQ(data[3], -3);
531 EXPECT_EQ(data[4], 4);
532 }
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, g_autoptr(), and value.

## ◆ TEST() [38/126]

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

Definition at line 515 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [39/126]

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

Definition at line 539 of file fl_standard_message_codec_test.cc.

539 {
540 decode_error_value("0a05000000000000", FL_MESSAGE_CODEC_ERROR,
541 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
542 }

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

534 {
535 decode_error_value("0a", FL_MESSAGE_CODEC_ERROR,
536 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
537 }

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

544 {
545 decode_error_value("0a0500000000000000", FL_MESSAGE_CODEC_ERROR,
546 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
547 }

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

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

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

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

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

## ◆ TEST() [44/126]

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

Definition at line 187 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [45/126]

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

Definition at line 214 of file fl_standard_message_codec_test.cc.

214 {
215 decode_error_value("04", FL_MESSAGE_CODEC_ERROR,
216 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
217 }

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

219 {
220 decode_error_value("04ef", FL_MESSAGE_CODEC_ERROR,
221 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
222 }

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

224 {
225 decode_error_value("04efcdab89674523", FL_MESSAGE_CODEC_ERROR,
226 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
227 }

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

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

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

## ◆ TEST() [49/126]

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

Definition at line 204 of file fl_standard_message_codec_test.cc.

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

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [50/126]

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

Definition at line 209 of file fl_standard_message_codec_test.cc.

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

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [51/126]

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

Definition at line 151 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [52/126]

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

Definition at line 707 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [53/126]

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

Definition at line 770 of file fl_standard_message_codec_test.cc.

770 {
771 decode_error_value("0c07", FL_MESSAGE_CODEC_ERROR,
772 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
773 }

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

742 {
743 g_autoptr(FlValue) value = decode_message(
744 "0c020c05030000000003020000000304000000030600000003080000000c"
745 "0503010000000303000000030500000003070000000309000000");
746 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
747 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
748 FlValue* even_list = fl_value_get_list_value(value, 0);
749 ASSERT_EQ(fl_value_get_type(even_list), FL_VALUE_TYPE_LIST);
750 ASSERT_EQ(fl_value_get_length(even_list), static_cast<size_t>(5));
751 FlValue* odd_list = fl_value_get_list_value(value, 1);
752 ASSERT_EQ(fl_value_get_type(odd_list), FL_VALUE_TYPE_LIST);
753 ASSERT_EQ(fl_value_get_length(odd_list), static_cast<size_t>(5));
754 for (int i = 0; i < 5; i++) {
755 FlValue* v = fl_value_get_list_value(even_list, i);
756 ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
757 EXPECT_EQ(fl_value_get_int(v), i * 2);
758
759 v = fl_value_get_list_value(odd_list, i);
760 ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
761 EXPECT_EQ(fl_value_get_int(v), i * 2 + 1);
762 }
763 }
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, g_autoptr(), i, and value.

## ◆ TEST() [55/126]

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

Definition at line 765 of file fl_standard_message_codec_test.cc.

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

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

775 {
776 decode_error_value("0c0700", FL_MESSAGE_CODEC_ERROR,
777 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
778 }

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

780 {
781 decode_error_value(
782 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d",
783 FL_MESSAGE_CODEC_ERROR, FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
784 }

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

713 {
714 g_autoptr(FlValue) value = decode_message(
715 "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
716 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
717 ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
718 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 0)),
719 FL_VALUE_TYPE_NULL);
720 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 1)),
721 FL_VALUE_TYPE_BOOL);
722 EXPECT_TRUE(fl_value_get_bool(fl_value_get_list_value(value, 1)));
723 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 2)),
724 FL_VALUE_TYPE_INT);
725 EXPECT_EQ(fl_value_get_int(fl_value_get_list_value(value, 2)), 42);
726 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 3)),
727 FL_VALUE_TYPE_FLOAT);
728 EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_list_value(value, 3)), M_PI);
729 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 4)),
730 FL_VALUE_TYPE_STRING);
731 EXPECT_STREQ(fl_value_get_string(fl_value_get_list_value(value, 4)), "hello");
732 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 5)),
733 FL_VALUE_TYPE_LIST);
734 ASSERT_EQ(fl_value_get_length(fl_value_get_list_value(value, 5)),
735 static_cast<size_t>(0));
736 ASSERT_EQ(fl_value_get_type(fl_value_get_list_value(value, 6)),
737 FL_VALUE_TYPE_MAP);
738 ASSERT_EQ(fl_value_get_length(fl_value_get_list_value(value, 6)),
739 static_cast<size_t>(0));
740 }
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, g_autoptr(), and value.

## ◆ TEST() [59/126]

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

Definition at line 873 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [60/126]

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

Definition at line 879 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [61/126]

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

Definition at line 1049 of file fl_standard_message_codec_test.cc.

1049 {
1050 decode_error_value("0d07", FL_MESSAGE_CODEC_ERROR,
1051 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1052 }

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

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

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

## ◆ TEST() [63/126]

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

Definition at line 1044 of file fl_standard_message_codec_test.cc.

1044 {
1045 decode_error_value("0d", FL_MESSAGE_CODEC_ERROR,
1046 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1047 }

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

1054 {
1055 decode_error_value("0d0707", FL_MESSAGE_CODEC_ERROR,
1056 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
1057 }

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

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

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

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

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

## ◆ TEST() [67/126]

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

Definition at line 78 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [68/126]

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

Definition at line 364 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [69/126]

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

Definition at line 370 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [70/126]

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

Definition at line 381 of file fl_standard_message_codec_test.cc.

381 {
382 decode_error_value("0705", FL_MESSAGE_CODEC_ERROR,
383 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
384 }

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

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

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [72/126]

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

Definition at line 386 of file fl_standard_message_codec_test.cc.

386 {
387 decode_error_value("070568", FL_MESSAGE_CODEC_ERROR,
388 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
389 }

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

391 {
392 decode_error_value("070568656c6c", FL_MESSAGE_CODEC_ERROR,
393 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
394 }

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

415 {
416 g_autoptr(FlValue) value = decode_message("08050001020304");
417 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_UINT8_LIST);
418 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(5));
419 const uint8_t* data = fl_value_get_uint8_list(value);
420 EXPECT_EQ(data[0], 0);
421 EXPECT_EQ(data[1], 1);
422 EXPECT_EQ(data[2], 2);
423 EXPECT_EQ(data[3], 3);
424 EXPECT_EQ(data[4], 4);
425 }
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, g_autoptr(), and value.

## ◆ TEST() [75/126]

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

Definition at line 409 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [76/126]

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

Definition at line 432 of file fl_standard_message_codec_test.cc.

432 {
433 decode_error_value("0805", FL_MESSAGE_CODEC_ERROR,
434 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
435 }

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

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

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

## ◆ TEST() [78/126]

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

Definition at line 437 of file fl_standard_message_codec_test.cc.

437 {
438 decode_error_value("080500", FL_MESSAGE_CODEC_ERROR,
439 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
440 }

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

442 {
443 decode_error_value("080500010203", FL_MESSAGE_CODEC_ERROR,
444 FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA);
445 }

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

1090 {
1091 decode_error_value("0f", FL_MESSAGE_CODEC_ERROR,
1092 FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE);
1093 }
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 96 of file fl_standard_message_codec_test.cc.

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

References encode_bool().

## ◆ TEST() [82/126]

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

Definition at line 101 of file fl_standard_message_codec_test.cc.

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

References encode_bool(), and TRUE.

## ◆ TEST() [83/126]

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

Definition at line 1247 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [84/126]

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

Definition at line 1256 of file fl_standard_message_codec_test.cc.

1256 {
1257 g_autoptr(FlValue) value = fl_value_new_list();
1258 fl_value_append_take(value, fl_value_new_custom(128, "hello", nullptr));
1259 fl_value_append_take(value, fl_value_new_custom(129, nullptr, nullptr));
1260 g_autoptr(FlTestStandardMessageCodec) codec =
1261 fl_test_standard_message_codec_new();
1262 g_autofree gchar* hex_string =
1263 encode_message_with_codec(value, FL_MESSAGE_CODEC(codec));
1264 EXPECT_STREQ(hex_string, "0c02800568656c6c6f81");
1265 }
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(), g_autoptr(), and value.

## ◆ TEST() [85/126]

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

Definition at line 1267 of file fl_standard_message_codec_test.cc.

1267 {
1268 g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1269
1270 g_autoptr(FlValue) input = fl_value_new_list();
1271 fl_value_append_take(input, fl_value_new_null());
1272 fl_value_append_take(input, fl_value_new_bool(TRUE));
1273 fl_value_append_take(input, fl_value_new_int(42));
1274 fl_value_append_take(input, fl_value_new_float(M_PI));
1275 fl_value_append_take(input, fl_value_new_string("hello"));
1276 fl_value_append_take(input, fl_value_new_list());
1277 fl_value_append_take(input, fl_value_new_map());
1278
1279 g_autoptr(GError) error = nullptr;
1280 g_autoptr(GBytes) message =
1281 fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), input, &error);
1282 EXPECT_NE(message, nullptr);
1283 EXPECT_EQ(error, nullptr);
1284
1285 g_autoptr(FlValue) output =
1286 fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1287 EXPECT_EQ(error, nullptr);
1288 EXPECT_NE(output, nullptr);
1289
1290 ASSERT_TRUE(fl_value_equal(input, output));
1291 }
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(), g_autoptr(), and TRUE.

## ◆ TEST() [86/126]

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

Definition at line 786 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [87/126]

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

Definition at line 1067 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [88/126]

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

Definition at line 563 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [89/126]

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

Definition at line 557 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [90/126]

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

Definition at line 254 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [91/126]

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

Definition at line 249 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [92/126]

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

Definition at line 269 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [93/126]

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

Definition at line 615 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [94/126]

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

Definition at line 609 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [95/126]

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

Definition at line 244 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [96/126]

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

Definition at line 259 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [97/126]

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

Definition at line 264 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [98/126]

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

Definition at line 239 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [99/126]

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

Definition at line 234 of file fl_standard_message_codec_test.cc.

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

References encode_float().

## ◆ TEST() [100/126]

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

Definition at line 121 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [101/126]

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

Definition at line 453 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [102/126]

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

Definition at line 447 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [103/126]

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

Definition at line 131 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [104/126]

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

Definition at line 126 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [105/126]

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

Definition at line 136 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [106/126]

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

Definition at line 505 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [107/126]

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

Definition at line 499 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [108/126]

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

Definition at line 146 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [109/126]

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

Definition at line 141 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [110/126]

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

Definition at line 116 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [111/126]

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

Definition at line 111 of file fl_standard_message_codec_test.cc.

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

References encode_int().

## ◆ TEST() [112/126]

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

Definition at line 667 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [113/126]

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

Definition at line 688 of file fl_standard_message_codec_test.cc.

688 {
689 g_autoptr(FlValue) even_numbers = fl_value_new_list();
690 g_autoptr(FlValue) odd_numbers = fl_value_new_list();
691 for (int i = 0; i < 10; i++) {
692 if (i % 2 == 0) {
693 fl_value_append_take(even_numbers, fl_value_new_int(i));
694 } else {
695 fl_value_append_take(odd_numbers, fl_value_new_int(i));
696 }
697 }
698 g_autoptr(FlValue) value = fl_value_new_list();
699 fl_value_append(value, even_numbers);
700 fl_value_append(value, odd_numbers);
701 g_autofree gchar* hex_string = encode_message(value);
702 EXPECT_STREQ(hex_string,
703 "0c020c05030000000003020000000304000000030600000003080000000c"
704 "0503010000000303000000030500000003070000000309000000");
705 }
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(), g_autoptr(), i, and value.

## ◆ TEST() [114/126]

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

Definition at line 673 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [115/126]

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

Definition at line 808 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [116/126]

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

Definition at line 814 of file fl_standard_message_codec_test.cc.

814 {
815 g_autoptr(FlValue) value = fl_value_new_map();
816 fl_value_set_take(value, fl_value_new_null(), fl_value_new_string("null"));
817 fl_value_set_take(value, fl_value_new_bool(TRUE),
818 fl_value_new_string("bool"));
819 fl_value_set_take(value, fl_value_new_int(42), fl_value_new_string("int"));
820 fl_value_set_take(value, fl_value_new_float(M_PI),
821 fl_value_new_string("float"));
822 fl_value_set_take(value, fl_value_new_string("hello"),
823 fl_value_new_string("string"));
824 fl_value_set_take(value, fl_value_new_list(), fl_value_new_string("list"));
825 fl_value_set_take(value, fl_value_new_map(), fl_value_new_string("map"));
826 g_autofree gchar* hex_string = encode_message(value);
827 EXPECT_STREQ(hex_string,
828 "0d070007046e756c6c010704626f6f6c032a0000000703696e7406000000000"
829 "0182d4454fb2109400705666c6f6174070568656c6c6f0706737472696e670c"
830 "0007046c6973740d0007036d6170");
831 }
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(), g_autoptr(), TRUE, and value.

## ◆ TEST() [117/126]

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

Definition at line 852 of file fl_standard_message_codec_test.cc.

852 {
853 g_autoptr(FlValue) str_to_int = fl_value_new_map();
854 g_autoptr(FlValue) int_to_str = fl_value_new_map();
855 const char* numbers[] = {"zero", "one", "two", "three", nullptr};
856 for (int i = 0; numbers[i] != nullptr; i++) {
857 fl_value_set_take(str_to_int, fl_value_new_string(numbers[i]),
858 fl_value_new_int(i));
859 fl_value_set_take(int_to_str, fl_value_new_int(i),
860 fl_value_new_string(numbers[i]));
861 }
862 g_autoptr(FlValue) value = fl_value_new_map();
863 fl_value_set_string(value, "str-to-int", str_to_int);
864 fl_value_set_string(value, "int-to-str", int_to_str);
865 g_autofree gchar* hex_string = encode_message(value);
866 EXPECT_STREQ(hex_string,
867 "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6"
868 "50301000000070374776f0302000000070574687265650303000000070a696e"
869 "742d746f2d7374720d04030000000007047a65726f030100000007036f6e650"
870 "302000000070374776f030300000007057468726565");
871 }
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(), g_autoptr(), i, and value.

## ◆ TEST() [118/126]

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

Definition at line 833 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [119/126]

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

Definition at line 72 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [120/126]

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

Definition at line 67 of file fl_standard_message_codec_test.cc.

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

References encode_message().

## ◆ TEST() [121/126]

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

Definition at line 342 of file fl_standard_message_codec_test.cc.

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

References encode_string().

## ◆ TEST() [122/126]

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

Definition at line 352 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [123/126]

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

Definition at line 347 of file fl_standard_message_codec_test.cc.

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

References encode_string().

## ◆ TEST() [124/126]

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

Definition at line 358 of file fl_standard_message_codec_test.cc.

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

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

## ◆ TEST() [125/126]

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

Definition at line 402 of file fl_standard_message_codec_test.cc.

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

## ◆ TEST() [126/126]

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

Definition at line 396 of file fl_standard_message_codec_test.cc.

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

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

## ◆ write_custom_value2()

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

Definition at line 1124 of file fl_standard_message_codec_test.cc.

1127 {
1128 uint8_t type = 129;
1129 g_byte_array_append(buffer, &type, sizeof(uint8_t));
1130 return TRUE;
1131 }
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 1110 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 1112 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 1115 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(), and flutter::ByteBufferStreamWriter::WriteBytes().

## ◆ TRUE

return TRUE

Definition at line 1121 of file fl_standard_message_codec_test.cc.

Referenced by TEST(), and write_custom_value2().

## ◆ type

uint8_t type = 128

Definition at line 1117 of file fl_standard_message_codec_test.cc.

Referenced by fl_key_channel_responder_handle_event(), fl_key_event_channel_send(), 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(), synthesize_simple_event(), system_exit_application(), system_sound_play(), TEST(), and write_custom_value2().

## ◆ value

GByteArray FlValue* value

Definition at line 1111 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().