1 /* t-mapstrings.c - Regression tests for mapstrings.c
2 * Copyright (C) 2014 Werner Koch
4 * This file is part of GnuPG.
6 * This file is free software; you can redistribute it and/or modify
7 * it under the terms of either
9 * - the GNU Lesser General Public License as published by the Free
10 * Software Foundation; either version 3 of the License, or (at
11 * your option) any later version.
15 * - the GNU General Public License as published by the Free
16 * Software Foundation; either version 2 of the License, or (at
17 * your option) any later version.
19 * or both in parallel, as here.
21 * This file is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see <https://www.gnu.org/licenses/>.
35 #include "t-support.h"
36 #include "stringhelp.h"
39 test_map_static_macro_string (void)
44 const char *lastresult;
47 GPG_NAME " (" GNUPG_NAME ")" },
49 GPG_NAME "(" GNUPG_NAME ")" },
51 GPG_NAME GNUPG_NAME },
53 " " GPG_NAME GNUPG_NAME },
55 " " GPG_NAME GNUPG_NAME " " },
57 " " GPG_NAME "GNUPG@ " },
59 " @ GPG" GNUPG_NAME " " },
66 for (testno=0; testno < DIM(tests); testno++)
68 result = map_static_macro_string (tests[testno].string);
71 else if (strcmp (result, tests[testno].expected))
73 if (!tests[testno].lastresult)
74 tests[testno].lastresult = result;
77 /* A second time to check that the same string is been returned. */
78 for (testno=0; testno < DIM(tests); testno++)
80 result = map_static_macro_string (tests[testno].string);
83 else if (strcmp (result, tests[testno].expected))
85 if (result != tests[testno].lastresult)
92 main (int argc, char **argv)
97 test_map_static_macro_string ();