-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathffi.scm.ok
546 lines (528 loc) · 29.2 KB
/
ffi.scm.ok
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
Notes:
* no tests with type 'long' because 'long' is either 'int' or 'long long', depends on then OS
and is completely covered by other tests ('int' and 'long long').
* type legend: 'c' for char, 's' for short, 'i' for int, 'q' for long long,
capital chars for unsigned prefix; 'f' for float, 'd' for double.
yes, all longs are all ints or all longlongs. it's tested right now!
basic numeric limits checking:
good char (-128)> [-128 => -128] = -128
good char (127)> [127 => 127] = 127
unsinged char (127)> [127 => 127] = 127
unsinged char (255)> [255 => 255] = 255
short (-32768)> [-32768 => -32768] = -32768
short (32767)> [32767 => 32767] = 32767
unsinged short (32767)> [32767 => 32767] = 32767
unsinged short (65535)> [65535 => 65535] = 65535
int (-2147483648)> [-2147483648 => -2147483648] = -2147483648
int (2147483647)> [2147483647 => 2147483647] = 2147483647
unsinged int (2147483647)> [2147483647 => 2147483647] = 2147483647
unsinged int (4294967295)> [4294967295 => 4294967295] = 4294967295
long long (-9223372036854775808)> [-9223372036854775808 => -9223372036854775808] = -9223372036854775808
long long (9223372036854775807)> [9223372036854775807 => 9223372036854775807] = 9223372036854775807
unsinged long long (9223372036854775807)> [9223372036854775807 => 9223372036854775807] = 9223372036854775807
unsinged long long (18446744073709551615)> [18446744073709551615 => 18446744073709551615] = 18446744073709551615
// simple type to type tests:
type function(type arg)
{
return arg;
}
c2c (1)> [1 => 1] = 1
c2c (125)> [125 => 125] = 125
c2c (0)> [0 => 0] = 0
s2s (1)> [1 => 1] = 1
s2s (125)> [125 => 125] = 125
s2s (0)> [0 => 0] = 0
i2i (1)> [1 => 1] = 1
i2i (125)> [125 => 125] = 125
i2i (0)> [0 => 0] = 0
q2q (1)> [1 => 1] = 1
q2q (125)> [125 => 125] = 125
q2q (0)> [0 => 0] = 0
C2C (1)> [1 => 1] = 1
C2C (125)> [125 => 125] = 125
C2C (0)> [0 => 0] = 0
C2C (-125)> [-125 => -125] = -125
C2C (-1)> [-1 => -1] = -1
S2S (1)> [1 => 1] = 1
S2S (125)> [125 => 125] = 125
S2S (0)> [0 => 0] = 0
S2S (-125)> [-125 => -125] = -125
S2S (-1)> [-1 => -1] = -1
I2I (1)> [1 => 1] = 1
I2I (125)> [125 => 125] = 125
I2I (0)> [0 => 0] = 0
I2I (-125)> [-125 => -125] = -125
I2I (-1)> [-1 => -1] = -1
Q2Q (1)> [1 => 1] = 1
Q2Q (125)> [125 => 125] = 125
Q2Q (0)> [0 => 0] = 0
Q2Q (-125)> [-125 => -125] = -125
Q2Q (-1)> [-1 => -1] = -1
f2f (0)> [0.000000 => 0.000000] = 0.0
f2f (0.0)> [0.000000 => 0.000000] = 0.0
f2f (1001/8)> [125.125000 => 125.125000] = 125.125
f2f (125.125)> [125.125000 => 125.125000] = 125.125
f2f (-1001/8)> [-125.125000 => -125.125000] = -125.125
f2f (-125.125)> [-125.125000 => -125.125000] = -125.125
d2d (0)> [0.000000 => 0.000000] = 0.0
d2d (0.0)> [0.000000 => 0.000000] = 0.0
d2d (1001/8)> [125.125000 => 125.125000] = 125.125
d2d (125.125)> [125.125000 => 125.125000] = 125.125
d2d (-1001/8)> [-125.125000 => -125.125000] = -125.125
d2d (-125.125)> [-125.125000 => -125.125000] = -125.125
type function(type* arg)
{
return *arg;
}
pc2c ((1))> [1 => 1] = 1, ((1))
pc2c (#(1))> [1 => 1] = 1, (#(1))
pc2c ((125))> [125 => 125] = 125, ((125))
pc2c (#(125))> [125 => 125] = 125, (#(125))
pc2c ((0))> [0 => 0] = 0, ((0))
pc2c (#(0))> [0 => 0] = 0, (#(0))
ps2s ((1))> [1 => 1] = 1, ((1))
ps2s (#(1))> [1 => 1] = 1, (#(1))
ps2s ((125))> [125 => 125] = 125, ((125))
ps2s (#(125))> [125 => 125] = 125, (#(125))
ps2s ((0))> [0 => 0] = 0, ((0))
ps2s (#(0))> [0 => 0] = 0, (#(0))
pi2i ((1))> [1 => 1] = 1, ((1))
pi2i (#(1))> [1 => 1] = 1, (#(1))
pi2i ((125))> [125 => 125] = 125, ((125))
pi2i (#(125))> [125 => 125] = 125, (#(125))
pi2i ((0))> [0 => 0] = 0, ((0))
pi2i (#(0))> [0 => 0] = 0, (#(0))
pq2q ((1))> [1 => 1] = 1, ((1))
pq2q (#(1))> [1 => 1] = 1, (#(1))
pq2q ((125))> [125 => 125] = 125, ((125))
pq2q (#(125))> [125 => 125] = 125, (#(125))
pq2q ((0))> [0 => 0] = 0, ((0))
pq2q (#(0))> [0 => 0] = 0, (#(0))
pC2C ((1))> [1 => 1] = 1, ((1))
pC2C (#(1))> [1 => 1] = 1, (#(1))
pC2C ((125))> [125 => 125] = 125, ((125))
pC2C (#(125))> [125 => 125] = 125, (#(125))
pC2C ((0))> [0 => 0] = 0, ((0))
pC2C (#(0))> [0 => 0] = 0, (#(0))
pC2C ((-125))> [-125 => -125] = -125, ((-125))
pC2C (#(-125))> [-125 => -125] = -125, (#(-125))
pC2C ((-1))> [-1 => -1] = -1, ((-1))
pC2C (#(-1))> [-1 => -1] = -1, (#(-1))
pS2S ((1))> [1 => 1] = 1, ((1))
pS2S (#(1))> [1 => 1] = 1, (#(1))
pS2S ((125))> [125 => 125] = 125, ((125))
pS2S (#(125))> [125 => 125] = 125, (#(125))
pS2S ((0))> [0 => 0] = 0, ((0))
pS2S (#(0))> [0 => 0] = 0, (#(0))
pS2S ((-125))> [-125 => -125] = -125, ((-125))
pS2S (#(-125))> [-125 => -125] = -125, (#(-125))
pS2S ((-1))> [-1 => -1] = -1, ((-1))
pS2S (#(-1))> [-1 => -1] = -1, (#(-1))
pI2I ((1))> [1 => 1] = 1, ((1))
pI2I (#(1))> [1 => 1] = 1, (#(1))
pI2I ((125))> [125 => 125] = 125, ((125))
pI2I (#(125))> [125 => 125] = 125, (#(125))
pI2I ((0))> [0 => 0] = 0, ((0))
pI2I (#(0))> [0 => 0] = 0, (#(0))
pI2I ((-125))> [-125 => -125] = -125, ((-125))
pI2I (#(-125))> [-125 => -125] = -125, (#(-125))
pI2I ((-1))> [-1 => -1] = -1, ((-1))
pI2I (#(-1))> [-1 => -1] = -1, (#(-1))
pQ2Q ((1))> [1 => 1] = 1, ((1))
pQ2Q (#(1))> [1 => 1] = 1, (#(1))
pQ2Q ((125))> [125 => 125] = 125, ((125))
pQ2Q (#(125))> [125 => 125] = 125, (#(125))
pQ2Q ((0))> [0 => 0] = 0, ((0))
pQ2Q (#(0))> [0 => 0] = 0, (#(0))
pQ2Q ((-125))> [-125 => -125] = -125, ((-125))
pQ2Q (#(-125))> [-125 => -125] = -125, (#(-125))
pQ2Q ((-1))> [-1 => -1] = -1, ((-1))
pQ2Q (#(-1))> [-1 => -1] = -1, (#(-1))
pf2f ((0))> [0.000000 => 0.000000] = 0.0, ((0))
pf2f ((0.0))> [0.000000 => 0.000000] = 0.0, ((0.0))
pf2f ((1001/8))> [125.125000 => 125.125000] = 125.125, ((1001/8))
pf2f ((125.125))> [125.125000 => 125.125000] = 125.125, ((125.125))
pf2f ((-1001/8))> [-125.125000 => -125.125000] = -125.125, ((-1001/8))
pf2f ((-125.125))> [-125.125000 => -125.125000] = -125.125, ((-125.125))
pd2d ((0))> [0.000000 => 0.000000] = 0.0, ((0))
pd2d ((0.0))> [0.000000 => 0.000000] = 0.0, ((0.0))
pd2d ((1001/8))> [125.125000 => 125.125000] = 125.125, ((1001/8))
pd2d ((125.125))> [125.125000 => 125.125000] = 125.125, ((125.125))
pd2d ((-1001/8))> [-125.125000 => -125.125000] = -125.125, ((-1001/8))
pd2d ((-125.125))> [-125.125000 => -125.125000] = -125.125, ((-125.125))
type function(type* arg)
{
*arg -= 1;
return *arg + 2;
}
rc2c ((1))> [1 => 0] = 2, ((0))
rc2c (#(1))> [1 => 0] = 2, (#(0))
rc2c ((125))> [125 => 124] = 126, ((124))
rc2c (#(125))> [125 => 124] = 126, (#(124))
rs2s ((1))> [1 => 0] = 2, ((0))
rs2s (#(1))> [1 => 0] = 2, (#(0))
rs2s ((125))> [125 => 124] = 126, ((124))
rs2s (#(125))> [125 => 124] = 126, (#(124))
ri2i ((1))> [1 => 0] = 2, ((0))
ri2i (#(1))> [1 => 0] = 2, (#(0))
ri2i ((125))> [125 => 124] = 126, ((124))
ri2i (#(125))> [125 => 124] = 126, (#(124))
rq2q ((1))> [1 => 0] = 2, ((0))
rq2q (#(1))> [1 => 0] = 2, (#(0))
rq2q ((125))> [125 => 124] = 126, ((124))
rq2q (#(125))> [125 => 124] = 126, (#(124))
rC2C ((1))> [1 => 0] = 2, ((0))
rC2C (#(1))> [1 => 0] = 2, (#(0))
rC2C ((125))> [125 => 124] = 126, ((124))
rC2C (#(125))> [125 => 124] = 126, (#(124))
rC2C ((0))> [0 => -1] = 1, ((-1))
rC2C (#(0))> [0 => -1] = 1, (#(-1))
rC2C ((-125))> [-125 => -126] = -124, ((-126))
rC2C (#(-125))> [-125 => -126] = -124, (#(-126))
rC2C ((-1))> [-1 => -2] = 0, ((-2))
rC2C (#(-1))> [-1 => -2] = 0, (#(-2))
rS2S ((1))> [1 => 0] = 2, ((0))
rS2S (#(1))> [1 => 0] = 2, (#(0))
rS2S ((125))> [125 => 124] = 126, ((124))
rS2S (#(125))> [125 => 124] = 126, (#(124))
rS2S ((0))> [0 => -1] = 1, ((-1))
rS2S (#(0))> [0 => -1] = 1, (#(-1))
rS2S ((-125))> [-125 => -126] = -124, ((-126))
rS2S (#(-125))> [-125 => -126] = -124, (#(-126))
rS2S ((-1))> [-1 => -2] = 0, ((-2))
rS2S (#(-1))> [-1 => -2] = 0, (#(-2))
rI2I ((1))> [1 => 0] = 2, ((0))
rI2I (#(1))> [1 => 0] = 2, (#(0))
rI2I ((125))> [125 => 124] = 126, ((124))
rI2I (#(125))> [125 => 124] = 126, (#(124))
rI2I ((0))> [0 => -1] = 1, ((-1))
rI2I (#(0))> [0 => -1] = 1, (#(-1))
rI2I ((-125))> [-125 => -126] = -124, ((-126))
rI2I (#(-125))> [-125 => -126] = -124, (#(-126))
rI2I ((-1))> [-1 => -2] = 0, ((-2))
rI2I (#(-1))> [-1 => -2] = 0, (#(-2))
rQ2Q ((1))> [1 => 0] = 2, ((0))
rQ2Q (#(1))> [1 => 0] = 2, (#(0))
rQ2Q ((125))> [125 => 124] = 126, ((124))
rQ2Q (#(125))> [125 => 124] = 126, (#(124))
rQ2Q ((0))> [0 => -1] = 1, ((-1))
rQ2Q (#(0))> [0 => -1] = 1, (#(-1))
rQ2Q ((-125))> [-125 => -126] = -124, ((-126))
rQ2Q (#(-125))> [-125 => -126] = -124, (#(-126))
rQ2Q ((-1))> [-1 => -2] = 0, ((-2))
rQ2Q (#(-1))> [-1 => -2] = 0, (#(-2))
rf2f ((0))> [0.000000 => -1.000000] = 1.0, ((-1))
rf2f ((0.0))> [0.000000 => -1.000000] = 1.0, ((-1.0))
rf2f ((125.125))> [125.125000 => 124.125000] = 126.125, ((124.125))
rf2f ((-125.125))> [-125.125000 => -126.125000] = -124.125, ((-126.125))
rd2d ((0))> [0.000000 => -1.000000] = 1.0, ((-1))
rd2d ((0.0))> [0.000000 => -1.000000] = 1.0, ((-1.0))
rd2d ((125.125))> [125.125000 => 124.125000] = 126.125, ((124.125))
rd2d ((-125.125))> [-125.125000 => -126.125000] = -124.125, ((-126.125))
// 16 arguments test:
type function(type a0, type a1, type a2, type a3,
type a4, type a5, type a6, type a7,
type a8, type a9, type aA, type aB,
type aC, type aD, type aE, type aF)
{
return a0+a1+a2+a3+a4+a5+a6+a7+a8+a9+aA+aB+aC+aD+aE+aF;
}
cccccccccccccccc2c (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
cccccccccccccccc2c (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
ssssssssssssssss2s (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
ssssssssssssssss2s (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
iiiiiiiiiiiiiiii2i (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
iiiiiiiiiiiiiiii2i (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
qqqqqqqqqqqqqqqq2q (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
qqqqqqqqqqqqqqqq2q (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
CCCCCCCCCCCCCCCC2C (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
CCCCCCCCCCCCCCCC2C (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
CCCCCCCCCCCCCCCC2C (0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15)> [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15 => -120] = -120
CCCCCCCCCCCCCCCC2C (-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0)> [-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0 => -120] = -120
SSSSSSSSSSSSSSSS2S (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
SSSSSSSSSSSSSSSS2S (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
SSSSSSSSSSSSSSSS2S (0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15)> [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15 => -120] = -120
SSSSSSSSSSSSSSSS2S (-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0)> [-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0 => -120] = -120
IIIIIIIIIIIIIIII2I (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
IIIIIIIIIIIIIIII2I (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
IIIIIIIIIIIIIIII2I (0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15)> [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15 => -120] = -120
IIIIIIIIIIIIIIII2I (-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0)> [-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0 => -120] = -120
QQQQQQQQQQQQQQQQ2Q (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 => 120] = 120
QQQQQQQQQQQQQQQQ2Q (15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)> [15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 => 120] = 120
QQQQQQQQQQQQQQQQ2Q (0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15)> [0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15 => -120] = -120
QQQQQQQQQQQQQQQQ2Q (-15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0)> [-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0 => -120] = -120
// extended test for all floats (rational and inexacts):
16 rationals (0 11/10 11/5 33/10 22/5 11/2 33/5 77/10 44/5 99/10 101/10 1111/100 303/25 1313/100 707/50 303/20)> [0.000000, 1.100000, 2.200000, 3.300000, 4.400000, 5.500000, 6.600000, 7.700000, 8.800000, 9.900000, 10.100000, 11.110000, 12.120000, 13.130000, 14.140000, 15.150000 => 125.250000] = 125.25
16 rationals (303/20 707/50 1313/100 303/25 1111/100 101/10 99/10 44/5 77/10 33/5 11/2 22/5 33/10 11/5 11/10 0)> [15.150000, 14.140000, 13.130000, 12.120000, 11.110000, 10.100000, 9.900000, 8.800000, 7.700000, 6.600000, 5.500000, 4.400000, 3.300000, 2.200000, 1.100000, 0.000000 => 125.250000] = 125.25
16 inexacts (0.0 1.1 2.2 3.29999999 4.4 5.5 6.59999999 7.7 8.8 9.9 10.09999999 11.1099999 12.1199999 13.13 14.14 15.15)> [0.000000, 1.100000, 2.200000, 3.300000, 4.400000, 5.500000, 6.600000, 7.700000, 8.800000, 9.900000, 10.100000, 11.110000, 12.120000, 13.130000, 14.140000, 15.150000 => 125.250000] = 125.25
16 mixed floats (15.15 707/50 13.13 303/25 11.1099999 101/10 9.9 44/5 7.7 33/5 5.5 22/5 3.29999999 11/5 1.1 0)> [15.150000, 14.140000, 13.130000, 12.120000, 11.110000, 10.100000, 9.900000, 8.800000, 7.700000, 6.600000, 5.500000, 4.400000, 3.300000, 2.200000, 1.100000, 0.000000 => 125.250000] = 125.25
16 rationals (0 -11/10 -11/5 -33/10 -22/5 -11/2 -33/5 -77/10 -44/5 -99/10 -101/10 -1111/100 -303/25 -1313/100 -707/50 -303/20)> [0.000000, -1.100000, -2.200000, -3.300000, -4.400000, -5.500000, -6.600000, -7.700000, -8.800000, -9.900000, -10.100000, -11.110000, -12.120000, -13.130000, -14.140000, -15.150000 => -125.250000] = -125.25
16 inexacts (0.0 -1.1 -2.2 -3.29999999 -4.4 -5.5 -6.59999999 -7.7 -8.8 -9.9 -10.09999999 -11.1099999 -12.1199999 -13.13 -14.14 -15.15)> [0.000000, -1.100000, -2.200000, -3.300000, -4.400000, -5.500000, -6.600000, -7.700000, -8.800000, -9.900000, -10.100000, -11.110000, -12.120000, -13.130000, -14.140000, -15.150000 => -125.250000] = -125.25
// 8 mixed integers, 1 float, 1 double:
double cCsSiIqQfd2d(char c, ..., double d)
{
return d+ ... +c;
}
10 mixed arguments (1 2 3 4 5 6 7 8 9 10)> [1, 2, 3, 4, 5, 6, 7, 8, 9.000000, 10.000000 => 55.000000] = 55.0
10 mixed arguments (1 -2 3 -4 5 -6 7 -8 9 -10)> [1, -2, 3, -4, 5, -6, 7, -8, 9.000000, -10.000000 => -5.000000] = -5.0
20 mixed type variables test:
double cCfdsSfdiIfddfqQfddf2d(char c, ..., float f)
{
return f+ ... +c;
}
20 integer arguments (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20)> [1, 2, 3.000000, 4.000000, 5, 6, 7.000000, 8.000000, 9, 10, 11.000000, 12.000000, 13.000000, 14.000000, 15, 16, 17.000000, 18.000000, 19.000000, 20.000000 => 210.000000] = 210.0
20 mixed exact arguments (1 2 3 9/2 5 6 29/4 35/4 9 10 89/8 103/8 223/16 235/16 15 16 567/32 607/32 19 20)> [1, 2, 3.000000, 4.500000, 5, 6, 7.250000, 8.750000, 9, 10, 11.125000, 12.875000, 13.937500, 14.687500, 15, 16, 17.718750, 18.968750, 19.000000, 20.000000 => 215.812500] = 215.8125
20 mixed inexact arguments (1.0 2.0 3.0 4.5 5.0 6.0 7.25 8.75 9.0 10.0 11.125 12.875 13.9375 14.6875 15.0 16.0 17.71875 18.96875 19.0 20.0)> [1, 2, 3.000000, 4.500000, 5, 6, 7.250000, 8.750000, 9, 10, 11.125000, 12.875000, 13.937500, 14.687500, 15, 16, 17.718750, 18.968750, 19.000000, 20.000000 => 215.812500] = 215.8125
// too much arguments (4 needed, more provided):
long long function(char c, short s, int i, long long q)
{
return c+s+i+q;
}
16 arguments (1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8)> [1, 2, 3, 4 => 10] = 10
99 arguments (1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 7 7 7)> [1, 2, 3, 4 => 10] = 10
// variable arguments test (returns count of printed arguments):
int format(const char *format, ...)
{
printf(format, ...);
}
numbers ("%i %f %i %f" (fft-int . 42) (fft-double . 2167/50) (fft-int . 44) (fft-double . 2277/50))> ['%i %f %i %f' = {42 43.340000 44 45.540000} -> 4] = 4
utf-8 strings/symbols ("<%s/%s/%s/%s>" "ansi" "юнікод" 'σύμβολο "ユニコード")> ['<%s/%s/%s/%s>' = {<ansi/юнікод/σύμβολο/ユニコード>} -> 4] = 4
empty strings/symbols ("<%s/%s/%s>" "" "" '||)> ['<%s/%s/%s>' = {<//>} -> 3] = 3
// reverse strings:
reverse_string(hello): olleh - ok.
reverse_string_wide(hello): olleh - ok.
reverse_string(привіт): тівирп - ok.
reverse_string_wide(привіт): тівирп - ok.
reverse_string(Совы (Strigiformes) суть релатівно чісленым рядом класы птахів обсягуюча веце як 200 видів.): .відив 002 кя ецев ачюугясбо віхатп ысалк модяр мынелсіч онвіталер ьтус )semrofigirtS( ывоС - ok.
reverse_string_wide(Совы (Strigiformes) суть релатівно чісленым рядом класы птахів обсягуюча веце як 200 видів.): .відив 002 кя ецев ачюугясбо віхатп ысалк модяр мынелсіч онвіталер ьтус )semrofigirtS( ывоС - ok.
reverse_string(ბუსნაირნი (ლათ. Strigiformes) — ფრინველთა რიგი. ფართოდაა გავრცელებული მსოფლიოში (ანტარქტიკული და ზოგიერთი ოკეანური კუნძულის გამოკლებით).): .)თიბელკომაგ სილუძნუკ ირუნაეკო ითრეიგოზ ად ილუკიტქრატნა( იშოილფოსმ ილუბელეცრვაგ აადოთრაფ .იგირ ათლევნირფ — )semrofigirtS .თალ( ინრიანსუბ - ok.
reverse_string_wide(ბუსნაირნი (ლათ. Strigiformes) — ფრინველთა რიგი. ფართოდაა გავრცელებული მსოფლიოში (ანტარქტიკული და ზოგიერთი ოკეანური კუნძულის გამოკლებით).): .)თიბელკომაგ სილუძნუკ ირუნაეკო ითრეიგოზ ად ილუკიტქრატნა( იშოილფოსმ ილუბელეცრვაგ აადოთრაფ .იგირ ათლევნირფ — )semrofigirtS .თალ( ინრიანსუბ - ok.
reverse_string(フクロウ目(フクロウもく、梟目、学名 Strigiformes)は鳥類の1目である。): 。るあで目1の類鳥は)semrofigirtS 名学、目梟、くもウロクフ(目ウロクフ - ok.
reverse_string_wide(フクロウ目(フクロウもく、梟目、学名 Strigiformes)は鳥類の1目である。): 。るあで目1の類鳥は)semrofigirtS 名学、目梟、くもウロクフ(目ウロクフ - ok.
// structure by reference:
struct args_t
{
int argc;
struct {
char** argv;
} x;
char c;
};
debug_args(args) = {
argc = 3
x = {
argv[0] = only
argv[1] = three
argv[2] = arguments
}
c = C
}
debug_args(args) = {
argc = 6
x = {
argv[0] = a
argv[1] = lot
argv[2] = of
argv[3] = аргументов
argv[4] = including
argv[5] = very-very-very-very-very-very-very-very-long-argument
}
c = C
}
// structure by reference with writeback:
struct csicisc_t
{
char c1;
short s1;
int i1;
struct {
char c2;
int i2;
short s2;
} substruct;
char c3;
};
> (65 2 3 (66 5 6 0) 67)
debug_csicisc(var) = {
c1 = A
s1 = 2
i1 = 3
{
c2 = B
i2 = 5
s2 = 6
}
c3 = C
}
and now we made +1 for all of these variables
(foreach var)++ = {
c1 = B
s1 = 3
i1 = 4
{
c2 = C
i2 = 6
s2 = 7
}
c3 = D
}
and now we made +1 for all of these variables< (66 3 4 (67 6 7 0) 68)
// (small) structure by value:
int function(struct { type x, type y } a)
{
return a.x + a.y;
}
_cc_2i ((1 2))> = { 1 2 } -> = 3
_cs_2i ((1 2))> = { 1 2 } -> = 3
_ci_2i ((1 2))> = { 1 2 } -> = 3
_cq_2i ((1 2))> = { 1 2 } -> = 3
_cf_2i ((1 2))> = { 1 2.000000 } -> = 3
_cd_2i ((1 2))> = { 1 2.000000 } -> = 3
_sc_2i ((1 2))> = { 1 2 } -> = 3
_ss_2i ((1 2))> = { 1 2 } -> = 3
_si_2i ((1 2))> = { 1 2 } -> = 3
_sq_2i ((1 2))> = { 1 2 } -> = 3
_sf_2i ((1 2))> = { 1 2.000000 } -> = 3
_sd_2i ((1 2))> = { 1 2.000000 } -> = 3
_ic_2i ((1 2))> = { 1 2 } -> = 3
_is_2i ((1 2))> = { 1 2 } -> = 3
_ii_2i ((1 2))> = { 1 2 } -> = 3
_iq_2i ((1 2))> = { 1 2 } -> = 3
_if_2i ((1 2))> = { 1 2.000000 } -> = 3
_id_2i ((1 2))> = { 1 2.000000 } -> = 3
_qc_2i ((1 2))> = { 1 2 } -> = 3
_qs_2i ((1 2))> = { 1 2 } -> = 3
_qi_2i ((1 2))> = { 1 2 } -> = 3
_qq_2i ((1 2))> = { 1 2 } -> = 3
_qf_2i ((1 2))> = { 1 2.000000 } -> = 3
_qd_2i ((1 2))> = { 1 2.000000 } -> = 3
_fc_2i ((1 2))> = { 1.000000 2 } -> = 3
_fs_2i ((1 2))> = { 1.000000 2 } -> = 3
_fi_2i ((1 2))> = { 1.000000 2 } -> = 3
_fq_2i ((1 2))> = { 1.000000 2 } -> = 3
_ff_2i ((1 2))> = { 1.000000 2.000000 } -> = 3
_fd_2i ((1 2))> = { 1.000000 2.000000 } -> = 3
_dc_2i ((1 2))> = { 1.000000 2 } -> = 3
_ds_2i ((1 2))> = { 1.000000 2 } -> = 3
_di_2i ((1 2))> = { 1.000000 2 } -> = 3
_dq_2i ((1 2))> = { 1.000000 2 } -> = 3
_df_2i ((1 2))> = { 1.000000 2.000000 } -> = 3
_dd_2i ((1 2))> = { 1.000000 2.000000 } -> = 3
// qualified '(type . ...) for fft-any to type test:
type function(type arg)
{
return arg;
}
c2c (1)> [1 => 1] = 1
s2s (1)> [1 => 1] = 1
i2i (1)> [1 => 1] = 1
q2q (1)> [1 => 1] = 1
C2C (1)> [1 => 1] = 1
C2C (-1)> [-1 => -1] = -1
S2S (1)> [1 => 1] = 1
S2S (-1)> [-1 => -1] = -1
I2I (1)> [1 => 1] = 1
I2I (-1)> [-1 => -1] = -1
Q2Q (1)> [1 => 1] = 1
Q2Q (-1)> [-1 => -1] = -1
float (125.125)> [125.125000 => 125.125000] = 125.125
float (-125.125)> [-125.125000 => -125.125000] = -125.125
double (125.125)> [125.125000 => 125.125000] = 125.125
double (-125.125)> [-125.125000 => -125.125000] = -125.125
// qualified '((fft* type) . ...) for fft-any to type test:
type function(type* arg)
{
return *arg;
}
pc2c ((1))> [1 => 1] = 1
ps2s ((1))> [1 => 1] = 1
pi2i ((1))> [1 => 1] = 1
pq2q ((1))> [1 => 1] = 1
pC2C ((1))> [1 => 1] = 1
pC2C ((-1))> [-1 => -1] = -1
pS2S ((1))> [1 => 1] = 1
pS2S ((-1))> [-1 => -1] = -1
pI2I ((1))> [1 => 1] = 1
pI2I ((-1))> [-1 => -1] = -1
pQ2Q ((1))> [1 => 1] = 1
pQ2Q ((-1))> [-1 => -1] = -1
rf2f ((125.125))> [125.125000 => 124.125000] = 126.125
rf2f ((-125.125))> [-125.125000 => -126.125000] = -124.125
rd2d ((125.125))> [125.125000 => 124.125000] = 126.125
rd2d ((-125.125))> [-125.125000 => -126.125000] = -124.125
// qualified '((fft& type) . ...) for fft-any to type test:
type function(type* arg)
{
type out = arg[2];
arg[2] = arg[0] + arg[1];
return out;
}
rpc2c3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpc2c3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpc2c3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rpc2c3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rpc2c3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rpc2c3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rps2s3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rps2s3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rps2s3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rps2s3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rps2s3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rps2s3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rpi2i3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpi2i3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpi2i3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rpi2i3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rpi2i3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rpi2i3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rpq2q3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpq2q3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpq2q3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rpq2q3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rpq2q3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rpq2q3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rpC2C3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpC2C3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpC2C3 ((125 7 42))> [125, 7, 42 => -124] = 42, (125 7 132)
rpC2C3 (#(125 7 42))> [125, 7, 42 => -124] = 42, #(125 7 132)
rpC2C3 ((7 125 42))> [7, 125, 42 => -124] = 42, (7 125 132)
rpC2C3 (#(7 125 42))> [7, 125, 42 => -124] = 42, #(7 125 132)
rpS2S3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpS2S3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpS2S3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rpS2S3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rpS2S3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rpS2S3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rpI2I3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpI2I3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpI2I3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rpI2I3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rpI2I3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rpI2I3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rpq2q3 ((1 2 42))> [1, 2, 42 => 3] = 42, (1 2 3)
rpq2q3 (#(1 2 42))> [1, 2, 42 => 3] = 42, #(1 2 3)
rpq2q3 ((125 7 42))> [125, 7, 42 => 132] = 42, (125 7 132)
rpq2q3 (#(125 7 42))> [125, 7, 42 => 132] = 42, #(125 7 132)
rpq2q3 ((7 125 42))> [7, 125, 42 => 132] = 42, (7 125 132)
rpq2q3 (#(7 125 42))> [7, 125, 42 => 132] = 42, #(7 125 132)
rpf2f3 ((1.0 2.0 42.0))> [1.000000, 2.000000, 42.000000 => 3.000000] = 42.0, (1.0 2.0 3.0)
rpf2f3 (#(1.0 2.0 42.0))> [1.000000, 2.000000, 42.000000 => 3.000000] = 42.0, #(1.0 2.0 3.0)
rpf2f3 ((125.125 7.0 42.0))> [125.125000, 7.000000, 42.000000 => 132.125000] = 42.0, (125.125 7.0 132.125)
rpf2f3 (#(125.125 7.0 42.0))> [125.125000, 7.000000, 42.000000 => 132.125000] = 42.0, #(125.125 7.0 132.125)
rpf2f3 ((7.0 125.125 42.0))> [7.000000, 125.125000, 42.000000 => 132.125000] = 42.0, (7.0 125.125 132.125)
rpf2f3 (#(7.0 125.125 42.0))> [7.000000, 125.125000, 42.000000 => 132.125000] = 42.0, #(7.0 125.125 132.125)
rpf2f3 ((-125.125 -125.125 42.0))> [-125.125000, -125.125000, 42.000000 => -250.250000] = 42.0, (-125.125 -125.125 -250.25)
rpf2f3 (#(-125.125 -125.125 42.0))> [-125.125000, -125.125000, 42.000000 => -250.250000] = 42.0, #(-125.125 -125.125 -250.25)
rpf2f3 ((125.125 -125.125 42.0))> [125.125000, -125.125000, 42.000000 => 0.000000] = 42.0, (125.125 -125.125 0.0)
rpf2f3 (#(125.125 -125.125 42.0))> [125.125000, -125.125000, 42.000000 => 0.000000] = 42.0, #(125.125 -125.125 0.0)
rpd2d3 ((1.0 2.0 42.0))> [1.000000, 2.000000, 42.000000 => 3.000000] = 42.0, (1.0 2.0 3.0)
rpd2d3 (#(1.0 2.0 42.0))> [1.000000, 2.000000, 42.000000 => 3.000000] = 42.0, #(1.0 2.0 3.0)
rpd2d3 ((125.125 7.0 42.0))> [125.125000, 7.000000, 42.000000 => 132.125000] = 42.0, (125.125 7.0 132.125)
rpd2d3 (#(125.125 7.0 42.0))> [125.125000, 7.000000, 42.000000 => 132.125000] = 42.0, #(125.125 7.0 132.125)
rpd2d3 ((7.0 125.125 42.0))> [7.000000, 125.125000, 42.000000 => 132.125000] = 42.0, (7.0 125.125 132.125)
rpd2d3 (#(7.0 125.125 42.0))> [7.000000, 125.125000, 42.000000 => 132.125000] = 42.0, #(7.0 125.125 132.125)
rpd2d3 ((-125.125 -125.125 42.0))> [-125.125000, -125.125000, 42.000000 => -250.250000] = 42.0, (-125.125 -125.125 -250.25)
rpd2d3 (#(-125.125 -125.125 42.0))> [-125.125000, -125.125000, 42.000000 => -250.250000] = 42.0, #(-125.125 -125.125 -250.25)
rpd2d3 ((125.125 -125.125 42.0))> [125.125000, -125.125000, 42.000000 => 0.000000] = 42.0, (125.125 -125.125 0.0)
rpd2d3 (#(125.125 -125.125 42.0))> [125.125000, -125.125000, 42.000000 => 0.000000] = 42.0, #(125.125 -125.125 0.0)
done.