support: Add support_set_vma_name
[glibc.git] / stdlib / test-a64l.c
blob0a84f1959e5a48c518657caaddac8047dcaf840b
1 /* Test program for the l64a and a64l functions.
2 Copyright (C) 2001-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
23 /* Prototype for our test function. */
24 extern int do_test (int argc, char *argv[]);
25 #include <test-skeleton.c>
27 struct a64l_test
29 const char *base64;
30 long int value;
33 static const struct a64l_test tests[] =
35 { "./", 64 },
36 { "", 0 },
37 { "/", 1 },
38 { "FT", 2001 },
39 { "zzzzz1", 0xffffffff },
40 { "zzzz1", 0x3ffffff },
41 { "zzz1", 0xfffff },
42 { "zz1", 0x3fff },
43 { "z1", 0xff },
44 { "1", 0x3 },
45 { NULL, 0 }
48 int
49 do_test (int argc, char ** argv)
51 const struct a64l_test *at;
52 long int l;
53 const char *s;
54 int status = 0;
56 for (at = tests; at->base64 != NULL; ++at)
58 printf ("a64l (\"%s\")", at->base64);
59 l = a64l (at->base64);
60 if (l == at->value)
61 puts ("\tOK");
62 else
64 printf ("\tBAD\n returns %ld, expected %ld\n", l, at->value);
65 status = 1;
67 printf ("l64a (%ld)", at->value);
68 s = l64a (at->value);
69 if (strcmp (s, at->base64) == 0)
70 puts ("\tOK");
71 else
73 printf ("\tBAD\n returns \"%s\", expected \"%s\"\n", s, at->base64);
74 status = 1;
78 return status ? EXIT_FAILURE : EXIT_SUCCESS;