1 /* -----------------------------------------------------------------------
2 ffitest.c - Copyright (c) 1996, 1997, 1998, 2002 Red Hat, Inc.
4 Permission is hereby granted, free of charge, to any person obtaining
5 a copy of this software and associated documentation files (the
6 ``Software''), to deal in the Software without restriction, including
7 without limitation the rights to use, copy, modify, merge, publish,
8 distribute, sublicense, and/or sell copies of the Software, and to
9 permit persons to whom the Software is furnished to do so, subject to
10 the following conditions:
12 The above copyright notice and this permission notice shall be included
13 in all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 OTHER DEALINGS IN THE SOFTWARE.
22 ----------------------------------------------------------------------- */
30 /* This is lame. Long double support is barely there under SunOS 4.x */
31 #if defined(SPARC) && (SIZEOF_LONG_DOUBLE != 16)
32 #define BROKEN_LONG_DOUBLE
35 #define CHECK(x) !(x) ? fail(__FILE__, __LINE__) : 0
37 static int fail(char *file, int line)
39 fprintf(stderr, "Test failure: %s line %d\n", file, line);
47 static size_t my_strlen(char *s)
53 static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s)
57 #endif /* X86_WIN32 */
59 static int promotion(signed char sc, signed short ss,
60 unsigned char uc, unsigned short us)
62 int r = (int) sc + (int) ss + (int) uc + (int) us;
67 static signed char return_sc(signed char sc)
72 static unsigned char return_uc(unsigned char uc)
77 static long long return_ll(long long ll)
82 static int floating(int a, float b, double c, long double d, int e)
87 /* This is ifdef'd out for now. long double support under SunOS/gcc
88 is pretty much non-existent. You'll get the odd bus error in library
89 routines like printf(). */
90 printf("%d %f %f %Lf %d\n", a, (double)b, c, d, e);
93 i = (int) ((float)a/b + ((float)c/(float)d));
98 static float many(float f1,
113 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
114 (double) f1, (double) f2, (double) f3, (double) f4, (double) f5,
115 (double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
116 (double) f11, (double) f12, (double) f13);
119 return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
123 static float __attribute__((stdcall)) stdcall_many(float f1,
137 return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
139 #endif /* X86_WIN32 */
141 static double dblit(float f)
146 static long double ldblit(float f)
148 return (long double) (((long double) f)/ (long double) 3.0);
209 static test_structure_1 struct1(test_structure_1 ts)
220 static test_structure_2 struct2(test_structure_2 ts)
228 static test_structure_3 struct3(test_structure_3 ts)
235 static test_structure_4 struct4(test_structure_4 ts)
237 ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3;
242 static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2)
250 static test_structure_6 struct6 (test_structure_6 ts)
258 static test_structure_7 struct7 (test_structure_7 ts)
267 static test_structure_8 struct8 (test_structure_8 ts)
277 static test_structure_9 struct9 (test_structure_9 ts)
285 /* Take an int and a float argument, together with int userdata, and */
286 /* return the sum. */
289 closure_test_fn(ffi_cif* cif,void* resp,void** args, void* userdata)
291 *(ffi_arg*)resp = *(int*)args[0] + (int)(*(float*)args[1]) + (int)(long)userdata;
294 typedef int (*closure_test_type)(int, float);
297 int main(/*@unused@*/ int argc, /*@unused@*/ char *argv[])
300 ffi_type *args[MAX_ARGS];
301 void *values[MAX_ARGS];
327 ffi_type *ts1_type_elements[4];
328 ffi_type *ts2_type_elements[3];
329 ffi_type *ts3_type_elements[2];
330 ffi_type *ts4_type_elements[4];
331 ffi_type *ts5_type_elements[3];
332 ffi_type *ts6_type_elements[3];
333 ffi_type *ts7_type_elements[4];
334 ffi_type *ts8_type_elements[5];
335 ffi_type *ts9_type_elements[3];
338 ts1_type.alignment = 0;
339 ts1_type.type = FFI_TYPE_STRUCT;
342 ts2_type.alignment = 0;
343 ts2_type.type = FFI_TYPE_STRUCT;
346 ts3_type.alignment = 0;
347 ts3_type.type = FFI_TYPE_STRUCT;
350 ts4_type.alignment = 0;
351 ts4_type.type = FFI_TYPE_STRUCT;
354 ts5_type.alignment = 0;
355 ts5_type.type = FFI_TYPE_STRUCT;
358 ts6_type.alignment = 0;
359 ts6_type.type = FFI_TYPE_STRUCT;
362 ts7_type.alignment = 0;
363 ts7_type.type = FFI_TYPE_STRUCT;
366 ts8_type.alignment = 0;
367 ts8_type.type = FFI_TYPE_STRUCT;
370 ts9_type.alignment = 0;
371 ts9_type.type = FFI_TYPE_STRUCT;
373 /*@-immediatetrans@*/
374 ts1_type.elements = ts1_type_elements;
375 ts2_type.elements = ts2_type_elements;
376 ts3_type.elements = ts3_type_elements;
377 ts4_type.elements = ts4_type_elements;
378 ts5_type.elements = ts5_type_elements;
379 ts6_type.elements = ts6_type_elements;
380 ts7_type.elements = ts7_type_elements;
381 ts8_type.elements = ts8_type_elements;
382 ts9_type.elements = ts9_type_elements;
383 /*@=immediatetrans@*/
385 ts1_type_elements[0] = &ffi_type_uchar;
386 ts1_type_elements[1] = &ffi_type_double;
387 ts1_type_elements[2] = &ffi_type_uint;
388 ts1_type_elements[3] = NULL;
390 ts2_type_elements[0] = &ffi_type_double;
391 ts2_type_elements[1] = &ffi_type_double;
392 ts2_type_elements[2] = NULL;
394 ts3_type_elements[0] = &ffi_type_sint;
395 ts3_type_elements[1] = NULL;
397 ts4_type_elements[0] = &ffi_type_uint;
398 ts4_type_elements[1] = &ffi_type_uint;
399 ts4_type_elements[2] = &ffi_type_uint;
400 ts4_type_elements[3] = NULL;
402 ts5_type_elements[0] = &ffi_type_schar;
403 ts5_type_elements[1] = &ffi_type_schar;
404 ts5_type_elements[2] = NULL;
406 ts6_type_elements[0] = &ffi_type_float;
407 ts6_type_elements[1] = &ffi_type_double;
408 ts6_type_elements[2] = NULL;
410 ts7_type_elements[0] = &ffi_type_float;
411 ts7_type_elements[1] = &ffi_type_float;
412 ts7_type_elements[2] = &ffi_type_double;
413 ts7_type_elements[3] = NULL;
415 ts8_type_elements[0] = &ffi_type_float;
416 ts8_type_elements[1] = &ffi_type_float;
417 ts8_type_elements[2] = &ffi_type_float;
418 ts8_type_elements[3] = &ffi_type_float;
419 ts8_type_elements[4] = NULL;
421 ts9_type_elements[0] = &ffi_type_float;
422 ts9_type_elements[1] = &ffi_type_sint;
423 ts9_type_elements[2] = NULL;
427 /* return value tests */
429 #if defined(MIPS) /* || defined(ARM) */
430 puts ("long long tests not run. This is a known bug on this architecture.");
432 args[0] = &ffi_type_sint64;
435 /* Initialize the cif */
436 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
437 &ffi_type_sint64, args) == FFI_OK);
439 for (ll = 0LL; ll < 100LL; ll++)
442 ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
443 CHECK(rlonglong == ll);
446 for (ll = 55555555555000LL; ll < 55555555555100LL; ll++)
449 ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
450 CHECK(rlonglong == ll);
454 args[0] = &ffi_type_schar;
457 /* Initialize the cif */
458 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
459 &ffi_type_schar, args) == FFI_OK);
461 for (sc = (signed char) -127;
462 sc < (signed char) 127; /*@-type@*/ sc++ /*@=type@*/)
465 ffi_call(&cif, FFI_FN(return_sc), &rint, values);
466 CHECK(rint == (ffi_arg) sc);
469 args[0] = &ffi_type_uchar;
472 /* Initialize the cif */
473 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
474 &ffi_type_uchar, args) == FFI_OK);
476 for (uc = (unsigned char) '\x00';
477 uc < (unsigned char) '\xff'; /*@-type@*/ uc++ /*@=type@*/)
480 ffi_call(&cif, FFI_FN(return_uc), &rint, values);
481 CHECK(rint == (signed int) uc);
484 printf("%lu return value tests run\n", ul);
487 #ifdef BROKEN_LONG_DOUBLE
488 printf ("This architecture has broken `long double' support. No floating point\ntests have been run.\n");
490 /* float arg tests */
492 args[0] = &ffi_type_float;
495 /* Initialize the cif */
496 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
497 &ffi_type_longdouble, args) == FFI_OK);
502 /* This is ifdef'd out for now. long double support under SunOS/gcc
503 is pretty much non-existent. You'll get the odd bus error in library
504 routines like printf(). */
505 printf ("%Lf\n", ldblit(f));
508 ffi_call(&cif, FFI_FN(ldblit), &ld, values);
511 /* This is ifdef'd out for now. long double support under SunOS/gcc
512 is pretty much non-existent. You'll get the odd bus error in library
513 routines like printf(). */
514 printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
517 /* These are not always the same!! Check for a reasonable delta */
519 if (ld - ldblit(f) < LDBL_EPSILON)
521 puts("long double return value tests ok!");
526 /* float arg tests */
528 args[0] = &ffi_type_sint;
530 args[1] = &ffi_type_float;
532 args[2] = &ffi_type_double;
534 args[3] = &ffi_type_longdouble;
536 args[4] = &ffi_type_sint;
539 /* Initialize the cif */
540 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 5,
541 &ffi_type_sint, args) == FFI_OK);
545 d = (double)1.0/(double)3.0;
549 floating (si1, f, d, ld, si2);
551 ffi_call(&cif, FFI_FN(floating), &rint, values);
553 printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld, si2));
555 CHECK(rint == floating(si1, f, d, ld, si2));
557 printf("float arg tests ok!\n");
563 args[0] = &ffi_type_pointer;
564 values[0] = (void*) &s;
566 /* Initialize the cif */
567 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
568 &ffi_type_sint, args) == FFI_OK);
571 ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
575 ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
578 s = "1234567890123456789012345";
579 ffi_call(&cif, FFI_FN(my_strlen), &rint, values);
582 printf("strlen tests passed\n");
585 /* float arg tests */
587 args[0] = &ffi_type_float;
590 /* Initialize the cif */
591 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
592 &ffi_type_double, args) == FFI_OK);
596 ffi_call(&cif, FFI_FN(dblit), &d, values);
598 /* These are not always the same!! Check for a reasonable delta */
600 CHECK(d - dblit(f) < DBL_EPSILON);
603 printf("double return value tests ok!\n");
611 for (ul = 0; ul < 13; ul++)
613 args[ul] = &ffi_type_float;
614 values[ul] = &fa[ul];
618 /* Initialize the cif */
619 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13,
620 &ffi_type_float, args) == FFI_OK);
623 ff = many (fa[0], fa[1],
628 fa[10],fa[11],fa[12]);
631 ffi_call(&cif, FFI_FN(many), &f, values);
634 if (f - ff < FLT_EPSILON)
636 printf("many arg tests ok!\n");
639 printf("many arg tests failed! This is a gcc bug.\n");
645 /* promotion tests */
647 args[0] = &ffi_type_schar;
648 args[1] = &ffi_type_sshort;
649 args[2] = &ffi_type_uchar;
650 args[3] = &ffi_type_ushort;
656 /* Initialize the cif */
657 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4,
658 &ffi_type_sint, args) == FFI_OK);
663 for (sc = (signed char) -127;
664 sc <= (signed char) 120; /*@-type@*/ sc += 1 /*@=type@*/)
665 for (ss = -30000; ss <= 30000; ss += 10000)
666 for (uc = (unsigned char) 0;
667 uc <= (unsigned char) 200; /*@-type@*/ uc += 20 /*@=type@*/)
668 for (us = 0; us <= 60000; us += 10000)
671 ffi_call(&cif, FFI_FN(promotion), &rint, values);
672 CHECK((int)rint == (signed char) sc + (signed short) ss +
673 (unsigned char) uc + (unsigned short) us);
675 printf("%lu promotion tests run\n", ul);
678 #ifndef X86_WIN32 /* Structures dont work on Win32 */
682 test_structure_1 ts1_arg;
683 /* This is a hack to get a properly aligned result buffer */
684 test_structure_1 *ts1_result =
685 (test_structure_1 *) malloc (sizeof(test_structure_1));
688 values[0] = &ts1_arg;
690 /* Initialize the cif */
691 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
692 &ts1_type, args) == FFI_OK);
698 ffi_call(&cif, FFI_FN(struct1), ts1_result, values);
700 CHECK(ts1_result->ui == 556);
701 CHECK(ts1_result->d == 3.14159 - 1);
703 puts ("structure test 1 ok!\n");
710 test_structure_2 ts2_arg;
712 /* This is a hack to get a properly aligned result buffer */
713 test_structure_2 *ts2_result =
714 (test_structure_2 *) malloc (sizeof(test_structure_2));
717 values[0] = &ts2_arg;
719 /* Initialize the cif */
720 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK);
725 printf ("%g\n", ts2_result->d1);
726 printf ("%g\n", ts2_result->d2);
728 ffi_call(&cif, FFI_FN(struct2), ts2_result, values);
730 printf ("%g\n", ts2_result->d1);
731 printf ("%g\n", ts2_result->d2);
733 CHECK(ts2_result->d1 == 5.55 - 1);
734 CHECK(ts2_result->d2 == 6.66 - 1);
736 printf("structure test 2 ok!\n");
744 test_structure_3 ts3_arg;
745 test_structure_3 *ts3_result =
746 (test_structure_3 *) malloc (sizeof(test_structure_3));
749 values[0] = &ts3_arg;
751 /* Initialize the cif */
752 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
753 &ts3_type, args) == FFI_OK);
756 compare_value = ts3_arg.si;
758 ffi_call(&cif, FFI_FN(struct3), ts3_result, values);
760 printf ("%d %d\n", ts3_result->si, -(compare_value*2));
762 if (ts3_result->si == -(ts3_arg.si*2))
763 puts ("structure test 3 ok!");
766 puts ("Structure test 3 found structure passing bug.");
767 puts (" Current versions of GCC are not 100% compliant with the");
768 puts (" n32 ABI. There is a known problem related to passing");
769 puts (" small structures. Send a bug report to the gcc maintainers.");
777 test_structure_4 ts4_arg;
779 /* This is a hack to get a properly aligned result buffer */
780 test_structure_4 *ts4_result =
781 (test_structure_4 *) malloc (sizeof(test_structure_4));
784 values[0] = &ts4_arg;
786 /* Initialize the cif */
787 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK);
793 ffi_call (&cif, FFI_FN(struct4), ts4_result, values);
795 if (ts4_result->ui3 == 2U * 3U * 4U)
796 puts ("structure test 4 ok!");
798 puts ("Structure test 4 found GCC's structure passing bug.");
805 test_structure_5 ts5_arg1, ts5_arg2;
807 /* This is a hack to get a properly aligned result buffer */
808 test_structure_5 *ts5_result =
809 (test_structure_5 *) malloc (sizeof(test_structure_5));
813 values[0] = &ts5_arg1;
814 values[1] = &ts5_arg2;
816 /* Initialize the cif */
817 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK);
824 ffi_call (&cif, FFI_FN(struct5), ts5_result, values);
826 if (ts5_result->c1 == 7
827 && ts5_result->c2 == 3)
828 puts ("structure test 5 ok!");
830 puts ("Structure test 5 found GCC's structure passing bug.");
837 test_structure_6 ts6_arg;
839 /* This is a hack to get a properly aligned result buffer */
840 test_structure_6 *ts6_result =
841 (test_structure_6 *) malloc (sizeof(test_structure_6));
844 values[0] = &ts6_arg;
846 /* Initialize the cif */
847 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK);
852 printf ("%g\n", ts6_arg.f);
853 printf ("%g\n", ts6_arg.d);
855 ffi_call(&cif, FFI_FN(struct6), ts6_result, values);
857 printf ("%g\n", ts6_result->f);
858 printf ("%g\n", ts6_result->d);
860 CHECK(ts6_result->f == 5.55f + 1);
861 CHECK(ts6_result->d == 6.66 + 1);
863 printf("structure test 6 ok!\n");
870 test_structure_7 ts7_arg;
872 /* This is a hack to get a properly aligned result buffer */
873 test_structure_7 *ts7_result =
874 (test_structure_7 *) malloc (sizeof(test_structure_7));
877 values[0] = &ts7_arg;
879 /* Initialize the cif */
880 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts7_type, args) == FFI_OK);
886 printf ("%g\n", ts7_arg.f1);
887 printf ("%g\n", ts7_arg.f2);
888 printf ("%g\n", ts7_arg.d);
890 ffi_call(&cif, FFI_FN(struct7), ts7_result, values);
892 printf ("%g\n", ts7_result->f1);
893 printf ("%g\n", ts7_result->f2);
894 printf ("%g\n", ts7_result->d);
896 CHECK(ts7_result->f1 == 5.55f + 1);
897 CHECK(ts7_result->f2 == 55.5f + 1);
898 CHECK(ts7_result->d == 6.66 + 1);
900 printf("structure test 7 ok!\n");
907 test_structure_8 ts8_arg;
909 /* This is a hack to get a properly aligned result buffer */
910 test_structure_8 *ts8_result =
911 (test_structure_8 *) malloc (sizeof(test_structure_8));
914 values[0] = &ts8_arg;
916 /* Initialize the cif */
917 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK);
924 printf ("%g\n", ts8_arg.f1);
925 printf ("%g\n", ts8_arg.f2);
926 printf ("%g\n", ts8_arg.f3);
927 printf ("%g\n", ts8_arg.f4);
929 ffi_call(&cif, FFI_FN(struct8), ts8_result, values);
931 printf ("%g\n", ts8_result->f1);
932 printf ("%g\n", ts8_result->f2);
933 printf ("%g\n", ts8_result->f3);
934 printf ("%g\n", ts8_result->f4);
936 CHECK(ts8_result->f1 == 5.55f + 1);
937 CHECK(ts8_result->f2 == 55.5f + 1);
938 CHECK(ts8_result->f3 == -5.55f + 1);
939 CHECK(ts8_result->f4 == -55.5f + 1);
941 printf("structure test 8 ok!\n");
948 test_structure_9 ts9_arg;
950 /* This is a hack to get a properly aligned result buffer */
951 test_structure_9 *ts9_result =
952 (test_structure_9 *) malloc (sizeof(test_structure_9));
955 values[0] = &ts9_arg;
957 /* Initialize the cif */
958 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts9_type, args) == FFI_OK);
963 printf ("%g\n", ts9_arg.f);
964 printf ("%d\n", ts9_arg.i);
966 ffi_call(&cif, FFI_FN(struct9), ts9_result, values);
968 printf ("%g\n", ts9_result->f);
969 printf ("%d\n", ts9_result->i);
971 CHECK(ts9_result->f == 5.55f + 1);
972 CHECK(ts9_result->i == 5 + 1);
974 printf("structure test 9 ok!\n");
980 printf("Structure passing doesn't work on Win32.\n");
981 #endif /* X86_WIN32 */
984 /* stdcall strlen tests */
986 args[0] = &ffi_type_pointer;
987 values[0] = (void*) &s;
989 /* Initialize the cif */
990 CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1,
991 &ffi_type_sint, args) == FFI_OK);
994 ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values);
998 ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values);
1001 s = "1234567890123456789012345";
1002 ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values);
1005 printf("stdcall strlen tests passed\n");
1008 /* stdcall many arg tests */
1013 for (ul = 0; ul < 13; ul++)
1015 args[ul] = &ffi_type_float;
1016 values[ul] = &fa[ul];
1017 fa[ul] = (float) ul;
1020 /* Initialize the cif */
1021 CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13,
1022 &ffi_type_float, args) == FFI_OK);
1025 ff = stdcall_many(fa[0], fa[1],
1030 fa[10],fa[11],fa[12]);
1033 ffi_call(&cif, FFI_FN(stdcall_many), &f, values);
1036 if (f - ff < FLT_EPSILON)
1038 printf("stdcall many arg tests ok!\n");
1042 #endif /* X86_WIN32 */
1045 /* A simple closure test */
1048 ffi_type * cl_arg_types[3];
1050 cl_arg_types[0] = &ffi_type_sint;
1051 cl_arg_types[1] = &ffi_type_float;
1052 cl_arg_types[2] = NULL;
1054 /* Initialize the cif */
1055 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2,
1056 &ffi_type_sint, cl_arg_types) == FFI_OK);
1058 CHECK(ffi_prep_closure(&cl, &cif, closure_test_fn,
1059 (void *) 3 /* userdata */)
1061 CHECK((*((closure_test_type)(&cl)))(1, 2.0) == 6);
1065 /* If we arrived here, all is good */
1066 (void) puts("\nLooks good. No surprises.\n");