glibc/string/tst-strsignal.c
Adhemerval Zanella c2723ce317 string: Add strsignal test
Checked on x86-64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu,
and s390x-linux-gnu.

Tested-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2020-07-07 14:10:58 -03:00

58 lines
1.7 KiB
C

/* Test for strsignal.
Copyright (C) 2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <string.h>
#include <stdio.h>
#include <signal.h>
#include <locale.h>
#include <array_length.h>
#include <support/support.h>
#include <support/check.h>
static int
do_test (void)
{
xsetlocale (LC_ALL, "C");
TEST_COMPARE_STRING (strsignal (SIGINT), "Interrupt");
TEST_COMPARE_STRING (strsignal (-1), "Unknown signal -1");
#ifdef SIGRTMIN
TEST_COMPARE_STRING (strsignal (SIGRTMIN), "Real-time signal 0");
#endif
#ifdef SIGRTMAX
TEST_COMPARE_STRING (strsignal (SIGRTMAX+1), "Unknown signal 65");
#endif
xsetlocale (LC_ALL, "pt_BR.UTF-8");
TEST_COMPARE_STRING (strsignal (SIGINT), "Interrup\xc3\xa7\xc3\xa3\x6f");
TEST_COMPARE_STRING (strsignal (-1), "Sinal desconhecido -1");
#ifdef SIGRTMI
TEST_COMPARE_STRING (strsignal (SIGRTMIN), "Sinal de tempo-real 0");
#endif
#ifdef SIGRTMAX
TEST_COMPARE_STRING (strsignal (SIGRTMAX+1), "Sinal desconhecido 65");
#endif
return 0;
}
#include <support/test-driver.c>