/* tst_strerror.c --- Self tests for *_strerror(). * Copyright (C) 2004, 2005, 2006, 2007 Simon Josefsson. * * This file is part of GNU Libidn. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include #include #include #include #include #include #include "utils.h" #define SUCCESS "Success" #define UNKNOWN "Unknown error" void doit (void) { const char *p; /* Test success. */ p = idna_strerror (0); if (strcmp (p, SUCCESS) != 0) fail ("idna_strerror (0) failed: %s\n", p); if (debug) printf ("idna_strerror (0) OK\n"); p = pr29_strerror (0); if (strcmp (p, SUCCESS) != 0) fail ("pr29_strerror (0) failed: %s\n", p); if (debug) printf ("pr29_strerror (0) OK\n"); p = punycode_strerror (0); if (strcmp (p, SUCCESS) != 0) fail ("punycode_strerror (0) failed: %s\n", p); if (debug) printf ("punycode_strerror (0) OK\n"); p = stringprep_strerror (0); if (strcmp (p, SUCCESS) != 0) fail ("stringprep_strerror (0) failed: %s\n", p); if (debug) printf ("stringprep_strerror (0) OK\n"); p = tld_strerror (0); if (strcmp (p, SUCCESS) != 0) fail ("tld_strerror (0) failed: %s\n", p); if (debug) printf ("tld_strerror (0) OK\n"); /* Test unknown error. */ p = idna_strerror (42); if (strcmp (p, UNKNOWN) != 0) fail ("idna_strerror (42) failed: %s\n", p); if (debug) printf ("idna_strerror (42) OK\n"); p = pr29_strerror (42); if (strcmp (p, UNKNOWN) != 0) fail ("pr29_strerror (42) failed: %s\n", p); if (debug) printf ("pr29_strerror (42) OK\n"); p = punycode_strerror (42); if (strcmp (p, UNKNOWN) != 0) fail ("punycode_strerror (42) failed: %s\n", p); if (debug) printf ("punycode_strerror (42) OK\n"); p = stringprep_strerror (42); if (strcmp (p, UNKNOWN) != 0) fail ("stringprep_strerror (42) failed: %s\n", p); if (debug) printf ("stringprep_strerror (42) OK\n"); p = tld_strerror (42); if (strcmp (p, UNKNOWN) != 0) fail ("tld_strerror (42) failed: %s\n", p); if (debug) printf ("tld_strerror (42) OK\n"); }