mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
common: New function map_static_strings
* common/mapstrings.c (struct intmapping_s): New. (map_static_strings): New. * common/stringhelp.c (do_strconcat): Rename to ... (vstrconcat): this and make global. * common/t-mapstrings.c (test_map_static_strings): New test.
This commit is contained in:
parent
8631d4cfe2
commit
449d2fbcde
4 changed files with 86 additions and 5 deletions
|
@ -88,6 +88,31 @@ test_map_static_macro_string (void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
test_map_static_strings (void)
|
||||
{
|
||||
const char *s, *s1;
|
||||
|
||||
s1 = map_static_strings ("mydomain", 0, 42,
|
||||
"This", " ", "is", " ", "my"," ","string", NULL);
|
||||
if (strcmp (s1, "This is my string"))
|
||||
fail (1);
|
||||
s = map_static_strings ("mydomain", 0, 42,
|
||||
"This", " ", "is", " ", "my"," ","string", NULL);
|
||||
if (strcmp (s1, s))
|
||||
fail (2);
|
||||
s = map_static_strings ("mydomain", 0, 42, "foo", NULL);
|
||||
if (strcmp (s1, s))
|
||||
fail (3);
|
||||
s = map_static_strings ("mydomain", 1, 42, "foo 1.42", NULL);
|
||||
if (!strcmp (s1, s))
|
||||
fail (4);
|
||||
s = map_static_strings ("xdomain", 1, 42, "foo 1.42 other domain", NULL);
|
||||
if (!strcmp (s1, s))
|
||||
fail (5);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
@ -95,6 +120,7 @@ main (int argc, char **argv)
|
|||
(void)argv;
|
||||
|
||||
test_map_static_macro_string ();
|
||||
test_map_static_strings ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue