Blame gnulib/tests/test-isblank.c

Packit 06dd63
/* Test of isblank() function.
Packit 06dd63
   Copyright (C) 2009-2019 Free Software Foundation, Inc.
Packit 06dd63
Packit 06dd63
   This program is free software: you can redistribute it and/or modify
Packit 06dd63
   it under the terms of the GNU General Public License as published by
Packit 06dd63
   the Free Software Foundation; either version 3 of the License, or
Packit 06dd63
   (at your option) any later version.
Packit 06dd63
Packit 06dd63
   This program is distributed in the hope that it will be useful,
Packit 06dd63
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 06dd63
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 06dd63
   GNU General Public License for more details.
Packit 06dd63
Packit 06dd63
   You should have received a copy of the GNU General Public License
Packit 06dd63
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
Packit 06dd63
Packit 06dd63
/* Written by Bruno Haible <bruno@clisp.org>, 2009.  */
Packit 06dd63
Packit 06dd63
#include <config.h>
Packit 06dd63
Packit 06dd63
#include <ctype.h>
Packit 06dd63
Packit 06dd63
#include "signature.h"
Packit 06dd63
SIGNATURE_CHECK (isblank, int, (int));
Packit 06dd63
Packit 06dd63
#include <limits.h>
Packit 06dd63
#include <stdio.h>
Packit 06dd63
Packit 06dd63
#include "macros.h"
Packit 06dd63
Packit 06dd63
int
Packit 06dd63
main (int argc, char *argv[])
Packit 06dd63
{
Packit 06dd63
  unsigned int c;
Packit 06dd63
Packit 06dd63
  /* Verify the property in the "C" locale.
Packit 06dd63
     POSIX specifies in
Packit 06dd63
       <http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
Packit 06dd63
     that
Packit 06dd63
       - in all locales, the blank characters include the <space> and <tab>
Packit 06dd63
         characters,
Packit 06dd63
       - in the "POSIX" locale (which is usually the same as the "C" locale),
Packit 06dd63
         the blank characters include only the ASCII <space> and <tab>
Packit 06dd63
         characters.  */
Packit 06dd63
  for (c = 0; c <= UCHAR_MAX; c++)
Packit 06dd63
    ASSERT (!isblank (c) == !(c == ' ' || c == '\t'));
Packit 06dd63
  ASSERT (!isblank (EOF));
Packit 06dd63
Packit 06dd63
  return 0;
Packit 06dd63
}