Define CMPLX macros for more _FloatN, _FloatNx types.
[glibc.git] / string / tst-svc2.c
blobc0aa03dc180a0872fd2c1c990c2e646b013a3f9a
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
6 static struct
8 const char *str1;
9 const char *str2;
10 } tests[] =
12 { "B0075022800016.gbp.corp.com", "B007502280067.gbp.corp.com" },
13 { "B0075022800016.gbp.corp.com", "B007502357019.GBP.CORP.COM" },
14 { "B007502280067.gbp.corp.com", "B007502357019.GBP.CORP.COM" }
16 #define ntests (sizeof (tests) / sizeof (tests[0]))
19 int
20 compare (const char *str1, const char *str2, int exp)
22 int c = strverscmp (str1, str2);
23 if (c != 0)
24 c /= abs (c);
25 return c != exp;
29 int
30 do_test (void)
32 int res = 0;
33 for (int i = 0; i < ntests; ++i)
35 if (compare (tests[i].str1, tests[i].str2, -1))
37 printf ("FAIL: \"%s\" > \"%s\"\n", tests[i].str1, tests[i].str2);
38 res = 1;
40 if (compare (tests[i].str2, tests[i].str1, +1))
42 printf ("FAIL: \"%s\" > \"%s\"\n", tests[i].str2, tests[i].str1);
43 res = 1;
45 char *copy1 = strdupa (tests[i].str1);
46 if (compare (tests[i].str1, copy1, 0))
48 printf ("FAIL: \"%s\" != \"%s\"\n", tests[i].str1, copy1);
49 res = 1;
51 char *copy2 = strdupa (tests[i].str2);
52 if (compare (tests[i].str2, copy2, 0))
54 printf ("FAIL: \"%s\" != \"%s\"\n", tests[i].str2, copy2);
55 res = 1;
58 return res;
61 #include <support/test-driver.c>