| Flutter Linux Embedder |

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 FlValue * | decode_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;
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 }

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

Referenced by TEST().

## ◆ 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;
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 }

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

Referenced by TEST().

## ◆ 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 }

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

Referenced by TEST().

## ◆ 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 }

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

Referenced by TEST().

## ◆ 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 }

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

Referenced by TEST().

## ◆ 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 }

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

Referenced by TEST().

## ◆ 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 }

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

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

## ◆ 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 }

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

Referenced by TEST().

## ◆ 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");
82 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_BOOL);
83 EXPECT_FALSE(fl_value_get_bool(value));
84 }

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

## ◆ 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");
88 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_BOOL);
89 EXPECT_TRUE(fl_value_get_bool(value));
90 }

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

## ◆ 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");
251 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
252 EXPECT_EQ(fl_value_get_float(value), 0.5);
253 }

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

## ◆ TEST() [4/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeFloatInvalidFraction |
| ) |  |

Definition at line 272 of file fl_json_message_codec_test.cc.

272 {
273 decode_error_message("0.a", FL_JSON_MESSAGE_CODEC_ERROR,
274 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
275 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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");
245 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
246 EXPECT_EQ(fl_value_get_float(value), -1.0);
247 }

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

## ◆ 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");
263 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
264 EXPECT_EQ(fl_value_get_float(value), -0.0);
265 }

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

## ◆ TEST() [7/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeFloatMissingFraction |
| ) |  |

Definition at line 267 of file fl_json_message_codec_test.cc.

267 {
268 decode_error_message("0.", FL_JSON_MESSAGE_CODEC_ERROR,
269 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
270 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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");
239 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
240 EXPECT_EQ(fl_value_get_float(value), 1.0);
241 }

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

## ◆ 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");
257 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
258 EXPECT_EQ(fl_value_get_float(value), M_PI);
259 }

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

## ◆ 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");
233 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
234 EXPECT_EQ(fl_value_get_float(value), 0.0);
235 }

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

## ◆ 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");
164 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
165 EXPECT_EQ(fl_value_get_float(value), 1.84467440737095516150e+20);
166 }

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

## ◆ 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");
136 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
137 EXPECT_EQ(fl_value_get_int(value), 12345);
138 }

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

## ◆ TEST() [13/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeIntDoubleNegative |
| ) |  |

Definition at line 178 of file fl_json_message_codec_test.cc.

178 {
179 decode_error_message("--1", FL_JSON_MESSAGE_CODEC_ERROR,
180 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
181 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [14/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeIntHexChar |
| ) |  |

Definition at line 188 of file fl_json_message_codec_test.cc.

188 {
189 decode_error_message("0a", FL_JSON_MESSAGE_CODEC_ERROR,
190 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
191 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [15/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeIntLeadingZero1 |
| ) |  |

Definition at line 168 of file fl_json_message_codec_test.cc.

168 {
169 decode_error_message("00", FL_JSON_MESSAGE_CODEC_ERROR,
170 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
171 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [16/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeIntLeadingZero2 |
| ) |  |

Definition at line 173 of file fl_json_message_codec_test.cc.

173 {
174 decode_error_message("01", FL_JSON_MESSAGE_CODEC_ERROR,
175 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
176 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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");
148 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
149 EXPECT_EQ(fl_value_get_int(value), G_MAXINT64);
150 }

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

## ◆ 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");
142 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
143 EXPECT_EQ(fl_value_get_int(value), G_MININT64);
144 }

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

## ◆ 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");
130 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
131 EXPECT_EQ(fl_value_get_int(value), 1);
132 }

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

## ◆ TEST() [20/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeIntPositiveSign |
| ) |  |

Definition at line 183 of file fl_json_message_codec_test.cc.

183 {
184 decode_error_message("+1", FL_JSON_MESSAGE_CODEC_ERROR,
185 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
186 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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");
124 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_INT);
125 EXPECT_EQ(fl_value_get_int(value), 0);
126 }

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

## ◆ TEST() [22/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeInvalidUTF8 |
| ) |  |

Definition at line 421 of file fl_json_message_codec_test.cc.

421 {
422 decode_error_message("\xff", FL_JSON_MESSAGE_CODEC_ERROR,
423 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8);
424 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8.

## ◆ TEST() [23/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeListDoubleTerminated |
| ) |  |

Definition at line 600 of file fl_json_message_codec_test.cc.

600 {
601 decode_error_message("[0,1,2,3,4]]", FL_JSON_MESSAGE_CODEC_ERROR,
602 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
603 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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("[]");
576 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_LIST);
577 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
578 }

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

## ◆ TEST() [25/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeListNoComma |
| ) |  |

Definition at line 580 of file fl_json_message_codec_test.cc.

580 {
581 decode_error_message("[0,1,2,3 4]", FL_JSON_MESSAGE_CODEC_ERROR,
582 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
583 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [26/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeListStartUnterminate |
| ) |  |

Definition at line 590 of file fl_json_message_codec_test.cc.

590 {
591 decode_error_message("]", FL_JSON_MESSAGE_CODEC_ERROR,
592 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
593 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [27/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeListUnterminated |
| ) |  |

Definition at line 595 of file fl_json_message_codec_test.cc.

595 {
596 decode_error_message("[0,1,2,3,4", FL_JSON_MESSAGE_CODEC_ERROR,
597 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
598 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [28/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeListUnterminatedEmpty |
| ) |  |

Definition at line 585 of file fl_json_message_codec_test.cc.

585 {
586 decode_error_message("[", FL_JSON_MESSAGE_CODEC_ERROR,
587 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
588 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [29/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeMapDoubleTerminated |
| ) |  |

Definition at line 750 of file fl_json_message_codec_test.cc.

750 {
751 decode_error_message("{\"zero\":0,\"one\":1}}", FL_JSON_MESSAGE_CODEC_ERROR,
752 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
753 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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("{}");
721 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_MAP);
722 EXPECT_EQ(fl_value_get_length(value), static_cast<size_t>(0));
723 }

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

## ◆ TEST() [31/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeMapNoColon |
| ) |  |

Definition at line 740 of file fl_json_message_codec_test.cc.

740 {
741 decode_error_message("{\"zero\" 0,\"one\":1}", FL_JSON_MESSAGE_CODEC_ERROR,
742 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
743 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [32/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeMapNoComma |
| ) |  |

Definition at line 735 of file fl_json_message_codec_test.cc.

735 {
736 decode_error_message("{\"zero\":0 \"one\":1}", FL_JSON_MESSAGE_CODEC_ERROR,
737 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
738 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [33/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeMapStartUnterminate |
| ) |  |

Definition at line 730 of file fl_json_message_codec_test.cc.

730 {
731 decode_error_message("}", FL_JSON_MESSAGE_CODEC_ERROR,
732 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
733 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [34/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeMapUnterminated |
| ) |  |

Definition at line 745 of file fl_json_message_codec_test.cc.

745 {
746 decode_error_message("{\"zero\":0,\"one\":1", FL_JSON_MESSAGE_CODEC_ERROR,
747 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
748 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [35/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeMapUnterminatedEmpty |
| ) |  |

Definition at line 725 of file fl_json_message_codec_test.cc.

725 {
726 decode_error_message("{", FL_JSON_MESSAGE_CODEC_ERROR,
727 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
728 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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");
62 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_NULL);
63 }

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

## ◆ TEST() [37/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringBinary |
| ) |  |

Definition at line 431 of file fl_json_message_codec_test.cc.

431 {
432 decode_error_message("\"Hello\x01World\"", FL_JSON_MESSAGE_CODEC_ERROR,
433 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
434 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [38/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringCarriageReturn |
| ) |  |

Definition at line 441 of file fl_json_message_codec_test.cc.

441 {
442 decode_error_message("\"Hello\rWorld\"", FL_JSON_MESSAGE_CODEC_ERROR,
443 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
444 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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("\"😀\"");
417 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
418 EXPECT_STREQ(fl_value_get_string(value), "😀");
419 }

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

## ◆ 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("\"\"");
351 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
352 EXPECT_STREQ(fl_value_get_string(value), "");
353 }

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

## ◆ 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("\"\\\\\"");
369 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
370 EXPECT_STREQ(fl_value_get_string(value), "\\");
371 }

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

## ◆ 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\"");
381 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
382 EXPECT_STREQ(fl_value_get_string(value), "\b");
383 }

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

## ◆ 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\"");
399 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
400 EXPECT_STREQ(fl_value_get_string(value), "\r");
401 }

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

## ◆ TEST() [44/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringEscapedClosingQuote |
| ) |  |

Definition at line 461 of file fl_json_message_codec_test.cc.

461 {
462 decode_error_message("\"\\\"", FL_JSON_MESSAGE_CODEC_ERROR,
463 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
464 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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\"");
387 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
388 EXPECT_STREQ(fl_value_get_string(value), "\f");
389 }

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

## ◆ 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\"");
393 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
394 EXPECT_STREQ(fl_value_get_string(value), "\n");
395 }

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

## ◆ 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("\"\\\"\"");
363 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
364 EXPECT_STREQ(fl_value_get_string(value), "\"");
365 }

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

## ◆ 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("\"\\/\"");
375 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
376 EXPECT_STREQ(fl_value_get_string(value), "/");
377 }

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

## ◆ 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\"");
405 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
406 EXPECT_STREQ(fl_value_get_string(value), "\t");
407 }

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

## ◆ 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\"");
411 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
412 EXPECT_STREQ(fl_value_get_string(value), "\u0001");
413 }

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

## ◆ TEST() [51/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringEscapeUnicodeNoData |
| ) |  |

Definition at line 476 of file fl_json_message_codec_test.cc.

476 {
477 decode_error_message("\"\\u\"", FL_JSON_MESSAGE_CODEC_ERROR,
478 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
479 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [52/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringEscapeUnicodeShortData |
| ) |  |

Definition at line 481 of file fl_json_message_codec_test.cc.

481 {
482 decode_error_message("\"\\uxx\"", FL_JSON_MESSAGE_CODEC_ERROR,
483 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
484 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [53/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringExtraQuote |
| ) |  |

Definition at line 456 of file fl_json_message_codec_test.cc.

456 {
457 decode_error_message("\"\"\"", FL_JSON_MESSAGE_CODEC_ERROR,
458 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
459 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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\"");
357 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_STRING);
358 EXPECT_STREQ(fl_value_get_string(value), "hello");
359 }

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

## ◆ TEST() [55/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringInvalidEscapeUnicode |
| ) |  |

Definition at line 471 of file fl_json_message_codec_test.cc.

471 {
472 decode_error_message("\"\\uxxxx\"", FL_JSON_MESSAGE_CODEC_ERROR,
473 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
474 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [56/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringInvalidUTF8 |
| ) |  |

Definition at line 426 of file fl_json_message_codec_test.cc.

426 {
427 decode_error_message("\"\xff\"", FL_JSON_MESSAGE_CODEC_ERROR,
428 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8);
429 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8.

## ◆ TEST() [57/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringNewline |
| ) |  |

Definition at line 436 of file fl_json_message_codec_test.cc.

436 {
437 decode_error_message("\"Hello\nWorld\"", FL_JSON_MESSAGE_CODEC_ERROR,
438 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
439 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [58/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringTab |
| ) |  |

Definition at line 446 of file fl_json_message_codec_test.cc.

446 {
447 decode_error_message("\"Hello\tWorld\"", FL_JSON_MESSAGE_CODEC_ERROR,
448 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
449 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [59/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringUnknownEscape |
| ) |  |

Definition at line 466 of file fl_json_message_codec_test.cc.

466 {
467 decode_error_message("\"\\z\"", FL_JSON_MESSAGE_CODEC_ERROR,
468 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
469 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ TEST() [60/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeStringUnterminatedEmpty |
| ) |  |

Definition at line 451 of file fl_json_message_codec_test.cc.

451 {
452 decode_error_message("\"", FL_JSON_MESSAGE_CODEC_ERROR,
453 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
454 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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");
156 ASSERT_EQ(fl_value_get_type(value), FL_VALUE_TYPE_FLOAT);
157 EXPECT_EQ(fl_value_get_float(value), 1.8446744073709551615e+19);
158 }

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

## ◆ TEST() [62/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | DecodeUnknownWord |
| ) |  |

Definition at line 755 of file fl_json_message_codec_test.cc.

755 {
756 decode_error_message("foo", FL_JSON_MESSAGE_CODEC_ERROR,
757 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON);
758 }

References decode_error_message(), FL_JSON_MESSAGE_CODEC_ERROR, and FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON.

## ◆ 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 }

References encode_bool().

## ◆ 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 }

References encode_bool(), and TRUE.

## ◆ 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();
764 fl_value_append_take(input, fl_value_new_null());
765 fl_value_append_take(input, fl_value_new_bool(TRUE));
766 fl_value_append_take(input, fl_value_new_int(42));
767 fl_value_append_take(input, fl_value_new_float(M_PI));
768 fl_value_append_take(input, fl_value_new_string("hello"));
769 fl_value_append_take(input, fl_value_new_list());
770 fl_value_append_take(input, fl_value_new_map());
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 }

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.

## ◆ 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 }

References encode_float().

## ◆ 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 }

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

## ◆ 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 }

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

## ◆ 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 }

References encode_float().

## ◆ 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 }

References encode_float().

## ◆ 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 }

References encode_float().

## ◆ 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 }

References encode_float().

## ◆ 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 }

References encode_float().

## ◆ 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 }

References encode_int().

## ◆ 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 }

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

## ◆ 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 }

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

## ◆ 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 }

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

## ◆ 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 }

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

## ◆ 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 }

References encode_int().

## ◆ 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 }

References encode_int().

## ◆ 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 }

References encode_int().

## ◆ 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 }

References encode_int().

## ◆ 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 }

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

## ◆ 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) {
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 }

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

## ◆ TEST() [85/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeListTypes |
| ) |  |

Definition at line 544 of file fl_json_message_codec_test.cc.

544 {
545 g_autoptr(FlValue) value = fl_value_new_list();
546 fl_value_append_take(value, fl_value_new_null());
547 fl_value_append_take(value, fl_value_new_bool(TRUE));
548 fl_value_append_take(value, fl_value_new_int(42));
549 fl_value_append_take(value, fl_value_new_float(-1.5));
550 fl_value_append_take(value, fl_value_new_string("hello"));
551 fl_value_append_take(value, fl_value_new_list());
552 fl_value_append_take(value, fl_value_new_map());
553 g_autofree gchar* text = encode_message(value);
554 EXPECT_STREQ(text, "[null,true,42,-1.5,\"hello\",[],{}]");
555 }

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.

## ◆ 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();
620 fl_value_set_take(value, fl_value_new_bool(TRUE),
621 fl_value_new_string("bool"));
622 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
623 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
624 }

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.

## ◆ 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 }

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

## ◆ TEST() [88/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapFloatKey |
| ) |  |

Definition at line 633 of file fl_json_message_codec_test.cc.

633 {
634 g_autoptr(FlValue) value = fl_value_new_map();
635 fl_value_set_take(value, fl_value_new_float(M_PI),
636 fl_value_new_string("float"));
637 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
638 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
639 }

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.

## ◆ TEST() [89/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapFloatListKey |
| ) |  |

Definition at line 665 of file fl_json_message_codec_test.cc.

665 {
666 g_autoptr(FlValue) value = fl_value_new_map();
667 fl_value_set_take(value, fl_value_new_float_list(nullptr, 0),
668 fl_value_new_string("float_list"));
669 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
670 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
671 }

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.

## ◆ TEST() [90/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapInt32ListKey |
| ) |  |

Definition at line 649 of file fl_json_message_codec_test.cc.

649 {
650 g_autoptr(FlValue) value = fl_value_new_map();
651 fl_value_set_take(value, fl_value_new_int32_list(nullptr, 0),
652 fl_value_new_string("int32_list"));
653 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
654 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
655 }

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.

## ◆ TEST() [91/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapInt64ListKey |
| ) |  |

Definition at line 657 of file fl_json_message_codec_test.cc.

657 {
658 g_autoptr(FlValue) value = fl_value_new_map();
659 fl_value_set_take(value, fl_value_new_int64_list(nullptr, 0),
660 fl_value_new_string("int64_list"));
661 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
662 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
663 }

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.

## ◆ TEST() [92/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapIntKey |
| ) |  |

Definition at line 626 of file fl_json_message_codec_test.cc.

626 {
627 g_autoptr(FlValue) value = fl_value_new_map();
628 fl_value_set_take(value, fl_value_new_int(42), fl_value_new_string("int"));
629 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
630 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
631 }

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.

## ◆ TEST() [93/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapListKey |
| ) |  |

Definition at line 673 of file fl_json_message_codec_test.cc.

673 {
674 g_autoptr(FlValue) value = fl_value_new_map();
675 fl_value_set_take(value, fl_value_new_list(), fl_value_new_string("list"));
676 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
677 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
678 }

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.

## ◆ TEST() [94/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapMapKey |
| ) |  |

Definition at line 680 of file fl_json_message_codec_test.cc.

680 {
681 g_autoptr(FlValue) value = fl_value_new_map();
682 fl_value_set_take(value, fl_value_new_map(), fl_value_new_string("map"));
683 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
684 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
685 }

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.

## ◆ 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]),
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 }

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

## ◆ TEST() [96/115]

TEST | ( | FlJsonMessageCodecTest | ,
|  | EncodeMapNullKey |
| ) |  |

Definition at line 611 of file fl_json_message_codec_test.cc.

611 {
612 g_autoptr(FlValue) value = fl_value_new_map();
613 fl_value_set_take(value, fl_value_new_null(), fl_value_new_string("null"));
614 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
615 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
616 }

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.

## ◆ 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();
643 fl_value_set_take(value, fl_value_new_uint8_list(nullptr, 0),
644 fl_value_new_string("uint8_list"));
645 encode_error_message(value, FL_JSON_MESSAGE_CODEC_ERROR,
646 FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE);
647 }

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.

## ◆ 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();
689 fl_value_set_take(value, fl_value_new_string("null"), fl_value_new_null());
690 fl_value_set_take(value, fl_value_new_string("bool"),
691 fl_value_new_bool(TRUE));
692 fl_value_set_take(value, fl_value_new_string("int"), fl_value_new_int(42));
693 fl_value_set_take(value, fl_value_new_string("float"),
694 fl_value_new_float(-1.5));
695 fl_value_set_take(value, fl_value_new_string("string"),
696 fl_value_new_string("hello"));
697 fl_value_set_take(value, fl_value_new_string("list"), fl_value_new_list());
698 fl_value_set_take(value, fl_value_new_string("map"), fl_value_new_map());
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 }

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.

## ◆ 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 }

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

## ◆ 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 }

References encode_message().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

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

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

References encode_string().

## ◆ 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 }

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

## ◆ 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 }

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

## ◆ 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 }

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

FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8
@ FL_JSON_MESSAGE_CODEC_ERROR_INVALID_UTF8
Definition: fl_json_message_codec.h:31
fl_value_new_string_sized
G_MODULE_EXPORT FlValue * fl_value_new_string_sized(const gchar *value, size_t value_length)
Definition: fl_value.cc:283
FL_VALUE_TYPE_MAP
@ FL_VALUE_TYPE_MAP
Definition: fl_value.h:75
encode_string
static gchar * encode_string(const gchar *value)
Definition: fl_json_message_codec_test.cc:277
FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE
@ FL_JSON_MESSAGE_CODEC_ERROR_INVALID_OBJECT_KEY_TYPE
Definition: fl_json_message_codec.h:33
fl_value_new_list
G_MODULE_EXPORT FlValue * fl_value_new_list()
Definition: fl_value.cc:349
encode_error_message
static void encode_error_message(FlValue *value, GQuark domain, gint code)
Definition: fl_json_message_codec_test.cc:21
i
int i
Definition: fl_socket_accessible.cc:18
fl_value_new_bool
G_MODULE_EXPORT FlValue * fl_value_new_bool(bool value)
Definition: fl_value.cc:255
FlValue
typedefG_BEGIN_DECLS struct _FlValue FlValue
Definition: fl_value.h:42
fl_json_message_codec_new
G_MODULE_EXPORT FlJsonMessageCodec * fl_json_message_codec_new()
Definition: fl_json_message_codec.cc:306
encode_message
static gchar * encode_message(FlValue *value)
Definition: fl_json_message_codec_test.cc:11
fl_value_set_take
G_MODULE_EXPORT void fl_value_set_take(FlValue *self, FlValue *key, FlValue *value)
Definition: fl_value.cc:618
encode_bool
static gchar * encode_bool(gboolean value)
Definition: fl_json_message_codec_test.cc:65
fl_value_new_null
G_MODULE_EXPORT FlValue * fl_value_new_null()
Definition: fl_value.cc:251
FL_VALUE_TYPE_LIST
@ FL_VALUE_TYPE_LIST
Definition: fl_value.h:74
fl_value_get_bool
G_MODULE_EXPORT bool fl_value_get_bool(FlValue *self)
Definition: fl_value.cc:661
fl_value_new_int
G_MODULE_EXPORT FlValue * fl_value_new_int(int64_t value)
Definition: fl_value.cc:262
fl_value_get_string
const G_MODULE_EXPORT gchar * fl_value_get_string(FlValue *self)
Definition: fl_value.cc:682
encode_float
static gchar * encode_float(double value)
Definition: fl_json_message_codec_test.cc:193
FL_VALUE_TYPE_NULL
@ FL_VALUE_TYPE_NULL
Definition: fl_value.h:65
fl_value_get_int
G_MODULE_EXPORT int64_t fl_value_get_int(FlValue *self)
Definition: fl_value.cc:668
fl_value_ref
G_MODULE_EXPORT FlValue * fl_value_ref(FlValue *self)
Definition: fl_value.cc:394
fl_value_new_map
G_MODULE_EXPORT FlValue * fl_value_new_map()
Definition: fl_value.cc:366
fl_value_get_type
G_MODULE_EXPORT FlValueType fl_value_get_type(FlValue *self)
Definition: fl_value.cc:466
fl_json_message_codec_encode
G_MODULE_EXPORT gchar * fl_json_message_codec_encode(FlJsonMessageCodec *codec, FlValue *value, GError **error)
Definition: fl_json_message_codec.cc:311
FL_VALUE_TYPE_STRING
@ FL_VALUE_TYPE_STRING
Definition: fl_value.h:69
fl_value_new_float_list
G_MODULE_EXPORT FlValue * fl_value_new_float_list(const double *data, size_t data_length)
Definition: fl_value.cc:339
encode_int
static gchar * encode_int(int64_t value)
Definition: fl_json_message_codec_test.cc:92
decode_error_message
static void decode_error_message(const char *text, GQuark domain, gint code)
Definition: fl_json_message_codec_test.cc:41
TRUE
return TRUE
Definition: fl_pixel_buffer_texture_test.cc:53
fl_value_new_int32_list
G_MODULE_EXPORT FlValue * fl_value_new_int32_list(const int32_t *data, size_t data_length)
Definition: fl_value.cc:309
fl_value_get_float
G_MODULE_EXPORT double fl_value_get_float(FlValue *self)
Definition: fl_value.cc:675
fl_value_append_take
G_MODULE_EXPORT void fl_value_append_take(FlValue *self, FlValue *value)
Definition: fl_value.cc:600
fl_value_get_length
G_MODULE_EXPORT size_t fl_value_get_length(FlValue *self)
Definition: fl_value.cc:724
fl_value_equal
G_MODULE_EXPORT bool fl_value_equal(FlValue *a, FlValue *b)
Definition: fl_value.cc:471
fl_value_set_string
G_MODULE_EXPORT void fl_value_set_string(FlValue *self, const gchar *key, FlValue *value)
Definition: fl_value.cc:639
FL_VALUE_TYPE_INT
@ FL_VALUE_TYPE_INT
Definition: fl_value.h:67
decode_message
static FlValue * decode_message(const char *text)
Definition: fl_json_message_codec_test.cc:30
result
GAsyncResult * result
Definition: fl_text_input_handler.cc:106
fl_value_new_int64_list
G_MODULE_EXPORT FlValue * fl_value_new_int64_list(const int64_t *data, size_t data_length)
Definition: fl_value.cc:319
error
const uint8_t uint32_t uint32_t GError ** error
Definition: fl_pixel_buffer_texture_test.cc:40
FL_JSON_MESSAGE_CODEC_ERROR
#define FL_JSON_MESSAGE_CODEC_ERROR
Definition: fl_json_message_codec.h:27
fl_json_message_codec_decode
G_MODULE_EXPORT FlValue * fl_json_message_codec_decode(FlJsonMessageCodec *codec, const gchar *text, GError **error)
Definition: fl_json_message_codec.cc:326
fl_value_new_uint8_list
G_MODULE_EXPORT FlValue * fl_value_new_uint8_list(const uint8_t *data, size_t data_length)
Definition: fl_value.cc:292
fl_value_append
G_MODULE_EXPORT void fl_value_append(FlValue *self, FlValue *value)
Definition: fl_value.cc:592
FL_VALUE_TYPE_FLOAT
@ FL_VALUE_TYPE_FLOAT
Definition: fl_value.h:68
fl_value_new_float
G_MODULE_EXPORT FlValue * fl_value_new_float(double value)
Definition: fl_value.cc:269
FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON
@ FL_JSON_MESSAGE_CODEC_ERROR_INVALID_JSON
Definition: fl_json_message_codec.h:32
FL_VALUE_TYPE_BOOL
@ FL_VALUE_TYPE_BOOL
Definition: fl_value.h:66
value
uint8_t value
Definition: fl_standard_message_codec.cc:36
fl_value_new_string
G_MODULE_EXPORT FlValue * fl_value_new_string(const gchar *value)
Definition: fl_value.cc:276