ObjFW  Diff

Differences From Artifact [1bbbdf67b6]:

To Artifact [5d557debb9]:


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







-
-
-
+
+
+















-
-
+
+

-
+

















-
-
-
+
+
+

-
+

-
+


-
+


















-
-
+
+

-
+



















-
-
-
+
+
+

-
+

-
+


-
+




















-
-
-
-
+
+
+
+

-
+


-
+



-
+



-
+







	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++)
		[invocation setArgument: &i
				atIndex: i + 1];
	for (int j = 1; j <= 16; j++)
		[invocation setArgument: &j
				atIndex: j + 1];

	int intResult;
	TEST(@"-[invoke] #1", R([invocation invoke]) &&
	    R([invocation getReturnValue: &intResult]) && intResult == 8)

	/* -[invoke] #2 */
	selector = @selector(invocationTestMethod3::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
		double d = i;
	for (int j = 1; j <= 16; j++) {
		double d = j;
		[invocation setArgument: &d
				atIndex: i + 1];
				atIndex: j + 1];
	}

	double doubleResult;
	TEST(@"-[invoke] #2", R([invocation invoke]) &&
	    R([invocation getReturnValue: &doubleResult]) &&
	    doubleResult == 8.5)

	/* -[invoke] #3 */
	selector = @selector(invocationTestMethod4::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
		float f = i;
		double d = i;
	for (int j = 1; j <= 16; j++) {
		float f = j;
		double d = j;

		if (i == 1 || i == 10)
		if (j == 1 || j == 10)
			[invocation setArgument: &d
					atIndex: i + 1];
					atIndex: j + 1];
		else
			[invocation setArgument: &f
					atIndex: i + 1];
					atIndex: j + 1];
	}

	float floatResult;
	TEST(@"-[invoke] #3", R([invocation invoke]) &&
	    R([invocation getReturnValue: &floatResult]) && floatResult == 8.5)

	/* Only when encoding long doubles is supported */
	if (strcmp(@encode(double), @encode(long double)) != 0) {
		/* -[invoke] #4 */
		selector = @selector(invocationTestMethod5::::::::::::::::);
		invocation = [OFInvocation invocationWithMethodSignature:
		    [self methodSignatureForSelector: selector]];

		[invocation setArgument: &self
				atIndex: 0];
		[invocation setArgument: &selector
				atIndex: 1];

		for (int i = 1; i <= 16; i++) {
			long double d = i;
		for (int j = 1; j <= 16; j++) {
			long double d = j;
			[invocation setArgument: &d
					atIndex: i + 1];
					atIndex: j + 1];
		}

		long double longDoubleResult;
		TEST(@"-[invoke] #4", R([invocation invoke]) &&
		    R([invocation getReturnValue: &longDoubleResult]) &&
		    longDoubleResult == 8.5)
	}

# ifndef __STDC_NO_COMPLEX__
	/* -[invoke] #5 */
	selector = @selector(invocationTestMethod6::::::::::::::::);
	invocation = [OFInvocation invocationWithMethodSignature:
	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
		complex float cf = i + 0.5 * i * I;
		complex double cd = i + 0.5 * i * I;
	for (int j = 1; j <= 16; j++) {
		complex float cf = j + 0.5 * j * I;
		complex double cd = j + 0.5 * j * I;

		if (i & 1)
		if (j & 1)
			[invocation setArgument: &cf
					atIndex: i + 1];
					atIndex: j + 1];
		else
			[invocation setArgument: &cd
					atIndex: i + 1];
					atIndex: j + 1];
	}

	complex double complexDoubleResult;
	TEST(@"-[invoke] #5", R([invocation invoke]) &&
	    R([invocation getReturnValue: &complexDoubleResult]) &&
	    complexDoubleResult == 8.5 + 4.25 * I)

	/* Only when encoding complex long doubles is supported */
	if (strcmp(@encode(complex double),
	    @encode(complex long double)) != 0) {
		/* -[invoke] #6 */
		selector = @selector(invocationTestMethod7::::::::::::::::);
		invocation = [OFInvocation invocationWithMethodSignature:
		    [self methodSignatureForSelector: selector]];

		[invocation setArgument: &self
				atIndex: 0];
		[invocation setArgument: &selector
				atIndex: 1];

		for (int i = 1; i <= 16; i++) {
			complex double cd = i + 0.5 * i * I;
			complex float cf = i + 0.5 * i * I;
			complex long double cld = i + 0.5 * i * I;
		for (int j = 1; j <= 16; j++) {
			complex double cd = j + 0.5 * j * I;
			complex float cf = j + 0.5 * j * I;
			complex long double cld = j + 0.5 * j * I;

			switch (i % 3) {
			switch (j % 3) {
			case 0:
				[invocation setArgument: &cld
						atIndex: i + 1];
						atIndex: j + 1];
				break;
			case 1:
				[invocation setArgument: &cd
						atIndex: i + 1];
						atIndex: j + 1];
				break;
			case 2:
				[invocation setArgument: &cf
						atIndex: i + 1];
						atIndex: j + 1];
				break;
			}
		}

		complex long double complexLongDoubleResult;
		TEST(@"-[invoke] #6", R([invocation invoke]) &&
		    R([invocation getReturnValue: &complexLongDoubleResult]) &&
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
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







-
+


-
+

-
-
-
+
+
+


-
+













	    [self methodSignatureForSelector: selector]];

	[invocation setArgument: &self
			atIndex: 0];
	[invocation setArgument: &selector
			atIndex: 1];

	for (int i = 1; i <= 16; i++) {
	for (int j = 1; j <= 16; j++) {
		__extension__ __int128 i128 = 0xFFFFFFFFFFFFFFFF;
		i128 <<= 64;
		i128 |= i;
		i128 |= j;

		if (i == 1 || i == 5)
			[invocation setArgument: &i
					atIndex: i + 1];
		if (j == 1 || j == 5)
			[invocation setArgument: &j
					atIndex: j + 1];
		else
			[invocation setArgument: &i128
					atIndex: i + 1];
					atIndex: j + 1];
	}

	__extension__ __int128 int128Result;
	TEST(@"-[invoke] #7", R([invocation invoke]) &&
	    R([invocation getReturnValue: &int128Result]) &&
	    int128Result == __extension__ ((__int128)0xFFFFFFFFFFFFFFFF << 64) +
	    8)
# endif
#endif

	[pool drain];
}
@end