forked from pmougin/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathKTestManager.m
620 lines (504 loc) · 30.5 KB
/
KTestManager.m
1
2
3
4
5
6
7
8
9
10
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
147
148
149
150
151
152
153
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
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
/* KTestManager.m Copyright (c) 2001-2009 Philippe Mougin. */
/* This software is open source. See the license. */
#import "KTestManager.h"
#import <Foundation/Foundation.h>
#import "FSBoolean.h"
#import "FSNumber.h"
#import "FScriptFunctions.h"
#import "FSBlock.h"
#import <objc/objc-class.h>
#import "FSNSString.h"
@class FSTestClass10;
@protocol MethodMappingTestHelper
- (id) giveBackId: (id) arg;
- (id *) giveBackIdPtr: (id *) arg;
- (id) dereferenceIdPtr: (id *) arg;
- (Class) giveBackClass: (Class) arg;
- (Class *) giveBackClassPtr: (Class *) arg;
- (Class) dereferenceClassPtr: (Class *) arg;
- (SEL) giveBackSEL: (SEL) arg;
- (SEL *) giveBackSELPtr: (SEL *) arg;
- (SEL) dereferenceSELPtr: (SEL *) arg;
- (BOOL) giveBackBOOL: (BOOL) arg;
- (BOOL *) giveBackBOOLPtr: (BOOL *) arg;
- (BOOL) dereferenceBOOLPtr: (BOOL *) arg;
- (_Bool) giveBack_Bool: (_Bool) arg;
- (_Bool *) giveBack_BoolPtr: (_Bool *) arg;
- (_Bool) dereference_BoolPtr: (_Bool *) arg;
- (char) giveBackChar: (char) arg;
- (char *) giveBackCharPtr: (char *) arg;
- (char) dereferenceCharPtr: (char *) arg;
- (unsigned char) giveBackUnsignedChar: (unsigned char) arg;
- (unsigned char *) giveBackUnsignedCharPtr: (unsigned char *) arg;
- (unsigned char) dereferenceUnsignedCharPtr: (unsigned char *) arg;
- (short) giveBackShort: (short) arg;
- (short *) giveBackShortPtr: (short *) arg;
- (short) dereferenceShortPtr: (short *) arg;
- (unsigned short) giveBackUnsignedShort: (unsigned short) arg;
- (unsigned short *) giveBackUnsignedShortPtr: (unsigned short *) arg;
- (unsigned short) dereferenceUnsignedShortPtr: (unsigned short *) arg;
- (int) giveBackInt: (int) arg;
- (int *) giveBackIntPtr: (int *) arg;
- (int) dereferenceIntPtr: (int *) arg;
- (unsigned int) giveBackUnsignedInt: (unsigned int) arg;
- (unsigned int *) giveBackUnsignedIntPtr: (unsigned int *) arg;
- (unsigned int) dereferenceUnsignedIntPtr: (unsigned int *) arg;
- (long) giveBackLong: (long) arg;
- (long *) giveBackLongPtr: (long *) arg;
- (long) dereferenceLongPtr: (long *) arg;
- (unsigned long) giveBackUnsignedLong: (unsigned long) arg;
- (unsigned long *) giveBackUnsignedLongPtr: (unsigned long *) arg;
- (unsigned long) dereferenceUnsignedLongPtr: (unsigned long *) arg;
- (long long) giveBackLongLong: (long long) arg;
- (long long *) giveBackLongLongPtr: (long long *) arg;
- (long long) dereferenceLongLongPtr: (long long *) arg;
- (unsigned long long) giveBackUnsignedLongLong: (unsigned long long) arg;
- (unsigned long long *) giveBackUnsignedLongLongPtr: (unsigned long long *) arg;
- (unsigned long long) dereferenceUnsignedLongLongPtr: (unsigned long long *) arg;
- (NSInteger) giveBackNSInteger: (NSInteger) arg;
- (NSInteger *) giveBackNSIntegerPtr: (NSInteger *) arg;
- (NSInteger) dereferenceNSIntegerPtr: (NSInteger *) arg;
- (NSUInteger) giveBackNSUInteger: (NSUInteger) arg;
- (NSUInteger *) giveBackNSUIntegerPtr: (NSUInteger *) arg;
- (NSUInteger) dereferenceNSUIntegerPtr: (NSUInteger *) arg;
- (float) giveBackFloat: (float) arg;
- (float *) giveBackFloatPtr: (float *) arg;
- (float) dereferenceFloatPtr: (float *) arg;
- (double) giveBackDouble: (double) arg;
- (double *) giveBackDoublePtr: (double *) arg;
- (double) dereferenceDoublePtr: (double *) arg;
- (CGFloat) giveBackCGFloat: (CGFloat) arg;
- (CGFloat *) giveBackCGFloatPtr: (CGFloat *) arg;
- (CGFloat) dereferenceCGFloatPtr: (CGFloat *) arg;
- (NSRange) giveBackNSRange: (NSRange) arg;
- (NSRange *) giveBackNSRangePtr: (NSRange *) arg;
- (NSRange) dereferenceNSRangePtr: (NSRange *) arg;
- (NSPoint) giveBackNSPoint: (NSPoint) arg;
- (NSPoint *) giveBackNSPointPtr: (NSPoint *) arg;
- (NSPoint) dereferenceNSPointPtr: (NSPoint *) arg;
- (CGPoint) giveBackCGPoint: (CGPoint) arg;
- (CGPoint *) giveBackCGPointPtr: (CGPoint *) arg;
- (CGPoint) dereferenceCGPointPtr: (CGPoint *) arg;
- (NSRect) giveBackNSRect : (NSRect) arg;
- (NSRect *) giveBackNSRectPtr: (NSRect *) arg;
- (NSRect) dereferenceNSRectPtr: (NSRect *) arg;
- (CGRect) giveBackCGRect : (CGRect) arg;
- (CGRect *) giveBackCGRectPtr: (CGRect *) arg;
- (CGRect) dereferenceCGRectPtr: (CGRect *) arg;
- (NSSize) giveBackNSSize : (NSSize) arg;
- (NSSize *) giveBackNSSizePtr: (NSSize *) arg;
- (NSSize) dereferenceNSSizePtr: (NSSize *) arg;
- (CGSize) giveBackCGSize : (CGSize) arg;
- (CGSize *) giveBackCGSizePtr: (CGSize *) arg;
- (CGSize) dereferenceCGSizePtr: (CGSize *) arg;
- (CGAffineTransform) giveBackCGAffineTransform : (CGAffineTransform) arg;
- (CGAffineTransform *) giveBackCGAffineTransformPtr: (CGAffineTransform *) arg;
- (CGAffineTransform) dereferenceCGAffineTransformPtr:(CGAffineTransform *) arg;
- (void *) giveBackVoidPtr: (void *) arg;
- (float) dereferenceVoidPtrAsFloat: (void *) arg;
- (unsigned long long **) giveBackUnsignedLongLongPtrPtr: (unsigned long long **) arg;
- (unsigned long long *) dereferenceUnsignedLongLongPtrPtr:(unsigned long long **) arg;
- (NSString *) giveBackNSString: (NSString *) arg;
- (FSTestClass10 *) giveBackFSTestClass10: (FSTestClass10 *) arg;
- (NSArray *) giveBackArrayWithId:(id)a1 Class:(Class)a2 SEL:(SEL)a3 BOOL:(BOOL)a4 _Bool:(_Bool)a5 char:(char)a6 unsignedChar:(unsigned char)a7
short:(short)a8 unsignedShort:(unsigned short)a9 int:(int)a10 unsignedInt:(unsigned int)a11 long:(long)a12 unsignedLong:(unsigned long)a13
longLong:(long long)a14 unsignedLongLong:(unsigned long long)a15 NSInteger:(NSInteger)a16 NSUInteger:(NSUInteger)a17 float:(float)a18
double:(double)a19 CGFloat:(CGFloat)a20 NSRange:(NSRange)a21 NSPoint:(NSPoint)a22 CGPoint:(CGPoint)a23 NSRect:(NSRect)a24 CGRect:(CGRect)a25
NSSize:(NSSize)a26 CGSize:(CGSize)a27 CGAffineTransform:(CGAffineTransform)a28 NSString:(NSString *)a29;
@end
@implementation KTestManager
-(void) addComment:(NSString *)comment
{
[[comments lastObject] appendString:comment];
}
-(void)assert:(BOOL)b
{
if (!b)
{
[results replaceObjectAtIndex:[results count]-1 withObject:[FSBoolean fsFalse]];
[self addComment:[NSString stringWithFormat:@" assertCount = %ld (note: counting starts at zero)", (long)assertCount]];
}
assertCount++;
}
-(void) assertError:(FSBlock *)b
{
BOOL isException = NO;
FSVerifClassArgsNoNil(@"assertError:",1,b,[FSBlock class]);
@try
{
[b value];
}
@catch (id exception)
{
isException = YES;
}
if (!isException)
{
[results replaceObjectAtIndex:[results count]-1 withObject:[FSBoolean fsFalse]];
[self addComment:[NSString stringWithFormat:@" assertCount = %ld (note: counting starts at zero)", (long)assertCount]];
}
assertCount++;
}
-(void) dealloc
{
[names release];
[times release];
[results release];
[comments release];
[currentCategory release];
[startDate release];
[super dealloc];
}
-(void) finish
{
if (startDate) [times addObject:[FSNumber numberWithDouble:-[startDate timeIntervalSinceNow]]];
}
- (id)init
{
if ((self = [super init]))
{
names = [[NSMutableArray alloc] init];
times = [[NSMutableArray alloc] init];
results = [[NSMutableArray alloc] init];
comments = [[NSMutableArray alloc] init];
currentCategory = @"";
shouldLog = NO;
return self;
}
return nil;
}
-(NSString *) report
{
NSUInteger i;
NSString *commentReport = [NSMutableString string];
NSString *errorReport = [NSMutableString string];
for (i = 0; i < [comments count]; i++)
{
if (![[comments objectAtIndex:i] isEqual:@""]) [(NSMutableString *)commentReport appendFormat:@"\n %@ -> %@",[names objectAtIndex:i],[comments objectAtIndex:i]];
}
if (![commentReport isEqual:@""]) commentReport = [@"Comments:" stringByAppendingString:commentReport];
for (i = 0; i < [results count]; i++)
{
if ([[results objectAtIndex:i] isEqual:[FSBoolean fsFalse]]) [(NSMutableString *)errorReport appendFormat:@"%@ failed\n",[names objectAtIndex:i]];
}
//if (![errorReport isEqual:@""]) errorReport = [@"Comments:" stringByAppendingString:commentReport];
if (![errorReport isEqual:@""])
{
return [NSString stringWithFormat:@"KTest error !\n%@\n%@", errorReport, commentReport];
}
else
{
double testTime = 0;
for (i = 0; i < [times count]; i++)
{
testTime += [[times objectAtIndex:i] doubleValue];
}
return [NSString stringWithFormat:@"KTest OK !\nTestTime = %g\n%@", testTime, commentReport];
}
}
-(void) setShouldLog:(BOOL)should
{
shouldLog = should;
}
-(void) startCategory:(NSString *)categoryName
{
if (shouldLog) NSLog(@"Start category %@", categoryName);
[categoryName retain];
[currentCategory release];
currentCategory = categoryName;
}
-(void) startTest:(NSString *)testName
{
if (startDate) [times addObject:[FSNumber numberWithDouble:-[startDate timeIntervalSinceNow]]];
[names addObject:[currentCategory stringByAppendingFormat:@" : %@",testName]];
[results addObject:[FSBoolean fsTrue]];
[comments addObject:[NSMutableString string]];
assertCount = 0;
[startDate release];
startDate = [[NSDate alloc] init];
if (shouldLog) NSLog(@" Start test %@", testName);
}
@end
@implementation KTestManager(KTestSpecificTests) // Support for some specific tests
///////////////// Forwarding test
- (void)forwardInvocation:(NSInvocation *)invocation
{
if ([invocation selector] == @selector(testForward1:))
{
[invocation setSelector:@selector(testForward1Imp:)];
[invocation invokeWithTarget:self];
}
else if ([invocation selector] == @selector(testForward2:))
{
[invocation setSelector:@selector(testForward2Imp:)];
[invocation invokeWithTarget:self];
}
else if ([invocation selector] == @selector(testForward3:::::::::))
{
[invocation setSelector:@selector(testForward3Imp:::::::::)];
[invocation invokeWithTarget:self];
}
else [self doesNotRecognizeSelector:[invocation selector]];
}
- (NSInteger)testForward1Imp:(double)d
{
return d*2;
}
- (id)testForward2Imp:(id)arg
{
return arg;
}
- (id)testForward3Imp:(id)arg1 :(id)arg2 :(id)arg3 :(id)arg4 :(id)arg5 :(id)arg6 :(id)arg7 :(id)arg8 :(id)arg9
{
return arg1;
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
if (aSelector == @selector(testForward1:)) return [self methodSignatureForSelector:@selector(testForward1Imp:)];
else if (aSelector == @selector(testForward2:)) return [self methodSignatureForSelector:@selector(testForward2Imp:)];
else if (aSelector == @selector(testForward3:::::::::)) return [self methodSignatureForSelector:@selector(testForward3Imp:::::::::)];
//else if (aSelector == @selector(retain) || aSelector == @selector(release) || aSelector == @selector(autorelease) || aSelector == @selector(dealloc) || aSelector == @selector(retainCount)) return nil;
else return [super methodSignatureForSelector:aSelector];
}
///////////////////////////
- (id *) idPointer { id *r = malloc(2*sizeof(id)); r[0] = self; r[1] = [self class]; return r; }
- (Class *) ClassPointer { Class *r = malloc(2*sizeof(Class)); r[0] = [FSNumber class]; r[1] = [self class]; return r; }
- (char *) charPointer { char *r = malloc(2*sizeof(char)); r[0] = -50; r[1] = 120; return r; }
- (signed char *) signedCharPointer { signed char *r = malloc(2*sizeof(signed char)); r[0] = -50; r[1] = 120; return r; }
- (_Bool *) _BoolPointer { _Bool *r = malloc(2*sizeof(_Bool)); r[0] = 0; r[1] = 1; return r; }
- (int *) intPointer { int *r = malloc(2*sizeof(int)); r[0] = -50; r[1] = 120; return r; }
- (short *) shortPointer { short *r = malloc(2*sizeof(short)); r[0] = -50; r[1] = 120; return r; }
- (long *) longPointer { long *r = malloc(2*sizeof(long)); r[0] = -50; r[1] = 120; return r; }
- (unsigned char *) unsignedCharPointer { unsigned char *r = malloc(2*sizeof(unsigned char)); r[0] = 0; r[1] = 200; return r; }
- (unsigned int *) unsignedIntPointer { unsigned int *r = malloc(2*sizeof(unsigned int)); r[0] = 0; r[1] = 200; return r; }
- (unsigned short *) unsignedShortPointer { unsigned short *r = malloc(2*sizeof(unsigned short)); r[0] = 0; r[1] = 200; return r; }
- (unsigned long *) unsignedLongPointer { unsigned long *r = malloc(2*sizeof(unsigned long)); r[0] = 0; r[1] = 200; return r; }
- (float *) floatPointer { float *r = malloc(2*sizeof(float)); r[0] = -1000.89; r[1] = 200.1; return r; }
- (double *) doublePointer { double *r = malloc(2*sizeof(double)); r[0] = -1000.89; r[1] = 200.1; return r; }
- (long long *) longLongPointer { long long *r = malloc(2*sizeof(long long)); r[0] = -50; r[1] = 120; return r; }
- (unsigned long long *) unsignedLongLongPointer { unsigned long long *r = malloc(2*sizeof(unsigned long long)); r[0] = 0; r[1] = 120; return r; }
- (char **) charPointerPointer { char * *r = malloc(2*sizeof(char *)); r[0] = "hello"; r[1] = "world"; return r; }
- (SEL *) SELPointer { SEL *r = malloc(2*sizeof(SEL)); r[0] = @selector(init); r[1] = @selector(self); return r; }
- (NSRange *) rangePointer { NSRange *r = malloc(2*sizeof(NSRange)); r[0] = NSMakeRange(0,10); r[1] = NSMakeRange(5,1); return r; }
- (NSPoint *) pointPointer { NSPoint *r = malloc(2*sizeof(NSPoint)); r[0] = NSMakePoint(0,10); r[1] = NSMakePoint(5,1); return r; }
- (NSSize *) sizePointer { NSSize *r = malloc(2*sizeof(NSSize)); r[0] = NSMakeSize(0,10); r[1] = NSMakeSize(5,1); return r; }
- (NSRect *) rectPointer { NSRect *r = malloc(2*sizeof(NSRect)); r[0] = NSMakeRect(0,10,100,200); r[1] = NSMakeRect(20,1,10,10); return r; }
- (CGPoint *) CGPointPointer { CGPoint *r = malloc(2*sizeof(CGPoint)); r[0] = CGPointMake(0,10); r[1] = CGPointMake(5,1); return r; }
- (CGSize *) CGSizePointer { CGSize *r = malloc(2*sizeof(CGSize)); r[0] = CGSizeMake(0,10); r[1] = CGSizeMake(5,1); return r; }
- (CGRect *) CGRectPointer { CGRect *r = malloc(2*sizeof(CGRect)); r[0] = CGRectMake(0,10,100,200); r[1] = CGRectMake(20,1,10,10); return r; }
- (CGAffineTransform *) CGAffineTransformPointer { CGAffineTransform *r = malloc(2*sizeof(CGAffineTransform)); r[0] = CGAffineTransformMake(0,10,100,200,5,6); r[1] = CGAffineTransformMake(20,1,10,10,7,8); return r; }
- (int **) intPointerPointer { int * *r = malloc(2*sizeof(int *)); r[0] = malloc(sizeof(int)); *(r[0]) = -50; r[1] = malloc(sizeof(int)); *(r[1]) = 120; return r; }
- (void *) voidPointer { return [self intPointer]; }
- (int *) staticIntPointer
{
static int staticInt;
return &staticInt;
}
- (CGPoint) CGPointMapping:(CGPoint) a
{
if (a.x != 7 || a.y != 0) return CGPointMake(0,0);
else return a;
}
- (CGSize) CGSizeMapping:(CGSize) a
{
if (a.width != (CGFloat)10.2 || a.height != (CGFloat)33.3) return CGSizeMake(0,0);
else return a;
}
- (CGRect) CGRectMapping:(CGRect) a
{
if (a.origin.x != 7 || a.origin.y != 0 || a.size.width != (CGFloat)10.2 || a.size.height != (CGFloat)33.3) return CGRectMake(0,0,0,0);
else return a;
}
- (FSArray *) duplicateUsingFastEnemeration:(NSArray *)array
{
FSArray *result = [FSArray array];
for (id elem in array) [result addObject:elem];
return result;
}
-(unsigned int) getUINT_MAX {return UINT_MAX;}
-(int) sizeofId {return sizeof(id);}
-(BOOL) runsIn64BitsMode
{
#if __LP64__
return YES;
#else
return NO;
#endif
}
- (BOOL) testFSNSDistantObjectClassOrMetaclass:(id)p
{
return ([p classOrMetaclass] == [NSDistantObject class] && [[p class] classOrMetaclass] == ((Class)[p class])->isa);
}
-(void) testMethodMappingWithFScriptObject:(id)o
{
[self assert:[o giveBackId:self] == self];
[self assert:[o giveBackIdPtr:&self] == &self];
[self assert:[o dereferenceIdPtr:&self] == self];
Class cl = [self class];
[self assert:[o giveBackClass:cl] == cl];
[self assert:[o giveBackClassPtr:&cl] == &cl];
[self assert:[o dereferenceClassPtr:&cl] == [self class]];
SEL selector = @selector(between:and:);
[self assert:[o giveBackSEL:selector] == selector];
[self assert:[o giveBackSELPtr:&selector] == &selector];
[self assert:[o dereferenceSELPtr:&selector] == @selector(between:and:)];
BOOL y = YES;
BOOL n = NO;
[self assert:[o giveBackBOOL:NO] == NO];
[self assert:[o giveBackBOOL:YES] == YES];
[self assert:[o giveBackBOOLPtr:&y] == &y];
[self assert:[o dereferenceBOOLPtr:&y] == YES];
[self assert:[o dereferenceBOOLPtr:&n] == NO];
_Bool tt = 1;
_Bool ff = 0;
[self assert:[o giveBack_Bool:0] == 0];
[self assert:[o giveBack_Bool:1] == 1];
[self assert:[o giveBack_BoolPtr:&tt] == &tt];
[self assert:[o dereference_BoolPtr:&tt] == 1];
[self assert:[o dereference_BoolPtr:&ff] == 0];
char c1 = -122;
char c2 = 107;
[self assert:[o giveBackChar:c1] == YES]; // F-script maps char to FSBoolean : c1 will be mapped to an FSBoolean
[self assert:[o giveBackChar:0] == NO]; // F-script maps char to FSBoolean : 0 will be mapped to an FSBoolean
[self assert:[o giveBackCharPtr:&c1] == &c1];
[self assert:[o dereferenceCharPtr:&c1] == -122];
[self assert:[o dereferenceCharPtr:&c2] == 107];
unsigned char uc = 246;
[self assert:[o giveBackUnsignedChar:uc] == uc];
[self assert:[o giveBackUnsignedCharPtr:&uc] == &uc];
[self assert:[o dereferenceUnsignedCharPtr:&uc] == 246];
short s1 = -12345;
short s2 = 12345;
[self assert:[o giveBackShort:s1] == s1];
[self assert:[o giveBackShort:s2] == s2];
[self assert:[o giveBackShortPtr:&s1] == &s1];
[self assert:[o dereferenceShortPtr:&s1] == -12345];
[self assert:[o dereferenceShortPtr:&s2] == 12345];
unsigned short us1 = 0;
unsigned short us2 = 55000;
[self assert:[o giveBackUnsignedShort:us1] == us1];
[self assert:[o giveBackUnsignedShort:us2] == us2];
[self assert:[o giveBackUnsignedShortPtr:&us1] == &us1];
[self assert:[o dereferenceUnsignedShortPtr:&us1] == 0];
[self assert:[o dereferenceUnsignedShortPtr:&us2] == 55000];
int i1 = -1234567890;
int i2 = 1234567890;
[self assert:[o giveBackInt:i1] == i1];
[self assert:[o giveBackInt:i2] == i2];
[self assert:[o giveBackIntPtr:&i1] == &i1];
[self assert:[o dereferenceIntPtr:&i1] == -1234567890];
[self assert:[o dereferenceIntPtr:&i2] == 1234567890];
unsigned int ui = 4234567890;
[self assert:[o giveBackUnsignedInt:ui] == ui];
[self assert:[o giveBackUnsignedIntPtr:&ui] == &ui];
[self assert:[o dereferenceUnsignedIntPtr:&ui] == 4234567890];
long l1 = -1234567890;
long l2 = 1234567890;
[self assert:[o giveBackLong:l1] == l1];
[self assert:[o giveBackLong:l2] == l2];
[self assert:[o giveBackLongPtr:&l1] == &l1];
[self assert:[o dereferenceLongPtr:&l1] == -1234567890];
[self assert:[o dereferenceLongPtr:&l2] == 1234567890];
unsigned long ul = 4234567890;
[self assert:[o giveBackUnsignedLong:ul] == ul];
[self assert:[o giveBackUnsignedLongPtr:&ul] == &ul];
[self assert:[o dereferenceUnsignedLongPtr:&ul] == 4234567890];
long long ll1 = -1234567890;
long long ll2 = 1234567890;
[self assert:[o giveBackLongLong:ll1] == ll1];
[self assert:[o giveBackLongLong:ll2] == ll2];
[self assert:[o giveBackLongLongPtr:&ll1] == &ll1];
[self assert:[o dereferenceLongLongPtr:&ll1] == -1234567890];
[self assert:[o dereferenceLongLongPtr:&ll2] == 1234567890];
unsigned long long ull = 4234567890;
[self assert:[o giveBackUnsignedLongLong:ull] == ull];
[self assert:[o giveBackUnsignedLongLongPtr:&ull] == &ull];
[self assert:[o dereferenceUnsignedLongLongPtr:&ull] == 4234567890];
NSInteger nsi1 = -1234567890;
NSInteger nsi2 = 1234567890;
[self assert:[o giveBackNSInteger:nsi1] == nsi1];
[self assert:[o giveBackNSInteger:nsi2] == nsi2];
[self assert:[o giveBackNSIntegerPtr:&nsi1] == &nsi1];
[self assert:[o dereferenceNSIntegerPtr:&nsi1] == -1234567890];
[self assert:[o dereferenceNSIntegerPtr:&nsi2] == 1234567890];
NSUInteger nsui = 4000999555;
[self assert:[o giveBackNSUInteger:nsui] == nsui];
[self assert:[o giveBackNSUIntegerPtr:&nsui] == &nsui];
[self assert:[o dereferenceNSUIntegerPtr:&nsui] == 4000999555];
[self assert:[o giveBackFloat:-3458] == -3458];
float f = [o giveBackFloat:3.1415926];
[self assert:f > 3.1415925 && f < 3.1415927];
[self assert:[o giveBackFloatPtr:&f] == &f];
f = [o dereferenceFloatPtr:&f];
[self assert:f > 3.1415925 && f < 3.1415927];
[self assert:[o giveBackDouble:-3458] == -3458];
double d = [o giveBackDouble:3.1415926];
[self assert:d > 3.1415925 && d < 3.1415927];
[self assert:[o giveBackDoublePtr:&d] == &d];
d = [o dereferenceDoublePtr:&d];
[self assert:d > 3.1415925 && d < 3.1415927];
[self assert:[o giveBackCGFloat:-3458] == -3458];
CGFloat cgf = [o giveBackCGFloat:3.1415926];
[self assert:cgf > 3.1415925 && cgf < 3.1415927];
[self assert:[o giveBackCGFloatPtr:&cgf] == &cgf];
cgf = [o dereferenceCGFloatPtr:&cgf];
[self assert:cgf > 3.1415925 && cgf < 3.1415927];
NSRange range = NSMakeRange(5, 100);
[self assert:NSEqualRanges([o giveBackNSRange:range], range)];
[self assert:[o giveBackNSRangePtr:&range] == &range];
[self assert:NSEqualRanges([o dereferenceNSRangePtr:&range], NSMakeRange(5, 100))];
NSPoint point = NSMakePoint(10, 20);
[self assert:NSEqualPoints([o giveBackNSPoint:point], point)];
[self assert:[o giveBackNSPointPtr:&point] == &point];
[self assert:NSEqualPoints([o dereferenceNSPointPtr:&point], NSMakePoint(10, 20))];
CGPoint cgpoint = CGPointMake(10, 20);
[self assert:CGPointEqualToPoint([o giveBackCGPoint:cgpoint], cgpoint)];
[self assert:[o giveBackCGPointPtr:&cgpoint] == &cgpoint];
[self assert:CGPointEqualToPoint([o dereferenceCGPointPtr:&cgpoint], CGPointMake(10, 20))];
NSRect rect = NSMakeRect(10, 20, 100, 300);
[self assert:NSEqualRects([o giveBackNSRect:rect], rect)];
[self assert:[o giveBackNSRectPtr:&rect] == &rect];
[self assert:NSEqualRects([o dereferenceNSRectPtr:&rect], NSMakeRect(10, 20, 100, 300))];
CGRect cgrect = CGRectMake(10, 20, 100, 300);
[self assert:CGRectEqualToRect([o giveBackCGRect:cgrect], cgrect)];
[self assert:[o giveBackCGRectPtr:&cgrect] == &cgrect];
[self assert:CGRectEqualToRect([o dereferenceCGRectPtr:&cgrect], CGRectMake(10, 20, 100, 300))];
NSSize size = NSMakeSize(44, 25);
[self assert:NSEqualSizes([o giveBackNSSize:size], size)];
[self assert:[o giveBackNSSizePtr:&size] == &size];
[self assert:NSEqualSizes([o dereferenceNSSizePtr:&size], NSMakeSize(44, 25))];
CGSize cgsize = CGSizeMake(44, 25);
[self assert:CGSizeEqualToSize([o giveBackCGSize:cgsize], cgsize)];
[self assert:[o giveBackCGSizePtr:&cgsize] == &cgsize];
[self assert:CGSizeEqualToSize([o dereferenceCGSizePtr:&cgsize], CGSizeMake(44, 25))];
CGAffineTransform cgat = CGAffineTransformMake(10, 55, 20, 56, 2, 3);
[self assert:CGAffineTransformEqualToTransform([o giveBackCGAffineTransform:cgat], cgat)];
[self assert:[o giveBackCGAffineTransformPtr:&cgat] == &cgat];
[self assert:CGAffineTransformEqualToTransform([o dereferenceCGAffineTransformPtr:&cgat], CGAffineTransformMake(10, 55, 20, 56, 2, 3))];
float fl = 3.1415926;
[self assert:[o giveBackVoidPtr:&fl] == &fl];
float fl2 = [o dereferenceVoidPtrAsFloat:&fl];
[self assert:fl2 > 3.1415925 && fl2 < 3.1415927];
unsigned long long ull3 = 3123456789;
unsigned long long *ull3Ptr = &ull3;
[self assert:[o giveBackUnsignedLongLongPtrPtr:&ull3Ptr] == &ull3Ptr];
[self assert:[o dereferenceUnsignedLongLongPtr:[o dereferenceUnsignedLongLongPtrPtr:&ull3Ptr]] == ull3];
NSString *str = @"hello";
[self assert:[o giveBackNSString:str] == str];
[self assert:[o giveBackFSTestClass10:o] == o];
NSArray *objects = [o giveBackArrayWithId:self Class:cl SEL:@selector(between:and:) BOOL:NO _Bool:1 char:c1 unsignedChar:uc short:s1 unsignedShort:us2
int:i1 unsignedInt:ui long:l2 unsignedLong:ul longLong:ll1 unsignedLongLong:ull NSInteger:nsi1 NSUInteger:nsui float:123 double:456
CGFloat:789 NSRange:range NSPoint:point CGPoint:cgpoint NSRect:rect CGRect:cgrect NSSize:size CGSize:cgsize CGAffineTransform:cgat NSString:str];
NSAffineTransform *nsatControl = [NSAffineTransform transform];
[nsatControl setTransformStruct:(NSAffineTransformStruct){10, 55, 20, 56, 2, 3}];
NSArray *control = [NSArray arrayWithObjects:self, cl, [@"#between:and:" asBlock], [FSBoolean fsFalse], [FSBoolean fsTrue], [FSBoolean booleanWithBool:c1],
[NSNumber numberWithUnsignedChar:uc], [NSNumber numberWithShort:s1], [NSNumber numberWithUnsignedShort:us2], [NSNumber numberWithInt:i1],
[NSNumber numberWithUnsignedInt:ui], [NSNumber numberWithLong:l2], [NSNumber numberWithUnsignedLong:ul], [NSNumber numberWithLongLong:ll1],
[NSNumber numberWithUnsignedLongLong:ull], [NSNumber numberWithInteger:nsi1], [NSNumber numberWithUnsignedInteger:nsui],
[NSNumber numberWithFloat:123], [NSNumber numberWithDouble:456], [NSNumber numberWithDouble:789], [NSValue valueWithRange:range],
[NSValue valueWithPoint:point], [NSValue valueWithPoint:NSPointFromCGPoint(cgpoint)], [NSValue valueWithRect:rect],
[NSValue valueWithRect:NSRectFromCGRect(cgrect)], [NSValue valueWithSize:size], [NSValue valueWithSize:NSSizeFromCGSize(cgsize)], nsatControl, str, nil];
//NSLog(@"%@", [objects operator_equal:control]);
[self assert:[objects isEqualToArray:control]];
}
@end