aboutsummaryrefslogtreecommitdiffstats
path: root/website/host-scripts/upload-website.sh
Commit message (Expand)AuthorAgeFilesLines
* Remove berlios from upload script.Matthias Andree2014-05-201-13/+1
* Also upload to SourceForge.Matthias Andree2010-05-271-0/+12
* Update documents/scripts after SVN -> Git move.Matthias Andree2010-02-061-7/+7
* Update upload script, use local public_html stagingl.Matthias Andree2009-10-301-2/+6
* Also upload website to TU Dortmund mirror at http://mandree.home.pages.de/fet...Matthias Andree2009-08-181-4/+18
* Fix permissions for rsync uploads.Matthias Andree2009-05-241-1/+2
* Track website in separate SVN directory (mostly symlinks for now).Matthias Andree2008-06-171-0/+31
id='n117' href='#n117'>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 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
/*************************************************************************
 * Regression test
 */

#include "triodef.h"
#if defined(TRIO_COMPILER_ANCIENT)
# include <varargs.h>
#else
# include <stdarg.h>
#endif
#include <math.h>
#include <limits.h>
#include <float.h>
#include <errno.h>

#include "trio.h"
#include "triop.h"
#include "trionan.h"
#if defined(TRIO_MINIMAL)
# define TRIO_STRING_PUBLIC static
# include "triostr.c"
#else
# include "triostr.h"
#endif
#undef printf

#if TRIO_WIDECHAR
# include <wchar.h>
#endif

#define QUOTE(x) #x

#define DOUBLE_EQUAL(x,y) (((x)>(y)-DBL_EPSILON) && ((x)<(y)+DBL_EPSILON))
#define FLOAT_EQUAL(x,y) (((x)>(y)-FLT_EPSILON) && ((x)<(y)+FLT_EPSILON))

static TRIO_CONST char rcsid[] = "@(#)$Id: regression.c,v 1.44 2002/12/29 15:08:56 breese Exp $";


/*************************************************************************
 *
 */
static void
Dump
TRIO_ARGS2((buffer, rc),
	   char *buffer,
	   int rc)
{
  if (rc < 0)
    {
      printf("Err = %d (%s), Pos = %d\n",
	     TRIO_ERROR_CODE(rc),
	     TRIO_ERROR_NAME(rc),
	     TRIO_ERROR_POSITION(rc));
    }
  else if (buffer)
    printf("buffer[% 3d] = \"%s\"\n", rc, buffer);
}

/*************************************************************************
 *
 */
static void
Report0
TRIO_ARGS2((file, line),
          TRIO_CONST char *file,
          int line)
{
  printf("Verification failed in %s:%d.\n", file, line);
}

/*************************************************************************
 *
 */
static void
Report
TRIO_ARGS4((file, line, expected, got),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *got)
{
  Report0(file, line);
  printf("  Expected \"%s\"\n", expected);
  printf("  Got      \"%s\"\n", got);
}

/*************************************************************************
 *
 */
int
Verify
TRIO_VARGS5((file, line, result, fmt, va_alist),
	    TRIO_CONST char *file,
	    int line,
	    TRIO_CONST char *result,
	    TRIO_CONST char *fmt,
	    TRIO_VA_DECL)
{
  int rc;
  va_list args;
  char buffer[4096];

  TRIO_VA_START(args, fmt);
  rc = trio_vsnprintf(buffer, sizeof(buffer), fmt, args);
  if (rc < 0)
    Dump(buffer, rc);
  TRIO_VA_END(args);

  if (!trio_equal_case(result, buffer))
    {
      Report(file, line, result, buffer);
      return 1;
    }
  return 0;
}

/*************************************************************************
 *
 */
int
VerifyReturnValues(TRIO_NOARGS)
{
  int nerrors = 0;
  int rc;
  int count;
  char *expected;
  char buffer[4096];
  char result[4096];

  rc = trio_sprintf(buffer, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 10 0123456789";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }
  
  rc = trio_snprintf(buffer, sizeof(buffer), "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 10 0123456789";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }
  
  rc = trio_snprintf(buffer, 4, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 3 012";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }

  /* The output buffer contains the empty string */
  rc = trio_snprintf(buffer, 1, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 0 ";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }

  /* The output buffer should be left untouched when max size is 0 */
  trio_sprintf(buffer, "DO NOT TOUCH");
  rc = trio_snprintf(buffer, 0, "%s%n", "0123456789", &count);
  trio_sprintf(result, "%d %d %s", rc, count, buffer);
  expected = "10 0 DO NOT TOUCH";
  if (!trio_equal_case(result, expected))
    {
      nerrors++;
      Report(__FILE__, __LINE__, expected, result);
    }
  
  return nerrors;
}

/*************************************************************************
 *
 */
#define TEST_STRING "0123456789"

int
VerifyAllocate(TRIO_NOARGS)
{
  int nerrors = 0;
  int rc;
  char *string;
  int count;
  int test_size = sizeof(TEST_STRING) - 1;

  /* Allocate a string with the result */
  rc = trio_asprintf(&string, "%s%n", TEST_STRING, &count);
  if (rc < 0)
    {
      nerrors++;
      Dump(string, rc);
    }
  else if (count != test_size)
    {
      nerrors++;
      printf("Validation failed in %s:%d\n", __FILE__, __LINE__);
      printf("  Expected %%n = %d\n", test_size);
      printf("  Got      %%n = %d\n", count);
    }
  else if (!trio_equal_case(string, TEST_STRING))
    {
      nerrors++;
      Report(__FILE__, __LINE__, TEST_STRING, string);
    }
  if (string)
    free(string);

  return nerrors;
}


/*************************************************************************
 *
 */
int
VerifyFormatting(TRIO_NOARGS)
{
  int nerrors = 0;
  char buffer[256];

  /* Normal text */
  nerrors += Verify(__FILE__, __LINE__, "Hello world",
		   "Hello world");
  /* String */
  nerrors += Verify(__FILE__, __LINE__, "Hello world",
		   "%s", "Hello world");
  /* Pointer */
  if (sizeof(void *) == 4)
    {
      nerrors += Verify(__FILE__, __LINE__, "Pointer 0x01234567",
			"Pointer %p", 0x1234567);
    }
  else if (sizeof(void *) == 8)
    {
      nerrors += Verify(__FILE__, __LINE__, "Pointer 0x0123456789012345",
			"Pointer %p", 0x123456789012345);
    }
  /* Nil pointer */
  nerrors += Verify(__FILE__, __LINE__, "Pointer (nil)",
		   "Pointer %p", NULL);
  /* Integer */
  nerrors += Verify(__FILE__, __LINE__, "Number 42",
		   "Number %d", 42);
  nerrors += Verify(__FILE__, __LINE__, "Number -42",
		   "Number %d", -42);
  nerrors += Verify(__FILE__, __LINE__, "Number 42",
		   "Number %ld", 42L);
  nerrors += Verify(__FILE__, __LINE__, "Number -42",
		   "Number %ld", -42L);
  /* Integer width */
  nerrors += Verify(__FILE__, __LINE__, "  1234",
		    "%6d", 1234);
  nerrors += Verify(__FILE__, __LINE__, "  1234",
		    "%*d", 6, 1234);
  /* Integer width overrun */
  nerrors += Verify(__FILE__, __LINE__, "123456",
		    "%4d", 123456);
  /* Integer precision */
  nerrors += Verify(__FILE__, __LINE__, "0012",
		    "%.4d", 12);
  nerrors += Verify(__FILE__, __LINE__, "0012",
		    "%.*d", 4, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%6.*d", 4, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%*.*d", 6, 4, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%*.*.*d", 6, 4, 2, 12);
  nerrors += Verify(__FILE__, __LINE__, "  0012",
		    "%*.*.*i", 6, 4, 10, 12);
  /* Integer sign, zero-padding, and width */
  nerrors += Verify(__FILE__, __LINE__, "+01234",
		    "%+06d", 1234);
  nerrors += Verify(__FILE__, __LINE__, " 01234",
		    "% 06d", 1234);
  nerrors += Verify(__FILE__, __LINE__, "+01234",
		    "% +06d", 1234);
  /* Integer adjust, zero-padding, and width */
  nerrors += Verify(__FILE__, __LINE__, "12      ",
		    "%-08d", 12);
  /* Integer zero-padding, width, and precision */
  nerrors += Verify(__FILE__, __LINE__, "  000012",
		    "%08.6d", 12);
  /* Integer base */
  nerrors += Verify(__FILE__, __LINE__, "42",
		   "%u", 42);
  nerrors += Verify(__FILE__, __LINE__, "-1",
		   "%d", -1);
  nerrors += Verify(__FILE__, __LINE__, "52",
		   "%o", 42);
  nerrors += Verify(__FILE__, __LINE__, "052",
		   "%#o", 42);
  nerrors += Verify(__FILE__, __LINE__, "0",
		   "%#o", 0);
  nerrors += Verify(__FILE__, __LINE__, "2a",
		    "%x", 42);
  nerrors += Verify(__FILE__, __LINE__, "2A",
		    "%X", 42);
  nerrors += Verify(__FILE__, __LINE__, "0x2a",
		   "%#x", 42);
  nerrors += Verify(__FILE__, __LINE__, "0X2A",
		   "%#X", 42);
  nerrors += Verify(__FILE__, __LINE__, "0x00c ",
		   "%-#6.3x", 12);
  nerrors += Verify(__FILE__, __LINE__, "",
		   "%.d", 0);
  nerrors += Verify(__FILE__, __LINE__, "",
		   "%#.d", 0);
  nerrors += Verify(__FILE__, __LINE__, "42",
		   "%.d", 42);
  nerrors += Verify(__FILE__, __LINE__, "",
		   "%.o", 0);
  nerrors += Verify(__FILE__, __LINE__, "    0000",
		   "%8.4o", 0);
  nerrors += Verify(__FILE__, __LINE__, "       0",
		   "%8o", 0);
  nerrors += Verify(__FILE__, __LINE__, "00000000",
		   "%08o", 0);
  nerrors += Verify(__FILE__, __LINE__, "0",
		   "%#.o", 0);
  nerrors += Verify(__FILE__, __LINE__, "52",
		   "%.o", 42);
  nerrors += Verify(__FILE__, __LINE__, "",
		   "%.x", 0);
  nerrors += Verify(__FILE__, __LINE__, "",
		   "%#.x", 0);
  nerrors += Verify(__FILE__, __LINE__, "2a",
		   "%.x", 42);
  sprintf(buffer, "%u", UINT_MAX);
  nerrors += Verify(__FILE__, __LINE__, buffer,
		   "%u", -1);
  sprintf(buffer, "%x", UINT_MAX);
  nerrors += Verify(__FILE__, __LINE__, buffer,
		    "%x", -1);
  /* Double */
  nerrors += Verify(__FILE__, __LINE__, "3141.000000",
		    "%f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.500000",
		    "%f", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3.141000e+03",
		    "%e", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "     -2.3420e-02",
		    "%16.4e", -2.342E-02);
  nerrors += Verify(__FILE__, __LINE__, "     -2.3420e-22",
		    "%16.4e", -2.342E-22);
  nerrors += Verify(__FILE__, __LINE__, "      2.3420e-02",
		    "% 16.4e", 2.342E-02);
  nerrors += Verify(__FILE__, __LINE__, " 2.3420e-02",
		    "% 1.4e", 2.342E-02);
  nerrors += Verify(__FILE__, __LINE__, "3.141000E-44",
		    "%E", 3.141e-44);
  nerrors += Verify(__FILE__, __LINE__, "0",
		    "%g", 0.0);
  nerrors += Verify(__FILE__, __LINE__, "-0",
		    "%g", trio_nzero());
  nerrors += Verify(__FILE__, __LINE__, "3141.5",
		    "%g", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3.1415E-06",
		    "%G", 3.1415e-6);
  nerrors += Verify(__FILE__, __LINE__, "+3141.000000",
		    "%+f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "-3141.000000",
		    "%+f", -3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0.333333",
		    "%f", 1.0/3.0);
  nerrors += Verify(__FILE__, __LINE__, "0.666667",
		    "%f", 2.0/3.0);
  /* Beyond accuracy */
  nerrors += Verify(__FILE__, __LINE__, "0.000000",
		    "%f", 1.234567890123456789e-20);
#if defined(TRIO_BREESE)
  nerrors += Verify(__FILE__, __LINE__, "1.3999999999999999111821580299875",
		    "%.32g", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.39999999999999991118215802998748",
		    "%.32f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.3999999999999999111821580300",
		    "%.28f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.399999999999999911182158",
		    "%.24f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.39999999999999991",
		    "%.17f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.40000000000000",
		    "%.14f", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "39413.800000000002910383045673370361",
		    "%.30f", 39413.80);
#endif
  /* 2^-1 + 2^-15 */
  nerrors += Verify(__FILE__, __LINE__, "0.500030517578125",
		    "%.*g", DBL_DIG + 10, 0.500030517578125);
  /* Double decimal point */
  nerrors += Verify(__FILE__, __LINE__, "3141",
		    "%.0f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3142",
		    "%.0f", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3141",
		    "%.f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "12",
		    "%.f", 12.34);
  nerrors += Verify(__FILE__, __LINE__, "3141.000",
		    "%.3f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.000000",
		    "%#f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0.0000",
		    "%#.4f", 0.0);
  nerrors += Verify(__FILE__, __LINE__, "0.000",
		    "%#.4g", 0.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.0000",
		    "%#.4f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.",
		    "%#.0f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3141.",
		    "%#.f", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "11.0000",
		    "%#.4f", 11.0);
  nerrors += Verify(__FILE__, __LINE__, "100.00",
		    "%.2f", 99.9999);
  nerrors += Verify(__FILE__, __LINE__, "3e+03",
		    "%.e", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "3.e+03",
		    "%#.e", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "100",
		    "%.2g", 99.9999);
  nerrors += Verify(__FILE__, __LINE__, "100.",
		    "%#.2g", 99.9999);
  nerrors += Verify(__FILE__, __LINE__, "0.123",
		    "%0g", 0.123);
  nerrors += Verify(__FILE__, __LINE__, "1.00e+00",
		    "%.2e", 0.9999);
  nerrors += Verify(__FILE__, __LINE__, "1",
		    "%.2g", 0.9999);
  nerrors += Verify(__FILE__, __LINE__, "2",
		    "%.g", 1.5);
  nerrors += Verify(__FILE__, __LINE__, "0.01",
		    "%.2g", 0.01);
  nerrors += Verify(__FILE__, __LINE__, "0.010",
		    "%#.2g", 0.01);
  /* Double width, precision, and zero padding */
  nerrors += Verify(__FILE__, __LINE__, "00003.141500e+03",
		    "%016e", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "    3.141500e+03",
		    "%16e", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "3.141500e+03    ",
		    "%-16e", 3141.5);
  nerrors += Verify(__FILE__, __LINE__, "03.142e+03",
		    "%010.3e", 3141.5);
#if !defined(TRIO_COMPILER_ANCIENT)
  /* Long double */
  nerrors += Verify(__FILE__, __LINE__, "1.400000",
		    "%Lf", 1.4L);
#endif
  
  /* Special cases */
  nerrors += Verify(__FILE__, __LINE__, "1.00",
		    "%.2f", 0.999);
  nerrors += Verify(__FILE__, __LINE__, "100",
		    "%.0f", 99.9);
  nerrors += Verify(__FILE__, __LINE__, "inf",
		    "%f", trio_pinf());
  nerrors += Verify(__FILE__, __LINE__, "-inf",
		    "%f", trio_ninf());
  nerrors += Verify(__FILE__, __LINE__, "INF",
		    "%F", trio_pinf());
  nerrors += Verify(__FILE__, __LINE__, "-INF",
		    "%F", trio_ninf());
  /* May fail if NaN is unsupported */
  nerrors += Verify(__FILE__, __LINE__, "nan",
		    "%f", trio_nan());
  nerrors += Verify(__FILE__, __LINE__, "NAN",
		    "%F", trio_nan());
  
  /* Char width alignment */
  nerrors += Verify(__FILE__, __LINE__, "Char X   .",
	 "Char %-4c.", 'X');
  /* String width / precision */
  nerrors += Verify(__FILE__, __LINE__, " testing",
		    "%8s", "testing");
  nerrors += Verify(__FILE__, __LINE__, "testing ",
		    "%-8s", "testing");
  nerrors += Verify(__FILE__, __LINE__, " testing",
		    "%*s", 8, "testing");
  nerrors += Verify(__FILE__, __LINE__, "testing ",
		    "%*s", -8, "testing");
  nerrors += Verify(__FILE__, __LINE__, "test",
		    "%.4s", "testing");
  nerrors += Verify(__FILE__, __LINE__, "test",
		    "%.*s", 4, "testing");
  nerrors += Verify(__FILE__, __LINE__, "testing",
		    "%.*s", -4, "testing");
#if TRIO_UNIX98
  /* Positional */
  nerrors += Verify(__FILE__, __LINE__, "222 111",
		    "%2$s %1$s", "111", "222");
  nerrors += Verify(__FILE__, __LINE__, "123456    12345 0001234  00123",
		    "%4$d %3$*8$d %2$.*7$d %1$*6$.*5$d",
		    123, 1234, 12345, 123456, 5, 6, 7, 8);
#endif
  
#if TRIO_GNU
  nerrors += Verify(__FILE__, __LINE__, "256",
		    "%Zd", sizeof(buffer));
  errno = EINTR;
  nerrors += Verify(__FILE__, __LINE__, "Interrupted system call",
		    "%m");
#endif
  
#if TRIO_BSD || TRIO_GNU
# if defined(TRIO_COMPILER_SUPPORTS_LL)
  /* This may fail if the preprocessor does not recognize LL */
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%qd", 42LL);
# endif
#endif
  
#if TRIO_C99
  nerrors += Verify(__FILE__, __LINE__, "0x2.ap+4",
		    "%a", 42.0);
  nerrors += Verify(__FILE__, __LINE__, "-0x2.ap+4",
		    "%a", -42.0);
  nerrors += Verify(__FILE__, __LINE__, "0x1.8p+0",
		    "%a", 1.5);
  nerrors += Verify(__FILE__, __LINE__, "0x1.6666666666666p+0",
		    "%a", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "0xc.45p+8",
		    "%a", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0XC.45P+8",
		    "%A", 3141.0);
  nerrors += Verify(__FILE__, __LINE__, "0xb.351c434a98fa8p-148",
		    "%a", 3.141e-44);
  nerrors += Verify(__FILE__, __LINE__, "256",
		    "%zd", sizeof(buffer));
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%td", 42);
# if defined(TRIO_COMPILER_SUPPORTS_LL)
  /* Some compilers may not handle the LL suffix correctly */
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%jd", 42LL);
# endif
#endif

#if TRIO_WIDECHAR
  nerrors += Verify(__FILE__, __LINE__, "Hello World",
		    "%ls", L"Hello World");
  nerrors += Verify(__FILE__, __LINE__, "\\aHello World",
		    "%#ls", L"\aHello World");
  nerrors += Verify(__FILE__, __LINE__, "A",
		    "%lc", L'A');
  nerrors += Verify(__FILE__, __LINE__, "\\a",
		    "%#lc", L'\a');
#endif

#if TRIO_MICROSOFT
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%I8d", 42);
  nerrors += Verify(__FILE__, __LINE__, "ffffffff",
		    "%I16x", -1);
#endif
  
#if TRIO_EXTENSION
  nerrors += Verify(__FILE__, __LINE__, "  42   86",
		    "%!4d %d", 42, 86);
  nerrors += Verify(__FILE__, __LINE__, "0042 0086",
		    "%!04d %d", 42, 86);
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%&d", sizeof(long), 42L);
  /* Non-printable string */
  nerrors += Verify(__FILE__, __LINE__, "NonPrintable \\x01 \\a \\\\",
		    "NonPrintable %#s", "\01 \07 \\");
  nerrors += Verify(__FILE__, __LINE__, "\\a \\b \\t \\n \\v \\f \\r",
		    "%#s", "\007 \010 \011 \012 \013 \014 \015");
  /* Quote flag */
  nerrors += Verify(__FILE__, __LINE__, "Another \"quoted\" string",
		   "Another %'s string", "quoted");
  /* Integer base */
  nerrors += Verify(__FILE__, __LINE__, "Number 42 == 1120 (base 3)",
		    "Number %d == %..3i (base 3)", 42, 42);
  /* Integer base (specifier base must be used instead of base modifier) */
  nerrors += Verify(__FILE__, __LINE__, "42",
		    "%..3d", 42);
  nerrors += Verify(__FILE__, __LINE__, "52",
		    "%..3o", 42);
  nerrors += Verify(__FILE__, __LINE__, "2a",
		    "%..3x", 42);
  /* Integer thousand separator */
  nerrors += Verify(__FILE__, __LINE__, "Number 100",
		    "Number %'d", 100);
  nerrors += Verify(__FILE__, __LINE__, "Number 1,000,000",
		    "Number %'d", 1000000);
  /* Float thousand separator */
  nerrors += Verify(__FILE__, __LINE__, "31,415.200000",
		    "%'f", 31415.2);
  nerrors += Verify(__FILE__, __LINE__, "1,000,000.000000",
		    "%'f", 1000000.0);
  /* Rounding modifier */
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%.32Rf", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%.17Rf", 1.4);
  nerrors += Verify(__FILE__, __LINE__, "39413.8",
		    "%.30Rf", 39413.80);
# if !defined(TRIO_COMPILER_ANCIENT)
  /* Long double */
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%RLf", 1.4L);
  nerrors += Verify(__FILE__, __LINE__, "1.4",
		    "%.30RLf", 1.4L);
# endif
#endif

#if defined(TRIO_BREESE)
  /*
   * These results depends on issues beyond our control. For example,
   * the accuracy of floating-point numbers depends on the underlying
   * floating-point hardware (e.g. whether IEEE 754 double or extended-
   * double format is used).
   *
   * These tests are therefore not part of the normal regression test,
   * but we keep them here for development purposes.
   */
  nerrors += Verify(__FILE__, __LINE__, "123456789012345680868.000000",
		    "%f", 1.234567890123456789e20);
  nerrors += Verify(__FILE__, __LINE__, "1.23456789012345677901e-20",
		    "%.20e", 1.2345678901234567e-20);
  nerrors += Verify(__FILE__, __LINE__, "0.666666666666666629659233",
		    "%.*g", DBL_DIG + 10, 2.0/3.0);
  nerrors += Verify(__FILE__, __LINE__, "123456789012345700000",
		    "%Rf", 1.234567890123456789e20);
# if !defined(TRIO_COMPILER_ANCIENT)
  nerrors += Verify(__FILE__, __LINE__, "0.666666666666666667",
		    "%RLf", (2.0L/3.0L));
  nerrors += Verify(__FILE__, __LINE__, "0.666666666666666667",
		    "%.30RLf", (2.0L/3.0L));
# endif
#endif
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyErrors(TRIO_NOARGS)
{
  char buffer[512];
  int rc;
  int nerrors = 0;
  
  /* Error: Invalid argument 1 */
  rc = trio_snprintf(buffer, sizeof(buffer), "%d %r", 42, "text");
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 5",
		    "%s", buffer);
#else
  nerrors += (rc != -1);
#endif
  /* Error: Invalid argument 2 */
  rc = trio_snprintf(buffer, sizeof(buffer), "%#");
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 3",
		    "%s", buffer);
#else
  nerrors += (rc != -1);
#endif
  /* Error: Invalid argument 3 */
  rc = trio_snprintf(buffer, sizeof(buffer), "%hhhd", 42);
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 4",
		    "%s", buffer);
#else
  nerrors += (rc != -1);
#endif
  /* Error: Double reference */
  rc = trio_snprintf(buffer, sizeof(buffer), "hello %1$d %1$d", 31, 32);
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
# if TRIO_UNIX98
  nerrors += Verify(__FILE__, __LINE__, "Err = 4 (Double reference), Pos = 0",
		    "%s", buffer);
# else
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 9",
		    "%s", buffer);
# endif
#else
  nerrors += (rc != -1);
#endif
  /* Error: Reference gap */
  rc = trio_snprintf(buffer, sizeof(buffer), "%3$d %1$d", 31, 32, 33);
#if TRIO_ERRORS
  trio_snprintf(buffer, sizeof(buffer), "Err = %d (%s), Pos = %d",
		TRIO_ERROR_CODE(rc),
		TRIO_ERROR_NAME(rc),
		TRIO_ERROR_POSITION(rc));
# if TRIO_UNIX98
  nerrors += Verify(__FILE__, __LINE__, "Err = 5 (Reference gap), Pos = 1",
		    "%s", buffer);
# else
  nerrors += Verify(__FILE__, __LINE__, "Err = 2 (Invalid argument), Pos = 3",
		    "%s", buffer);
# endif
#else
  nerrors += (rc != -1);
#endif
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningOneInteger
TRIO_ARGS5((file, line, expected, format, original),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *format,
	   int original)
{
  int number;
  char data[512];
  
  trio_snprintf(data, sizeof(data), format, original);
  trio_sscanf(data, format, &number);
  return Verify(file, line, expected, format, number);
}

int
VerifyScanningIntegers(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "42",
				      "%i", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "42",
				      "%d", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "-42",
				      "%d", -42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "2147483647",
				      "%d", 2147483647);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "42",
				      "%u", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "2a",
				      "%x", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "52",
				      "%o", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "101010",
				      "%..2i", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "0x2a",
				      "%#x", 42);
  nerrors += VerifyScanningOneInteger(__FILE__, __LINE__, "052",
				      "%#o", 42);

  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningOneFloat
TRIO_ARGS5((file, line, expected, format, original),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *format,
	   double original)
{
  double number;
  char data[512];
  
  trio_snprintf(data, sizeof(data), format, original);
  trio_sscanf(data, format, &number);
  return Verify(file, line, expected, format, number);
}

int
VerifyScanningFloats(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "42.000000",
				      "%f", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "-42.000000",
				      "%f", -42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "4.200000e+01",
				      "%e", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "4.200000E+01",
				      "%E", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "42",
				      "%g", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457e+06",
				      "%g", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457e-06",
				      "%g", 1.234567e-6);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457E+06",
				      "%G", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.234567e+06",
				      "%12e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.234500e+00",
				      "%6e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.234567e+06",
				      "%.6e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.2345670000e+06",
				      "%.10e", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.23457e+06",
				      "%.6g", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1234567",
				      "%.10g", 1234567.0);
#if TRIO_C99
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "0x2.ap+4",
				      "%a", 42.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "0x1.2d687p+20",
				      "%a", 1234567.0);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "0X1.2D687P+20",
				      "%A", 1234567.0);
#endif
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "1.79769e+308",
				      "%g", 1.79769e+308);
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "nan",
				      "%f", trio_nan());
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "NAN",
				      "%F", trio_nan());
  nerrors += VerifyScanningOneFloat(__FILE__, __LINE__, "-inf",
				      "%f", trio_ninf());
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningOneString
TRIO_ARGS5((file, line, expected, format, original),
	   TRIO_CONST char *file,
	   int line,
	   TRIO_CONST char *expected,
	   TRIO_CONST char *format,
	   char *original)
{
  char string[512];
  char data[512];
  
  trio_snprintf(data, sizeof(data), "%s", original);
  trio_sscanf(data, format, string);
  return Verify(file, line, expected, "%s", string);
}

int
VerifyScanningStrings(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello",
				     "%s", "hello");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello",
				     "%s", "hello world");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello world",
				     "%[^\n]", "hello world");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "(nil)",
				     "%s", NULL);
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "hello",
				     "%20s", "hello");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "he",
				     "%2s", "hello");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "ab",
				     "%[ab]", "abcba");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "abcba",
				     "%[abc]", "abcba");
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "abcba",
				     "%[a-c]", "abcba");
#if TRIO_EXTENSION
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "abcba",
				     "%[[:alpha:]]", "abcba");
#endif
  nerrors += VerifyScanningOneString(__FILE__, __LINE__, "ba",
				     "%*[ab]c%[^\n]", "abcba");

  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanningRegression(TRIO_NOARGS)
{
  int nerrors = 0;
  int rc;
  int index;
  double dnumber;
  trio_long_double_t ldnumber;
  long lnumber;
  int number;
  char ch;

  rc = trio_sscanf("1.5", "%lf%n", &dnumber, &index);
  nerrors += Verify(__FILE__, __LINE__, "1 3 1.500000",
		    "%d %d %f", rc, index, dnumber);
  rc = trio_sscanf("q 123", "%c%ld", &ch, &lnumber);
  nerrors += Verify(__FILE__, __LINE__, "q 123",
		    "%c %ld", ch, lnumber);
  rc = trio_sscanf("abc", "%*s%n", &number);
  nerrors += Verify(__FILE__, __LINE__, "0 3",
		    "%d %d", rc, number);
  rc = trio_sscanf("abc def", "%*s%n", &number);
  nerrors += Verify(__FILE__, __LINE__, "0 3",
		    "%d %d", rc, number);
  rc = trio_sscanf("0.141882295971771490", "%lf", &dnumber);
  number = 33;
  rc = trio_sscanf("total 1", "total %d", &number);
  nerrors += Verify(__FILE__, __LINE__, "1 1",
		    "%d %d", rc, number);
#if defined(TRIO_BREESE)
  nerrors += Verify(__FILE__, __LINE__, "1 0.141882295971771488",
		    "%d %.18f", rc, dnumber);
  rc = trio_sscanf("0.141882295971771490", "%Lf", &ldnumber);
  nerrors += Verify(__FILE__, __LINE__, "1 0.141882295971771490",
		    "%d %.18Lf", rc, ldnumber);
#endif
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyScanning(TRIO_NOARGS)
{
  int nerrors = 0;

  nerrors += VerifyScanningIntegers();
  nerrors += VerifyScanningFloats();
  nerrors += VerifyScanningStrings();
  nerrors += VerifyScanningRegression();
  
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyStrings(TRIO_NOARGS)
{
  int nerrors = 0;
#if !defined(TRIO_MINIMAL)
  char buffer[512];
  double dnumber;
  float fnumber;
  char *end;

  /* Comparison */
  trio_copy(buffer, "Find me now");
  if (trio_length(buffer) != sizeof("Find me now") - 1) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal(buffer, "Find me now")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal_case(buffer, "Find me now")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_equal_case(buffer, "FIND ME NOW")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal_max(buffer, sizeof("Find me") - 1, "Find ME")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_contains(buffer, "me")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_contains(buffer, "and me")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_substring(buffer, "me") == NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_substring_max(buffer, 4, "me") != NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_match(buffer, "* me *")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_match_case(buffer, "* ME *")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_index(buffer, 'n') == NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_index(buffer, '_') != NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_index_last(buffer, 'n') == NULL) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }

  /* Append */
  trio_copy(buffer, "Find me now");
  if (!trio_append(buffer, " and again")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal(buffer, "Find me now and again")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_append_max(buffer, 0, "should not appear")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (!trio_equal(buffer, "Find me now and again")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  
  /* To upper/lower */
  trio_copy(buffer, "Find me now");
  trio_upper(buffer);
  if (!trio_equal_case(buffer, "FIND ME NOW")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  trio_lower(buffer);
  if (!trio_equal_case(buffer, "find me now")) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }

  /* Double conversion */
  trio_copy(buffer, "3.1415");
  dnumber = trio_to_double(buffer, NULL);
  if (!DOUBLE_EQUAL(dnumber, 3.1415)) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  fnumber = trio_to_float(buffer, NULL);
  if (!FLOAT_EQUAL(fnumber, 3.1415)) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }

  /* Long conversion */
  trio_copy(buffer, "3.1415");
  if (trio_to_long(buffer, NULL, 10) != 3L) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  if (trio_to_long(buffer, NULL, 4) != 3L) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  trio_to_long(buffer, &end, 2);
  if (end != buffer) {
    nerrors++;
    Report0(__FILE__, __LINE__);
  }
  
#endif /* !defined(TRIO_MINIMAL) */
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyDynamicStrings(TRIO_NOARGS)
{
  int nerrors = 0;
#if !defined(TRIO_MINIMAL)
  trio_string_t *string;

  string = trio_xstring_duplicate("Find me now");
  if (string == NULL) {
    nerrors++;
    goto error;
  }
  if (!trio_xstring_equal(string, "FIND ME NOW"))
    nerrors++;
  if (!trio_xstring_append(string, " and again") ||
      !trio_xstring_equal(string, "FIND ME NOW AND AGAIN"))
    nerrors++;
  if (!trio_xstring_contains(string, "me"))
    nerrors++;
  if (trio_xstring_contains(string, "ME"))
    nerrors++;
  if (!trio_xstring_match(string, "* me *"))
    nerrors++;
  if (trio_xstring_match_case(string, "* ME *"))
    nerrors++;
  
 error:
  if (string)
    trio_string_destroy(string);
  
#endif /* !defined(TRIO_MINIMAL) */
  return nerrors;
}

/*************************************************************************
 *
 */
int
VerifyNaN(TRIO_NOARGS)
{
  double ninf_number = trio_ninf();
  double pinf_number = trio_pinf();
  double nan_number = trio_nan();
  int nerrors = 0;
  
  nerrors += Verify(__FILE__, __LINE__, "-1",
		    "%d", trio_isinf(ninf_number));
  nerrors += Verify(__FILE__, __LINE__, "0",
		    "%d", trio_isinf(42.0));
  nerrors += Verify(__FILE__, __LINE__, "1",
		    "%d", trio_isinf(pinf_number));
  nerrors += Verify(__FILE__, __LINE__, "1",
		    "%d", trio_isnan(nan_number));
  nerrors += Verify(__FILE__, __LINE__, "0",
		    "%d", trio_isnan(42.0));

  return nerrors;
}

/*************************************************************************
 *
 */
int
main(TRIO_NOARGS)
{
  int nerrors = 0;

  printf("%s\n", rcsid);

  /* Override system locale settings */
  trio_locale_set_decimal_point(".");
  trio_locale_set_thousand_separator(",");
  trio_locale_set_grouping("\3");

  printf("Verifying strings\n");
  nerrors += VerifyStrings();
  
  printf("Verifying dynamic strings\n");
  nerrors += VerifyDynamicStrings();

  printf("Verifying special quantities\n");
  nerrors += VerifyNaN();
  
  printf("Verifying formatting\n");
  nerrors += VerifyFormatting();
  
  printf("Verifying scanning\n");
  nerrors += VerifyScanning();
  
  printf("Verifying return values\n");
  nerrors += VerifyErrors();
  nerrors += VerifyReturnValues();
  
  printf("Verifying allocation\n");
  nerrors += VerifyAllocate();

  if (nerrors == 0)
    printf("Regression test suceeded\n");
  else
    printf("Regression test failed in %d instance(s)\n", nerrors);
  
  return nerrors ? 1 : 0;
}