ObjFW  Diff

Differences From Artifact [3e2e21ca4d]:

To Artifact [86c5f0ef13]:


13
14
15
16
17
18
19




20
21
22
23
24
25
26
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <string.h>





#import "OFInvocation.h"
#import "OFMethodSignature.h"
#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"








>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <string.h>

#ifndef __STDC_NO_COMPLEX__
# include <complex.h>
#endif

#import "OFInvocation.h"
#import "OFMethodSignature.h"
#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"

98
99
100
101
102
103
104
105








































106
107
108
109
110
111
112
113
114
115
				    : (long double)d14
				    : (long double)d15
				    : (long double)d16
{
	return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 +
	    d12 + d13 + d14 + d15 + d16) / 16;
}









































#ifdef __SIZEOF_INT128__
__extension__
- (__int128)invocationTestMethod5: (int)i1
				 : (__int128)i2
				 : (__int128)i3
				 : (__int128)i4
				 : (int)i5
				 : (__int128)i6
				 : (__int128)i7
				 : (__int128)i8








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


|







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
				    : (long double)d14
				    : (long double)d15
				    : (long double)d16
{
	return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 +
	    d12 + d13 + d14 + d15 + d16) / 16;
}

#ifndef __STDC_NO_COMPLEX__
- (complex double)invocationTestMethod5: (complex float)c1
				       : (complex double)c2
				       : (complex float)c3
				       : (complex double)c4
				       : (complex float)c5
				       : (complex double)c6
				       : (complex float)c7
				       : (complex double)c8
				       : (complex float)c9
				       : (complex double)c10
				       : (complex float)c11
				       : (complex double)c12
				       : (complex float)c13
				       : (complex double)c14
				       : (complex float)c15
				       : (complex double)c16
{
	OF_ENSURE(creal(c1) == 1.0 && cimag(c1) == 0.5);
	OF_ENSURE(creal(c2) == 2.0 && cimag(c2) == 1.0);
	OF_ENSURE(creal(c3) == 3.0 && cimag(c3) == 1.5);
	OF_ENSURE(creal(c4) == 4.0 && cimag(c4) == 2.0);
	OF_ENSURE(creal(c5) == 5.0 && cimag(c5) == 2.5);
	OF_ENSURE(creal(c6) == 6.0 && cimag(c6) == 3.0);
	OF_ENSURE(creal(c7) == 7.0 && cimag(c7) == 3.5);
	OF_ENSURE(creal(c8) == 8.0 && cimag(c8) == 4.0);
	OF_ENSURE(creal(c9) == 9.0 && cimag(c9) == 4.5);
	OF_ENSURE(creal(c10) == 10.0 && cimag(c10) == 5.0);
	OF_ENSURE(creal(c11) == 11.0 && cimag(c11) == 5.5);
	OF_ENSURE(creal(c12) == 12.0 && cimag(c12) == 6.0);
	OF_ENSURE(creal(c13) == 13.0 && cimag(c13) == 6.5);
	OF_ENSURE(creal(c14) == 14.0 && cimag(c14) == 7.0);
	OF_ENSURE(creal(c15) == 15.0 && cimag(c15) == 7.5);
	OF_ENSURE(creal(c16) == 16.0 && cimag(c16) == 8.0);

	return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 +
	    c12 + c13 + c14 + c15 + c16) / 16;
}
#endif

#ifdef __SIZEOF_INT128__
__extension__
- (__int128)invocationTestMethod6: (int)i1
				 : (__int128)i2
				 : (__int128)i3
				 : (__int128)i4
				 : (int)i5
				 : (__int128)i6
				 : (__int128)i7
				 : (__int128)i8
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

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

# ifdef __SIZEOF_INT128__
	/* -[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++) {
		__extension__ __int128 i128 = 0xFFFFFFFFFFFFFFFF;
		i128 <<= 64;
		i128 |= i;

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

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

	[pool drain];
}
@end







|





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



















|









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

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

# ifndef __STDC_NO_COMPLEX__
	/* -[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++) {
		complex float cf = i + 0.5 * i * I;
		complex double cd = i + 0.5 * i * I;

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

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

# ifdef __SIZEOF_INT128__
	/* -[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++) {
		__extension__ __int128 i128 = 0xFFFFFFFFFFFFFFFF;
		i128 <<= 64;
		i128 |= i;

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

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

	[pool drain];
}
@end