| Flutter iOS Embedder |

Classes | Functions | Variables
flutter_standard_codec_unittest.mm File Reference
`#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"`
`#include "gtest/gtest.h"`

Go to the source code of this file.

## Classes
class | Pair
class | ExtendedWriter
class | ExtendedReader
class | ExtendedReaderWriter

## Functions
static void | CheckEncodeDecode (id value, NSData *expectedEncoding)
static void | CheckEncodeDecode (id value)
| TEST (FlutterStandardCodec, CanDecodeZeroLength)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeNil)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeNSNull)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeYes)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeNo)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeUInt8)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeUInt16)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeUInt32)
| TEST (FlutterStandardCodec, CanEncodeUInt64)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeSInt8)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeSInt16)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeSInt32)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeSInt64)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeFloat32)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeFloat64)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeString)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeStringWithNonAsciiCodePoint)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeStringWithNonBMPCodePoint)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeArray)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeDictionary)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeByteArray)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeNSData)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeInt32Array)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeInt64Array)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeFloat32Array)
| TEST (FlutterStandardCodec, CanEncodeAndDecodeFloat64Array)
| TEST (FlutterStandardCodec, HandlesMethodCallsWithNilArguments)
| TEST (FlutterStandardCodec, HandlesMethodCallsWithSingleArgument)
| TEST (FlutterStandardCodec, HandlesMethodCallsWithArgumentList)
| TEST (FlutterStandardCodec, HandlesSuccessEnvelopesWithNilResult)
| TEST (FlutterStandardCodec, HandlesSuccessEnvelopesWithSingleResult)
| TEST (FlutterStandardCodec, HandlesSuccessEnvelopesWithResultMap)
| TEST (FlutterStandardCodec, HandlesErrorEnvelopes)
| TEST (FlutterStandardCodec, HandlesSubclasses)

## Variables
static const UInt8 | kDATE = 128
static const UInt8 | kPAIR = 129

## Function Documentation

## ◆ CheckEncodeDecode() [1/2]

static void CheckEncodeDecode | ( | id | value | ) |
| static

Definition at line 106 of file flutter_standard_codec_unittest.mm.

106 {
107 FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance];
108 NSData* encoded = [codec encode:value];
109 id decoded = [codec decode:encoded];
110 if (value == nil || value == [NSNull null]) {
111 ASSERT_TRUE(decoded == nil);
112 } else {
113 ASSERT_TRUE([value isEqual:decoded]);
114 }
115 }

References <FlutterMessageCodec>::decode:, <FlutterMessageCodec>::encode:, and <FlutterMessageCodec>::sharedInstance.

## ◆ CheckEncodeDecode() [2/2]

static void CheckEncodeDecode | ( | id | value,
|  | NSData * | expectedEncoding
| ) |  |
| static

Definition at line 90 of file flutter_standard_codec_unittest.mm.

90 {
91 FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance];
92 NSData* encoded = [codec encode:value];
93 if (expectedEncoding == nil) {
94 ASSERT_TRUE(encoded == nil);
95 } else {
96 ASSERT_TRUE([encoded isEqual:expectedEncoding]);
97 }
98 id decoded = [codec decode:encoded];
99 if (value == nil || value == [NSNull null]) {
100 ASSERT_TRUE(decoded == nil);
101 } else {
102 ASSERT_TRUE([value isEqual:decoded]);
103 }
104 }

References <FlutterMessageCodec>::decode:, <FlutterMessageCodec>::encode:, and <FlutterMessageCodec>::sharedInstance.

Referenced by TEST().

## ◆ TEST() [1/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanDecodeZeroLength |
| ) |  |

Definition at line 117 of file flutter_standard_codec_unittest.mm.

117 {
118 FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance];
119 id decoded = [codec decode:[NSData data]];
120 ASSERT_TRUE(decoded == nil);
121 }

References <FlutterMessageCodec>::decode:, and <FlutterMessageCodec>::sharedInstance.

## ◆ TEST() [2/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeArray |
| ) |  |

Definition at line 218 of file flutter_standard_codec_unittest.mm.

218 {
219 NSArray* value = @[ [NSNull null], @"hello", @3.14, @47, @{@42 : @"nested"} ];
220 CheckEncodeDecode(value);
221 }

References CheckEncodeDecode().

## ◆ TEST() [3/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeByteArray |
| ) |  |

Definition at line 232 of file flutter_standard_codec_unittest.mm.

232 {
233 uint8_t bytes[4] = {0xBA, 0x5E, 0xBA, 0x11};
234 NSData* data = [NSData dataWithBytes:bytes length:4];
235 FlutterStandardTypedData* value = [FlutterStandardTypedData typedDataWithBytes:data];
236 CheckEncodeDecode(value);
237 }

References CheckEncodeDecode(), and FlutterStandardTypedData::typedDataWithBytes:.

## ◆ TEST() [4/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeDictionary |
| ) |  |

Definition at line 223 of file flutter_standard_codec_unittest.mm.

223 {
224 NSDictionary* value =
225 @{@"a" : @3.14,
226 @"b" : @47,
227 [NSNull null] : [NSNull null],
228 @3.14 : @[ @"nested" ]};
229 CheckEncodeDecode(value);
230 }

References CheckEncodeDecode().

## ◆ TEST() [5/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeFloat32 |
| ) |  |

Definition at line 190 of file flutter_standard_codec_unittest.mm.

190 {
191 uint8_t bytes[16] = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
192 0x00, 0x00, 0x00, 0x60, 0xfb, 0x21, 0x09, 0x40};
193 CheckEncodeDecode(@3.1415927f, [NSData dataWithBytes:bytes length:16]);
194 }

References CheckEncodeDecode().

## ◆ TEST() [6/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeFloat32Array |
| ) |  |

Definition at line 263 of file flutter_standard_codec_unittest.mm.

263 {
264 uint8_t bytes[8] = {0xd8, 0x0f, 0x49, 0x40, 0x00, 0x00, 0x7a, 0x44};
265 NSData* data = [NSData dataWithBytes:bytes length:8];
266 FlutterStandardTypedData* value = [FlutterStandardTypedData typedDataWithFloat32:data];
267 CheckEncodeDecode(value);
268 }

References CheckEncodeDecode(), and FlutterStandardTypedData::typedDataWithFloat32:.

## ◆ TEST() [7/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeFloat64 |
| ) |  |

Definition at line 196 of file flutter_standard_codec_unittest.mm.

196 {
197 uint8_t bytes[16] = {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
198 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40};
199 CheckEncodeDecode(@3.14159265358979311599796346854, [NSData dataWithBytes:bytes length:16]);
200 }

References CheckEncodeDecode().

## ◆ TEST() [8/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeFloat64Array |
| ) |  |

Definition at line 270 of file flutter_standard_codec_unittest.mm.

270 {
271 uint8_t bytes[16] = {0xBA, 0x5E, 0xBA, 0x11, 0xff, 0xff, 0xff, 0xff,
272 0xBA, 0x5E, 0xBA, 0x11, 0xff, 0xff, 0xff, 0xff};
273 NSData* data = [NSData dataWithBytes:bytes length:16];
274 FlutterStandardTypedData* value = [FlutterStandardTypedData typedDataWithFloat64:data];
275 CheckEncodeDecode(value);
276 }

References CheckEncodeDecode(), and FlutterStandardTypedData::typedDataWithFloat64:.

## ◆ TEST() [9/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeInt32Array |
| ) |  |

Definition at line 249 of file flutter_standard_codec_unittest.mm.

249 {
250 uint8_t bytes[8] = {0xBA, 0x5E, 0xBA, 0x11, 0xff, 0xff, 0xff, 0xff};
251 NSData* data = [NSData dataWithBytes:bytes length:8];
252 FlutterStandardTypedData* value = [FlutterStandardTypedData typedDataWithInt32:data];
253 CheckEncodeDecode(value);
254 }

References CheckEncodeDecode(), and FlutterStandardTypedData::typedDataWithInt32:.

## ◆ TEST() [10/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeInt64Array |
| ) |  |

Definition at line 256 of file flutter_standard_codec_unittest.mm.

256 {
257 uint8_t bytes[8] = {0xBA, 0x5E, 0xBA, 0x11, 0xff, 0xff, 0xff, 0xff};
258 NSData* data = [NSData dataWithBytes:bytes length:8];
259 FlutterStandardTypedData* value = [FlutterStandardTypedData typedDataWithInt64:data];
260 CheckEncodeDecode(value);
261 }

References CheckEncodeDecode(), and FlutterStandardTypedData::typedDataWithInt64:.

## ◆ TEST() [11/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeNil |
| ) |  |

Definition at line 123 of file flutter_standard_codec_unittest.mm.

123 {
124 CheckEncodeDecode(nil, nil);
125 }

References CheckEncodeDecode().

## ◆ TEST() [12/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeNo |
| ) |  |

Definition at line 137 of file flutter_standard_codec_unittest.mm.

137 {
138 uint8_t bytes[1] = {0x02};
139 CheckEncodeDecode(@NO, [NSData dataWithBytes:bytes length:1]);
140 }

References CheckEncodeDecode().

## ◆ TEST() [13/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeNSData |
| ) |  |

Definition at line 239 of file flutter_standard_codec_unittest.mm.

239 {
240 FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance];
241 uint8_t bytes[4] = {0xBA, 0x5E, 0xBA, 0x11};
242 NSData* data = [NSData dataWithBytes:bytes length:4];
243 FlutterStandardTypedData* standardData = [FlutterStandardTypedData typedDataWithBytes:data];
244
245 NSData* encoded = [codec encode:data];
246 ASSERT_TRUE([encoded isEqual:[codec encode:standardData]]);
247 }

References <FlutterMessageCodec>::encode:, <FlutterMessageCodec>::sharedInstance, and FlutterStandardTypedData::typedDataWithBytes:.

## ◆ TEST() [14/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeNSNull |
| ) |  |

Definition at line 127 of file flutter_standard_codec_unittest.mm.

127 {
128 uint8_t bytes[1] = {0x00};
129 CheckEncodeDecode([NSNull null], [NSData dataWithBytes:bytes length:1]);
130 }

References CheckEncodeDecode().

## ◆ TEST() [15/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeSInt16 |
| ) |  |

Definition at line 174 of file flutter_standard_codec_unittest.mm.

174 {
175 uint8_t bytes[5] = {0x03, 0xdc, 0xfe, 0xff, 0xff};
176 SInt16 value = 0xfedc;
177 CheckEncodeDecode(@(value), [NSData dataWithBytes:bytes length:5]);
178 }

References CheckEncodeDecode().

## ◆ TEST() [16/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeSInt32 |
| ) |  |

Definition at line 180 of file flutter_standard_codec_unittest.mm.

180 {
181 uint8_t bytes[5] = {0x03, 0x78, 0x56, 0x34, 0x12};
182 CheckEncodeDecode(@(0x12345678), [NSData dataWithBytes:bytes length:5]);
183 }

References CheckEncodeDecode().

## ◆ TEST() [17/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeSInt64 |
| ) |  |

Definition at line 185 of file flutter_standard_codec_unittest.mm.

185 {
186 uint8_t bytes[9] = {0x04, 0xef, 0xcd, 0xab, 0x90, 0x78, 0x56, 0x34, 0x12};
187 CheckEncodeDecode(@(0x1234567890abcdef), [NSData dataWithBytes:bytes length:9]);
188 }

References CheckEncodeDecode().

## ◆ TEST() [18/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeSInt8 |
| ) |  |

Definition at line 168 of file flutter_standard_codec_unittest.mm.

168 {
169 uint8_t bytes[5] = {0x03, 0xfe, 0xff, 0xff, 0xff};
170 SInt8 value = 0xfe;
171 CheckEncodeDecode(@(value), [NSData dataWithBytes:bytes length:5]);
172 }

References CheckEncodeDecode().

## ◆ TEST() [19/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeString |
| ) |  |

Definition at line 202 of file flutter_standard_codec_unittest.mm.

202 {
203 uint8_t bytes[13] = {0x07, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
204 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64};
205 CheckEncodeDecode(@"hello world", [NSData dataWithBytes:bytes length:13]);
206 }

References CheckEncodeDecode().

## ◆ TEST() [20/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeStringWithNonAsciiCodePoint |
| ) |  |

Definition at line 208 of file flutter_standard_codec_unittest.mm.

208 {
209 uint8_t bytes[7] = {0x07, 0x05, 0x68, 0xe2, 0x98, 0xba, 0x77};
210 CheckEncodeDecode(@"h\u263Aw", [NSData dataWithBytes:bytes length:7]);
211 }

References CheckEncodeDecode().

## ◆ TEST() [21/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeStringWithNonBMPCodePoint |
| ) |  |

Definition at line 213 of file flutter_standard_codec_unittest.mm.

213 {
214 uint8_t bytes[8] = {0x07, 0x06, 0x68, 0xf0, 0x9f, 0x98, 0x82, 0x77};
215 CheckEncodeDecode(@"h\U0001F602w", [NSData dataWithBytes:bytes length:8]);
216 }

References CheckEncodeDecode().

## ◆ TEST() [22/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeUInt16 |
| ) |  |

Definition at line 148 of file flutter_standard_codec_unittest.mm.

148 {
149 uint8_t bytes[5] = {0x03, 0xdc, 0xfe, 0x00, 0x00};
150 UInt16 value = 0xfedc;
151 CheckEncodeDecode(@(value), [NSData dataWithBytes:bytes length:5]);
152 }

References CheckEncodeDecode().

## ◆ TEST() [23/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeUInt32 |
| ) |  |

Definition at line 154 of file flutter_standard_codec_unittest.mm.

154 {
155 uint8_t bytes[9] = {0x04, 0x09, 0xba, 0xdc, 0xfe, 0x00, 0x00, 0x00, 0x00};
156 UInt32 value = 0xfedcba09;
157 CheckEncodeDecode(@(value), [NSData dataWithBytes:bytes length:9]);
158 }

References CheckEncodeDecode().

## ◆ TEST() [24/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeUInt8 |
| ) |  |

Definition at line 142 of file flutter_standard_codec_unittest.mm.

142 {
143 uint8_t bytes[5] = {0x03, 0xfe, 0x00, 0x00, 0x00};
144 UInt8 value = 0xfe;
145 CheckEncodeDecode(@(value), [NSData dataWithBytes:bytes length:5]);
146 }

References CheckEncodeDecode().

## ◆ TEST() [25/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeAndDecodeYes |
| ) |  |

Definition at line 132 of file flutter_standard_codec_unittest.mm.

132 {
133 uint8_t bytes[1] = {0x01};
134 CheckEncodeDecode(@YES, [NSData dataWithBytes:bytes length:1]);
135 }

References CheckEncodeDecode().

## ◆ TEST() [26/34]

TEST | ( | FlutterStandardCodec | ,
|  | CanEncodeUInt64 |
| ) |  |

Definition at line 160 of file flutter_standard_codec_unittest.mm.

160 {
161 FlutterStandardMessageCodec* codec = [FlutterStandardMessageCodec sharedInstance];
162 UInt64 u64 = 0xfffffffffffffffa;
163 uint8_t bytes[9] = {0x04, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
164 NSData* encoded = [codec encode:@(u64)];
165 ASSERT_TRUE([encoded isEqual:[NSData dataWithBytes:bytes length:9]]);
166 }

References <FlutterMessageCodec>::encode:, and <FlutterMessageCodec>::sharedInstance.

## ◆ TEST() [27/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesErrorEnvelopes |
| ) |  |

Definition at line 326 of file flutter_standard_codec_unittest.mm.

326 {
327 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
328 NSDictionary* details = @{@"a" : @42, @42 : @"a"};
329 FlutterError* error = [FlutterError errorWithCode:@"errorCode"
330 message:@"something failed"
331 details:details];
332 NSData* encoded = [codec encodeErrorEnvelope:error];
333 id decoded = [codec decodeEnvelope:encoded];
334 ASSERT_TRUE([decoded isEqual:error]);
335 }

References FlutterError::errorWithCode:message:details:.

## ◆ TEST() [28/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesMethodCallsWithArgumentList |
| ) |  |

Definition at line 294 of file flutter_standard_codec_unittest.mm.

294 {
295 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
296 NSArray* arguments = @[ @42, @"world" ];
297 FlutterMethodCall* call = [FlutterMethodCall methodCallWithMethodName:@"hello"
298 arguments:arguments];
299 NSData* encoded = [codec encodeMethodCall:call];
300 FlutterMethodCall* decoded = [codec decodeMethodCall:encoded];
301 ASSERT_TRUE([decoded isEqual:call]);
302 }

References FlutterMethodCall::methodCallWithMethodName:arguments:.

## ◆ TEST() [29/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesMethodCallsWithNilArguments |
| ) |  |

Definition at line 278 of file flutter_standard_codec_unittest.mm.

278 {
279 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
280 FlutterMethodCall* call = [FlutterMethodCall methodCallWithMethodName:@"hello" arguments:nil];
281 NSData* encoded = [codec encodeMethodCall:call];
282 FlutterMethodCall* decoded = [codec decodeMethodCall:encoded];
283 ASSERT_TRUE([decoded isEqual:call]);
284 }

References FlutterMethodCall::methodCallWithMethodName:arguments:.

## ◆ TEST() [30/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesMethodCallsWithSingleArgument |
| ) |  |

Definition at line 286 of file flutter_standard_codec_unittest.mm.

286 {
287 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
288 FlutterMethodCall* call = [FlutterMethodCall methodCallWithMethodName:@"hello" arguments:@42];
289 NSData* encoded = [codec encodeMethodCall:call];
290 FlutterMethodCall* decoded = [codec decodeMethodCall:encoded];
291 ASSERT_TRUE([decoded isEqual:call]);
292 }

References FlutterMethodCall::methodCallWithMethodName:arguments:.

## ◆ TEST() [31/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesSubclasses |
| ) |  |

Definition at line 337 of file flutter_standard_codec_unittest.mm.

337 {
338 ExtendedReaderWriter* extendedReaderWriter = [[ExtendedReaderWriter alloc] init];
339 FlutterStandardMessageCodec* codec =
340 [FlutterStandardMessageCodec codecWithReaderWriter:extendedReaderWriter];
341 Pair* pair = [[Pair alloc] initWithLeft:@1 right:@2];
342 NSData* encoded = [codec encode:pair];
343 Pair* decoded = [codec decode:encoded];
344 ASSERT_TRUE([pair.left isEqual:decoded.left]);
345 ASSERT_TRUE([pair.right isEqual:decoded.right]);
346 }

References FlutterStandardMessageCodec::codecWithReaderWriter:, <FlutterMessageCodec>::decode:, <FlutterMessageCodec>::encode:, Pair::left, and Pair::right.

## ◆ TEST() [32/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesSuccessEnvelopesWithNilResult |
| ) |  |

Definition at line 304 of file flutter_standard_codec_unittest.mm.

304 {
305 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
306 NSData* encoded = [codec encodeSuccessEnvelope:nil];
307 id decoded = [codec decodeEnvelope:encoded];
308 ASSERT_TRUE(decoded == nil);
309 }

## ◆ TEST() [33/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesSuccessEnvelopesWithResultMap |
| ) |  |

Definition at line 318 of file flutter_standard_codec_unittest.mm.

318 {
319 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
320 NSDictionary* result = @{@"a" : @42, @42 : @"a"};
321 NSData* encoded = [codec encodeSuccessEnvelope:result];
322 id decoded = [codec decodeEnvelope:encoded];
323 ASSERT_TRUE([decoded isEqual:result]);
324 }

## ◆ TEST() [34/34]

TEST | ( | FlutterStandardCodec | ,
|  | HandlesSuccessEnvelopesWithSingleResult |
| ) |  |

Definition at line 311 of file flutter_standard_codec_unittest.mm.

311 {
312 FlutterStandardMethodCodec* codec = [FlutterStandardMethodCodec sharedInstance];
313 NSData* encoded = [codec encodeSuccessEnvelope:@42];
314 id decoded = [codec decodeEnvelope:encoded];
315 ASSERT_TRUE([decoded isEqual:@42]);
316 }

## Variable Documentation

## ◆ kDATE

const UInt8 kDATE = 128
| static

Definition at line 28 of file flutter_standard_codec_unittest.mm.

Referenced by ExtendedReader::readValueOfType:.

## ◆ kPAIR

const UInt8 kPAIR = 129
| static

Definition at line 29 of file flutter_standard_codec_unittest.mm.

Referenced by ExtendedReader::readValueOfType:.

FlutterError
Definition: FlutterCodecs.h:246
Pair::right
NSObject * right
Definition: flutter_standard_codec_unittest.mm:13
FlutterStandardMessageCodec
Definition: FlutterCodecs.h:209
FlutterMethodCall
Definition: FlutterCodecs.h:220
Pair
Definition: flutter_standard_codec_unittest.mm:11
CheckEncodeDecode
static void CheckEncodeDecode(id value, NSData *expectedEncoding)
Definition: flutter_standard_codec_unittest.mm:90
FlutterStandardTypedData
Definition: FlutterCodecs.h:300
Pair::left
NSObject * left
Definition: flutter_standard_codec_unittest.mm:12
FlutterStandardMethodCodec
Definition: FlutterCodecs.h:469
ExtendedReaderWriter
Definition: flutter_standard_codec_unittest.mm:76