Flutter Engine
fl_json_message_codec_test.cc File Reference
#include "flutter/shell/platform/linux/public/flutter_linux/fl_json_message_codec.h"
#include "gtest/gtest.h"
#include <cmath>

Go to the source code of this file.

Functions

static gchar * encode_message (FlValue *value)
 
static void encode_error_message (FlValue *value, GQuark domain, gint code)
 
static FlValuedecode_message (const char *text)
 
static void decode_error_message (const char *text, GQuark domain, gint code)
 
 TEST (FlJsonMessageCodecTest, EncodeNullptr)
 
 TEST (FlJsonMessageCodecTest, EncodeNull)
 
 TEST (FlJsonMessageCodecTest, DecodeNull)
 
static gchar * encode_bool (gboolean value)
 
 TEST (FlJsonMessageCodecTest, EncodeBoolFalse)
 
 TEST (FlJsonMessageCodecTest, EncodeBoolTrue)
 
 TEST (FlJsonMessageCodecTest, DecodeBoolFalse)
 
 TEST (FlJsonMessageCodecTest, DecodeBoolTrue)
 
static gchar * encode_int (int64_t value)
 
 TEST (FlJsonMessageCodecTest, EncodeIntZero)
 
 TEST (FlJsonMessageCodecTest, EncodeIntOne)
 
 TEST (FlJsonMessageCodecTest, EncodeInt12345)
 
 TEST (FlJsonMessageCodecTest, EncodeIntMin)
 
 TEST (FlJsonMessageCodecTest, EncodeIntMax)
 
 TEST (FlJsonMessageCodecTest, DecodeIntZero)
 
 TEST (FlJsonMessageCodecTest, DecodeIntOne)
 
 TEST (FlJsonMessageCodecTest, DecodeInt12345)
 
 TEST (FlJsonMessageCodecTest, DecodeIntMin)
 
 TEST (FlJsonMessageCodecTest, DecodeIntMax)
 
 TEST (FlJsonMessageCodecTest, DecodeUintMax)
 
 TEST (FlJsonMessageCodecTest, DecodeHugeNumber)
 
 TEST (FlJsonMessageCodecTest, DecodeIntLeadingZero1)
 
 TEST (FlJsonMessageCodecTest, DecodeIntLeadingZero2)
 
 TEST (FlJsonMessageCodecTest, DecodeIntDoubleNegative)
 
 TEST (FlJsonMessageCodecTest, DecodeIntPositiveSign)
 
 TEST (FlJsonMessageCodecTest, DecodeIntHexChar)
 
static gchar * encode_float (double value)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatZero)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatOne)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatMinusOne)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatHalf)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatPi)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatMinusZero)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatZero)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatOne)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatMinusOne)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatHalf)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatPi)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatMinusZero)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatMissingFraction)
 
 TEST (FlJsonMessageCodecTest, DecodeFloatInvalidFraction)
 
static gchar * encode_string (const gchar *value)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeStringHello)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEmptySized)
 
 TEST (FlJsonMessageCodecTest, EncodeStringHelloSized)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeQuote)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeBackslash)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeBackspace)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeFormFeed)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeNewline)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeCarriageReturn)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeTab)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEscapeUnicode)
 
 TEST (FlJsonMessageCodecTest, EncodeStringEmoji)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEmpty)
 
 TEST (FlJsonMessageCodecTest, DecodeStringHello)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeQuote)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeBackslash)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeSlash)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeBackspace)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeFormFeed)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeNewline)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeCarriageReturn)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeTab)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeUnicode)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEmoji)
 
 TEST (FlJsonMessageCodecTest, DecodeInvalidUTF8)
 
 TEST (FlJsonMessageCodecTest, DecodeStringInvalidUTF8)
 
 TEST (FlJsonMessageCodecTest, DecodeStringBinary)
 
 TEST (FlJsonMessageCodecTest, DecodeStringNewline)
 
 TEST (FlJsonMessageCodecTest, DecodeStringCarriageReturn)
 
 TEST (FlJsonMessageCodecTest, DecodeStringTab)
 
 TEST (FlJsonMessageCodecTest, DecodeStringUnterminatedEmpty)
 
 TEST (FlJsonMessageCodecTest, DecodeStringExtraQuote)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapedClosingQuote)
 
 TEST (FlJsonMessageCodecTest, DecodeStringUnknownEscape)
 
 TEST (FlJsonMessageCodecTest, DecodeStringInvalidEscapeUnicode)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeUnicodeNoData)
 
 TEST (FlJsonMessageCodecTest, DecodeStringEscapeUnicodeShortData)
 
 TEST (FlJsonMessageCodecTest, EncodeUint8ListEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeUint8List)
 
 TEST (FlJsonMessageCodecTest, EncodeInt32ListEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeInt32List)
 
 TEST (FlJsonMessageCodecTest, EncodeInt64ListEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeInt64List)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatListEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeFloatList)
 
 TEST (FlJsonMessageCodecTest, EncodeListEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeListTypes)
 
 TEST (FlJsonMessageCodecTest, EncodeListNested)
 
 TEST (FlJsonMessageCodecTest, DecodeListEmpty)
 
 TEST (FlJsonMessageCodecTest, DecodeListNoComma)
 
 TEST (FlJsonMessageCodecTest, DecodeListUnterminatedEmpty)
 
 TEST (FlJsonMessageCodecTest, DecodeListStartUnterminate)
 
 TEST (FlJsonMessageCodecTest, DecodeListUnterminated)
 
 TEST (FlJsonMessageCodecTest, DecodeListDoubleTerminated)
 
 TEST (FlJsonMessageCodecTest, EncodeMapEmpty)
 
 TEST (FlJsonMessageCodecTest, EncodeMapNullKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapBoolKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapIntKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapFloatKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapUint8ListKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapInt32ListKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapInt64ListKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapFloatListKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapListKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapMapKey)
 
 TEST (FlJsonMessageCodecTest, EncodeMapValueTypes)
 
 TEST (FlJsonMessageCodecTest, EncodeMapNested)
 
 TEST (FlJsonMessageCodecTest, DecodeMapEmpty)
 
 TEST (FlJsonMessageCodecTest, DecodeMapUnterminatedEmpty)
 
 TEST (FlJsonMessageCodecTest, DecodeMapStartUnterminate)
 
 TEST (FlJsonMessageCodecTest, DecodeMapNoComma)
 
 TEST (FlJsonMessageCodecTest, DecodeMapNoColon)
 
 TEST (FlJsonMessageCodecTest, DecodeMapUnterminated)
 
 TEST (FlJsonMessageCodecTest, DecodeMapDoubleTerminated)
 
 TEST (FlJsonMessageCodecTest, DecodeUnknownWord)
 
 TEST (FlJsonMessageCodecTest, EncodeDecode)
 

Function Documentation

◆ decode_error_message()

static void decode_error_message ( const char *  text,
GQuark  domain,
gint  code 
)
static

Definition at line 41 of file fl_json_message_codec_test.cc.

References error, fl_json_message_codec_decode(), fl_json_message_codec_new(), and value.

Referenced by TEST().

41  {
42  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
43  g_autoptr(GError) error = nullptr;
44  g_autoptr(FlValue) value = fl_json_message_codec_decode(codec, text, &error);
45  EXPECT_TRUE(g_error_matches(error, domain, code));
46  EXPECT_EQ(value, nullptr);
47 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
uint8_t value
G_MODULE_EXPORT FlValue * fl_json_message_codec_decode(FlJsonMessageCodec *codec, const gchar *text, GError **error)

◆ decode_message()

static FlValue* decode_message ( const char *  text)
static

Definition at line 30 of file fl_json_message_codec_test.cc.

References error, fl_json_message_codec_decode(), fl_json_message_codec_new(), fl_value_ref(), and value.

Referenced by TEST().

30  {
31  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
32  g_autoptr(GError) error = nullptr;
33  g_autoptr(FlValue) value = fl_json_message_codec_decode(codec, text, &error);
34  EXPECT_EQ(error, nullptr);
35  EXPECT_NE(value, nullptr);
36  return fl_value_ref(value);
37 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:335
G_MODULE_EXPORT FlValue * fl_json_message_codec_decode(FlJsonMessageCodec *codec, const gchar *text, GError **error)

◆ encode_bool()

static gchar* encode_bool ( gboolean  value)
static

Definition at line 65 of file fl_json_message_codec_test.cc.

References encode_message(), and fl_value_new_bool().

Referenced by TEST().

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

◆ encode_error_message()

static void encode_error_message ( FlValue value,
GQuark  domain,
gint  code 
)
static

Definition at line 21 of file fl_json_message_codec_test.cc.

References error, fl_json_message_codec_encode(), and fl_json_message_codec_new().

Referenced by TEST().

21  {
22  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
23  g_autoptr(GError) error = nullptr;
24  g_autofree gchar* result = fl_json_message_codec_encode(codec, value, &error);
25  EXPECT_TRUE(g_error_matches(error, domain, code));
26  EXPECT_EQ(result, nullptr);
27 }
FlMethodResponse GError ** error
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
uint8_t value
G_MODULE_EXPORT gchar * fl_json_message_codec_encode(FlJsonMessageCodec *codec, FlValue *value, GError **error)

◆ encode_float()

static gchar* encode_float ( double  value)
static

Definition at line 193 of file fl_json_message_codec_test.cc.

References encode_message(), and fl_value_new_float().

Referenced by TEST().

193  {
194  g_autoptr(FlValue) v = fl_value_new_float(value);
195  return encode_message(v);
196 }
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ encode_int()

static gchar* encode_int ( int64_t  value)
static

Definition at line 92 of file fl_json_message_codec_test.cc.

References encode_message(), and fl_value_new_int().

Referenced by TEST().

92  {
93  g_autoptr(FlValue) v = fl_value_new_int(value);
94  return encode_message(v);
95 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233

◆ encode_message()

static gchar* encode_message ( FlValue value)
static

Definition at line 11 of file fl_json_message_codec_test.cc.

References error, fl_json_message_codec_encode(), and fl_json_message_codec_new().

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

11  {
12  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
13  g_autoptr(GError) error = nullptr;
14  g_autofree gchar* result = fl_json_message_codec_encode(codec, value, &error);
15  EXPECT_EQ(error, nullptr);
16  return static_cast<gchar*>(g_steal_pointer(&result));
17 }
FlMethodResponse GError ** error
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
uint8_t value
G_MODULE_EXPORT gchar * fl_json_message_codec_encode(FlJsonMessageCodec *codec, FlValue *value, GError **error)

◆ encode_string()

static gchar* encode_string ( const gchar *  value)
static

Definition at line 277 of file fl_json_message_codec_test.cc.

References encode_message(), and fl_value_new_string().

Referenced by TEST().

277  {
278  g_autoptr(FlValue) v = fl_value_new_string(value);
279  return encode_message(v);
280 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [1/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeNullptr   
)

Definition at line 49 of file fl_json_message_codec_test.cc.

References encode_message().

49  {
50  g_autofree gchar* text = encode_message(nullptr);
51  EXPECT_STREQ(text, "null");
52 }
static gchar * encode_message(FlValue *value)

◆ TEST() [2/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeNull   
)

Definition at line 54 of file fl_json_message_codec_test.cc.

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

54  {
55  g_autoptr(FlValue) value = fl_value_new_null();
56  g_autofree gchar* text = encode_message(value);
57  EXPECT_STREQ(text, "null");
58 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [3/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeNull   
)

Definition at line 60 of file fl_json_message_codec_test.cc.

References decode_message(), fl_value_get_type(), FL_VALUE_TYPE_NULL, and value.

60  {
61  g_autoptr(FlValue) value = decode_message("null");
63 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [4/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeBoolFalse   
)

Definition at line 70 of file fl_json_message_codec_test.cc.

References encode_bool().

70  {
71  g_autofree gchar* text = encode_bool(FALSE);
72  EXPECT_STREQ(text, "false");
73 }
static gchar * encode_bool(gboolean value)

◆ TEST() [5/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeBoolTrue   
)

Definition at line 75 of file fl_json_message_codec_test.cc.

References encode_bool(), and TRUE.

75  {
76  g_autofree gchar* text = encode_bool(TRUE);
77  EXPECT_STREQ(text, "true");
78 }
static gchar * encode_bool(gboolean value)
return TRUE
Definition: fl_view.cc:107

◆ TEST() [6/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeBoolFalse   
)

Definition at line 80 of file fl_json_message_codec_test.cc.

References decode_message(), fl_value_get_bool(), fl_value_get_type(), FL_VALUE_TYPE_BOOL, and value.

80  {
81  g_autoptr(FlValue) value = decode_message("false");
83  EXPECT_FALSE(fl_value_get_bool(value));
84 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:575

◆ TEST() [7/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeBoolTrue   
)

Definition at line 86 of file fl_json_message_codec_test.cc.

References decode_message(), fl_value_get_bool(), fl_value_get_type(), FL_VALUE_TYPE_BOOL, and value.

86  {
87  g_autoptr(FlValue) value = decode_message("true");
89  EXPECT_TRUE(fl_value_get_bool(value));
90 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:575

◆ TEST() [8/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntZero   
)

Definition at line 97 of file fl_json_message_codec_test.cc.

References encode_int().

97  {
98  g_autofree gchar* text = encode_int(0);
99  EXPECT_STREQ(text, "0");
100 }
static gchar * encode_int(int64_t value)

◆ TEST() [9/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntOne   
)

Definition at line 102 of file fl_json_message_codec_test.cc.

References encode_int().

102  {
103  g_autofree gchar* text = encode_int(1);
104  EXPECT_STREQ(text, "1");
105 }
static gchar * encode_int(int64_t value)

◆ TEST() [10/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt12345   
)

Definition at line 107 of file fl_json_message_codec_test.cc.

References encode_int().

107  {
108  g_autofree gchar* text = encode_int(12345);
109  EXPECT_STREQ(text, "12345");
110 }
static gchar * encode_int(int64_t value)

◆ TEST() [11/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntMin   
)

Definition at line 112 of file fl_json_message_codec_test.cc.

References encode_int().

112  {
113  g_autofree gchar* text = encode_int(G_MININT64);
114  EXPECT_STREQ(text, "-9223372036854775808");
115 }
static gchar * encode_int(int64_t value)

◆ TEST() [12/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntMax   
)

Definition at line 117 of file fl_json_message_codec_test.cc.

References encode_int().

117  {
118  g_autofree gchar* text = encode_int(G_MAXINT64);
119  EXPECT_STREQ(text, "9223372036854775807");
120 }
static gchar * encode_int(int64_t value)

◆ TEST() [13/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntZero   
)

Definition at line 122 of file fl_json_message_codec_test.cc.

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

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

◆ TEST() [14/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntOne   
)

Definition at line 128 of file fl_json_message_codec_test.cc.

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

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

◆ TEST() [15/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeInt12345   
)

Definition at line 134 of file fl_json_message_codec_test.cc.

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

134  {
135  g_autoptr(FlValue) value = decode_message("12345");
137  EXPECT_EQ(fl_value_get_int(value), 12345);
138 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [16/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntMin   
)

Definition at line 140 of file fl_json_message_codec_test.cc.

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

140  {
141  g_autoptr(FlValue) value = decode_message("-9223372036854775808");
143  EXPECT_EQ(fl_value_get_int(value), G_MININT64);
144 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [17/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntMax   
)

Definition at line 146 of file fl_json_message_codec_test.cc.

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

146  {
147  g_autoptr(FlValue) value = decode_message("9223372036854775807");
149  EXPECT_EQ(fl_value_get_int(value), G_MAXINT64);
150 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:582
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [18/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeUintMax   
)

Definition at line 152 of file fl_json_message_codec_test.cc.

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

152  {
153  // This is bigger than an signed 64 bit integer, so we expect it to be
154  // represented as a double.
155  g_autoptr(FlValue) value = decode_message("18446744073709551615");
157  EXPECT_EQ(fl_value_get_float(value), 1.8446744073709551615e+19);
158 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [19/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeHugeNumber   
)

Definition at line 160 of file fl_json_message_codec_test.cc.

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

160  {
161  // This is bigger than an unsigned 64 bit integer, so we expect it to be
162  // represented as a double.
163  g_autoptr(FlValue) value = decode_message("184467440737095516150");
165  EXPECT_EQ(fl_value_get_float(value), 1.84467440737095516150e+20);
166 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [20/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntLeadingZero1   
)

◆ TEST() [21/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntLeadingZero2   
)

◆ TEST() [22/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntDoubleNegative   
)

◆ TEST() [23/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntPositiveSign   
)

◆ TEST() [24/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntHexChar   
)

◆ TEST() [25/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatZero   
)

Definition at line 198 of file fl_json_message_codec_test.cc.

References encode_float().

198  {
199  g_autofree gchar* text = encode_float(0);
200  EXPECT_STREQ(text, "0.0");
201 }
static gchar * encode_float(double value)

◆ TEST() [26/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatOne   
)

Definition at line 203 of file fl_json_message_codec_test.cc.

References encode_float().

203  {
204  g_autofree gchar* text = encode_float(1);
205  EXPECT_STREQ(text, "1.0");
206 }
static gchar * encode_float(double value)

◆ TEST() [27/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatMinusOne   
)

Definition at line 208 of file fl_json_message_codec_test.cc.

References encode_float().

208  {
209  g_autofree gchar* text = encode_float(-1);
210  EXPECT_STREQ(text, "-1.0");
211 }
static gchar * encode_float(double value)

◆ TEST() [28/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatHalf   
)

Definition at line 213 of file fl_json_message_codec_test.cc.

References encode_float().

213  {
214  g_autofree gchar* text = encode_float(0.5);
215  EXPECT_STREQ(text, "0.5");
216 }
static gchar * encode_float(double value)

◆ TEST() [29/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatPi   
)

Definition at line 218 of file fl_json_message_codec_test.cc.

References encode_float().

218  {
219  g_autofree gchar* text = encode_float(M_PI);
220  EXPECT_STREQ(text, "3.141592653589793");
221 }
static gchar * encode_float(double value)

◆ TEST() [30/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatMinusZero   
)

Definition at line 223 of file fl_json_message_codec_test.cc.

References encode_float().

223  {
224  g_autofree gchar* text = encode_float(-0.0);
225  EXPECT_STREQ(text, "-0.0");
226 }
static gchar * encode_float(double value)

◆ TEST() [31/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatZero   
)

Definition at line 231 of file fl_json_message_codec_test.cc.

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

231  {
232  g_autoptr(FlValue) value = decode_message("0.0");
234  EXPECT_EQ(fl_value_get_float(value), 0.0);
235 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [32/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatOne   
)

Definition at line 237 of file fl_json_message_codec_test.cc.

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

237  {
238  g_autoptr(FlValue) value = decode_message("1.0");
240  EXPECT_EQ(fl_value_get_float(value), 1.0);
241 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [33/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatMinusOne   
)

Definition at line 243 of file fl_json_message_codec_test.cc.

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

243  {
244  g_autoptr(FlValue) value = decode_message("-1.0");
246  EXPECT_EQ(fl_value_get_float(value), -1.0);
247 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [34/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatHalf   
)

Definition at line 249 of file fl_json_message_codec_test.cc.

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

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

◆ TEST() [35/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatPi   
)

Definition at line 255 of file fl_json_message_codec_test.cc.

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

255  {
256  g_autoptr(FlValue) value = decode_message("3.1415926535897931");
258  EXPECT_EQ(fl_value_get_float(value), M_PI);
259 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [36/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatMinusZero   
)

Definition at line 261 of file fl_json_message_codec_test.cc.

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

261  {
262  g_autoptr(FlValue) value = decode_message("-0.0");
264  EXPECT_EQ(fl_value_get_float(value), -0.0);
265 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:589
uint8_t value
static FlValue * decode_message(const char *text)

◆ TEST() [37/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatMissingFraction   
)

◆ TEST() [38/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatInvalidFraction   
)

◆ TEST() [39/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEmpty   
)

Definition at line 282 of file fl_json_message_codec_test.cc.

References encode_string().

282  {
283  g_autofree gchar* text = encode_string("");
284  EXPECT_STREQ(text, "\"\"");
285 }
static gchar * encode_string(const gchar *value)

◆ TEST() [40/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringHello   
)

Definition at line 287 of file fl_json_message_codec_test.cc.

References encode_string().

287  {
288  g_autofree gchar* text = encode_string("hello");
289  EXPECT_STREQ(text, "\"hello\"");
290 }
static gchar * encode_string(const gchar *value)

◆ TEST() [41/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEmptySized   
)

Definition at line 292 of file fl_json_message_codec_test.cc.

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

292  {
293  g_autoptr(FlValue) value = fl_value_new_string_sized(nullptr, 0);
294  g_autofree gchar* text = encode_message(value);
295  EXPECT_STREQ(text, "\"\"");
296 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:254

◆ TEST() [42/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringHelloSized   
)

Definition at line 298 of file fl_json_message_codec_test.cc.

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

298  {
299  g_autoptr(FlValue) value = fl_value_new_string_sized("Hello World", 5);
300  g_autofree gchar* text = encode_message(value);
301  EXPECT_STREQ(text, "\"Hello\"");
302 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:254

◆ TEST() [43/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeQuote   
)

Definition at line 304 of file fl_json_message_codec_test.cc.

References encode_string().

304  {
305  g_autofree gchar* text = encode_string("\"");
306  EXPECT_STREQ(text, "\"\\\"\"");
307 }
static gchar * encode_string(const gchar *value)

◆ TEST() [44/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeBackslash   
)

Definition at line 309 of file fl_json_message_codec_test.cc.

References encode_string().

309  {
310  g_autofree gchar* text = encode_string("\\");
311  EXPECT_STREQ(text, "\"\\\\\"");
312 }
static gchar * encode_string(const gchar *value)

◆ TEST() [45/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeBackspace   
)

Definition at line 314 of file fl_json_message_codec_test.cc.

References encode_string().

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

◆ TEST() [46/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeFormFeed   
)

Definition at line 319 of file fl_json_message_codec_test.cc.

References encode_string().

319  {
320  g_autofree gchar* text = encode_string("\f");
321  EXPECT_STREQ(text, "\"\\f\"");
322 }
static gchar * encode_string(const gchar *value)

◆ TEST() [47/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeNewline   
)

Definition at line 324 of file fl_json_message_codec_test.cc.

References encode_string().

324  {
325  g_autofree gchar* text = encode_string("\n");
326  EXPECT_STREQ(text, "\"\\n\"");
327 }
static gchar * encode_string(const gchar *value)

◆ TEST() [48/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeCarriageReturn   
)

Definition at line 329 of file fl_json_message_codec_test.cc.

References encode_string().

329  {
330  g_autofree gchar* text = encode_string("\r");
331  EXPECT_STREQ(text, "\"\\r\"");
332 }
static gchar * encode_string(const gchar *value)

◆ TEST() [49/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeTab   
)

Definition at line 334 of file fl_json_message_codec_test.cc.

References encode_string().

334  {
335  g_autofree gchar* text = encode_string("\t");
336  EXPECT_STREQ(text, "\"\\t\"");
337 }
static gchar * encode_string(const gchar *value)

◆ TEST() [50/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeUnicode   
)

Definition at line 339 of file fl_json_message_codec_test.cc.

References encode_string().

339  {
340  g_autofree gchar* text = encode_string("\u0001");
341  EXPECT_STREQ(text, "\"\\u0001\"");
342 }
static gchar * encode_string(const gchar *value)

◆ TEST() [51/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEmoji   
)

Definition at line 344 of file fl_json_message_codec_test.cc.

References encode_string().

344  {
345  g_autofree gchar* text = encode_string("😀");
346  EXPECT_STREQ(text, "\"😀\"");
347 }
static gchar * encode_string(const gchar *value)

◆ TEST() [52/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEmpty   
)

Definition at line 349 of file fl_json_message_codec_test.cc.

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

349  {
350  g_autoptr(FlValue) value = decode_message("\"\"");
352  EXPECT_STREQ(fl_value_get_string(value), "");
353 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [53/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringHello   
)

Definition at line 355 of file fl_json_message_codec_test.cc.

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

355  {
356  g_autoptr(FlValue) value = decode_message("\"hello\"");
358  EXPECT_STREQ(fl_value_get_string(value), "hello");
359 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [54/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeQuote   
)

Definition at line 361 of file fl_json_message_codec_test.cc.

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

361  {
362  g_autoptr(FlValue) value = decode_message("\"\\\"\"");
364  EXPECT_STREQ(fl_value_get_string(value), "\"");
365 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [55/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeBackslash   
)

Definition at line 367 of file fl_json_message_codec_test.cc.

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

367  {
368  g_autoptr(FlValue) value = decode_message("\"\\\\\"");
370  EXPECT_STREQ(fl_value_get_string(value), "\\");
371 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [56/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeSlash   
)

Definition at line 373 of file fl_json_message_codec_test.cc.

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

373  {
374  g_autoptr(FlValue) value = decode_message("\"\\/\"");
376  EXPECT_STREQ(fl_value_get_string(value), "/");
377 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [57/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeBackspace   
)

Definition at line 379 of file fl_json_message_codec_test.cc.

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

379  {
380  g_autoptr(FlValue) value = decode_message("\"\\b\"");
382  EXPECT_STREQ(fl_value_get_string(value), "\b");
383 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [58/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeFormFeed   
)

Definition at line 385 of file fl_json_message_codec_test.cc.

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

385  {
386  g_autoptr(FlValue) value = decode_message("\"\\f\"");
388  EXPECT_STREQ(fl_value_get_string(value), "\f");
389 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [59/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeNewline   
)

Definition at line 391 of file fl_json_message_codec_test.cc.

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

391  {
392  g_autoptr(FlValue) value = decode_message("\"\\n\"");
394  EXPECT_STREQ(fl_value_get_string(value), "\n");
395 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [60/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeCarriageReturn   
)

Definition at line 397 of file fl_json_message_codec_test.cc.

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

397  {
398  g_autoptr(FlValue) value = decode_message("\"\\r\"");
400  EXPECT_STREQ(fl_value_get_string(value), "\r");
401 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [61/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeTab   
)

Definition at line 403 of file fl_json_message_codec_test.cc.

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

403  {
404  g_autoptr(FlValue) value = decode_message("\"\\t\"");
406  EXPECT_STREQ(fl_value_get_string(value), "\t");
407 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [62/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeUnicode   
)

Definition at line 409 of file fl_json_message_codec_test.cc.

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

409  {
410  g_autoptr(FlValue) value = decode_message("\"\\u0001\"");
412  EXPECT_STREQ(fl_value_get_string(value), "\u0001");
413 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [63/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEmoji   
)

Definition at line 415 of file fl_json_message_codec_test.cc.

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

415  {
416  g_autoptr(FlValue) value = decode_message("\"😀\"");
418  EXPECT_STREQ(fl_value_get_string(value), "😀");
419 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:596

◆ TEST() [64/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeInvalidUTF8   
)

◆ TEST() [65/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringInvalidUTF8   
)

◆ TEST() [66/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringBinary   
)

Definition at line 431 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

431  {
434 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [67/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringNewline   
)

Definition at line 436 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

436  {
439 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [68/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringCarriageReturn   
)

Definition at line 441 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

441  {
444 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [69/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringTab   
)

Definition at line 446 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

446  {
449 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [70/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringUnterminatedEmpty   
)

◆ TEST() [71/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringExtraQuote   
)

◆ TEST() [72/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapedClosingQuote   
)

◆ TEST() [73/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringUnknownEscape   
)

◆ TEST() [74/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringInvalidEscapeUnicode   
)

◆ TEST() [75/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeUnicodeNoData   
)

◆ TEST() [76/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeUnicodeShortData   
)

◆ TEST() [77/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeUint8ListEmpty   
)

Definition at line 486 of file fl_json_message_codec_test.cc.

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

486  {
487  g_autoptr(FlValue) value = fl_value_new_uint8_list(nullptr, 0);
488  g_autofree gchar* text = encode_message(value);
489  EXPECT_STREQ(text, "[]");
490 }
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:263
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [78/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeUint8List   
)

Definition at line 492 of file fl_json_message_codec_test.cc.

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

492  {
493  uint8_t data[] = {0, 1, 2, 3, 4};
494  g_autoptr(FlValue) value = fl_value_new_uint8_list(data, 5);
495  g_autofree gchar* text = encode_message(value);
496  EXPECT_STREQ(text, "[0,1,2,3,4]");
497 }
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:263
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [79/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt32ListEmpty   
)

Definition at line 499 of file fl_json_message_codec_test.cc.

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

499  {
500  g_autoptr(FlValue) value = fl_value_new_int32_list(nullptr, 0);
501  g_autofree gchar* text = encode_message(value);
502  EXPECT_STREQ(text, "[]");
503 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:280
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [80/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt32List   
)

Definition at line 505 of file fl_json_message_codec_test.cc.

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

505  {
506  int32_t data[] = {0, -1, 2, -3, 4};
507  g_autoptr(FlValue) value = fl_value_new_int32_list(data, 5);
508  g_autofree gchar* text = encode_message(value);
509  EXPECT_STREQ(text, "[0,-1,2,-3,4]");
510 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:280
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [81/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt64ListEmpty   
)

Definition at line 512 of file fl_json_message_codec_test.cc.

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

512  {
513  g_autoptr(FlValue) value = fl_value_new_int64_list(nullptr, 0);
514  g_autofree gchar* text = encode_message(value);
515  EXPECT_STREQ(text, "[]");
516 }
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:290
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [82/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt64List   
)

Definition at line 518 of file fl_json_message_codec_test.cc.

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

518  {
519  int64_t data[] = {0, -1, 2, -3, 4};
520  g_autoptr(FlValue) value = fl_value_new_int64_list(data, 5);
521  g_autofree gchar* text = encode_message(value);
522  EXPECT_STREQ(text, "[0,-1,2,-3,4]");
523 }
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:290
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [83/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatListEmpty   
)

Definition at line 525 of file fl_json_message_codec_test.cc.

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

525  {
526  g_autoptr(FlValue) value = fl_value_new_float_list(nullptr, 0);
527  g_autofree gchar* text = encode_message(value);
528  EXPECT_STREQ(text, "[]");
529 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:300

◆ TEST() [84/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatList   
)

Definition at line 531 of file fl_json_message_codec_test.cc.

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

531  {
532  double data[] = {0, -0.5, 0.25, -0.125, 0.0625};
533  g_autoptr(FlValue) value = fl_value_new_float_list(data, 5);
534  g_autofree gchar* text = encode_message(value);
535  EXPECT_STREQ(text, "[0.0,-0.5,0.25,-0.125,0.0625]");
536 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:300

◆ TEST() [85/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeListEmpty   
)

Definition at line 538 of file fl_json_message_codec_test.cc.

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

538  {
539  g_autoptr(FlValue) value = fl_value_new_list();
540  g_autofree gchar* text = encode_message(value);
541  EXPECT_STREQ(text, "[]");
542 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [86/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeListTypes   
)

Definition at line 544 of file fl_json_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.

544  {
545  g_autoptr(FlValue) value = fl_value_new_list();
553  g_autofree gchar* text = encode_message(value);
554  EXPECT_STREQ(text, "[null,true,42,-1.5,\"hello\",[],{}]");
555 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [87/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeListNested   
)

Definition at line 557 of file fl_json_message_codec_test.cc.

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

557  {
558  g_autoptr(FlValue) even_numbers = fl_value_new_list();
559  g_autoptr(FlValue) odd_numbers = fl_value_new_list();
560  for (int i = 0; i < 10; i++) {
561  if (i % 2 == 0) {
562  fl_value_append_take(even_numbers, fl_value_new_int(i));
563  } else {
564  fl_value_append_take(odd_numbers, fl_value_new_int(i));
565  }
566  }
567  g_autoptr(FlValue) value = fl_value_new_list();
568  fl_value_append(value, even_numbers);
569  fl_value_append(value, odd_numbers);
570  g_autofree gchar* text = encode_message(value);
571  EXPECT_STREQ(text, "[[0,2,4,6,8],[1,3,5,7,9]]");
572 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:506
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
uint8_t value
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233

◆ TEST() [88/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListEmpty   
)

Definition at line 574 of file fl_json_message_codec_test.cc.

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

574  {
575  g_autoptr(FlValue) value = decode_message("[]");
577  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
578 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [89/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListNoComma   
)

◆ TEST() [90/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListUnterminatedEmpty   
)

◆ TEST() [91/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListStartUnterminate   
)

◆ TEST() [92/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListUnterminated   
)

◆ TEST() [93/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListDoubleTerminated   
)

◆ TEST() [94/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapEmpty   
)

Definition at line 605 of file fl_json_message_codec_test.cc.

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

605  {
606  g_autoptr(FlValue) value = fl_value_new_map();
607  g_autofree gchar* text = encode_message(value);
608  EXPECT_STREQ(text, "{}");
609 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static gchar * encode_message(FlValue *value)
uint8_t value

◆ TEST() [95/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapNullKey   
)

Definition at line 611 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_map(), fl_value_new_null(), fl_value_new_string(), fl_value_set_take(), and value.

611  {
612  g_autoptr(FlValue) value = fl_value_new_map();
616 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [96/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapBoolKey   
)

Definition at line 618 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_bool(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), TRUE, and value.

618  {
619  g_autoptr(FlValue) value = fl_value_new_map();
621  fl_value_new_string("bool"));
624 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107

◆ TEST() [97/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapIntKey   
)

Definition at line 626 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_int(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

626  {
627  g_autoptr(FlValue) value = fl_value_new_map();
631 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [98/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapFloatKey   
)

Definition at line 633 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_float(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

633  {
634  g_autoptr(FlValue) value = fl_value_new_map();
636  fl_value_new_string("float"));
639 }
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [99/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapUint8ListKey   
)

Definition at line 641 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_map(), fl_value_new_string(), fl_value_new_uint8_list(), fl_value_set_take(), and value.

641  {
642  g_autoptr(FlValue) value = fl_value_new_map();
644  fl_value_new_string("uint8_list"));
647 }
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:263
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [100/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapInt32ListKey   
)

Definition at line 649 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_int32_list(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

649  {
650  g_autoptr(FlValue) value = fl_value_new_map();
652  fl_value_new_string("int32_list"));
655 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:280
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [101/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapInt64ListKey   
)

Definition at line 657 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_int64_list(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

657  {
658  g_autoptr(FlValue) value = fl_value_new_map();
660  fl_value_new_string("int64_list"));
663 }
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:290
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [102/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapFloatListKey   
)

Definition at line 665 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_float_list(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

665  {
666  g_autoptr(FlValue) value = fl_value_new_map();
668  fl_value_new_string("float_list"));
671 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:300

◆ TEST() [103/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapListKey   
)

Definition at line 673 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_list(), fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

673  {
674  g_autoptr(FlValue) value = fl_value_new_map();
678 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [104/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapMapKey   
)

Definition at line 680 of file fl_json_message_codec_test.cc.

References encode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE, fl_value_new_map(), fl_value_new_string(), fl_value_set_take(), and value.

680  {
681  g_autoptr(FlValue) value = fl_value_new_map();
685 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
#define FL_JSON_MESSAGE_CODEC_ERROR
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static void encode_error_message(FlValue *value, GQuark domain, gint code)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247

◆ TEST() [105/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapValueTypes   
)

Definition at line 687 of file fl_json_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.

687  {
688  g_autoptr(FlValue) value = fl_value_new_map();
694  fl_value_new_float(-1.5));
696  fl_value_new_string("hello"));
699  g_autofree gchar* text = encode_message(value);
700  EXPECT_STREQ(text,
701  "{\"null\":null,\"bool\":true,\"int\":42,\"float\":-"
702  "1.5,\"string\":\"hello\",\"list\":[],\"map\":{}}");
703 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222

◆ TEST() [106/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapNested   
)

Definition at line 705 of file fl_json_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.

705  {
706  g_autoptr(FlValue) str_to_int = fl_value_new_map();
707  const char* numbers[] = {"zero", "one", "two", "three", nullptr};
708  for (int i = 0; numbers[i] != nullptr; i++) {
709  fl_value_set_take(str_to_int, fl_value_new_string(numbers[i]),
710  fl_value_new_int(i));
711  }
712  g_autoptr(FlValue) value = fl_value_new_map();
713  fl_value_set_string(value, "str-to-int", str_to_int);
714  g_autofree gchar* text = encode_message(value);
715  EXPECT_STREQ(text,
716  "{\"str-to-int\":{\"zero\":0,\"one\":1,\"two\":2,\"three\":3}}");
717 }
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
static gchar * encode_message(FlValue *value)
uint8_t value
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:532
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:553

◆ TEST() [107/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapEmpty   
)

Definition at line 719 of file fl_json_message_codec_test.cc.

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

719  {
720  g_autoptr(FlValue) value = decode_message("{}");
722  EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
723 }
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:395
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
uint8_t value
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:631

◆ TEST() [108/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapUnterminatedEmpty   
)

◆ TEST() [109/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapStartUnterminate   
)

◆ TEST() [110/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapNoComma   
)

Definition at line 735 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

735  {
736  decode_error_message("{\"zero\":0 \"one\":1}", FL_JSON_MESSAGE_CODEC_ERROR,
738 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [111/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapNoColon   
)

Definition at line 740 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

740  {
741  decode_error_message("{\"zero\" 0,\"one\":1}", FL_JSON_MESSAGE_CODEC_ERROR,
743 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [112/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapUnterminated   
)

Definition at line 745 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

745  {
746  decode_error_message("{\"zero\":0,\"one\":1", FL_JSON_MESSAGE_CODEC_ERROR,
748 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [113/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapDoubleTerminated   
)

Definition at line 750 of file fl_json_message_codec_test.cc.

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

750  {
751  decode_error_message("{\"zero\":0,\"one\":1}}", FL_JSON_MESSAGE_CODEC_ERROR,
753 }
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [114/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeUnknownWord   
)

◆ TEST() [115/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeDecode   
)

Definition at line 760 of file fl_json_message_codec_test.cc.

References error, fl_json_message_codec_decode(), fl_json_message_codec_encode(), fl_json_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.

760  {
761  g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
762 
763  g_autoptr(FlValue) input = fl_value_new_list();
768  fl_value_append_take(input, fl_value_new_string("hello"));
771 
772  g_autoptr(GError) error = nullptr;
773  g_autofree gchar* message =
774  fl_json_message_codec_encode(codec, input, &error);
775  ASSERT_NE(message, nullptr);
776  EXPECT_EQ(error, nullptr);
777 
778  g_autoptr(FlValue) output =
779  fl_json_message_codec_decode(codec, message, &error);
780  EXPECT_EQ(error, nullptr);
781  EXPECT_NE(output, nullptr);
782 
783  EXPECT_TRUE(fl_value_equal(input, output));
784 }
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:310
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:240
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:39
FlMethodResponse GError ** error
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:327
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:226
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:400
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:514
G_MODULE_EXPORT gchar * fl_json_message_codec_encode(FlJsonMessageCodec *codec, FlValue *value, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:233
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:247
return TRUE
Definition: fl_view.cc:107
G_MODULE_EXPORT FlValue * fl_json_message_codec_decode(FlJsonMessageCodec *codec, const gchar *text, GError **error)
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:222