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

Go to the source code of this file.

Functions

static gchar * encode_message (FlValue *value)
 
static FlValuedecode_message (const char *hex_string)
 
static void decode_error_value (const char *hex_string, GQuark domain, gint code)
 
 TEST (FlStandardMessageCodecTest, EncodeNullptr)
 
 TEST (FlStandardMessageCodecTest, EncodeNull)
 
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, EncodeFloatListEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeFloatList)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatList)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeListEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeListTypes)
 
 TEST (FlStandardMessageCodecTest, EncodeListNested)
 
 TEST (FlStandardMessageCodecTest, DecodeListEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeListTypes)
 
 TEST (FlStandardMessageCodecTest, DecodeListNested)
 
 TEST (FlStandardMessageCodecTest, DecodeListNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeListLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeListShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeListShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeDecodeLargeList)
 
 TEST (FlStandardMessageCodecTest, EncodeMapEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeMapKeyTypes)
 
 TEST (FlStandardMessageCodecTest, EncodeMapValueTypes)
 
 TEST (FlStandardMessageCodecTest, EncodeMapNested)
 
 TEST (FlStandardMessageCodecTest, DecodeMapEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeMapKeyTypes)
 
 TEST (FlStandardMessageCodecTest, DecodeMapValueTypes)
 
 TEST (FlStandardMessageCodecTest, DecodeMapNested)
 
 TEST (FlStandardMessageCodecTest, DecodeMapNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeMapLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeMapShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeMapShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeDecodeLargeMap)
 
 TEST (FlStandardMessageCodecTest, DecodeUnknownType)
 
 TEST (FlStandardMessageCodecTest, EncodeDecode)
 

Function Documentation

◆ decode_error_value()

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

Definition at line 40 of file fl_standard_message_codec_test.cc.

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

Referenced by TEST().

42  {
43  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
44  g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
45  g_autoptr(GError) error = nullptr;
46  g_autoptr(FlValue) value =
47  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
48  EXPECT_TRUE(value == nullptr);
49  EXPECT_TRUE(g_error_matches(error, domain, code));
50 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
uint8_t value
GBytes * hex_string_to_bytes(const gchar *hex_string)
Definition: fl_test.cc:24
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)

◆ decode_message()

static FlValue* decode_message ( const char *  hex_string)
static

Definition at line 27 of file fl_standard_message_codec_test.cc.

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

Referenced by TEST().

27  {
28  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
29  g_autoptr(GBytes) data = hex_string_to_bytes(hex_string);
30  g_autoptr(GError) error = nullptr;
31  g_autoptr(FlValue) value =
32  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), data, &error);
33  EXPECT_EQ(error, nullptr);
34  EXPECT_NE(value, nullptr);
35  return fl_value_ref(value);
36 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
uint8_t value
GBytes * hex_string_to_bytes(const gchar *hex_string)
Definition: fl_test.cc:24
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:335
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)

◆ encode_bool()

static gchar* encode_bool ( gboolean  value)
static

Definition at line 63 of file fl_standard_message_codec_test.cc.

References encode_message(), and fl_value_new_bool().

Referenced by TEST().

63  {
64  g_autoptr(FlValue) v = fl_value_new_bool(value);
65  return encode_message(v);
66 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
uint8_t value

◆ encode_float()

static gchar* encode_float ( double  value)
static

Definition at line 201 of file fl_standard_message_codec_test.cc.

References encode_message(), and fl_value_new_float().

Referenced by TEST().

201  {
202  g_autoptr(FlValue) v = fl_value_new_float(value);
203  return encode_message(v);
204 }
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ encode_int()

static gchar* encode_int ( int64_t  value)
static

Definition at line 78 of file fl_standard_message_codec_test.cc.

References encode_message(), and fl_value_new_int().

Referenced by TEST().

78  {
79  g_autoptr(FlValue) v = fl_value_new_int(value);
80  return encode_message(v);
81 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233

◆ encode_message()

static gchar* encode_message ( FlValue value)
static

Definition at line 14 of file fl_standard_message_codec_test.cc.

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

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

14  {
15  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
16  g_autoptr(GError) error = nullptr;
17  g_autoptr(GBytes) message =
18  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
19  EXPECT_NE(message, nullptr);
20  EXPECT_EQ(error, nullptr);
21 
22  return bytes_to_hex_string(message);
23 }
FlMethodResponse GError ** error
gchar * bytes_to_hex_string(GBytes *bytes)
Definition: fl_test.cc:33
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
uint8_t value
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)

◆ encode_string()

static gchar* encode_string ( const gchar *  value)
static

Definition at line 309 of file fl_standard_message_codec_test.cc.

References encode_message(), and fl_value_new_string().

Referenced by TEST().

309  {
310  g_autoptr(FlValue) v = fl_value_new_string(value);
311  return encode_message(v);
312 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [1/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeNullptr   
)

Definition at line 52 of file fl_standard_message_codec_test.cc.

References encode_message().

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

◆ TEST() [2/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeNull   
)

Definition at line 57 of file fl_standard_message_codec_test.cc.

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

57  {
58  g_autoptr(FlValue) value = fl_value_new_null();
59  g_autofree gchar* hex_string = encode_message(value);
60  EXPECT_STREQ(hex_string, "00");
61 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [3/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeBoolFalse   
)

Definition at line 68 of file fl_standard_message_codec_test.cc.

References encode_bool().

68  {
69  g_autofree gchar* hex_string = encode_bool(FALSE);
70  EXPECT_STREQ(hex_string, "02");
71 }
static gchar * encode_bool(gboolean value)

◆ TEST() [4/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeBoolTrue   
)

Definition at line 73 of file fl_standard_message_codec_test.cc.

References encode_bool(), and TRUE.

73  {
74  g_autofree gchar* hex_string = encode_bool(TRUE);
75  EXPECT_STREQ(hex_string, "01");
76 }
static gchar * encode_bool(gboolean value)
return TRUE
Definition: fl_view.cc:107

◆ TEST() [5/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeIntZero   
)

Definition at line 83 of file fl_standard_message_codec_test.cc.

References encode_int().

83  {
84  g_autofree gchar* hex_string = encode_int(0);
85  EXPECT_STREQ(hex_string, "0300000000");
86 }
static gchar * encode_int(int64_t value)

◆ TEST() [6/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeIntOne   
)

Definition at line 88 of file fl_standard_message_codec_test.cc.

References encode_int().

88  {
89  g_autofree gchar* hex_string = encode_int(1);
90  EXPECT_STREQ(hex_string, "0301000000");
91 }
static gchar * encode_int(int64_t value)

◆ TEST() [7/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt32   
)

Definition at line 93 of file fl_standard_message_codec_test.cc.

References encode_int().

93  {
94  g_autofree gchar* hex_string = encode_int(0x01234567);
95  EXPECT_STREQ(hex_string, "0367452301");
96 }
static gchar * encode_int(int64_t value)

◆ TEST() [8/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt32Min   
)

Definition at line 98 of file fl_standard_message_codec_test.cc.

References encode_int().

98  {
99  g_autofree gchar* hex_string = encode_int(G_MININT32);
100  EXPECT_STREQ(hex_string, "0300000080");
101 }
static gchar * encode_int(int64_t value)

◆ TEST() [9/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt32Max   
)

Definition at line 103 of file fl_standard_message_codec_test.cc.

References encode_int().

103  {
104  g_autofree gchar* hex_string = encode_int(G_MAXINT32);
105  EXPECT_STREQ(hex_string, "03ffffff7f");
106 }
static gchar * encode_int(int64_t value)

◆ TEST() [10/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt64   
)

Definition at line 108 of file fl_standard_message_codec_test.cc.

References encode_int().

108  {
109  g_autofree gchar* hex_string = encode_int(0x0123456789abcdef);
110  EXPECT_STREQ(hex_string, "04efcdab8967452301");
111 }
static gchar * encode_int(int64_t value)

◆ TEST() [11/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt64Min   
)

Definition at line 113 of file fl_standard_message_codec_test.cc.

References encode_int().

113  {
114  g_autofree gchar* hex_string = encode_int(G_MININT64);
115  EXPECT_STREQ(hex_string, "040000000000000080");
116 }
static gchar * encode_int(int64_t value)

◆ TEST() [12/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt64Max   
)

Definition at line 118 of file fl_standard_message_codec_test.cc.

References encode_int().

118  {
119  g_autofree gchar* hex_string = encode_int(G_MAXINT64);
120  EXPECT_STREQ(hex_string, "04ffffffffffffff7f");
121 }
static gchar * encode_int(int64_t value)

◆ TEST() [13/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeIntZero   
)

Definition at line 123 of file fl_standard_message_codec_test.cc.

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

123  {
124  g_autoptr(FlValue) value = decode_message("0300000000");
126  EXPECT_EQ(fl_value_get_int(value), 0);
127 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [14/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeIntOne   
)

Definition at line 129 of file fl_standard_message_codec_test.cc.

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

129  {
130  g_autoptr(FlValue) value = decode_message("0301000000");
132  EXPECT_EQ(fl_value_get_int(value), 1);
133 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [15/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32   
)

Definition at line 135 of file fl_standard_message_codec_test.cc.

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

135  {
136  g_autoptr(FlValue) value = decode_message("0367452301");
138  EXPECT_EQ(fl_value_get_int(value), 0x01234567);
139 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [16/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32Min   
)

Definition at line 141 of file fl_standard_message_codec_test.cc.

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

141  {
142  g_autoptr(FlValue) value = decode_message("0300000080");
144  EXPECT_EQ(fl_value_get_int(value), G_MININT32);
145 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [17/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32Max   
)

Definition at line 147 of file fl_standard_message_codec_test.cc.

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

147  {
148  g_autoptr(FlValue) value = decode_message("03ffffff7f");
150  EXPECT_EQ(fl_value_get_int(value), G_MAXINT32);
151 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [18/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64   
)

Definition at line 153 of file fl_standard_message_codec_test.cc.

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

153  {
154  g_autoptr(FlValue) value = decode_message("04efcdab8967452301");
156  EXPECT_EQ(fl_value_get_int(value), 0x0123456789abcdef);
157 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [19/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64Min   
)

Definition at line 159 of file fl_standard_message_codec_test.cc.

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

159  {
160  g_autoptr(FlValue) value = decode_message("040000000000000080");
162  EXPECT_EQ(fl_value_get_int(value), G_MININT64);
163 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [20/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64Max   
)

Definition at line 165 of file fl_standard_message_codec_test.cc.

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

165  {
166  g_autoptr(FlValue) value = decode_message("04ffffffffffffff7f");
168  EXPECT_EQ(fl_value_get_int(value), G_MAXINT64);
169 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value

◆ TEST() [21/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32NoData   
)

Definition at line 171 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

171  {
174 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [22/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeIntShortData1   
)

Definition at line 176 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

176  {
179 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [23/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeIntShortData2   
)

Definition at line 181 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

181  {
184 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [24/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64NoData   
)

Definition at line 186 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

186  {
189 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [25/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ShortData1   
)

Definition at line 191 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

191  {
194 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [26/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ShortData2   
)

Definition at line 196 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

196  {
197  decode_error_value("04efcdab89674523", FL_MESSAGE_CODEC_ERROR,
199 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [27/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatZero   
)

Definition at line 206 of file fl_standard_message_codec_test.cc.

References encode_float().

206  {
207  g_autofree gchar* hex_string = encode_float(0);
208  EXPECT_STREQ(hex_string, "06000000000000000000000000000000");
209 }
static gchar * encode_float(double value)

◆ TEST() [28/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatOne   
)

Definition at line 211 of file fl_standard_message_codec_test.cc.

References encode_float().

211  {
212  g_autofree gchar* hex_string = encode_float(1);
213  EXPECT_STREQ(hex_string, "0600000000000000000000000000f03f");
214 }
static gchar * encode_float(double value)

◆ TEST() [29/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatMinusOne   
)

Definition at line 216 of file fl_standard_message_codec_test.cc.

References encode_float().

216  {
217  g_autofree gchar* hex_string = encode_float(-1);
218  EXPECT_STREQ(hex_string, "0600000000000000000000000000f0bf");
219 }
static gchar * encode_float(double value)

◆ TEST() [30/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatHalf   
)

Definition at line 221 of file fl_standard_message_codec_test.cc.

References encode_float().

221  {
222  g_autofree gchar* hex_string = encode_float(0.5);
223  EXPECT_STREQ(hex_string, "0600000000000000000000000000e03f");
224 }
static gchar * encode_float(double value)

◆ TEST() [31/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatFraction   
)

Definition at line 226 of file fl_standard_message_codec_test.cc.

References encode_float().

226  {
227  g_autofree gchar* hex_string = encode_float(M_PI);
228  EXPECT_STREQ(hex_string, "0600000000000000182d4454fb210940");
229 }
static gchar * encode_float(double value)

◆ TEST() [32/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatMinusZero   
)

Definition at line 231 of file fl_standard_message_codec_test.cc.

References encode_float().

231  {
232  g_autofree gchar* hex_string = encode_float(-0.0);
233  EXPECT_STREQ(hex_string, "06000000000000000000000000000080");
234 }
static gchar * encode_float(double value)

◆ TEST() [33/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatNaN   
)

Definition at line 236 of file fl_standard_message_codec_test.cc.

References encode_float().

236  {
237  g_autofree gchar* hex_string = encode_float(NAN);
238  EXPECT_STREQ(hex_string, "0600000000000000000000000000f87f");
239 }
static gchar * encode_float(double value)

◆ TEST() [34/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatInfinity   
)

Definition at line 241 of file fl_standard_message_codec_test.cc.

References encode_float().

241  {
242  g_autofree gchar* hex_string = encode_float(INFINITY);
243  EXPECT_STREQ(hex_string, "0600000000000000000000000000f07f");
244 }
static gchar * encode_float(double value)

◆ TEST() [35/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatZero   
)

Definition at line 246 of file fl_standard_message_codec_test.cc.

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

246  {
247  g_autoptr(FlValue) value = decode_message("06000000000000000000000000000000");
249  EXPECT_EQ(fl_value_get_float(value), 0.0);
250 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [36/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatOne   
)

Definition at line 252 of file fl_standard_message_codec_test.cc.

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

252  {
253  g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f03f");
255  EXPECT_EQ(fl_value_get_float(value), 1.0);
256 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [37/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatMinusOne   
)

Definition at line 258 of file fl_standard_message_codec_test.cc.

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

258  {
259  g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f0bf");
261  EXPECT_EQ(fl_value_get_float(value), -1.0);
262 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [38/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatHalf   
)

Definition at line 264 of file fl_standard_message_codec_test.cc.

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

264  {
265  g_autoptr(FlValue) value = decode_message("0600000000000000000000000000e03f");
267  EXPECT_EQ(fl_value_get_float(value), 0.5);
268 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [39/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatPi   
)

Definition at line 270 of file fl_standard_message_codec_test.cc.

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

270  {
271  g_autoptr(FlValue) value = decode_message("0600000000000000182d4454fb210940");
273  EXPECT_EQ(fl_value_get_float(value), M_PI);
274 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [40/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatMinusZero   
)

Definition at line 276 of file fl_standard_message_codec_test.cc.

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

276  {
277  g_autoptr(FlValue) value = decode_message("06000000000000000000000000000080");
279  EXPECT_EQ(fl_value_get_float(value), -0.0);
280 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [41/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatNaN   
)

Definition at line 282 of file fl_standard_message_codec_test.cc.

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

282  {
283  g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f87f");
285  EXPECT_TRUE(isnan(fl_value_get_float(value)));
286 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [42/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatInfinity   
)

Definition at line 288 of file fl_standard_message_codec_test.cc.

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

288  {
289  g_autoptr(FlValue) value = decode_message("0600000000000000000000000000f07f");
291  EXPECT_TRUE(isinf(fl_value_get_float(value)));
292 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value

◆ TEST() [43/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatNoData   
)

Definition at line 294 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

294  {
295  decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
297 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [44/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatShortData1   
)

Definition at line 299 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

299  {
300  decode_error_value("060000000000000000", FL_MESSAGE_CODEC_ERROR,
302 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [45/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatShortData2   
)

Definition at line 304 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

304  {
305  decode_error_value("060000000000000000000000000000", FL_MESSAGE_CODEC_ERROR,
307 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [46/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeStringEmpty   
)

Definition at line 314 of file fl_standard_message_codec_test.cc.

References encode_string().

314  {
315  g_autofree gchar* hex_string = encode_string("");
316  EXPECT_STREQ(hex_string, "0700");
317 }
static gchar * encode_string(const gchar *value)

◆ TEST() [47/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeStringHello   
)

Definition at line 319 of file fl_standard_message_codec_test.cc.

References encode_string().

319  {
320  g_autofree gchar* hex_string = encode_string("hello");
321  EXPECT_STREQ(hex_string, "070568656c6c6f");
322 }
static gchar * encode_string(const gchar *value)

◆ TEST() [48/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeStringEmptySized   
)

Definition at line 324 of file fl_standard_message_codec_test.cc.

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

324  {
325  g_autoptr(FlValue) value = fl_value_new_string_sized(nullptr, 0);
326  g_autofree gchar* hex_string = encode_message(value);
327  EXPECT_STREQ(hex_string, "0700");
328 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:254

◆ TEST() [49/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeStringHelloSized   
)

Definition at line 330 of file fl_standard_message_codec_test.cc.

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

330  {
331  g_autoptr(FlValue) value = fl_value_new_string_sized("Hello World", 5);
332  g_autofree gchar* hex_string = encode_message(value);
333  EXPECT_STREQ(hex_string, "070548656c6c6f");
334 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:254

◆ TEST() [50/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeStringEmpty   
)

Definition at line 336 of file fl_standard_message_codec_test.cc.

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

336  {
337  g_autoptr(FlValue) value = decode_message("0700");
339  EXPECT_STREQ(fl_value_get_string(value), "");
340 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [51/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeStringHello   
)

Definition at line 342 of file fl_standard_message_codec_test.cc.

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

342  {
343  g_autoptr(FlValue) value = decode_message("070568656c6c6f");
345  EXPECT_STREQ(fl_value_get_string(value), "hello");
346 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [52/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeStringNoData   
)

Definition at line 348 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

348  {
351 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [53/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeStringLengthNoData   
)

Definition at line 353 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

353  {
356 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [54/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeStringShortData1   
)

Definition at line 358 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

358  {
361 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [55/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeStringShortData2   
)

Definition at line 363 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

363  {
366 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [56/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeUint8ListEmpty   
)

Definition at line 368 of file fl_standard_message_codec_test.cc.

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

368  {
369  g_autoptr(FlValue) value = fl_value_new_uint8_list(nullptr, 0);
370  g_autofree gchar* hex_string = encode_message(value);
371  EXPECT_STREQ(hex_string, "0800");
372 }
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:263
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [57/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeUint8List   
)

Definition at line 374 of file fl_standard_message_codec_test.cc.

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

374  {
375  uint8_t data[] = {0, 1, 2, 3, 4};
376  g_autoptr(FlValue) value = fl_value_new_uint8_list(data, 5);
377  g_autofree gchar* hex_string = encode_message(value);
378  EXPECT_STREQ(hex_string, "08050001020304");
379 }
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:263
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [58/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUint8ListEmpty   
)

Definition at line 381 of file fl_standard_message_codec_test.cc.

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

381  {
382  g_autoptr(FlValue) value = decode_message("0800");
384  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
385 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [59/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUint8List   
)

Definition at line 387 of file fl_standard_message_codec_test.cc.

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

387  {
388  g_autoptr(FlValue) value = decode_message("08050001020304");
390  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(5));
391  const uint8_t* data = fl_value_get_uint8_list(value);
392  EXPECT_EQ(data[0], 0);
393  EXPECT_EQ(data[1], 1);
394  EXPECT_EQ(data[2], 2);
395  EXPECT_EQ(data[3], 3);
396  EXPECT_EQ(data[4], 4);
397 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:603
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [60/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUint8ListNoData   
)

Definition at line 399 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

399  {
402 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [61/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUint8ListLengthNoData   
)

Definition at line 404 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

404  {
407 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [62/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUint8ListShortData1   
)

Definition at line 409 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

409  {
412 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [63/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUint8ListShortData2   
)

Definition at line 414 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

414  {
417 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [64/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt32ListEmpty   
)

Definition at line 419 of file fl_standard_message_codec_test.cc.

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

419  {
420  g_autoptr(FlValue) value = fl_value_new_int32_list(nullptr, 0);
421  g_autofree gchar* hex_string = encode_message(value);
422  EXPECT_STREQ(hex_string, "09000000");
423 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:280
uint8_t value

◆ TEST() [65/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt32List   
)

Definition at line 425 of file fl_standard_message_codec_test.cc.

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

425  {
426  int32_t data[] = {0, -1, 2, -3, 4};
427  g_autoptr(FlValue) value = fl_value_new_int32_list(data, 5);
428  g_autofree gchar* hex_string = encode_message(value);
429  EXPECT_STREQ(hex_string, "0905000000000000ffffffff02000000fdffffff04000000");
430 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:280
uint8_t value

◆ TEST() [66/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32ListEmpty   
)

Definition at line 432 of file fl_standard_message_codec_test.cc.

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

432  {
433  g_autoptr(FlValue) value = decode_message("09000000");
435  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
436 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [67/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32List   
)

Definition at line 438 of file fl_standard_message_codec_test.cc.

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

438  {
439  g_autoptr(FlValue) value =
440  decode_message("0905000000000000ffffffff02000000fdffffff04000000");
442  const int32_t* data = fl_value_get_int32_list(value);
443  EXPECT_EQ(data[0], 0);
444  EXPECT_EQ(data[1], -1);
445  EXPECT_EQ(data[2], 2);
446  EXPECT_EQ(data[3], -3);
447  EXPECT_EQ(data[4], 4);
448 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:610

◆ TEST() [68/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32ListNoData   
)

Definition at line 450 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

450  {
453 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [69/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32ListLengthNoData   
)

Definition at line 455 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

455  {
458 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [70/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32ListShortData1   
)

Definition at line 460 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

460  {
463 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [71/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt32ListShortData2   
)

Definition at line 465 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

465  {
466  decode_error_value("090500000000ffffffff02000000fdffffff040000",
469 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [72/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt64ListEmpty   
)

Definition at line 471 of file fl_standard_message_codec_test.cc.

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

471  {
472  g_autoptr(FlValue) value = fl_value_new_int64_list(nullptr, 0);
473  g_autofree gchar* hex_string = encode_message(value);
474  EXPECT_STREQ(hex_string, "0a00000000000000");
475 }
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:290
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [73/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeInt64List   
)

Definition at line 477 of file fl_standard_message_codec_test.cc.

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

477  {
478  int64_t data[] = {0, -1, 2, -3, 4};
479  g_autoptr(FlValue) value = fl_value_new_int64_list(data, 5);
480  g_autofree gchar* hex_string = encode_message(value);
481  EXPECT_STREQ(
482  hex_string,
483  "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
484  "ffffffff0400000000000000");
485 }
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:290
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [74/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ListEmpty   
)

Definition at line 487 of file fl_standard_message_codec_test.cc.

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

487  {
488  g_autoptr(FlValue) value = decode_message("0a00000000000000");
490  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
491 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [75/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64List   
)

Definition at line 493 of file fl_standard_message_codec_test.cc.

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

493  {
494  g_autoptr(FlValue) value = decode_message(
495  "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
496  "ffffffff0400000000000000");
498  const int64_t* data = fl_value_get_int64_list(value);
499  EXPECT_EQ(data[0], 0);
500  EXPECT_EQ(data[1], -1);
501  EXPECT_EQ(data[2], 2);
502  EXPECT_EQ(data[3], -3);
503  EXPECT_EQ(data[4], 4);
504 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:617
uint8_t value

◆ TEST() [76/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ListNoData   
)

Definition at line 506 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

506  {
509 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [77/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ListLengthNoData   
)

Definition at line 511 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

511  {
512  decode_error_value("0a05000000000000", FL_MESSAGE_CODEC_ERROR,
514 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [78/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ListShortData1   
)

Definition at line 516 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

516  {
517  decode_error_value("0a0500000000000000", FL_MESSAGE_CODEC_ERROR,
519 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [79/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeInt64ListShortData2   
)

Definition at line 521 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

521  {
523  "0a050000000000000000000000000000ffffffffffffffff0200000000000000fdffffff"
524  "ffffffff0400"
525  "0000000000",
527 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [80/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatListEmpty   
)

Definition at line 529 of file fl_standard_message_codec_test.cc.

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

529  {
530  g_autoptr(FlValue) value = fl_value_new_float_list(nullptr, 0);
531  g_autofree gchar* hex_string = encode_message(value);
532  EXPECT_STREQ(hex_string, "0b00000000000000");
533 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:300

◆ TEST() [81/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatList   
)

Definition at line 535 of file fl_standard_message_codec_test.cc.

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

535  {
536  double data[] = {0, -0.5, 0.25, -0.125, 0.00625};
537  g_autoptr(FlValue) value = fl_value_new_float_list(data, 5);
538  g_autofree gchar* hex_string = encode_message(value);
539  EXPECT_STREQ(
540  hex_string,
541  "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
542  "0000c0bf9a9999999999793f");
543 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:300

◆ TEST() [82/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListEmpty   
)

Definition at line 545 of file fl_standard_message_codec_test.cc.

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

545  {
546  g_autoptr(FlValue) value = decode_message("0b00000000000000");
548  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
549 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [83/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatList   
)

Definition at line 551 of file fl_standard_message_codec_test.cc.

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

551  {
552  g_autoptr(FlValue) value = decode_message(
553  "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
554  "0000c0bf9a9999999999793f");
556  const double* data = fl_value_get_float_list(value);
557  EXPECT_FLOAT_EQ(data[0], 0.0);
558  EXPECT_FLOAT_EQ(data[1], -0.5);
559  EXPECT_FLOAT_EQ(data[2], 0.25);
560  EXPECT_FLOAT_EQ(data[3], -0.125);
561  EXPECT_FLOAT_EQ(data[4], 0.00625);
562 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:624
uint8_t value

◆ TEST() [84/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListNoData   
)

Definition at line 564 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

564  {
567 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [85/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListLengthNoData   
)

Definition at line 569 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

569  {
570  decode_error_value("0b05000000000000", FL_MESSAGE_CODEC_ERROR,
572 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [86/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListShortData1   
)

Definition at line 574 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

574  {
575  decode_error_value("0b0500000000000000", FL_MESSAGE_CODEC_ERROR,
577 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [87/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListShortData2   
)

Definition at line 579 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

579  {
581  "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
582  "0000c0bf9a99"
583  "9999999979",
585 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [88/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeListEmpty   
)

Definition at line 587 of file fl_standard_message_codec_test.cc.

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

587  {
588  g_autoptr(FlValue) value = fl_value_new_list();
589  g_autofree gchar* hex_string = encode_message(value);
590  EXPECT_STREQ(hex_string, "0c00");
591 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [89/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeListTypes   
)

Definition at line 593 of file fl_standard_message_codec_test.cc.

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

593  {
594  g_autoptr(FlValue) value = fl_value_new_list();
602  g_autofree gchar* hex_string = encode_message(value);
603  EXPECT_STREQ(
604  hex_string,
605  "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
606 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [90/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeListNested   
)

Definition at line 608 of file fl_standard_message_codec_test.cc.

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

608  {
609  g_autoptr(FlValue) even_numbers = fl_value_new_list();
610  g_autoptr(FlValue) odd_numbers = fl_value_new_list();
611  for (int i = 0; i < 10; i++) {
612  if (i % 2 == 0)
613  fl_value_append_take(even_numbers, fl_value_new_int(i));
614  else
615  fl_value_append_take(odd_numbers, fl_value_new_int(i));
616  }
617  g_autoptr(FlValue) value = fl_value_new_list();
618  fl_value_append(value, even_numbers);
619  fl_value_append(value, odd_numbers);
620  g_autofree gchar* hex_string = encode_message(value);
621  EXPECT_STREQ(hex_string,
622  "0c020c05030000000003020000000304000000030600000003080000000c"
623  "0503010000000303000000030500000003070000000309000000");
624 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:506
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233

◆ TEST() [91/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListEmpty   
)

Definition at line 626 of file fl_standard_message_codec_test.cc.

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

626  {
627  g_autoptr(FlValue) value = decode_message("0c00");
629  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
630 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [92/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListTypes   
)

Definition at line 632 of file fl_standard_message_codec_test.cc.

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

632  {
633  g_autoptr(FlValue) value = decode_message(
634  "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
636  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
644  EXPECT_EQ(fl_value_get_int(fl_value_get_list_value(value, 2)), 42);
647  EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_list_value(value, 3)), M_PI);
650  EXPECT_STREQ(fl_value_get_string(fl_value_get_list_value(value, 4)), "hello");
654  static_cast<size_t>(0));
658  static_cast<size_t>(0));
659 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:677
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:575

◆ TEST() [93/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListNested   
)

Definition at line 661 of file fl_standard_message_codec_test.cc.

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

661  {
662  g_autoptr(FlValue) value = decode_message(
663  "0c020c05030000000003020000000304000000030600000003080000000c"
664  "0503010000000303000000030500000003070000000309000000");
666  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
667  FlValue* even_list = fl_value_get_list_value(value, 0);
668  ASSERT_EQ(fl_value_get_type(even_list), FL_VALUE_TYPE_LIST);
669  ASSERT_EQ(fl_value_get_length(even_list), static_cast<size_t>(5));
670  FlValue* odd_list = fl_value_get_list_value(value, 1);
671  ASSERT_EQ(fl_value_get_type(odd_list), FL_VALUE_TYPE_LIST);
672  ASSERT_EQ(fl_value_get_length(odd_list), static_cast<size_t>(5));
673  for (int i = 0; i < 5; i++) {
674  FlValue* v = fl_value_get_list_value(even_list, i);
675  ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
676  EXPECT_EQ(fl_value_get_int(v), i * 2);
677 
678  v = fl_value_get_list_value(odd_list, i);
679  ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
680  EXPECT_EQ(fl_value_get_int(v), i * 2 + 1);
681  }
682 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:677
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [94/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListNoData   
)

Definition at line 684 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

684  {
687 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [95/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListLengthNoData   
)

Definition at line 689 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

689  {
692 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [96/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListShortData1   
)

Definition at line 694 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

694  {
697 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [97/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeListShortData2   
)

Definition at line 699 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

699  {
701  "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d",
703 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [98/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeDecodeLargeList   
)

Definition at line 705 of file fl_standard_message_codec_test.cc.

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

705  {
706  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
707 
708  g_autoptr(FlValue) value = fl_value_new_list();
709  for (int i = 0; i < 65535; i++)
711 
712  g_autoptr(GError) error = nullptr;
713  g_autoptr(GBytes) message =
714  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
715  EXPECT_NE(message, nullptr);
716  EXPECT_EQ(error, nullptr);
717 
718  g_autoptr(FlValue) decoded_value =
719  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
720  EXPECT_EQ(error, nullptr);
721  EXPECT_NE(value, nullptr);
722 
723  ASSERT_TRUE(fl_value_equal(value, decoded_value));
724 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:400
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)

◆ TEST() [99/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapEmpty   
)

Definition at line 726 of file fl_standard_message_codec_test.cc.

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

726  {
727  g_autoptr(FlValue) value = fl_value_new_map();
728  g_autofree gchar* hex_string = encode_message(value);
729  EXPECT_STREQ(hex_string, "0d00");
730 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
uint8_t value

◆ TEST() [100/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapKeyTypes   
)

Definition at line 732 of file fl_standard_message_codec_test.cc.

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

732  {
733  g_autoptr(FlValue) value = fl_value_new_map();
736  fl_value_new_string("bool"));
739  fl_value_new_string("float"));
741  fl_value_new_string("string"));
744  g_autofree gchar* hex_string = encode_message(value);
745  EXPECT_STREQ(hex_string,
746  "0d070007046e756c6c010704626f6f6c032a0000000703696e7406000000000"
747  "0182d4454fb2109400705666c6f6174070568656c6c6f0706737472696e670c"
748  "0007046c6973740d0007036d6170");
749 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [101/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapValueTypes   
)

Definition at line 751 of file fl_standard_message_codec_test.cc.

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

751  {
752  g_autoptr(FlValue) value = fl_value_new_map();
758  fl_value_new_float(M_PI));
760  fl_value_new_string("hello"));
763  g_autofree gchar* hex_string = encode_message(value);
764  EXPECT_STREQ(hex_string,
765  "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6"
766  "17406000000000000182d4454fb2109400706737472696e67070568656c6c6f"
767  "07046c6973740c0007036d61700d00");
768 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [102/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapNested   
)

Definition at line 770 of file fl_standard_message_codec_test.cc.

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

770  {
771  g_autoptr(FlValue) str_to_int = fl_value_new_map();
772  g_autoptr(FlValue) int_to_str = fl_value_new_map();
773  const char* numbers[] = {"zero", "one", "two", "three", nullptr};
774  for (int i = 0; numbers[i] != nullptr; i++) {
775  fl_value_set_take(str_to_int, fl_value_new_string(numbers[i]),
776  fl_value_new_int(i));
777  fl_value_set_take(int_to_str, fl_value_new_int(i),
778  fl_value_new_string(numbers[i]));
779  }
780  g_autoptr(FlValue) value = fl_value_new_map();
781  fl_value_set_string(value, "str-to-int", str_to_int);
782  fl_value_set_string(value, "int-to-str", int_to_str);
783  g_autofree gchar* hex_string = encode_message(value);
784  EXPECT_STREQ(hex_string,
785  "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6"
786  "50301000000070374776f0302000000070574687265650303000000070a696e"
787  "742d746f2d7374720d04030000000007047a65726f030100000007036f6e650"
788  "302000000070374776f030300000007057468726565");
789 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:553

◆ TEST() [103/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapEmpty   
)

Definition at line 791 of file fl_standard_message_codec_test.cc.

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

791  {
792  g_autoptr(FlValue) value = decode_message("0d00");
794  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
795 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [104/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapKeyTypes   
)

Definition at line 797 of file fl_standard_message_codec_test.cc.

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

797  {
798  g_autoptr(FlValue) value = decode_message(
799  "0d070007046e756c6c010704626f6f6c032a0000000703696e74060000000000182d4454"
800  "fb2109400705666c6f6174070568656c6c6f0706737472696e670c0007046c6973740d00"
801  "07036d6170");
803  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
804 
809  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 0)), "null");
810 
813  EXPECT_TRUE(fl_value_get_bool(fl_value_get_map_key(value, 1)));
816  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 1)), "bool");
817 
820  EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(value, 2)), 42);
823  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 2)), "int");
824 
827  EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_key(value, 3)), M_PI);
830  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 3)), "float");
831 
834  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "hello");
837  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "string");
838 
842  static_cast<size_t>(0));
845  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 5)), "list");
846 
850  static_cast<size_t>(0));
853  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 6)), "map");
854 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:693
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:685
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:575

◆ TEST() [105/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapValueTypes   
)

Definition at line 856 of file fl_standard_message_codec_test.cc.

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

856  {
857  g_autoptr(FlValue) value = decode_message(
858  "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
859  "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
860  "036d61700d00");
862  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
863 
866  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 0)), "null");
869 
872  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 1)), "bool");
876 
879  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 2)), "int");
882  EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(value, 2)), 42);
883 
886  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 3)), "float");
889  EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_value(value, 3)), M_PI);
890 
893  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "string");
896  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "hello");
897 
900  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 5)), "list");
904  static_cast<size_t>(0));
905 
908  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 6)), "map");
912  static_cast<size_t>(0));
913 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:693
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:685
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:575

◆ TEST() [106/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapNested   
)

Definition at line 915 of file fl_standard_message_codec_test.cc.

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

915  {
916  g_autoptr(FlValue) value = decode_message(
917  "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6503010000"
918  "00070374776f0302000000070574687265650303000000070a696e742d746f2d7374720d"
919  "04030000000007047a65726f030100000007036f6e650302000000070374776f03030000"
920  "0007057468726565");
922  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
923 
927  "str-to-int");
928  FlValue* str_to_int = fl_value_get_map_value(value, 0);
929  ASSERT_EQ(fl_value_get_type(str_to_int), FL_VALUE_TYPE_MAP);
930  ASSERT_EQ(fl_value_get_length(str_to_int), static_cast<size_t>(4));
931 
935  "int-to-str");
936  FlValue* int_to_str = fl_value_get_map_value(value, 1);
937  ASSERT_EQ(fl_value_get_type(int_to_str), FL_VALUE_TYPE_MAP);
938  ASSERT_EQ(fl_value_get_length(int_to_str), static_cast<size_t>(4));
939 
940  const char* numbers[] = {"zero", "one", "two", "three", nullptr};
941  for (int i = 0; numbers[i] != nullptr; i++) {
942  ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(str_to_int, i)),
944  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(str_to_int, i)),
945  numbers[i]);
946 
947  ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(str_to_int, i)),
949  EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(str_to_int, i)), i);
950 
951  ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(int_to_str, i)),
953  EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(int_to_str, i)), i);
954 
955  ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(int_to_str, i)),
957  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(int_to_str, i)),
958  numbers[i]);
959  }
960 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:693
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:685
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [107/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapNoData   
)

Definition at line 962 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

962  {
965 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [108/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapLengthNoData   
)

Definition at line 967 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

967  {
970 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [109/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapShortData1   
)

Definition at line 972 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

972  {
975 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [110/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapShortData2   
)

Definition at line 977 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

977  {
979  "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
980  "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
981  "036d61700d",
983 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [111/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeDecodeLargeMap   
)

Definition at line 985 of file fl_standard_message_codec_test.cc.

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

985  {
986  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
987 
988  g_autoptr(FlValue) value = fl_value_new_map();
989  for (int i = 0; i < 512; i++) {
990  g_autofree gchar* key = g_strdup_printf("key%d", i);
992  }
993 
994  g_autoptr(GError) error = nullptr;
995  g_autoptr(GBytes) message =
996  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
997  EXPECT_NE(message, nullptr);
998  EXPECT_EQ(error, nullptr);
999 
1000  g_autoptr(FlValue) decoded_value =
1001  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1002  EXPECT_EQ(error, nullptr);
1003  EXPECT_NE(value, nullptr);
1004 
1005  ASSERT_TRUE(fl_value_equal(value, decoded_value));
1006 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:400
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
G_MODULE_EXPORT void fl_value_set_string_take(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:564

◆ TEST() [112/113]

TEST ( FlStandardMessageCodecTest  ,
DecodeUnknownType   
)

Definition at line 1008 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE.

1008  {
1011 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [113/113]

TEST ( FlStandardMessageCodecTest  ,
EncodeDecode   
)

Definition at line 1013 of file fl_standard_message_codec_test.cc.

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

1013  {
1014  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1015 
1016  g_autoptr(FlValue) input = fl_value_new_list();
1021  fl_value_append_take(input, fl_value_new_string("hello"));
1024 
1025  g_autoptr(GError) error = nullptr;
1026  g_autoptr(GBytes) message =
1027  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), input, &error);
1028  EXPECT_NE(message, nullptr);
1029  EXPECT_EQ(error, nullptr);
1030 
1031  g_autoptr(FlValue) output =
1032  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1033  EXPECT_EQ(error, nullptr);
1034  EXPECT_NE(output, nullptr);
1035 
1036  ASSERT_TRUE(fl_value_equal(input, output));
1037 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:400
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
G_MODULE_EXPORT GBytes * fl_message_codec_encode_message(FlMessageCodec *self, FlValue *message, GError **error)
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_message_codec_decode_message(FlMessageCodec *self, GBytes *message, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222