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, EncodeFloat32ListEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeFloat32List)
 
 TEST (FlStandardMessageCodecTest, DecodeFloat32ListEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeFloat32List)
 
 TEST (FlStandardMessageCodecTest, DecodeFloat32ListNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeFloat32ListLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeFloat32ListShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeFloat32ListShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeFloatListEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeFloatList)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatList)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeFloatListShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeListEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeListTypes)
 
 TEST (FlStandardMessageCodecTest, EncodeListNested)
 
 TEST (FlStandardMessageCodecTest, DecodeListEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeListTypes)
 
 TEST (FlStandardMessageCodecTest, DecodeListNested)
 
 TEST (FlStandardMessageCodecTest, DecodeListNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeListLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeListShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeListShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeDecodeLargeList)
 
 TEST (FlStandardMessageCodecTest, EncodeMapEmpty)
 
 TEST (FlStandardMessageCodecTest, EncodeMapKeyTypes)
 
 TEST (FlStandardMessageCodecTest, EncodeMapValueTypes)
 
 TEST (FlStandardMessageCodecTest, EncodeMapNested)
 
 TEST (FlStandardMessageCodecTest, DecodeMapEmpty)
 
 TEST (FlStandardMessageCodecTest, DecodeMapKeyTypes)
 
 TEST (FlStandardMessageCodecTest, DecodeMapValueTypes)
 
 TEST (FlStandardMessageCodecTest, DecodeMapNested)
 
 TEST (FlStandardMessageCodecTest, DecodeMapNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeMapLengthNoData)
 
 TEST (FlStandardMessageCodecTest, DecodeMapShortData1)
 
 TEST (FlStandardMessageCodecTest, DecodeMapShortData2)
 
 TEST (FlStandardMessageCodecTest, EncodeDecodeLargeMap)
 
 TEST (FlStandardMessageCodecTest, DecodeUnknownType)
 
 TEST (FlStandardMessageCodecTest, EncodeDecode)
 

Function Documentation

◆ decode_error_value()

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

Definition at line 40 of file fl_standard_message_codec_test.cc.

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 }
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
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:31
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 }
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
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:31
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:363
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:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
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:258
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
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:40
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251

◆ 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 }
const uint8_t uint32_t uint32_t GError ** error
gchar * bytes_to_hex_string(GBytes *bytes)
Definition: fl_test.cc:40
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:40
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265

◆ TEST() [1/121]

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/121]

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:40
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:240

◆ TEST() [3/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeBoolFalse   
)

Definition at line 68 of file fl_standard_message_codec_test.cc.

References encode_bool(), and FALSE.

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

◆ TEST() [4/121]

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)

◆ TEST() [5/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [14/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [15/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [16/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [17/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [18/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [19/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [20/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value

◆ TEST() [21/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [36/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [37/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [38/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [39/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [40/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [41/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [42/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value

◆ TEST() [43/121]

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/121]

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/121]

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/121]

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/121]

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/121]

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:40
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:272

◆ TEST() [49/121]

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:40
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:272

◆ TEST() [50/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642

◆ TEST() [51/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642

◆ TEST() [52/121]

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/121]

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/121]

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/121]

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/121]

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:281
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [57/121]

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:281
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [58/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [59/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT const uint8_t * fl_value_get_uint8_list(FlValue *self)
Definition: fl_value.cc:649
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [60/121]

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/121]

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/121]

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/121]

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/121]

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:40
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:298
uint8_t value

◆ TEST() [65/121]

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:40
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:298
uint8_t value

◆ TEST() [66/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [67/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT const int32_t * fl_value_get_int32_list(FlValue *self)
Definition: fl_value.cc:656

◆ TEST() [68/121]

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/121]

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/121]

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/121]

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/121]

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:308
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [73/121]

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:308
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [74/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [75/121]

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:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT const int64_t * fl_value_get_int64_list(FlValue *self)
Definition: fl_value.cc:663
uint8_t value

◆ TEST() [76/121]

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/121]

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/121]

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/121]

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/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloat32ListEmpty   
)

Definition at line 529 of file fl_standard_message_codec_test.cc.

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

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

◆ TEST() [81/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloat32List   
)

Definition at line 535 of file fl_standard_message_codec_test.cc.

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

535  {
536  float data[] = {0.0f, -0.5f, 0.25f, -0.125f, 0.00625f};
537  g_autoptr(FlValue) value = fl_value_new_float32_list(data, 5);
538  g_autofree gchar* hex_string = encode_message(value);
539  EXPECT_STREQ(hex_string, "0e05000000000000000000bf0000803e000000becdcccc3b");
540 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_float32_list(const float *data, size_t data_length)
Definition: fl_value.cc:318

◆ TEST() [82/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloat32ListEmpty   
)

Definition at line 542 of file fl_standard_message_codec_test.cc.

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

542  {
543  g_autoptr(FlValue) value = decode_message("0e000000");
545  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
546 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [83/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloat32List   
)

Definition at line 548 of file fl_standard_message_codec_test.cc.

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

548  {
549  g_autoptr(FlValue) value =
550  decode_message("0e05000000000000000000bf0000803e000000becdcccc3b");
552  const float* data = fl_value_get_float32_list(value);
553  EXPECT_FLOAT_EQ(data[0], 0.0f);
554  EXPECT_FLOAT_EQ(data[1], -0.5f);
555  EXPECT_FLOAT_EQ(data[2], 0.25f);
556  EXPECT_FLOAT_EQ(data[3], -0.125f);
557  EXPECT_FLOAT_EQ(data[4], 0.00625f);
558 }
G_MODULE_EXPORT const float * fl_value_get_float32_list(FlValue *self)
Definition: fl_value.cc:670
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value

◆ TEST() [84/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloat32ListNoData   
)

Definition at line 560 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [85/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloat32ListLengthNoData   
)

Definition at line 565 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [86/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloat32ListShortData1   
)

Definition at line 570 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [87/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloat32ListShortData2   
)

Definition at line 575 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

575  {
576  decode_error_value("0e05000000000000000000bf0000803e000000becdcccc",
579 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [88/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatListEmpty   
)

Definition at line 581 of file fl_standard_message_codec_test.cc.

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

581  {
582  g_autoptr(FlValue) value = fl_value_new_float_list(nullptr, 0);
583  g_autofree gchar* hex_string = encode_message(value);
584  EXPECT_STREQ(hex_string, "0b00000000000000");
585 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
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:328

◆ TEST() [89/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeFloatList   
)

Definition at line 587 of file fl_standard_message_codec_test.cc.

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

587  {
588  double data[] = {0, -0.5, 0.25, -0.125, 0.00625};
589  g_autoptr(FlValue) value = fl_value_new_float_list(data, 5);
590  g_autofree gchar* hex_string = encode_message(value);
591  EXPECT_STREQ(
592  hex_string,
593  "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
594  "0000c0bf9a9999999999793f");
595 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
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:328

◆ TEST() [90/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListEmpty   
)

Definition at line 597 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.

597  {
598  g_autoptr(FlValue) value = decode_message("0b00000000000000");
600  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
601 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [91/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatList   
)

Definition at line 603 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.

603  {
604  g_autoptr(FlValue) value = decode_message(
605  "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
606  "0000c0bf9a9999999999793f");
608  const double* data = fl_value_get_float_list(value);
609  EXPECT_FLOAT_EQ(data[0], 0.0);
610  EXPECT_FLOAT_EQ(data[1], -0.5);
611  EXPECT_FLOAT_EQ(data[2], 0.25);
612  EXPECT_FLOAT_EQ(data[3], -0.125);
613  EXPECT_FLOAT_EQ(data[4], 0.00625);
614 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT const double * fl_value_get_float_list(FlValue *self)
Definition: fl_value.cc:677
uint8_t value

◆ TEST() [92/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListNoData   
)

Definition at line 616 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [93/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListLengthNoData   
)

Definition at line 621 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

621  {
622  decode_error_value("0b05000000000000", FL_MESSAGE_CODEC_ERROR,
624 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [94/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListShortData1   
)

Definition at line 626 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

626  {
627  decode_error_value("0b0500000000000000", FL_MESSAGE_CODEC_ERROR,
629 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [95/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeFloatListShortData2   
)

Definition at line 631 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

631  {
633  "0b050000000000000000000000000000000000000000e0bf000000000000d03f00000000"
634  "0000c0bf9a99"
635  "9999999979",
637 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [96/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeListEmpty   
)

Definition at line 639 of file fl_standard_message_codec_test.cc.

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

639  {
640  g_autoptr(FlValue) value = fl_value_new_list();
641  g_autofree gchar* hex_string = encode_message(value);
642  EXPECT_STREQ(hex_string, "0c00");
643 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [97/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeListTypes   
)

Definition at line 645 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.

645  {
646  g_autoptr(FlValue) value = fl_value_new_list();
654  g_autofree gchar* hex_string = encode_message(value);
655  EXPECT_STREQ(
656  hex_string,
657  "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
658 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:258
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:560
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:240

◆ TEST() [98/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeListNested   
)

Definition at line 660 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.

660  {
661  g_autoptr(FlValue) even_numbers = fl_value_new_list();
662  g_autoptr(FlValue) odd_numbers = fl_value_new_list();
663  for (int i = 0; i < 10; i++) {
664  if (i % 2 == 0)
665  fl_value_append_take(even_numbers, fl_value_new_int(i));
666  else
667  fl_value_append_take(odd_numbers, fl_value_new_int(i));
668  }
669  g_autoptr(FlValue) value = fl_value_new_list();
670  fl_value_append(value, even_numbers);
671  fl_value_append(value, odd_numbers);
672  g_autofree gchar* hex_string = encode_message(value);
673  EXPECT_STREQ(hex_string,
674  "0c020c05030000000003020000000304000000030600000003080000000c"
675  "0503010000000303000000030500000003070000000309000000");
676 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:552
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:560
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251

◆ TEST() [99/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListEmpty   
)

Definition at line 678 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.

678  {
679  g_autoptr(FlValue) value = decode_message("0c00");
681  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
682 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [100/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListTypes   
)

Definition at line 684 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.

684  {
685  g_autoptr(FlValue) value = decode_message(
686  "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d00");
688  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
696  EXPECT_EQ(fl_value_get_int(fl_value_get_list_value(value, 2)), 42);
699  EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_list_value(value, 3)), M_PI);
702  EXPECT_STREQ(fl_value_get_string(fl_value_get_list_value(value, 4)), "hello");
706  static_cast<size_t>(0));
710  static_cast<size_t>(0));
711 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:735
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:621

◆ TEST() [101/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListNested   
)

Definition at line 713 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.

713  {
714  g_autoptr(FlValue) value = decode_message(
715  "0c020c05030000000003020000000304000000030600000003080000000c"
716  "0503010000000303000000030500000003070000000309000000");
718  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
719  FlValue* even_list = fl_value_get_list_value(value, 0);
720  ASSERT_EQ(fl_value_get_type(even_list), FL_VALUE_TYPE_LIST);
721  ASSERT_EQ(fl_value_get_length(even_list), static_cast<size_t>(5));
722  FlValue* odd_list = fl_value_get_list_value(value, 1);
723  ASSERT_EQ(fl_value_get_type(odd_list), FL_VALUE_TYPE_LIST);
724  ASSERT_EQ(fl_value_get_length(odd_list), static_cast<size_t>(5));
725  for (int i = 0; i < 5; i++) {
726  FlValue* v = fl_value_get_list_value(even_list, i);
727  ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
728  EXPECT_EQ(fl_value_get_int(v), i * 2);
729 
730  v = fl_value_get_list_value(odd_list, i);
731  ASSERT_EQ(fl_value_get_type(v), FL_VALUE_TYPE_INT);
732  EXPECT_EQ(fl_value_get_int(v), i * 2 + 1);
733  }
734 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_list_value(FlValue *self, size_t index)
Definition: fl_value.cc:735
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [102/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListNoData   
)

Definition at line 736 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [103/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListLengthNoData   
)

Definition at line 741 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [104/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListShortData1   
)

Definition at line 746 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [105/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeListShortData2   
)

Definition at line 751 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

751  {
753  "0c070001032a00000006000000000000182d4454fb210940070568656c6c6f0c000d",
755 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [106/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeDecodeLargeList   
)

Definition at line 757 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.

757  {
758  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
759 
760  g_autoptr(FlValue) value = fl_value_new_list();
761  for (int i = 0; i < 65535; i++)
763 
764  g_autoptr(GError) error = nullptr;
765  g_autoptr(GBytes) message =
766  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
767  EXPECT_NE(message, nullptr);
768  EXPECT_EQ(error, nullptr);
769 
770  g_autoptr(FlValue) decoded_value =
771  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
772  EXPECT_EQ(error, nullptr);
773  EXPECT_NE(value, nullptr);
774 
775  ASSERT_TRUE(fl_value_equal(value, decoded_value));
776 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:433
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:560
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
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() [107/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapEmpty   
)

Definition at line 778 of file fl_standard_message_codec_test.cc.

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

778  {
779  g_autoptr(FlValue) value = fl_value_new_map();
780  g_autofree gchar* hex_string = encode_message(value);
781  EXPECT_STREQ(hex_string, "0d00");
782 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
uint8_t value

◆ TEST() [108/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapKeyTypes   
)

Definition at line 784 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.

784  {
785  g_autoptr(FlValue) value = fl_value_new_map();
788  fl_value_new_string("bool"));
791  fl_value_new_string("float"));
793  fl_value_new_string("string"));
796  g_autofree gchar* hex_string = encode_message(value);
797  EXPECT_STREQ(hex_string,
798  "0d070007046e756c6c010704626f6f6c032a0000000703696e7406000000000"
799  "0182d4454fb2109400705666c6f6174070568656c6c6f0706737472696e670c"
800  "0007046c6973740d0007036d6170");
801 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:258
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:578
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:240

◆ TEST() [109/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapValueTypes   
)

Definition at line 803 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.

803  {
804  g_autoptr(FlValue) value = fl_value_new_map();
810  fl_value_new_float(M_PI));
812  fl_value_new_string("hello"));
815  g_autofree gchar* hex_string = encode_message(value);
816  EXPECT_STREQ(hex_string,
817  "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6"
818  "17406000000000000182d4454fb2109400706737472696e67070568656c6c6f"
819  "07046c6973740c0007036d61700d00");
820 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:258
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:578
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:240

◆ TEST() [110/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeMapNested   
)

Definition at line 822 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.

822  {
823  g_autoptr(FlValue) str_to_int = fl_value_new_map();
824  g_autoptr(FlValue) int_to_str = fl_value_new_map();
825  const char* numbers[] = {"zero", "one", "two", "three", nullptr};
826  for (int i = 0; numbers[i] != nullptr; i++) {
827  fl_value_set_take(str_to_int, fl_value_new_string(numbers[i]),
828  fl_value_new_int(i));
829  fl_value_set_take(int_to_str, fl_value_new_int(i),
830  fl_value_new_string(numbers[i]));
831  }
832  g_autoptr(FlValue) value = fl_value_new_map();
833  fl_value_set_string(value, "str-to-int", str_to_int);
834  fl_value_set_string(value, "int-to-str", int_to_str);
835  g_autofree gchar* hex_string = encode_message(value);
836  EXPECT_STREQ(hex_string,
837  "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6"
838  "50301000000070374776f0302000000070574687265650303000000070a696e"
839  "742d746f2d7374720d04030000000007047a65726f030100000007036f6e650"
840  "302000000070374776f030300000007057468726565");
841 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:578
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:599

◆ TEST() [111/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapEmpty   
)

Definition at line 843 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.

843  {
844  g_autoptr(FlValue) value = decode_message("0d00");
846  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
847 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
uint8_t value
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [112/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapKeyTypes   
)

Definition at line 849 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.

849  {
850  g_autoptr(FlValue) value = decode_message(
851  "0d070007046e756c6c010704626f6f6c032a0000000703696e74060000000000182d4454"
852  "fb2109400705666c6f6174070568656c6c6f0706737472696e670c0007046c6973740d00"
853  "07036d6170");
855  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
856 
861  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 0)), "null");
862 
865  EXPECT_TRUE(fl_value_get_bool(fl_value_get_map_key(value, 1)));
868  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 1)), "bool");
869 
872  EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(value, 2)), 42);
875  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 2)), "int");
876 
879  EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_key(value, 3)), M_PI);
882  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 3)), "float");
883 
886  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "hello");
889  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "string");
890 
894  static_cast<size_t>(0));
897  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 5)), "list");
898 
902  static_cast<size_t>(0));
905  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 6)), "map");
906 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:751
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:743
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:621

◆ TEST() [113/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapValueTypes   
)

Definition at line 908 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.

908  {
909  g_autoptr(FlValue) value = decode_message(
910  "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
911  "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
912  "036d61700d00");
914  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(7));
915 
918  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 0)), "null");
921 
924  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 1)), "bool");
928 
931  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 2)), "int");
934  EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(value, 2)), 42);
935 
938  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 3)), "float");
941  EXPECT_FLOAT_EQ(fl_value_get_float(fl_value_get_map_value(value, 3)), M_PI);
942 
945  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 4)), "string");
948  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(value, 4)), "hello");
949 
952  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 5)), "list");
956  static_cast<size_t>(0));
957 
960  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(value, 6)), "map");
964  static_cast<size_t>(0));
965 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:635
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:751
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:743
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:621

◆ TEST() [114/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapNested   
)

Definition at line 967 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.

967  {
968  g_autoptr(FlValue) value = decode_message(
969  "0d02070a7374722d746f2d696e740d0407047a65726f030000000007036f6e6503010000"
970  "00070374776f0302000000070574687265650303000000070a696e742d746f2d7374720d"
971  "04030000000007047a65726f030100000007036f6e650302000000070374776f03030000"
972  "0007057468726565");
974  ASSERT_EQ(fl_value_get_length(value), static_cast<size_t>(2));
975 
979  "str-to-int");
980  FlValue* str_to_int = fl_value_get_map_value(value, 0);
981  ASSERT_EQ(fl_value_get_type(str_to_int), FL_VALUE_TYPE_MAP);
982  ASSERT_EQ(fl_value_get_length(str_to_int), static_cast<size_t>(4));
983 
987  "int-to-str");
988  FlValue* int_to_str = fl_value_get_map_value(value, 1);
989  ASSERT_EQ(fl_value_get_type(int_to_str), FL_VALUE_TYPE_MAP);
990  ASSERT_EQ(fl_value_get_length(int_to_str), static_cast<size_t>(4));
991 
992  const char* numbers[] = {"zero", "one", "two", "three", nullptr};
993  for (int i = 0; numbers[i] != nullptr; i++) {
994  ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(str_to_int, i)),
996  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_key(str_to_int, i)),
997  numbers[i]);
998 
999  ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(str_to_int, i)),
1001  EXPECT_EQ(fl_value_get_int(fl_value_get_map_value(str_to_int, i)), i);
1002 
1003  ASSERT_EQ(fl_value_get_type(fl_value_get_map_key(int_to_str, i)),
1005  EXPECT_EQ(fl_value_get_int(fl_value_get_map_key(int_to_str, i)), i);
1006 
1007  ASSERT_EQ(fl_value_get_type(fl_value_get_map_value(int_to_str, i)),
1009  EXPECT_STREQ(fl_value_get_string(fl_value_get_map_value(int_to_str, i)),
1010  numbers[i]);
1011  }
1012 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:428
static FlValue * decode_message(const char *hex_string)
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:628
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_get_map_value(FlValue *self, size_t index)
Definition: fl_value.cc:751
G_MODULE_EXPORT FlValue * fl_value_get_map_key(FlValue *self, size_t index)
Definition: fl_value.cc:743
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:642
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:684

◆ TEST() [115/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapNoData   
)

Definition at line 1014 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [116/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapLengthNoData   
)

Definition at line 1019 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [117/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapShortData1   
)

Definition at line 1024 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

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

◆ TEST() [118/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeMapShortData2   
)

Definition at line 1029 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_OUT_OF_DATA.

1029  {
1031  "0d0707046e756c6c000704626f6f6c010703696e74032a0000000705666c6f6174060000"
1032  "00000000182d4454fb2109400706737472696e67070568656c6c6f07046c6973740c0007"
1033  "036d61700d",
1035 }
#define FL_MESSAGE_CODEC_ERROR
static void decode_error_value(const char *hex_string, GQuark domain, gint code)

◆ TEST() [119/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeDecodeLargeMap   
)

Definition at line 1037 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(), key, and value.

1037  {
1038  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1039 
1040  g_autoptr(FlValue) value = fl_value_new_map();
1041  for (int i = 0; i < 512; i++) {
1042  g_autofree gchar* key = g_strdup_printf("key%d", i);
1044  }
1045 
1046  g_autoptr(GError) error = nullptr;
1047  g_autoptr(GBytes) message =
1048  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), value, &error);
1049  EXPECT_NE(message, nullptr);
1050  EXPECT_EQ(error, nullptr);
1051 
1052  g_autoptr(FlValue) decoded_value =
1053  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1054  EXPECT_EQ(error, nullptr);
1055  EXPECT_NE(value, nullptr);
1056 
1057  ASSERT_TRUE(fl_value_equal(value, decoded_value));
1058 }
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:433
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
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:610

◆ TEST() [120/121]

TEST ( FlStandardMessageCodecTest  ,
DecodeUnknownType   
)

Definition at line 1060 of file fl_standard_message_codec_test.cc.

References decode_error_value(), FL_MESSAGE_CODEC_ERROR, and FL_MESSAGE_CODEC_ERROR_UNSUPPORTED_TYPE.

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

◆ TEST() [121/121]

TEST ( FlStandardMessageCodecTest  ,
EncodeDecode   
)

Definition at line 1065 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.

1065  {
1066  g_autoptr(FlStandardMessageCodec) codec = fl_standard_message_codec_new();
1067 
1068  g_autoptr(FlValue) input = fl_value_new_list();
1073  fl_value_append_take(input, fl_value_new_string("hello"));
1076 
1077  g_autoptr(GError) error = nullptr;
1078  g_autoptr(GBytes) message =
1079  fl_message_codec_encode_message(FL_MESSAGE_CODEC(codec), input, &error);
1080  EXPECT_NE(message, nullptr);
1081  EXPECT_EQ(error, nullptr);
1082 
1083  g_autoptr(FlValue) output =
1084  fl_message_codec_decode_message(FL_MESSAGE_CODEC(codec), message, &error);
1085  EXPECT_EQ(error, nullptr);
1086  EXPECT_NE(output, nullptr);
1087 
1088  ASSERT_TRUE(fl_value_equal(input, output));
1089 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:338
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:258
const uint8_t uint32_t uint32_t GError ** error
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:40
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:355
G_MODULE_EXPORT FlStandardMessageCodec * fl_standard_message_codec_new()
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:244
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:433
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:560
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:251
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:265
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 FlValue * fl_value_new_null()
Definition: fl_value.cc:240