ObjFW  Check-in [66f22a2831]

Overview
Comment:OFMessagePackTests: Add more tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 66f22a2831095173ff344f82b3810edfeb0c6be4b2719439955cd04d42153ad9
User & Date: js on 2024-03-23 16:43:04
Other Links: manifest | tags
References
2024-03-23
16:45 Fixed ticket [8a4a9631fd]: Write tests for MessagePack plus 4 other changes artifact: e7b53a18cd user: js
Context
2024-03-27
23:33
OFColor: Use roundf instead of nearbyintf check-in: 69931b1982 user: js tags: trunk
2024-03-23
16:43
OFMessagePackTests: Add more tests check-in: 66f22a2831 user: js tags: trunk
2024-03-17
22:40
Add OFMessagePackTests check-in: cb8e2e3fa6 user: js tags: trunk
Changes

Modified .fossil-settings/clean-glob from [2a90f48586] to [749762eae0].

35
36
37
38
39
40
41

42
43
44
45
46
47
48
src/test/libobjfwtest.a
src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO

tests/objc_sync/objc_sync
tests/plugin/Info.plist
tests/subprocess/subprocess
tests/terminal/terminal_tests
tests/testfile_bin.m
tests/testfile_ini.m
tests/tests







>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
src/test/libobjfwtest.a
src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO
tests/big_dictionary_msgpack.m
tests/objc_sync/objc_sync
tests/plugin/Info.plist
tests/subprocess/subprocess
tests/terminal/terminal_tests
tests/testfile_bin.m
tests/testfile_ini.m
tests/tests

Modified .fossil-settings/ignore-glob from [1998337625] to [92d0e0d642].

37
38
39
40
41
42
43

44
45
46
47
48
49
50
src/test/libobjfwtest.a
src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO

tests/iOS.xcodeproj/*.pbxuser
tests/iOS.xcodeproj/project.xcworkspace
tests/iOS.xcodeproj/xcuserdata
tests/objc_sync/objc_sync
tests/plugin/Info.plist
tests/subprocess/subprocess
tests/terminal/terminal_tests







>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
src/test/libobjfwtest.a
src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO
tests/big_dictionary_msgpack.m
tests/iOS.xcodeproj/*.pbxuser
tests/iOS.xcodeproj/project.xcworkspace
tests/iOS.xcodeproj/xcuserdata
tests/objc_sync/objc_sync
tests/plugin/Info.plist
tests/subprocess/subprocess
tests/terminal/terminal_tests

Modified .gitignore from [f4069ec503] to [77b3609eea].

37
38
39
40
41
42
43

44
45
46
47
48
49
50
src/test/libobjfwtest.a
src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO

tests/iOS.xcodeproj/*.pbxuser
tests/iOS.xcodeproj/project.xcworkspace
tests/iOS.xcodeproj/xcuserdata
tests/objc_sync/objc_sync
tests/plugin/Info.plist
tests/subprocess/subprocess
tests/terminal/terminal_tests







>







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
src/test/libobjfwtest.a
src/tls/Info.plist
src/tls/libobjfwtls.*
tests/DerivedData
tests/EBOOT.PBP
tests/Info.plist
tests/PARAM.SFO
tests/big_dictionary_msgpack.m
tests/iOS.xcodeproj/*.pbxuser
tests/iOS.xcodeproj/project.xcworkspace
tests/iOS.xcodeproj/xcuserdata
tests/objc_sync/objc_sync
tests/plugin/Info.plist
tests/subprocess/subprocess
tests/terminal/terminal_tests

Modified src/OFMessagePackExtension.m from [33ef9555ae] to [205f87096d].

16
17
18
19
20
21
22

23
24
25
26
27
28
29
#include "config.h"

#import "OFMessagePackExtension.h"
#import "OFData.h"
#import "OFString.h"

#import "OFInvalidArgumentException.h"


@implementation OFMessagePackExtension
@synthesize type = _type, data = _data;

+ (instancetype)extensionWithType: (int8_t)type data: (OFData *)data
{
	return [[[self alloc] initWithType: type data: data] autorelease];







>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "config.h"

#import "OFMessagePackExtension.h"
#import "OFData.h"
#import "OFString.h"

#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"

@implementation OFMessagePackExtension
@synthesize type = _type, data = _data;

+ (instancetype)extensionWithType: (int8_t)type data: (OFData *)data
{
	return [[[self alloc] initWithType: type data: data] autorelease];
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
	} else if (count == 16) {
		ret = [OFMutableData dataWithCapacity: 18];

		prefix = 0xD8;
		[ret addItem: &prefix];

		[ret addItem: &_type];
	} else if (count < 0x100) {
		uint8_t length;

		ret = [OFMutableData dataWithCapacity: count + 3];

		prefix = 0xC7;
		[ret addItem: &prefix];

		length = (uint8_t)count;
		[ret addItem: &length];

		[ret addItem: &_type];
	} else if (count < 0x10000) {
		uint16_t length;

		ret = [OFMutableData dataWithCapacity: count + 4];

		prefix = 0xC8;
		[ret addItem: &prefix];

		length = OFToBigEndian16((uint16_t)count);
		[ret addItems: &length count: 2];

		[ret addItem: &_type];
	} else {
		uint32_t length;

		ret = [OFMutableData dataWithCapacity: count + 6];

		prefix = 0xC9;
		[ret addItem: &prefix];

		length = OFToBigEndian32((uint32_t)count);
		[ret addItems: &length count: 4];

		[ret addItem: &_type];
	}


	[ret addItems: _data.items count: _data.count];
	[ret makeImmutable];

	return ret;
}








|











|











|











|
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
	} else if (count == 16) {
		ret = [OFMutableData dataWithCapacity: 18];

		prefix = 0xD8;
		[ret addItem: &prefix];

		[ret addItem: &_type];
	} else if (count <= UINT8_MAX) {
		uint8_t length;

		ret = [OFMutableData dataWithCapacity: count + 3];

		prefix = 0xC7;
		[ret addItem: &prefix];

		length = (uint8_t)count;
		[ret addItem: &length];

		[ret addItem: &_type];
	} else if (count <= UINT16_MAX) {
		uint16_t length;

		ret = [OFMutableData dataWithCapacity: count + 4];

		prefix = 0xC8;
		[ret addItem: &prefix];

		length = OFToBigEndian16((uint16_t)count);
		[ret addItems: &length count: 2];

		[ret addItem: &_type];
	} else if (count <= UINT32_MAX) {
		uint32_t length;

		ret = [OFMutableData dataWithCapacity: count + 6];

		prefix = 0xC9;
		[ret addItem: &prefix];

		length = OFToBigEndian32((uint32_t)count);
		[ret addItems: &length count: 4];

		[ret addItem: &_type];
	} else
		@throw [OFOutOfRangeException exception];

	[ret addItems: _data.items count: _data.count];
	[ret makeImmutable];

	return ret;
}

Modified tests/Makefile from [f0a82101d7] to [9a520a5dc7].

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
include ../extra.mk

SUBDIRS = ${TESTPLUGIN}	\
	  ${SUBPROCESS}	\
	  ${OBJC_SYNC}	\
	  terminal

CLEAN = EBOOT.PBP		\
	boot.dol		\
	${PROG_NOINST}.arm9	\
	${PROG_NOINST}.nds	\
	${PROG_NOINST}.nro	\
	${PROG_NOINST}.rpx	\

	testfile_bin.m		\
	testfile_ini.m
DISTCLEAN = Info.plist

PROG_NOINST = tests${PROG_SUFFIX}
STATIC_LIB_NOINST = ${TESTS_STATIC_LIB}
SRCS = ForwardingTests.m			\
       OFArrayTests.m				\







|
|
|
|
|
|
>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
include ../extra.mk

SUBDIRS = ${TESTPLUGIN}	\
	  ${SUBPROCESS}	\
	  ${OBJC_SYNC}	\
	  terminal

CLEAN = EBOOT.PBP			\
	boot.dol			\
	${PROG_NOINST}.arm9		\
	${PROG_NOINST}.nds		\
	${PROG_NOINST}.nro		\
	${PROG_NOINST}.rpx		\
	big_dictionary_msgpack.m	\
	testfile_bin.m			\
	testfile_ini.m
DISTCLEAN = Info.plist

PROG_NOINST = tests${PROG_SUFFIX}
STATIC_LIB_NOINST = ${TESTS_STATIC_LIB}
SRCS = ForwardingTests.m			\
       OFArrayTests.m				\
72
73
74
75
76
77
78

79
80
81
82
83
84
85
       RuntimeTests.m				\
       ${USE_SRCS_FILES}			\
       ${USE_SRCS_PLUGINS}			\
       ${USE_SRCS_SOCKETS}			\
       ${USE_SRCS_SUBPROCESSES}			\
       ${USE_SRCS_THREADS}			\
       ${USE_SRCS_WINDOWS}			\

       testfile_bin.m				\
       testfile_ini.m
SRCS_FILES = OFFileManagerTests.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFDNSResolverTests.m		\
	       ${OF_HTTP_CLIENT_TESTS_M}	\
	       OFHTTPCookieManagerTests.m	\







>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
       RuntimeTests.m				\
       ${USE_SRCS_FILES}			\
       ${USE_SRCS_PLUGINS}			\
       ${USE_SRCS_SOCKETS}			\
       ${USE_SRCS_SUBPROCESSES}			\
       ${USE_SRCS_THREADS}			\
       ${USE_SRCS_WINDOWS}			\
       big_dictionary_msgpack.m			\
       testfile_bin.m				\
       testfile_ini.m
SRCS_FILES = OFFileManagerTests.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFDNSResolverTests.m		\
	       ${OF_HTTP_CLIENT_TESTS_M}	\
	       OFHTTPCookieManagerTests.m	\
99
100
101
102
103
104
105



106
107
108
109
110
111
112
		    OFUNIXStreamSocketTests.m
SRCS_SUBPROCESSES = OFSubprocessTests.m
SRCS_THREADS = OFThreadTests.m
SRCS_WINDOWS = OFWindowsRegistryKeyTests.m

include ../buildsys.mk




testfile_bin.m: testfile.bin
	${SHELL} ../utils/objfw-embed testfile.bin testfile.bin $@
testfile_ini.m: testfile.ini
	${SHELL} ../utils/objfw-embed testfile.ini testfile.ini $@

.PHONY: run run-on-ios run-on-android
run:







>
>
>







101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
		    OFUNIXStreamSocketTests.m
SRCS_SUBPROCESSES = OFSubprocessTests.m
SRCS_THREADS = OFThreadTests.m
SRCS_WINDOWS = OFWindowsRegistryKeyTests.m

include ../buildsys.mk

big_dictionary_msgpack.m:
	${SHELL} ../utils/objfw-embed \
		big_dictionary.msgpack big_dictionary.msgpack $@
testfile_bin.m: testfile.bin
	${SHELL} ../utils/objfw-embed testfile.bin testfile.bin $@
testfile_ini.m: testfile.ini
	${SHELL} ../utils/objfw-embed testfile.ini testfile.ini $@

.PHONY: run run-on-ios run-on-android
run:

Modified tests/OFMessagePackTests.m from [f63bfb7b62] to [1cd99d50a7].

11
12
13
14
15
16
17


18
19
20
21
22
23





24












25
26
27
28
29
30
31
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"



#import "ObjFW.h"
#import "ObjFWTest.h"

@interface OFMessagePackTests: OTTestCase
@end






@implementation OFMessagePackTests












- (void)testMessagePackRepresentationForNumber
{
	OTAssertEqualObjects([[OFNumber numberWithChar: -30]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xE2" count: 1]);

	OTAssertEqualObjects([[OFNumber numberWithChar: -33]







>
>






>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <string.h>

#import "ObjFW.h"
#import "ObjFWTest.h"

@interface OFMessagePackTests: OTTestCase
@end

const char *smallDictionaryRepresentation =
    "\xDE\x00\x10\x00\x01\x01\x02\x02\x03\x03\x04\x04\x05\x05\x06\x06"
    "\x07\x07\x08\x08\x09\x09\x0A\x0A\x0B\x0B\x0C\x0C\x0D\x0D\x0E\x0E"
    "\x0F\x0F\x10";

@implementation OFMessagePackTests
- (void)testMessagePackRepresentationForNull
{
	OTAssertEqualObjects([[OFNull null] messagePackRepresentation],
	    [OFData dataWithItems: "\xC0" count: 1]);
}

- (void)testObjectByParsingMessagePackForNull
{
	OTAssertEqualObjects([[OFData dataWithItems: "\xC0" count: 1]
	    objectByParsingMessagePack], [OFNull null]);
}

- (void)testMessagePackRepresentationForNumber
{
	OTAssertEqualObjects([[OFNumber numberWithChar: -30]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xE2" count: 1]);

	OTAssertEqualObjects([[OFNumber numberWithChar: -33]
70
71
72
73
74
75
76








77
78
79
80
81
82
83
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xCA\x3F\xA0\x00\x00" count: 5]);

	OTAssertEqualObjects([[OFNumber numberWithDouble: 1.25]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xCB\x3F\xF4\x00\x00\x00\x00\x00\x00"
			    count: 9]);








}

- (void)testObjectByParsingMessagePackForNumber
{
	OTAssertEqualObjects([[OFData dataWithItems: "\xE2" count: 1]
	    objectByParsingMessagePack],
	    [OFNumber numberWithChar: -30]);







>
>
>
>
>
>
>
>







89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xCA\x3F\xA0\x00\x00" count: 5]);

	OTAssertEqualObjects([[OFNumber numberWithDouble: 1.25]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xCB\x3F\xF4\x00\x00\x00\x00\x00\x00"
			    count: 9]);

	OTAssertEqualObjects(
	    [[OFNumber numberWithBool: true] messagePackRepresentation],
	    [OFData dataWithItems: "\xC3" count: 1]);

	OTAssertEqualObjects(
	    [[OFNumber numberWithBool: false] messagePackRepresentation],
	    [OFData dataWithItems: "\xC2" count: 1]);
}

- (void)testObjectByParsingMessagePackForNumber
{
	OTAssertEqualObjects([[OFData dataWithItems: "\xE2" count: 1]
	    objectByParsingMessagePack],
	    [OFNumber numberWithChar: -30]);
127
128
129
130
131
132
133
134


























































































































































































































































































































































































































135
			     count: 5] objectByParsingMessagePack],
	    [OFNumber numberWithFloat: 1.25f]);

	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xCB\x3F\xF4\x00\x00\x00\x00\x00\x00"
			     count: 9] objectByParsingMessagePack],
	    [OFNumber numberWithDouble: 1.25]);
}


























































































































































































































































































































































































































@end







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
			     count: 5] objectByParsingMessagePack],
	    [OFNumber numberWithFloat: 1.25f]);

	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xCB\x3F\xF4\x00\x00\x00\x00\x00\x00"
			     count: 9] objectByParsingMessagePack],
	    [OFNumber numberWithDouble: 1.25]);

	OTAssertEqualObjects([[OFData dataWithItems: "\xC3" count: 1]
	    objectByParsingMessagePack],
	    [OFNumber numberWithBool: true]);

	OTAssertEqualObjects([[OFData dataWithItems: "\xC2" count: 1]
	    objectByParsingMessagePack],
	    [OFNumber numberWithBool: false]);
}

static void
generateStringAndData(OFString **string, OFMutableData **data, size_t length,
    const char *dataPrefix, size_t dataPrefixLength)
{
	*data = [OFMutableData dataWithCapacity: length + dataPrefixLength];
	[*data addItems: dataPrefix count: dataPrefixLength];
	[*data increaseCountBy: length];
	memset([*data mutableItemAtIndex: dataPrefixLength], 'x', length);

	*string = [OFString
	    stringWithUTF8String: [*data itemAtIndex: dataPrefixLength]
			  length: length];
}

- (void)testMessagePackRepresentationForString
{
	OFString *string;
	OFMutableData *data;

	OTAssertEqualObjects(@"x".messagePackRepresentation,
	    [OFData dataWithItems: "\xA1x" count: 2]);

	generateStringAndData(&string, &data, 32, "\xD9\x20", 2);
	OTAssertEqualObjects(string.messagePackRepresentation, data);

	generateStringAndData(&string, &data, 256, "\xDA\x01\x00", 3);
	OTAssertEqualObjects(string.messagePackRepresentation, data);

	generateStringAndData(&string, &data, 65536, "\xDB\x00\x01\x00\x00", 5);
	OTAssertEqualObjects(string.messagePackRepresentation, data);
}

- (void)testObjectByParsingMessagePackForString
{
	OFString *string;
	OFMutableData *data;

	OTAssertEqualObjects([[OFData dataWithItems: "\xA1x" count: 2]
	    objectByParsingMessagePack], @"x");

	generateStringAndData(&string, &data, 32, "\xD9\x20", 2);
	OTAssertEqualObjects(data.objectByParsingMessagePack, string);

	generateStringAndData(&string, &data, 256, "\xDA\x01\x00", 3);
	OTAssertEqualObjects(data.objectByParsingMessagePack, string);

	generateStringAndData(&string, &data, 65536, "\xDB\x00\x01\x00\x00", 5);
	OTAssertEqualObjects(data.objectByParsingMessagePack, string);
}

- (void)testMessagePackRepresentationForData
{
	OFMutableData *data;

	OTAssertEqualObjects(
	    [[OFData dataWithItems: "x" count: 1] messagePackRepresentation],
	    [OFData dataWithItems: "\xC4\x01x" count: 3]);

	data = [OFMutableData data];
	[data addItems: "\xC5\x01\x00" count: 3];
	[data increaseCountBy: 256];
	memset([data mutableItemAtIndex: 3], 'x', 256);
	OTAssertEqualObjects([[data subdataWithRange: OFMakeRange(3, 256)]
	    messagePackRepresentation], data);

	data = [OFMutableData data];
	[data addItems: "\xC6\x00\x01\x00\x00" count: 5];
	[data increaseCountBy: 65536];
	memset([data mutableItemAtIndex: 5], 'x', 65536);
	OTAssertEqualObjects([[data subdataWithRange: OFMakeRange(5, 65536)]
	    messagePackRepresentation], data);
}

- (void)testObjectByParsingMessagePackForData
{
	OFMutableData *data;

	OTAssertEqualObjects([[OFData dataWithItems: "\xC4\x01x" count: 3]
	    objectByParsingMessagePack],
	    [OFData dataWithItems: "x" count: 1]);

	data = [OFMutableData data];
	[data addItems: "\xC5\x01\x00" count: 3];
	[data increaseCountBy: 256];
	memset([data mutableItemAtIndex: 3], 'x', 256);
	OTAssertEqualObjects(data.objectByParsingMessagePack,
	    [data subdataWithRange: OFMakeRange(3, 256)]);

	data = [OFMutableData data];
	[data addItems: "\xC6\x00\x01\x00\x00" count: 5];
	[data increaseCountBy: 65536];
	memset([data mutableItemAtIndex: 5], 'x', 65536);
	OTAssertEqualObjects(data.objectByParsingMessagePack,
	    [data subdataWithRange: OFMakeRange(5, 65536)]);
}

- (void)testMessagePackRepresentationForArray
{
	OFMutableArray *array = [OFMutableArray arrayWithCapacity: 65536];
	OFNumber *number = [OFNumber numberWithUnsignedInt: 1];
	OFMutableData *data;

	OTAssertEqualObjects([[OFArray array] messagePackRepresentation],
	    [OFData dataWithItems: "\x90" count: 1]);

	OTAssertEqualObjects(
	    [[OFArray arrayWithObject: number] messagePackRepresentation],
	    [OFData dataWithItems: "\x91\x01" count: 2]);

	data = [OFMutableData dataWithCapacity: 19];
	[data addItems: "\xDC\x00\x10" count: 3];
	[data increaseCountBy: 16];
	memset([data mutableItemAtIndex: 3], '\x01', 16);
	for (size_t i = 0; i < 16; i++)
		[array addObject: number];
	OTAssertEqualObjects(array.messagePackRepresentation, data);

	data = [OFMutableData dataWithCapacity: 65541];
	[data addItems: "\xDD\x00\x01\x00\x00" count: 5];
	[data increaseCountBy: 65536];
	memset([data mutableItemAtIndex: 5], '\x01', 65536);
	for (size_t i = 16; i < 65536; i++)
		[array addObject: number];
	OTAssertEqualObjects(array.messagePackRepresentation, data);
}

- (void)testObjectByParsingMessagePackForArray
{
	OFMutableArray *array = [OFMutableArray arrayWithCapacity: 65536];
	OFNumber *number = [OFNumber numberWithUnsignedInt: 1];
	OFMutableData *data;

	OTAssertEqualObjects([[OFData dataWithItems: "\x90" count: 1]
	    objectByParsingMessagePack], [OFArray array]);

	OTAssertEqualObjects([[OFData dataWithItems: "\x91\x01" count: 2]
	    objectByParsingMessagePack],
	    [OFArray arrayWithObject: number]);

	data = [OFMutableData dataWithCapacity: 19];
	[data addItems: "\xDC\x00\x10" count: 3];
	[data increaseCountBy: 16];
	memset([data mutableItemAtIndex: 3], '\x01', 16);
	for (size_t i = 0; i < 16; i++)
		[array addObject: number];
	OTAssertEqualObjects(data.objectByParsingMessagePack, array);

	data = [OFMutableData dataWithCapacity: 65541];
	[data addItems: "\xDD\x00\x01\x00\x00" count: 5];
	[data increaseCountBy: 65536];
	memset([data mutableItemAtIndex: 5], '\x01', 65536);
	for (size_t i = 16; i < 65536; i++)
		[array addObject: number];
	OTAssertEqualObjects(data.objectByParsingMessagePack, array);
}

- (void)testMessagePackRepresentationForDictionary
{
	OFMutableArray *keys = [OFMutableArray arrayWithCapacity: 65536];
	OFMutableArray *objects = [OFMutableArray arrayWithCapacity: 65536];

	OTAssertEqualObjects([[OFDictionary dictionary]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\x80" count: 1]);

	OTAssertEqualObjects([[OFDictionary
	    dictionaryWithObject: [OFNumber numberWithUnsignedInt: 2]
			  forKey: [OFNumber numberWithUnsignedInt: 1]]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\x81\x01\x02" count: 3]);

	for (unsigned int i = 0; i < 16; i++) {
		[keys addObject: [OFNumber numberWithUnsignedInt: i]];
		[objects addObject: [OFNumber numberWithUnsignedInt: i + 1]];
	}
	OTAssertEqualObjects([[OTOrderedDictionary
	    dictionaryWithObjects: objects.objects
			  forKeys: keys.objects
			    count: 16] messagePackRepresentation],
	    [OFData dataWithItems: smallDictionaryRepresentation count: 35]);

	for (unsigned int i = 16; i < 65536; i++) {
		[keys addObject: [OFNumber numberWithUnsignedInt: i]];
		[objects addObject: [OFNumber numberWithUnsignedInt: i + 1]];
	}
	OTAssertEqualObjects([[OTOrderedDictionary
	    dictionaryWithObjects: objects.objects
			  forKeys: keys.objects
			    count: 65536] messagePackRepresentation],
	    [OFData dataWithContentsOfIRI:
	    [OFIRI IRIWithString: @"embedded:big_dictionary.msgpack"]]);
}

- (void)testObjectByParsingMessagePackForDictionary
{
	OFMutableDictionary *dictionary =
	    [OFMutableDictionary dictionaryWithCapacity: 65536];

	OTAssertEqualObjects([[OFData dataWithItems: "\x80" count: 1]
	    objectByParsingMessagePack], [OFDictionary dictionary]);

	OTAssertEqualObjects([[OFData dataWithItems: "\x81\x01\x02" count: 3]
	    objectByParsingMessagePack],
	    [OFDictionary
	    dictionaryWithObject: [OFNumber numberWithUnsignedInt: 2]
			  forKey: [OFNumber numberWithUnsignedInt: 1]]);

	for (unsigned int i = 0; i < 16; i++)
		[dictionary setObject: [OFNumber numberWithUnsignedInt: i + 1]
			       forKey: [OFNumber numberWithUnsignedInt: i]];
	OTAssertEqualObjects(
	    [[OFData dataWithItems: smallDictionaryRepresentation
			     count: 35] objectByParsingMessagePack],
	    dictionary);

	for (unsigned int i = 16; i < 65536; i++)
		[dictionary setObject: [OFNumber numberWithUnsignedInt: i + 1]
			       forKey: [OFNumber numberWithUnsignedInt: i]];
	OTAssertEqualObjects(dictionary,
	    [[OFData dataWithContentsOfIRI:
	    [OFIRI IRIWithString: @"embedded:big_dictionary.msgpack"]]
	    objectByParsingMessagePack]);
}

- (void)testMessagePackRepresentationForExtension
{
	OFMessagePackExtension *extension;
	OFMutableData *data;

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "x" count: 1]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xD4\x01x" count: 3]);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "xy" count: 2]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xD5\x01xy" count: 4]);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "abcd" count: 4]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xD6\x01" "abcd" count: 6]);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "12345678" count: 8]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xD7\x01" "12345678" count: 10]);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "12345678ABCDEFGH"
					       count: 16]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xD8\x01" "12345678ABCDEFGH" count: 18]);

	extension = [OFMessagePackExtension extensionWithType: 1
							 data: [OFData data]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xC7\x00\x01" count: 3]);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "abc" count: 3]];
	OTAssertEqualObjects(extension.messagePackRepresentation,
	    [OFData dataWithItems: "\xC7\x03\x01" "abc" count: 6]);

	data = [OFMutableData dataWithCapacity: 260];
	[data addItems: "\xC8\x01\x00\x01" count: 4];
	[data increaseCountBy: 256];
	memset([data mutableItemAtIndex: 4], 'x', 256);
	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [data subdataWithRange: OFMakeRange(4, 256)]];
	OTAssertEqualObjects(extension.messagePackRepresentation, data);

	data = [OFMutableData dataWithCapacity: 65542];
	[data addItems: "\xC9\x00\x01\x00\x00\x01" count: 6];
	[data increaseCountBy: 65536];
	memset([data mutableItemAtIndex: 6], 'x', 65536);
	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [data subdataWithRange: OFMakeRange(6, 65536)]];
	OTAssertEqualObjects(extension.messagePackRepresentation, data);
}

- (void)testObjectByParsingMessagePackForExtension
{
	OFMessagePackExtension *extension;
	OFMutableData *data;

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "x" count: 1]];
	OTAssertEqualObjects([[OFData dataWithItems: "\xD4\x01x" count: 3]
	    objectByParsingMessagePack], extension);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "xy" count: 2]];
	OTAssertEqualObjects([[OFData dataWithItems: "\xD5\x01xy" count: 4]
	    objectByParsingMessagePack], extension);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "abcd" count: 4]];
	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xD6\x01" "abcd"
			     count: 6] objectByParsingMessagePack],
	    extension);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "12345678" count: 8]];
	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xD7\x01" "12345678"
			     count: 10] objectByParsingMessagePack],
	    extension);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "12345678ABCDEFGH"
					       count: 16]];
	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xD8\x01" "12345678ABCDEFGH"
			     count: 18] objectByParsingMessagePack],
	    extension);

	extension = [OFMessagePackExtension extensionWithType: 1
							 data: [OFData data]];
	OTAssertEqualObjects([[OFData dataWithItems: "\xC7\x00\x01" count: 3]
	    objectByParsingMessagePack], extension);

	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [OFData dataWithItems: "abc" count: 3]];
	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xC7\x03\x01" "abc"
			     count: 6] objectByParsingMessagePack],
	    extension);

	data = [OFMutableData dataWithCapacity: 260];
	[data addItems: "\xC8\x01\x00\x01" count: 4];
	[data increaseCountBy: 256];
	memset([data mutableItemAtIndex: 4], 'x', 256);
	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [data subdataWithRange: OFMakeRange(4, 256)]];
	OTAssertEqualObjects(data.objectByParsingMessagePack, extension);

	data = [OFMutableData dataWithCapacity: 65542];
	[data addItems: "\xC9\x00\x01\x00\x00\x01" count: 6];
	[data increaseCountBy: 65536];
	memset([data mutableItemAtIndex: 6], 'x', 65536);
	extension = [OFMessagePackExtension
	    extensionWithType: 1
			 data: [data subdataWithRange: OFMakeRange(6, 65536)]];
	OTAssertEqualObjects(data.objectByParsingMessagePack, extension);
}

- (void)testMessagePackRepresentationForDate
{
	OTAssertEqualObjects([[OFDate dateWithTimeIntervalSince1970: 1]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xD6\xFF\x00\x00\x00\x01" count: 6]);

	OTAssertEqualObjects([[OFDate dateWithTimeIntervalSince1970: 1.25]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xD7\xFF\x3B\x9A\xCA\x00\x00\x00\x00\x01"
			    count: 10]);

	OTAssertEqualObjects(
	    [[OFDate dateWithTimeIntervalSince1970: 0x400000000 + 0.25]
	    messagePackRepresentation],
	    [OFData dataWithItems: "\xC7\x0C\xFF\x0E\xE6\xB2\x80\x00\x00\x00"
				   "\x04\x00\x00\x00\x00"
			    count: 15]);
}

- (void)testObjectByParsingMessagePackForDate
{
	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xD6\xFF\x00\x00\x00\x01"
			     count: 6] objectByParsingMessagePack],
	    [OFDate dateWithTimeIntervalSince1970: 1]);

	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xD7\xFF\x3B\x9A\xCA\x00\x00\x00\x00\x01"
			     count: 10] objectByParsingMessagePack],
	    [OFDate dateWithTimeIntervalSince1970: 1.25]);

	OTAssertEqualObjects(
	    [[OFData dataWithItems: "\xC7\x0C\xFF\x0E\xE6\xB2\x80\x00\x00\x00"
				    "\x04\x00\x00\x00\x00"
			     count: 15] objectByParsingMessagePack],
	    [OFDate dateWithTimeIntervalSince1970: 0x400000000 + 0.25]);
}
@end

Added tests/big_dictionary.msgpack version [02714ede05].

cannot compute difference between binary files