Flutter Engine
The Flutter Engine
Functions
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.

41 {
42 g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
43 g_autoptr(GError) error = nullptr;
45 EXPECT_TRUE(g_error_matches(error, domain, code));
46 EXPECT_EQ(value, nullptr);
47}
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
G_MODULE_EXPORT FlValue * fl_json_message_codec_decode(FlJsonMessageCodec *codec, const gchar *text, GError **error)
const uint8_t uint32_t uint32_t GError ** error
uint8_t value
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
std::u16string text
#define EXPECT_TRUE(handle)
Definition: unit_test.h:678

◆ decode_message()

static FlValue * decode_message ( const char *  text)
static

Definition at line 30 of file fl_json_message_codec_test.cc.

30 {
31 g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
32 g_autoptr(GError) error = nullptr;
34 EXPECT_EQ(error, nullptr);
35 EXPECT_NE(value, nullptr);
36 return fl_value_ref(value);
37}
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394

◆ encode_bool()

static gchar * encode_bool ( gboolean  value)
static

Definition at line 65 of file fl_json_message_codec_test.cc.

65 {
66 g_autoptr(FlValue) v = fl_value_new_bool(value);
67 return encode_message(v);
68}
static gchar * encode_message(FlValue *value)
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255

◆ 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.

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}
G_MODULE_EXPORT gchar * fl_json_message_codec_encode(FlJsonMessageCodec *codec, FlValue *value, GError **error)
GAsyncResult * result

◆ encode_float()

static gchar * encode_float ( double  value)
static

Definition at line 193 of file fl_json_message_codec_test.cc.

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:269

◆ encode_int()

static gchar * encode_int ( int64_t  value)
static

Definition at line 92 of file fl_json_message_codec_test.cc.

92 {
93 g_autoptr(FlValue) v = fl_value_new_int(value);
94 return encode_message(v);
95}
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262

◆ encode_message()

static gchar * encode_message ( FlValue value)
static

Definition at line 11 of file fl_json_message_codec_test.cc.

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}

◆ encode_string()

static gchar * encode_string ( const gchar *  value)
static

Definition at line 277 of file fl_json_message_codec_test.cc.

277 {
278 g_autoptr(FlValue) v = fl_value_new_string(value);
279 return encode_message(v);
280}
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276

◆ TEST() [1/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeBoolFalse   
)

Definition at line 80 of file fl_json_message_codec_test.cc.

80 {
81 g_autoptr(FlValue) value = decode_message("false");
83 EXPECT_FALSE(fl_value_get_bool(value));
84}
static FlValue * decode_message(const char *text)
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:66

◆ TEST() [2/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeBoolTrue   
)

Definition at line 86 of file fl_json_message_codec_test.cc.

86 {
87 g_autoptr(FlValue) value = decode_message("true");
90}

◆ TEST() [3/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatHalf   
)

Definition at line 249 of file fl_json_message_codec_test.cc.

249 {
250 g_autoptr(FlValue) value = decode_message("0.5");
252 EXPECT_EQ(fl_value_get_float(value), 0.5);
253}
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:68

◆ TEST() [4/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatInvalidFraction   
)

Definition at line 272 of file fl_json_message_codec_test.cc.

272 {
275}
@ FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON
#define FL_JSON_MESSAGE_CODEC_ERROR
static void decode_error_message(const char *text, GQuark domain, gint code)

◆ TEST() [5/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatMinusOne   
)

Definition at line 243 of file fl_json_message_codec_test.cc.

243 {
244 g_autoptr(FlValue) value = decode_message("-1.0");
246 EXPECT_EQ(fl_value_get_float(value), -1.0);
247}

◆ TEST() [6/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatMinusZero   
)

Definition at line 261 of file fl_json_message_codec_test.cc.

261 {
262 g_autoptr(FlValue) value = decode_message("-0.0");
264 EXPECT_EQ(fl_value_get_float(value), -0.0);
265}

◆ TEST() [7/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatMissingFraction   
)

◆ TEST() [8/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatOne   
)

Definition at line 237 of file fl_json_message_codec_test.cc.

237 {
238 g_autoptr(FlValue) value = decode_message("1.0");
240 EXPECT_EQ(fl_value_get_float(value), 1.0);
241}

◆ TEST() [9/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatPi   
)

Definition at line 255 of file fl_json_message_codec_test.cc.

255 {
256 g_autoptr(FlValue) value = decode_message("3.1415926535897931");
258 EXPECT_EQ(fl_value_get_float(value), M_PI);
259}
#define M_PI

◆ TEST() [10/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeFloatZero   
)

Definition at line 231 of file fl_json_message_codec_test.cc.

231 {
232 g_autoptr(FlValue) value = decode_message("0.0");
234 EXPECT_EQ(fl_value_get_float(value), 0.0);
235}

◆ TEST() [11/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeHugeNumber   
)

Definition at line 160 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [12/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeInt12345   
)

Definition at line 134 of file fl_json_message_codec_test.cc.

134 {
135 g_autoptr(FlValue) value = decode_message("12345");
137 EXPECT_EQ(fl_value_get_int(value), 12345);
138}
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:67

◆ TEST() [13/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntDoubleNegative   
)

◆ TEST() [14/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntHexChar   
)

◆ TEST() [15/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntLeadingZero1   
)

◆ TEST() [16/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntLeadingZero2   
)

◆ TEST() [17/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntMax   
)

Definition at line 146 of file fl_json_message_codec_test.cc.

146 {
147 g_autoptr(FlValue) value = decode_message("9223372036854775807");
149 EXPECT_EQ(fl_value_get_int(value), G_MAXINT64);
150}

◆ TEST() [18/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntMin   
)

Definition at line 140 of file fl_json_message_codec_test.cc.

140 {
141 g_autoptr(FlValue) value = decode_message("-9223372036854775808");
143 EXPECT_EQ(fl_value_get_int(value), G_MININT64);
144}

◆ TEST() [19/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntOne   
)

Definition at line 128 of file fl_json_message_codec_test.cc.

128 {
129 g_autoptr(FlValue) value = decode_message("1");
131 EXPECT_EQ(fl_value_get_int(value), 1);
132}

◆ TEST() [20/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntPositiveSign   
)

◆ TEST() [21/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeIntZero   
)

Definition at line 122 of file fl_json_message_codec_test.cc.

122 {
123 g_autoptr(FlValue) value = decode_message("0");
125 EXPECT_EQ(fl_value_get_int(value), 0);
126}

◆ TEST() [22/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeInvalidUTF8   
)

◆ TEST() [23/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListDoubleTerminated   
)

◆ TEST() [24/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListEmpty   
)

Definition at line 574 of file fl_json_message_codec_test.cc.

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 size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:74

◆ TEST() [25/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListNoComma   
)

◆ TEST() [26/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListStartUnterminate   
)

◆ TEST() [27/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListUnterminated   
)

◆ TEST() [28/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeListUnterminatedEmpty   
)

◆ TEST() [29/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapDoubleTerminated   
)

Definition at line 750 of file fl_json_message_codec_test.cc.

◆ TEST() [30/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapEmpty   
)

Definition at line 719 of file fl_json_message_codec_test.cc.

719 {
720 g_autoptr(FlValue) value = decode_message("{}");
722 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
723}
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:75

◆ TEST() [31/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapNoColon   
)

Definition at line 740 of file fl_json_message_codec_test.cc.

◆ TEST() [32/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapNoComma   
)

Definition at line 735 of file fl_json_message_codec_test.cc.

◆ TEST() [33/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapStartUnterminate   
)

◆ TEST() [34/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapUnterminated   
)

Definition at line 745 of file fl_json_message_codec_test.cc.

◆ TEST() [35/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeMapUnterminatedEmpty   
)

◆ TEST() [36/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeNull   
)

Definition at line 60 of file fl_json_message_codec_test.cc.

60 {
61 g_autoptr(FlValue) value = decode_message("null");
63}
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:65

◆ TEST() [37/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringBinary   
)

◆ TEST() [38/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringCarriageReturn   
)

◆ TEST() [39/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEmoji   
)

Definition at line 415 of file fl_json_message_codec_test.cc.

415 {
416 g_autoptr(FlValue) value = decode_message("\"😀\"");
418 EXPECT_STREQ(fl_value_get_string(value), "😀");
419}
G_MODULE_EXPORT const gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:69

◆ TEST() [40/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEmpty   
)

Definition at line 349 of file fl_json_message_codec_test.cc.

349 {
350 g_autoptr(FlValue) value = decode_message("\"\"");
352 EXPECT_STREQ(fl_value_get_string(value), "");
353}

◆ TEST() [41/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeBackslash   
)

Definition at line 367 of file fl_json_message_codec_test.cc.

367 {
368 g_autoptr(FlValue) value = decode_message("\"\\\\\"");
370 EXPECT_STREQ(fl_value_get_string(value), "\\");
371}

◆ TEST() [42/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeBackspace   
)

Definition at line 379 of file fl_json_message_codec_test.cc.

379 {
380 g_autoptr(FlValue) value = decode_message("\"\\b\"");
382 EXPECT_STREQ(fl_value_get_string(value), "\b");
383}

◆ TEST() [43/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeCarriageReturn   
)

Definition at line 397 of file fl_json_message_codec_test.cc.

397 {
398 g_autoptr(FlValue) value = decode_message("\"\\r\"");
400 EXPECT_STREQ(fl_value_get_string(value), "\r");
401}

◆ TEST() [44/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapedClosingQuote   
)

◆ TEST() [45/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeFormFeed   
)

Definition at line 385 of file fl_json_message_codec_test.cc.

385 {
386 g_autoptr(FlValue) value = decode_message("\"\\f\"");
388 EXPECT_STREQ(fl_value_get_string(value), "\f");
389}

◆ TEST() [46/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeNewline   
)

Definition at line 391 of file fl_json_message_codec_test.cc.

391 {
392 g_autoptr(FlValue) value = decode_message("\"\\n\"");
394 EXPECT_STREQ(fl_value_get_string(value), "\n");
395}

◆ TEST() [47/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeQuote   
)

Definition at line 361 of file fl_json_message_codec_test.cc.

361 {
362 g_autoptr(FlValue) value = decode_message("\"\\\"\"");
364 EXPECT_STREQ(fl_value_get_string(value), "\"");
365}

◆ TEST() [48/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeSlash   
)

Definition at line 373 of file fl_json_message_codec_test.cc.

373 {
374 g_autoptr(FlValue) value = decode_message("\"\\/\"");
376 EXPECT_STREQ(fl_value_get_string(value), "/");
377}

◆ TEST() [49/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeTab   
)

Definition at line 403 of file fl_json_message_codec_test.cc.

403 {
404 g_autoptr(FlValue) value = decode_message("\"\\t\"");
406 EXPECT_STREQ(fl_value_get_string(value), "\t");
407}

◆ TEST() [50/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeUnicode   
)

Definition at line 409 of file fl_json_message_codec_test.cc.

409 {
410 g_autoptr(FlValue) value = decode_message("\"\\u0001\"");
412 EXPECT_STREQ(fl_value_get_string(value), "\u0001");
413}

◆ TEST() [51/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeUnicodeNoData   
)

◆ TEST() [52/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringEscapeUnicodeShortData   
)

◆ TEST() [53/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringExtraQuote   
)

◆ TEST() [54/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringHello   
)

Definition at line 355 of file fl_json_message_codec_test.cc.

355 {
356 g_autoptr(FlValue) value = decode_message("\"hello\"");
358 EXPECT_STREQ(fl_value_get_string(value), "hello");
359}

◆ TEST() [55/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringInvalidEscapeUnicode   
)

◆ TEST() [56/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringInvalidUTF8   
)

◆ TEST() [57/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringNewline   
)

◆ TEST() [58/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringTab   
)

◆ TEST() [59/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringUnknownEscape   
)

◆ TEST() [60/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeStringUnterminatedEmpty   
)

◆ TEST() [61/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeUintMax   
)

Definition at line 152 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [62/115]

TEST ( FlJsonMessageCodecTest  ,
DecodeUnknownWord   
)

◆ TEST() [63/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeBoolFalse   
)

Definition at line 70 of file fl_json_message_codec_test.cc.

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

◆ TEST() [64/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeBoolTrue   
)

Definition at line 75 of file fl_json_message_codec_test.cc.

75 {
76 g_autofree gchar* text = encode_bool(TRUE);
77 EXPECT_STREQ(text, "true");
78}

◆ TEST() [65/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeDecode   
)

Definition at line 760 of file fl_json_message_codec_test.cc.

760 {
761 g_autoptr(FlJsonMessageCodec) codec = fl_json_message_codec_new();
762
763 g_autoptr(FlValue) input = fl_value_new_list();
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 =
780 EXPECT_EQ(error, nullptr);
781 EXPECT_NE(output, nullptr);
782
784}
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
Win32Message message

◆ TEST() [66/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatHalf   
)

Definition at line 213 of file fl_json_message_codec_test.cc.

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

◆ TEST() [67/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatList   
)

Definition at line 531 of file fl_json_message_codec_test.cc.

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}
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:339
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ TEST() [68/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatListEmpty   
)

Definition at line 525 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [69/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatMinusOne   
)

Definition at line 208 of file fl_json_message_codec_test.cc.

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

◆ TEST() [70/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatMinusZero   
)

Definition at line 223 of file fl_json_message_codec_test.cc.

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

◆ TEST() [71/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatOne   
)

Definition at line 203 of file fl_json_message_codec_test.cc.

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

◆ TEST() [72/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatPi   
)

Definition at line 218 of file fl_json_message_codec_test.cc.

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

◆ TEST() [73/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeFloatZero   
)

Definition at line 198 of file fl_json_message_codec_test.cc.

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

◆ TEST() [74/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt12345   
)

Definition at line 107 of file fl_json_message_codec_test.cc.

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

◆ TEST() [75/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt32List   
)

Definition at line 505 of file fl_json_message_codec_test.cc.

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}
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:309

◆ TEST() [76/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt32ListEmpty   
)

Definition at line 499 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [77/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt64List   
)

Definition at line 518 of file fl_json_message_codec_test.cc.

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:319

◆ TEST() [78/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeInt64ListEmpty   
)

Definition at line 512 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [79/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntMax   
)

Definition at line 117 of file fl_json_message_codec_test.cc.

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

◆ TEST() [80/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntMin   
)

Definition at line 112 of file fl_json_message_codec_test.cc.

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

◆ TEST() [81/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntOne   
)

Definition at line 102 of file fl_json_message_codec_test.cc.

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

◆ TEST() [82/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeIntZero   
)

Definition at line 97 of file fl_json_message_codec_test.cc.

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

◆ TEST() [83/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeListEmpty   
)

Definition at line 538 of file fl_json_message_codec_test.cc.

538 {
539 g_autoptr(FlValue) value = fl_value_new_list();
540 g_autofree gchar* text = encode_message(value);
541 EXPECT_STREQ(text, "[]");
542}

◆ TEST() [84/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeListNested   
)

Definition at line 557 of file fl_json_message_codec_test.cc.

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) {
563 } else {
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 void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592

◆ TEST() [85/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeListTypes   
)

◆ TEST() [86/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapBoolKey   
)

Definition at line 618 of file fl_json_message_codec_test.cc.

618 {
619 g_autoptr(FlValue) value = fl_value_new_map();
621 fl_value_new_string("bool"));
624}
@ FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE
static void encode_error_message(FlValue *value, GQuark domain, gint code)
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:618

◆ TEST() [87/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapEmpty   
)

Definition at line 605 of file fl_json_message_codec_test.cc.

605 {
606 g_autoptr(FlValue) value = fl_value_new_map();
607 g_autofree gchar* text = encode_message(value);
608 EXPECT_STREQ(text, "{}");
609}

◆ TEST() [88/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapFloatKey   
)

◆ TEST() [89/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapFloatListKey   
)

◆ TEST() [90/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapInt32ListKey   
)

◆ TEST() [91/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapInt64ListKey   
)

◆ TEST() [92/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapIntKey   
)

◆ TEST() [93/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapListKey   
)

◆ TEST() [94/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapMapKey   
)

◆ TEST() [95/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapNested   
)

Definition at line 705 of file fl_json_message_codec_test.cc.

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]),
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}
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:639

◆ TEST() [96/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapNullKey   
)

◆ TEST() [97/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapUint8ListKey   
)

Definition at line 641 of file fl_json_message_codec_test.cc.

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:292

◆ TEST() [98/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeMapValueTypes   
)

Definition at line 687 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [99/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeNull   
)

Definition at line 54 of file fl_json_message_codec_test.cc.

54 {
55 g_autoptr(FlValue) value = fl_value_new_null();
56 g_autofree gchar* text = encode_message(value);
57 EXPECT_STREQ(text, "null");
58}

◆ TEST() [100/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeNullptr   
)

Definition at line 49 of file fl_json_message_codec_test.cc.

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

◆ TEST() [101/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEmoji   
)

Definition at line 344 of file fl_json_message_codec_test.cc.

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

◆ TEST() [102/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEmpty   
)

Definition at line 282 of file fl_json_message_codec_test.cc.

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

◆ TEST() [103/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEmptySized   
)

Definition at line 292 of file fl_json_message_codec_test.cc.

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}
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:283

◆ TEST() [104/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeBackslash   
)

Definition at line 309 of file fl_json_message_codec_test.cc.

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

◆ TEST() [105/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeBackspace   
)

Definition at line 314 of file fl_json_message_codec_test.cc.

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

◆ TEST() [106/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeCarriageReturn   
)

Definition at line 329 of file fl_json_message_codec_test.cc.

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

◆ TEST() [107/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeFormFeed   
)

Definition at line 319 of file fl_json_message_codec_test.cc.

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

◆ TEST() [108/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeNewline   
)

Definition at line 324 of file fl_json_message_codec_test.cc.

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

◆ TEST() [109/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeQuote   
)

Definition at line 304 of file fl_json_message_codec_test.cc.

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

◆ TEST() [110/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeTab   
)

Definition at line 334 of file fl_json_message_codec_test.cc.

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

◆ TEST() [111/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringEscapeUnicode   
)

Definition at line 339 of file fl_json_message_codec_test.cc.

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

◆ TEST() [112/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringHello   
)

Definition at line 287 of file fl_json_message_codec_test.cc.

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

◆ TEST() [113/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeStringHelloSized   
)

Definition at line 298 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [114/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeUint8List   
)

Definition at line 492 of file fl_json_message_codec_test.cc.

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}

◆ TEST() [115/115]

TEST ( FlJsonMessageCodecTest  ,
EncodeUint8ListEmpty   
)

Definition at line 486 of file fl_json_message_codec_test.cc.

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}