Blame gl/tests/test-isblank.c

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