[System.Runtime.InteropServices.RuntimeInformation] Updated to reference copied files...
[mono-project.git] / mono / tests / pinvoke_ppcc.cs
blobda90ba1c35f5cc620149a389272f22af4539ba22
1 // pinvoke_ppcc.cs - Test cases for passing structures to and and returning
2 // structures from functions. This particular test is for
3 // structures consisting wholy of 1 byte fields.
4 //
5 // The Power ABI version 2 allows for special parameter
6 // passing and returning optimizations for certain
7 // structures of homogenous composition (like all ints).
8 // This set of tests checks all the possible combinations
9 // that use the special parm/return rules and one beyond.
11 // Bill Seurer (seurer@linux.vnet.ibm.com)
13 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
16 using System;
17 using System.Runtime.InteropServices;
20 public class Test_sbyte {
22 [DllImport ("libtest", EntryPoint="mono_return_sbyte1")]
23 public static extern sbyte1 mono_return_sbyte1 (sbyte1 s, int addend);
24 [StructLayout(LayoutKind.Sequential)]
25 public struct sbyte1 {
26 public sbyte f1;
28 [DllImport ("libtest", EntryPoint="mono_return_sbyte2")]
29 public static extern sbyte2 mono_return_sbyte2 (sbyte2 s, int addend);
30 [StructLayout(LayoutKind.Sequential)]
31 public struct sbyte2 {
32 public sbyte f1,f2;
34 [DllImport ("libtest", EntryPoint="mono_return_sbyte3")]
35 public static extern sbyte3 mono_return_sbyte3 (sbyte3 s, int addend);
36 [StructLayout(LayoutKind.Sequential)]
37 public struct sbyte3 {
38 public sbyte f1,f2,f3;
40 [DllImport ("libtest", EntryPoint="mono_return_sbyte4")]
41 public static extern sbyte4 mono_return_sbyte4 (sbyte4 s, int addend);
42 [StructLayout(LayoutKind.Sequential)]
43 public struct sbyte4 {
44 public sbyte f1,f2,f3,f4;
46 [DllImport ("libtest", EntryPoint="mono_return_sbyte5")]
47 public static extern sbyte5 mono_return_sbyte5 (sbyte5 s, int addend);
48 [StructLayout(LayoutKind.Sequential)]
49 public struct sbyte5 {
50 public sbyte f1,f2,f3,f4,f5;
52 [DllImport ("libtest", EntryPoint="mono_return_sbyte6")]
53 public static extern sbyte6 mono_return_sbyte6 (sbyte6 s, int addend);
54 [StructLayout(LayoutKind.Sequential)]
55 public struct sbyte6 {
56 public sbyte f1,f2,f3,f4,f5,f6;
58 [DllImport ("libtest", EntryPoint="mono_return_sbyte7")]
59 public static extern sbyte7 mono_return_sbyte7 (sbyte7 s, int addend);
60 [StructLayout(LayoutKind.Sequential)]
61 public struct sbyte7 {
62 public sbyte f1,f2,f3,f4,f5,f6,f7;
64 [DllImport ("libtest", EntryPoint="mono_return_sbyte8")]
65 public static extern sbyte8 mono_return_sbyte8 (sbyte8 s, int addend);
66 [StructLayout(LayoutKind.Sequential)]
67 public struct sbyte8 {
68 public sbyte f1,f2,f3,f4,f5,f6,f7,f8;
70 [DllImport ("libtest", EntryPoint="mono_return_sbyte9")]
71 public static extern sbyte9 mono_return_sbyte9 (sbyte9 s, int addend);
72 [StructLayout(LayoutKind.Sequential)]
73 public struct sbyte9 {
74 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9;
76 [DllImport ("libtest", EntryPoint="mono_return_sbyte10")]
77 public static extern sbyte10 mono_return_sbyte10 (sbyte10 s, int addend);
78 [StructLayout(LayoutKind.Sequential)]
79 public struct sbyte10 {
80 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
82 [DllImport ("libtest", EntryPoint="mono_return_sbyte11")]
83 public static extern sbyte11 mono_return_sbyte11 (sbyte11 s, int addend);
84 [StructLayout(LayoutKind.Sequential)]
85 public struct sbyte11 {
86 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11;
88 [DllImport ("libtest", EntryPoint="mono_return_sbyte12")]
89 public static extern sbyte12 mono_return_sbyte12 (sbyte12 s, int addend);
90 [StructLayout(LayoutKind.Sequential)]
91 public struct sbyte12 {
92 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
94 [DllImport ("libtest", EntryPoint="mono_return_sbyte13")]
95 public static extern sbyte13 mono_return_sbyte13 (sbyte13 s, int addend);
96 [StructLayout(LayoutKind.Sequential)]
97 public struct sbyte13 {
98 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
100 [DllImport ("libtest", EntryPoint="mono_return_sbyte14")]
101 public static extern sbyte14 mono_return_sbyte14 (sbyte14 s, int addend);
102 [StructLayout(LayoutKind.Sequential)]
103 public struct sbyte14 {
104 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14;
106 [DllImport ("libtest", EntryPoint="mono_return_sbyte15")]
107 public static extern sbyte15 mono_return_sbyte15 (sbyte15 s, int addend);
108 [StructLayout(LayoutKind.Sequential)]
109 public struct sbyte15 {
110 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
112 [DllImport ("libtest", EntryPoint="mono_return_sbyte16")]
113 public static extern sbyte16 mono_return_sbyte16 (sbyte16 s, int addend);
114 [StructLayout(LayoutKind.Sequential)]
115 public struct sbyte16 {
116 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16;
118 // This structure is 1 element too large to use the special return
119 // rules.
120 [DllImport ("libtest", EntryPoint="mono_return_sbyte17")]
121 public static extern sbyte17 mono_return_sbyte17 (sbyte17 s, int addend);
122 [StructLayout(LayoutKind.Sequential)]
123 public struct sbyte17 {
124 public sbyte f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17;
127 // This structure has nested structures within it but they are
128 // homogenous and thus should still use the special rules.
129 public struct sbyte16_nested1 {
130 public sbyte f1;
132 public struct sbyte16_nested2 {
133 public sbyte f16;
135 [DllImport ("libtest", EntryPoint="mono_return_sbyte16_nested")]
136 public static extern sbyte16_nested mono_return_sbyte16_nested (sbyte16_nested s, int addend);
137 [StructLayout(LayoutKind.Sequential)]
138 public struct sbyte16_nested {
139 public sbyte16_nested1 nested1;
140 public sbyte f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
141 public sbyte16_nested2 nested2;
144 public static int Main (string[] args) {
146 sbyte1 s1;
147 s1.f1 = 1;
148 s1 = mono_return_sbyte1(s1, 9);
150 if (s1.f1 != 1+9) {
151 Console.WriteLine(" sbyte1 s1.f1: got {0} but expected {1}", s1.f1, 1+9);
152 return 1;
155 sbyte2 s2;
156 s2.f1 = 1;
157 s2.f2 = 2;
158 s2 = mono_return_sbyte2(s2, 9);
159 if (s2.f1 != 1+9) {
160 Console.WriteLine(" sbyte2 s2.f1: got {0} but expected {1}", s2.f1, 1+9);
161 return 1;
163 if (s2.f2 != 2+9) {
164 Console.WriteLine(" sbyte2 s2.f2: got {0} but expected {1}", s2.f2, 2+9);
165 return 2;
168 sbyte3 s3;
169 s3.f1 = 1;
170 s3.f2 = 2;
171 s3.f3 = 3;
172 s3 = mono_return_sbyte3(s3, 9);
173 if (s3.f1 != 1+9) {
174 Console.WriteLine(" sbyte3 s3.f1: got {0} but expected {1}", s3.f1, 1+9);
175 return 1;
177 if (s3.f2 != 2+9) {
178 Console.WriteLine(" sbyte3 s3.f2: got {0} but expected {1}", s3.f2, 2+9);
179 return 2;
181 if (s3.f3 != 3+9) {
182 Console.WriteLine(" sbyte3 s3.f3: got {0} but expected {1}", s3.f3, 3+9);
183 return 3;
186 sbyte4 s4;
187 s4.f1 = 1;
188 s4.f2 = 2;
189 s4.f3 = 3;
190 s4.f4 = 4;
191 s4 = mono_return_sbyte4(s4, 9);
192 if (s4.f1 != 1+9) {
193 Console.WriteLine(" sbyte4 s4.f1: got {0} but expected {1}", s4.f1, 1+9);
194 return 1;
196 if (s4.f2 != 2+9) {
197 Console.WriteLine(" sbyte4 s4.f2: got {0} but expected {1}", s4.f2, 2+9);
198 return 2;
200 if (s4.f3 != 3+9) {
201 Console.WriteLine(" sbyte4 s4.f3: got {0} but expected {1}", s4.f3, 3+9);
202 return 3;
204 if (s4.f4 != 4+9) {
205 Console.WriteLine(" sbyte4 s4.f4: got {0} but expected {1}", s4.f4, 4+9);
206 return 4;
209 sbyte5 s5;
210 s5.f1 = 1;
211 s5.f2 = 2;
212 s5.f3 = 3;
213 s5.f4 = 4;
214 s5.f5 = 5;
215 s5 = mono_return_sbyte5(s5, 9);
216 if (s5.f1 != 1+9) {
217 Console.WriteLine(" sbyte5 s5.f1: got {0} but expected {1}", s5.f1, 1+9);
218 return 1;
220 if (s5.f2 != 2+9) {
221 Console.WriteLine(" sbyte5 s5.f2: got {0} but expected {1}", s5.f2, 2+9);
222 return 2;
224 if (s5.f3 != 3+9) {
225 Console.WriteLine(" sbyte5 s5.f3: got {0} but expected {1}", s5.f3, 3+9);
226 return 3;
228 if (s5.f4 != 4+9) {
229 Console.WriteLine(" sbyte5 s5.f4: got {0} but expected {1}", s5.f4, 4+9);
230 return 4;
232 if (s5.f5 != 5+9) {
233 Console.WriteLine(" sbyte5 s5.f5: got {0} but expected {1}", s5.f5, 5+9);
234 return 5;
237 sbyte6 s6;
238 s6.f1 = 1;
239 s6.f2 = 2;
240 s6.f3 = 3;
241 s6.f4 = 4;
242 s6.f5 = 5;
243 s6.f6 = 6;
244 s6 = mono_return_sbyte6(s6, 9);
245 if (s6.f1 != 1+9) {
246 Console.WriteLine(" sbyte6 s6.f1: got {0} but expected {1}", s6.f1, 1+9);
247 return 1;
249 if (s6.f2 != 2+9) {
250 Console.WriteLine(" sbyte6 s6.f2: got {0} but expected {1}", s6.f2, 2+9);
251 return 2;
253 if (s6.f3 != 3+9) {
254 Console.WriteLine(" sbyte6 s6.f3: got {0} but expected {1}", s6.f3, 3+9);
255 return 3;
257 if (s6.f4 != 4+9) {
258 Console.WriteLine(" sbyte6 s6.f4: got {0} but expected {1}", s6.f4, 4+9);
259 return 4;
261 if (s6.f5 != 5+9) {
262 Console.WriteLine(" sbyte6 s6.f5: got {0} but expected {1}", s6.f5, 5+9);
263 return 5;
265 if (s6.f6 != 6+9) {
266 Console.WriteLine(" sbyte6 s6.f6: got {0} but expected {1}", s6.f6, 6+9);
267 return 6;
270 sbyte7 s7;
271 s7.f1 = 1;
272 s7.f2 = 2;
273 s7.f3 = 3;
274 s7.f4 = 4;
275 s7.f5 = 5;
276 s7.f6 = 6;
277 s7.f7 = 7;
278 s7 = mono_return_sbyte7(s7, 9);
279 if (s7.f1 != 1+9) {
280 Console.WriteLine(" sbyte7 s7.f1: got {0} but expected {1}", s7.f1, 1+9);
281 return 1;
283 if (s7.f2 != 2+9) {
284 Console.WriteLine(" sbyte7 s7.f2: got {0} but expected {1}", s7.f2, 2+9);
285 return 2;
287 if (s7.f3 != 3+9) {
288 Console.WriteLine(" sbyte7 s7.f3: got {0} but expected {1}", s7.f3, 3+9);
289 return 3;
291 if (s7.f4 != 4+9) {
292 Console.WriteLine(" sbyte7 s7.f4: got {0} but expected {1}", s7.f4, 4+9);
293 return 4;
295 if (s7.f5 != 5+9) {
296 Console.WriteLine(" sbyte7 s7.f5: got {0} but expected {1}", s7.f5, 5+9);
297 return 5;
299 if (s7.f6 != 6+9) {
300 Console.WriteLine(" sbyte7 s7.f6: got {0} but expected {1}", s7.f6, 6+9);
301 return 6;
303 if (s7.f7 != 7+9) {
304 Console.WriteLine(" sbyte7 s7.f7: got {0} but expected {1}", s7.f7, 7+9);
305 return 7;
308 sbyte8 s8;
309 s8.f1 = 1;
310 s8.f2 = 2;
311 s8.f3 = 3;
312 s8.f4 = 4;
313 s8.f5 = 5;
314 s8.f6 = 6;
315 s8.f7 = 7;
316 s8.f8 = 8;
317 s8 = mono_return_sbyte8(s8, 9);
318 if (s8.f1 != 1+9) {
319 Console.WriteLine(" sbyte8 s8.f1: got {0} but expected {1}", s8.f1, 1+9);
320 return 1;
322 if (s8.f2 != 2+9) {
323 Console.WriteLine(" sbyte8 s8.f2: got {0} but expected {1}", s8.f2, 2+9);
324 return 2;
326 if (s8.f3 != 3+9) {
327 Console.WriteLine(" sbyte8 s8.f3: got {0} but expected {1}", s8.f3, 3+9);
328 return 3;
330 if (s8.f4 != 4+9) {
331 Console.WriteLine(" sbyte8 s8.f4: got {0} but expected {1}", s8.f4, 4+9);
332 return 4;
334 if (s8.f5 != 5+9) {
335 Console.WriteLine(" sbyte8 s8.f5: got {0} but expected {1}", s8.f5, 5+9);
336 return 5;
338 if (s8.f6 != 6+9) {
339 Console.WriteLine(" sbyte8 s8.f6: got {0} but expected {1}", s8.f6, 6+9);
340 return 6;
342 if (s8.f7 != 7+9) {
343 Console.WriteLine(" sbyte8 s8.f7: got {0} but expected {1}", s8.f7, 7+9);
344 return 7;
346 if (s8.f8 != 8+9) {
347 Console.WriteLine(" sbyte8 s8.f8: got {0} but expected {1}", s8.f8, 8+9);
348 return 8;
351 sbyte9 s9;
352 s9.f1 = 1;
353 s9.f2 = 2;
354 s9.f3 = 3;
355 s9.f4 = 4;
356 s9.f5 = 5;
357 s9.f6 = 6;
358 s9.f7 = 7;
359 s9.f8 = 8;
360 s9.f9 = 9;
361 s9 = mono_return_sbyte9(s9, 9);
362 if (s9.f1 != 1+9) {
363 Console.WriteLine(" sbyte9 s9.f1: got {0} but expected {1}", s9.f1, 1+9);
364 return 1;
366 if (s9.f2 != 2+9) {
367 Console.WriteLine(" sbyte9 s9.f2: got {0} but expected {1}", s9.f2, 2+9);
368 return 2;
370 if (s9.f3 != 3+9) {
371 Console.WriteLine(" sbyte9 s9.f3: got {0} but expected {1}", s9.f3, 3+9);
372 return 3;
374 if (s9.f4 != 4+9) {
375 Console.WriteLine(" sbyte9 s9.f4: got {0} but expected {1}", s9.f4, 4+9);
376 return 4;
378 if (s9.f5 != 5+9) {
379 Console.WriteLine(" sbyte9 s9.f5: got {0} but expected {1}", s9.f5, 5+9);
380 return 5;
382 if (s9.f6 != 6+9) {
383 Console.WriteLine(" sbyte9 s9.f6: got {0} but expected {1}", s9.f6, 6+9);
384 return 6;
386 if (s9.f7 != 7+9) {
387 Console.WriteLine(" sbyte9 s9.f7: got {0} but expected {1}", s9.f7, 7+9);
388 return 7;
390 if (s9.f8 != 8+9) {
391 Console.WriteLine(" sbyte9 s9.f8: got {0} but expected {1}", s9.f8, 8+9);
392 return 8;
394 if (s9.f9 != 9+9) {
395 Console.WriteLine(" sbyte9 s9.f9: got {0} but expected {1}", s9.f9, 9+9);
396 return 9;
399 sbyte10 s10;
400 s10.f1 = 1;
401 s10.f2 = 2;
402 s10.f3 = 3;
403 s10.f4 = 4;
404 s10.f5 = 5;
405 s10.f6 = 6;
406 s10.f7 = 7;
407 s10.f8 = 8;
408 s10.f9 = 9;
409 s10.f10 = 10;
410 s10 = mono_return_sbyte10(s10, 9);
411 if (s10.f1 != 1+9) {
412 Console.WriteLine(" sbyte10 s10.f1: got {0} but expected {1}", s10.f1, 1+9);
413 return 1;
415 if (s10.f2 != 2+9) {
416 Console.WriteLine(" sbyte10 s10.f2: got {0} but expected {1}", s10.f2, 2+9);
417 return 2;
419 if (s10.f3 != 3+9) {
420 Console.WriteLine(" sbyte10 s10.f3: got {0} but expected {1}", s10.f3, 3+9);
421 return 3;
423 if (s10.f4 != 4+9) {
424 Console.WriteLine(" sbyte10 s10.f4: got {0} but expected {1}", s10.f4, 4+9);
425 return 4;
427 if (s10.f5 != 5+9) {
428 Console.WriteLine(" sbyte10 s10.f5: got {0} but expected {1}", s10.f5, 5+9);
429 return 5;
431 if (s10.f6 != 6+9) {
432 Console.WriteLine(" sbyte10 s10.f6: got {0} but expected {1}", s10.f6, 6+9);
433 return 6;
435 if (s10.f7 != 7+9) {
436 Console.WriteLine(" sbyte10 s10.f7: got {0} but expected {1}", s10.f7, 7+9);
437 return 7;
439 if (s10.f8 != 8+9) {
440 Console.WriteLine(" sbyte10 s10.f8: got {0} but expected {1}", s10.f8, 8+9);
441 return 8;
443 if (s10.f9 != 9+9) {
444 Console.WriteLine(" sbyte10 s10.f9: got {0} but expected {1}", s10.f9, 9+9);
445 return 9;
447 if (s10.f10 != 10+9) {
448 Console.WriteLine(" sbyte10 s10.f10: got {0} but expected {1}", s10.f10, 10+9);
449 return 10;
452 sbyte11 s11;
453 s11.f1 = 1;
454 s11.f2 = 2;
455 s11.f3 = 3;
456 s11.f4 = 4;
457 s11.f5 = 5;
458 s11.f6 = 6;
459 s11.f7 = 7;
460 s11.f8 = 8;
461 s11.f9 = 9;
462 s11.f10 = 10;
463 s11.f11 = 11;
464 s11 = mono_return_sbyte11(s11, 9);
465 if (s11.f1 != 1+9) {
466 Console.WriteLine(" sbyte11 s11.f1: got {0} but expected {1}", s11.f1, 1+9);
467 return 1;
469 if (s11.f2 != 2+9) {
470 Console.WriteLine(" sbyte11 s11.f2: got {0} but expected {1}", s11.f2, 2+9);
471 return 2;
473 if (s11.f3 != 3+9) {
474 Console.WriteLine(" sbyte11 s11.f3: got {0} but expected {1}", s11.f3, 3+9);
475 return 3;
477 if (s11.f4 != 4+9) {
478 Console.WriteLine(" sbyte11 s11.f4: got {0} but expected {1}", s11.f4, 4+9);
479 return 4;
481 if (s11.f5 != 5+9) {
482 Console.WriteLine(" sbyte11 s11.f5: got {0} but expected {1}", s11.f5, 5+9);
483 return 5;
485 if (s11.f6 != 6+9) {
486 Console.WriteLine(" sbyte11 s11.f6: got {0} but expected {1}", s11.f6, 6+9);
487 return 6;
489 if (s11.f7 != 7+9) {
490 Console.WriteLine(" sbyte11 s11.f7: got {0} but expected {1}", s11.f7, 7+9);
491 return 7;
493 if (s11.f8 != 8+9) {
494 Console.WriteLine(" sbyte11 s11.f8: got {0} but expected {1}", s11.f8, 8+9);
495 return 8;
497 if (s11.f9 != 9+9) {
498 Console.WriteLine(" sbyte11 s11.f9: got {0} but expected {1}", s11.f9, 9+9);
499 return 9;
501 if (s11.f10 != 10+9) {
502 Console.WriteLine(" sbyte11 s11.f10: got {0} but expected {1}", s11.f10, 10+9);
503 return 10;
505 if (s11.f11 != 11+9) {
506 Console.WriteLine(" sbyte11 s11.f11: got {0} but expected {1}", s11.f11, 11+9);
507 return 11;
510 sbyte12 s12;
511 s12.f1 = 1;
512 s12.f2 = 2;
513 s12.f3 = 3;
514 s12.f4 = 4;
515 s12.f5 = 5;
516 s12.f6 = 6;
517 s12.f7 = 7;
518 s12.f8 = 8;
519 s12.f9 = 9;
520 s12.f10 = 10;
521 s12.f11 = 11;
522 s12.f12 = 12;
523 s12 = mono_return_sbyte12(s12, 9);
524 if (s12.f1 != 1+9) {
525 Console.WriteLine(" sbyte12 s12.f1: got {0} but expected {1}", s12.f1, 1+9);
526 return 1;
528 if (s12.f2 != 2+9) {
529 Console.WriteLine(" sbyte12 s12.f2: got {0} but expected {1}", s12.f2, 2+9);
530 return 2;
532 if (s12.f3 != 3+9) {
533 Console.WriteLine(" sbyte12 s12.f3: got {0} but expected {1}", s12.f3, 3+9);
534 return 3;
536 if (s12.f4 != 4+9) {
537 Console.WriteLine(" sbyte12 s12.f4: got {0} but expected {1}", s12.f4, 4+9);
538 return 4;
540 if (s12.f5 != 5+9) {
541 Console.WriteLine(" sbyte12 s12.f5: got {0} but expected {1}", s12.f5, 5+9);
542 return 5;
544 if (s12.f6 != 6+9) {
545 Console.WriteLine(" sbyte12 s12.f6: got {0} but expected {1}", s12.f6, 6+9);
546 return 6;
548 if (s12.f7 != 7+9) {
549 Console.WriteLine(" sbyte12 s12.f7: got {0} but expected {1}", s12.f7, 7+9);
550 return 7;
552 if (s12.f8 != 8+9) {
553 Console.WriteLine(" sbyte12 s12.f8: got {0} but expected {1}", s12.f8, 8+9);
554 return 8;
556 if (s12.f9 != 9+9) {
557 Console.WriteLine(" sbyte12 s12.f9: got {0} but expected {1}", s12.f9, 9+9);
558 return 9;
560 if (s12.f10 != 10+9) {
561 Console.WriteLine(" sbyte12 s12.f10: got {0} but expected {1}", s12.f10, 10+9);
562 return 10;
564 if (s12.f11 != 11+9) {
565 Console.WriteLine(" sbyte12 s12.f11: got {0} but expected {1}", s12.f11, 11+9);
566 return 11;
568 if (s12.f12 != 12+9) {
569 Console.WriteLine(" sbyte12 s12.f12: got {0} but expected {1}", s12.f12, 12+9);
570 return 12;
573 sbyte13 s13;
574 s13.f1 = 1;
575 s13.f2 = 2;
576 s13.f3 = 3;
577 s13.f4 = 4;
578 s13.f5 = 5;
579 s13.f6 = 6;
580 s13.f7 = 7;
581 s13.f8 = 8;
582 s13.f9 = 9;
583 s13.f10 = 10;
584 s13.f11 = 11;
585 s13.f12 = 12;
586 s13.f13 = 13;
587 s13 = mono_return_sbyte13(s13, 9);
588 if (s13.f1 != 1+9) {
589 Console.WriteLine(" sbyte13 s13.f1: got {0} but expected {1}", s13.f1, 1+9);
590 return 1;
592 if (s13.f2 != 2+9) {
593 Console.WriteLine(" sbyte13 s13.f2: got {0} but expected {1}", s13.f2, 2+9);
594 return 2;
596 if (s13.f3 != 3+9) {
597 Console.WriteLine(" sbyte13 s13.f3: got {0} but expected {1}", s13.f3, 3+9);
598 return 3;
600 if (s13.f4 != 4+9) {
601 Console.WriteLine(" sbyte13 s13.f4: got {0} but expected {1}", s13.f4, 4+9);
602 return 4;
604 if (s13.f5 != 5+9) {
605 Console.WriteLine(" sbyte13 s13.f5: got {0} but expected {1}", s13.f5, 5+9);
606 return 5;
608 if (s13.f6 != 6+9) {
609 Console.WriteLine(" sbyte13 s13.f6: got {0} but expected {1}", s13.f6, 6+9);
610 return 6;
612 if (s13.f7 != 7+9) {
613 Console.WriteLine(" sbyte13 s13.f7: got {0} but expected {1}", s13.f7, 7+9);
614 return 7;
616 if (s13.f8 != 8+9) {
617 Console.WriteLine(" sbyte13 s13.f8: got {0} but expected {1}", s13.f8, 8+9);
618 return 8;
620 if (s13.f9 != 9+9) {
621 Console.WriteLine(" sbyte13 s13.f9: got {0} but expected {1}", s13.f9, 9+9);
622 return 9;
624 if (s13.f10 != 10+9) {
625 Console.WriteLine(" sbyte13 s13.f10: got {0} but expected {1}", s13.f10, 10+9);
626 return 10;
628 if (s13.f11 != 11+9) {
629 Console.WriteLine(" sbyte13 s13.f11: got {0} but expected {1}", s13.f11, 11+9);
630 return 11;
632 if (s13.f12 != 12+9) {
633 Console.WriteLine(" sbyte13 s13.f12: got {0} but expected {1}", s13.f12, 12+9);
634 return 12;
636 if (s13.f13 != 13+9) {
637 Console.WriteLine(" sbyte13 s13.f13: got {0} but expected {1}", s13.f13, 13+9);
638 return 13;
641 sbyte14 s14;
642 s14.f1 = 1;
643 s14.f2 = 2;
644 s14.f3 = 3;
645 s14.f4 = 4;
646 s14.f5 = 5;
647 s14.f6 = 6;
648 s14.f7 = 7;
649 s14.f8 = 8;
650 s14.f9 = 9;
651 s14.f10 = 10;
652 s14.f11 = 11;
653 s14.f12 = 12;
654 s14.f13 = 13;
655 s14.f14 = 14;
656 s14 = mono_return_sbyte14(s14, 9);
657 if (s14.f1 != 1+9) {
658 Console.WriteLine(" sbyte14 s14.f1: got {0} but expected {1}", s14.f1, 1+9);
659 return 1;
661 if (s14.f2 != 2+9) {
662 Console.WriteLine(" sbyte14 s14.f2: got {0} but expected {1}", s14.f2, 2+9);
663 return 2;
665 if (s14.f3 != 3+9) {
666 Console.WriteLine(" sbyte14 s14.f3: got {0} but expected {1}", s14.f3, 3+9);
667 return 3;
669 if (s14.f4 != 4+9) {
670 Console.WriteLine(" sbyte14 s14.f4: got {0} but expected {1}", s14.f4, 4+9);
671 return 4;
673 if (s14.f5 != 5+9) {
674 Console.WriteLine(" sbyte14 s14.f5: got {0} but expected {1}", s14.f5, 5+9);
675 return 5;
677 if (s14.f6 != 6+9) {
678 Console.WriteLine(" sbyte14 s14.f6: got {0} but expected {1}", s14.f6, 6+9);
679 return 6;
681 if (s14.f7 != 7+9) {
682 Console.WriteLine(" sbyte14 s14.f7: got {0} but expected {1}", s14.f7, 7+9);
683 return 7;
685 if (s14.f8 != 8+9) {
686 Console.WriteLine(" sbyte14 s14.f8: got {0} but expected {1}", s14.f8, 8+9);
687 return 8;
689 if (s14.f9 != 9+9) {
690 Console.WriteLine(" sbyte14 s14.f9: got {0} but expected {1}", s14.f9, 9+9);
691 return 9;
693 if (s14.f10 != 10+9) {
694 Console.WriteLine(" sbyte14 s14.f10: got {0} but expected {1}", s14.f10, 10+9);
695 return 10;
697 if (s14.f11 != 11+9) {
698 Console.WriteLine(" sbyte14 s14.f11: got {0} but expected {1}", s14.f11, 11+9);
699 return 11;
701 if (s14.f12 != 12+9) {
702 Console.WriteLine(" sbyte14 s14.f12: got {0} but expected {1}", s14.f12, 12+9);
703 return 12;
705 if (s14.f13 != 13+9) {
706 Console.WriteLine(" sbyte14 s14.f13: got {0} but expected {1}", s14.f13, 13+9);
707 return 13;
709 if (s14.f14 != 14+9) {
710 Console.WriteLine(" sbyte14 s14.f14: got {0} but expected {1}", s14.f14, 14+9);
711 return 14;
714 sbyte15 s15;
715 s15.f1 = 1;
716 s15.f2 = 2;
717 s15.f3 = 3;
718 s15.f4 = 4;
719 s15.f5 = 5;
720 s15.f6 = 6;
721 s15.f7 = 7;
722 s15.f8 = 8;
723 s15.f9 = 9;
724 s15.f10 = 10;
725 s15.f11 = 11;
726 s15.f12 = 12;
727 s15.f13 = 13;
728 s15.f14 = 14;
729 s15.f15 = 15;
730 s15 = mono_return_sbyte15(s15, 9);
731 if (s15.f1 != 1+9) {
732 Console.WriteLine(" sbyte15 s15.f1: got {0} but expected {1}", s15.f1, 1+9);
733 return 1;
735 if (s15.f2 != 2+9) {
736 Console.WriteLine(" sbyte15 s15.f2: got {0} but expected {1}", s15.f2, 2+9);
737 return 2;
739 if (s15.f3 != 3+9) {
740 Console.WriteLine(" sbyte15 s15.f3: got {0} but expected {1}", s15.f3, 3+9);
741 return 3;
743 if (s15.f4 != 4+9) {
744 Console.WriteLine(" sbyte15 s15.f4: got {0} but expected {1}", s15.f4, 4+9);
745 return 4;
747 if (s15.f5 != 5+9) {
748 Console.WriteLine(" sbyte15 s15.f5: got {0} but expected {1}", s15.f5, 5+9);
749 return 5;
751 if (s15.f6 != 6+9) {
752 Console.WriteLine(" sbyte15 s15.f6: got {0} but expected {1}", s15.f6, 6+9);
753 return 6;
755 if (s15.f7 != 7+9) {
756 Console.WriteLine(" sbyte15 s15.f7: got {0} but expected {1}", s15.f7, 7+9);
757 return 7;
759 if (s15.f8 != 8+9) {
760 Console.WriteLine(" sbyte15 s15.f8: got {0} but expected {1}", s15.f8, 8+9);
761 return 8;
763 if (s15.f9 != 9+9) {
764 Console.WriteLine(" sbyte15 s15.f9: got {0} but expected {1}", s15.f9, 9+9);
765 return 9;
767 if (s15.f10 != 10+9) {
768 Console.WriteLine(" sbyte15 s15.f10: got {0} but expected {1}", s15.f10, 10+9);
769 return 10;
771 if (s15.f11 != 11+9) {
772 Console.WriteLine(" sbyte15 s15.f11: got {0} but expected {1}", s15.f11, 11+9);
773 return 11;
775 if (s15.f12 != 12+9) {
776 Console.WriteLine(" sbyte15 s15.f12: got {0} but expected {1}", s15.f12, 12+9);
777 return 12;
779 if (s15.f13 != 13+9) {
780 Console.WriteLine(" sbyte15 s15.f13: got {0} but expected {1}", s15.f13, 13+9);
781 return 13;
783 if (s15.f14 != 14+9) {
784 Console.WriteLine(" sbyte15 s15.f14: got {0} but expected {1}", s15.f14, 14+9);
785 return 14;
787 if (s15.f15 != 15+9) {
788 Console.WriteLine(" sbyte15 s15.f15: got {0} but expected {1}", s15.f15, 15+9);
789 return 15;
792 sbyte16 s16;
793 s16.f1 = 1;
794 s16.f2 = 2;
795 s16.f3 = 3;
796 s16.f4 = 4;
797 s16.f5 = 5;
798 s16.f6 = 6;
799 s16.f7 = 7;
800 s16.f8 = 8;
801 s16.f9 = 9;
802 s16.f10 = 10;
803 s16.f11 = 11;
804 s16.f12 = 12;
805 s16.f13 = 13;
806 s16.f14 = 14;
807 s16.f15 = 15;
808 s16.f16 = 16;
809 s16 = mono_return_sbyte16(s16, 9);
810 if (s16.f1 != 1+9) {
811 Console.WriteLine(" sbyte16 s16.f1: got {0} but expected {1}", s16.f1, 1+9);
812 return 1;
814 if (s16.f2 != 2+9) {
815 Console.WriteLine(" sbyte16 s16.f2: got {0} but expected {1}", s16.f2, 2+9);
816 return 2;
818 if (s16.f3 != 3+9) {
819 Console.WriteLine(" sbyte16 s16.f3: got {0} but expected {1}", s16.f3, 3+9);
820 return 3;
822 if (s16.f4 != 4+9) {
823 Console.WriteLine(" sbyte16 s16.f4: got {0} but expected {1}", s16.f4, 4+9);
824 return 4;
826 if (s16.f5 != 5+9) {
827 Console.WriteLine(" sbyte16 s16.f5: got {0} but expected {1}", s16.f5, 5+9);
828 return 5;
830 if (s16.f6 != 6+9) {
831 Console.WriteLine(" sbyte16 s16.f6: got {0} but expected {1}", s16.f6, 6+9);
832 return 6;
834 if (s16.f7 != 7+9) {
835 Console.WriteLine(" sbyte16 s16.f7: got {0} but expected {1}", s16.f7, 7+9);
836 return 7;
838 if (s16.f8 != 8+9) {
839 Console.WriteLine(" sbyte16 s16.f8: got {0} but expected {1}", s16.f8, 8+9);
840 return 8;
842 if (s16.f9 != 9+9) {
843 Console.WriteLine(" sbyte16 s16.f9: got {0} but expected {1}", s16.f9, 9+9);
844 return 9;
846 if (s16.f10 != 10+9) {
847 Console.WriteLine(" sbyte16 s16.f10: got {0} but expected {1}", s16.f10, 10+9);
848 return 10;
850 if (s16.f11 != 11+9) {
851 Console.WriteLine(" sbyte16 s16.f11: got {0} but expected {1}", s16.f11, 11+9);
852 return 11;
854 if (s16.f12 != 12+9) {
855 Console.WriteLine(" sbyte16 s16.f12: got {0} but expected {1}", s16.f12, 12+9);
856 return 12;
858 if (s16.f13 != 13+9) {
859 Console.WriteLine(" sbyte16 s16.f13: got {0} but expected {1}", s16.f13, 13+9);
860 return 13;
862 if (s16.f14 != 14+9) {
863 Console.WriteLine(" sbyte16 s16.f14: got {0} but expected {1}", s16.f14, 14+9);
864 return 14;
866 if (s16.f15 != 15+9) {
867 Console.WriteLine(" sbyte16 s16.f15: got {0} but expected {1}", s16.f15, 15+9);
868 return 15;
870 if (s16.f16 != 16+9) {
871 Console.WriteLine(" sbyte16 s16.f16: got {0} but expected {1}", s16.f16, 16+9);
872 return 16;
875 sbyte17 s17;
876 s17.f1 = 1;
877 s17.f2 = 2;
878 s17.f3 = 3;
879 s17.f4 = 4;
880 s17.f5 = 5;
881 s17.f6 = 6;
882 s17.f7 = 7;
883 s17.f8 = 8;
884 s17.f9 = 9;
885 s17.f10 = 10;
886 s17.f11 = 11;
887 s17.f12 = 12;
888 s17.f13 = 13;
889 s17.f14 = 14;
890 s17.f15 = 15;
891 s17.f16 = 16;
892 s17.f17 = 17;
893 s17 = mono_return_sbyte17(s17, 9);
894 if (s17.f1 != 1+9) {
895 Console.WriteLine(" sbyte17 s17.f1: got {0} but expected {1}", s17.f1, 1+9);
896 return 1;
898 if (s17.f2 != 2+9) {
899 Console.WriteLine(" sbyte17 s17.f2: got {0} but expected {1}", s17.f2, 2+9);
900 return 2;
902 if (s17.f3 != 3+9) {
903 Console.WriteLine(" sbyte17 s17.f3: got {0} but expected {1}", s17.f3, 3+9);
904 return 3;
906 if (s17.f4 != 4+9) {
907 Console.WriteLine(" sbyte17 s17.f4: got {0} but expected {1}", s17.f4, 4+9);
908 return 4;
910 if (s17.f5 != 5+9) {
911 Console.WriteLine(" sbyte17 s17.f5: got {0} but expected {1}", s17.f5, 5+9);
912 return 5;
914 if (s17.f6 != 6+9) {
915 Console.WriteLine(" sbyte17 s17.f6: got {0} but expected {1}", s17.f6, 6+9);
916 return 6;
918 if (s17.f7 != 7+9) {
919 Console.WriteLine(" sbyte17 s17.f7: got {0} but expected {1}", s17.f7, 7+9);
920 return 7;
922 if (s17.f8 != 8+9) {
923 Console.WriteLine(" sbyte17 s17.f8: got {0} but expected {1}", s17.f8, 8+9);
924 return 8;
926 if (s17.f9 != 9+9) {
927 Console.WriteLine(" sbyte17 s17.f9: got {0} but expected {1}", s17.f9, 9+9);
928 return 9;
930 if (s17.f10 != 10+9) {
931 Console.WriteLine(" sbyte17 s17.f10: got {0} but expected {1}", s17.f10, 10+9);
932 return 10;
934 if (s17.f11 != 11+9) {
935 Console.WriteLine(" sbyte17 s17.f11: got {0} but expected {1}", s17.f11, 11+9);
936 return 11;
938 if (s17.f12 != 12+9) {
939 Console.WriteLine(" sbyte17 s17.f12: got {0} but expected {1}", s17.f12, 12+9);
940 return 12;
942 if (s17.f13 != 13+9) {
943 Console.WriteLine(" sbyte17 s17.f13: got {0} but expected {1}", s17.f13, 13+9);
944 return 13;
946 if (s17.f14 != 14+9) {
947 Console.WriteLine(" sbyte17 s17.f14: got {0} but expected {1}", s17.f14, 14+9);
948 return 14;
950 if (s17.f15 != 15+9) {
951 Console.WriteLine(" sbyte17 s17.f15: got {0} but expected {1}", s17.f15, 15+9);
952 return 15;
954 if (s17.f16 != 16+9) {
955 Console.WriteLine(" sbyte17 s17.f16: got {0} but expected {1}", s17.f16, 16+9);
956 return 16;
958 if (s17.f17 != 17+9) {
959 Console.WriteLine(" sbyte17 s17.f17: got {0} but expected {1}", s17.f17, 17+9);
960 return 17;
964 sbyte16_nested sn16;
965 sn16.nested1.f1 = 1;
966 sn16.f2 = 2;
967 sn16.f3 = 3;
968 sn16.f4 = 4;
969 sn16.f5 = 5;
970 sn16.f6 = 6;
971 sn16.f7 = 7;
972 sn16.f8 = 8;
973 sn16.f9 = 9;
974 sn16.f10 = 10;
975 sn16.f11 = 11;
976 sn16.f12 = 12;
977 sn16.f13 = 13;
978 sn16.f14 = 14;
979 sn16.f15 = 15;
980 sn16.nested2.f16 = 16;
981 sn16 = mono_return_sbyte16_nested(sn16, 9);
982 if (sn16.nested1.f1 != 1+9) {
983 Console.WriteLine(" sbyte16_nested sn16.nested1.f1: got {0} but expected {1}", sn16.nested1.f1, 1+9);
984 return 1;
986 if (sn16.f2 != 2+9) {
987 Console.WriteLine(" sbyte16_nested sn16.f2: got {0} but expected {1}", sn16.f2, 2+9);
988 return 2;
990 if (sn16.f3 != 3+9) {
991 Console.WriteLine(" sbyte16_nested sn16.f3: got {0} but expected {1}", sn16.f3, 3+9);
992 return 3;
994 if (sn16.f4 != 4+9) {
995 Console.WriteLine(" sbyte16_nested sn16.f4: got {0} but expected {1}", sn16.f4, 4+9);
996 return 4;
998 if (sn16.f5 != 5+9) {
999 Console.WriteLine(" sbyte16_nested sn16.f5: got {0} but expected {1}", sn16.f5, 5+9);
1000 return 5;
1002 if (sn16.f6 != 6+9) {
1003 Console.WriteLine(" sbyte16_nested sn16.f6: got {0} but expected {1}", sn16.f6, 6+9);
1004 return 6;
1006 if (sn16.f7 != 7+9) {
1007 Console.WriteLine(" sbyte16_nested sn16.f7: got {0} but expected {1}", sn16.f7, 7+9);
1008 return 7;
1010 if (sn16.f8 != 8+9) {
1011 Console.WriteLine(" sbyte16_nested sn16.f8: got {0} but expected {1}", sn16.f8, 8+9);
1012 return 8;
1014 if (sn16.f9 != 9+9) {
1015 Console.WriteLine(" sbyte16_nested sn16.f9: got {0} but expected {1}", sn16.f9, 9+9);
1016 return 9;
1018 if (sn16.f10 != 10+9) {
1019 Console.WriteLine(" sbyte16_nested sn16.f10: got {0} but expected {1}", sn16.f10, 10+9);
1020 return 10;
1022 if (sn16.f11 != 11+9) {
1023 Console.WriteLine(" sbyte16_nested sn16.f11: got {0} but expected {1}", sn16.f11, 11+9);
1024 return 11;
1026 if (sn16.f12 != 12+9) {
1027 Console.WriteLine(" sbyte16_nested sn16.f12: got {0} but expected {1}", sn16.f12, 12+9);
1028 return 12;
1030 if (sn16.f13 != 13+9) {
1031 Console.WriteLine(" sbyte16_nested sn16.f13: got {0} but expected {1}", sn16.f13, 13+9);
1032 return 13;
1034 if (sn16.f14 != 14+9) {
1035 Console.WriteLine(" sbyte16_nested sn16.f14: got {0} but expected {1}", sn16.f14, 14+9);
1036 return 14;
1038 if (sn16.f15 != 15+9) {
1039 Console.WriteLine(" sbyte16_nested sn16.f15: got {0} but expected {1}", sn16.f15, 15+9);
1040 return 15;
1042 if (sn16.nested2.f16 != 16+9) {
1043 Console.WriteLine(" sbyte16_nested sn16.nested2.f16: got {0} but expected {1}", sn16.nested2.f16, 16+9);
1044 return 16;
1047 return 0;
1048 } // end Main
1049 } // end class Test_sbyte