1 /* tst_strerror.c --- Self tests for *_strerror().
2 * Copyright (C) 2004, 2005, 2006, 2007 Simon Josefsson.
4 * This file is part of GNU Libidn.
6 * GNU Libidn is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GNU Libidn is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Libidn; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
34 #include <stringprep.h>
39 #define SUCCESS "Success"
40 #define UNKNOWN "Unknown error"
49 p
= idna_strerror (0);
50 if (strcmp (p
, SUCCESS
) != 0)
51 fail ("idna_strerror (0) failed: %s\n", p
);
53 printf ("idna_strerror (0) OK\n");
55 p
= pr29_strerror (0);
56 if (strcmp (p
, SUCCESS
) != 0)
57 fail ("pr29_strerror (0) failed: %s\n", p
);
59 printf ("pr29_strerror (0) OK\n");
61 p
= punycode_strerror (0);
62 if (strcmp (p
, SUCCESS
) != 0)
63 fail ("punycode_strerror (0) failed: %s\n", p
);
65 printf ("punycode_strerror (0) OK\n");
67 p
= stringprep_strerror (0);
68 if (strcmp (p
, SUCCESS
) != 0)
69 fail ("stringprep_strerror (0) failed: %s\n", p
);
71 printf ("stringprep_strerror (0) OK\n");
74 if (strcmp (p
, SUCCESS
) != 0)
75 fail ("tld_strerror (0) failed: %s\n", p
);
77 printf ("tld_strerror (0) OK\n");
79 /* Test unknown error. */
81 p
= idna_strerror (42);
82 if (strcmp (p
, UNKNOWN
) != 0)
83 fail ("idna_strerror (42) failed: %s\n", p
);
85 printf ("idna_strerror (42) OK\n");
87 p
= pr29_strerror (42);
88 if (strcmp (p
, UNKNOWN
) != 0)
89 fail ("pr29_strerror (42) failed: %s\n", p
);
91 printf ("pr29_strerror (42) OK\n");
93 p
= punycode_strerror (42);
94 if (strcmp (p
, UNKNOWN
) != 0)
95 fail ("punycode_strerror (42) failed: %s\n", p
);
97 printf ("punycode_strerror (42) OK\n");
99 p
= stringprep_strerror (42);
100 if (strcmp (p
, UNKNOWN
) != 0)
101 fail ("stringprep_strerror (42) failed: %s\n", p
);
103 printf ("stringprep_strerror (42) OK\n");
105 p
= tld_strerror (42);
106 if (strcmp (p
, UNKNOWN
) != 0)
107 fail ("tld_strerror (42) failed: %s\n", p
);
109 printf ("tld_strerror (42) OK\n");