annotate tests/test-isblank.c @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents 10eb9086bea0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12185
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of isblank() function.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 19484
diff changeset
2 Copyright (C) 2009-2019 Free Software Foundation, Inc.
12185
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software: you can redistribute it and/or modify
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 3 of the License, or
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 (at your option) any later version.
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 18626
diff changeset
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
12185
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 /* Written by Bruno Haible <bruno@clisp.org>, 2009. */
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #include <config.h>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #include <ctype.h>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
12489
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
23 #include "signature.h"
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
24 SIGNATURE_CHECK (isblank, int, (int));
33ab12a7cea2 tests: add signature checks
Eric Blake <ebb9@byu.net>
parents: 12421
diff changeset
25
12185
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include <limits.h>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #include <stdio.h>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28
12496
a48d3d749ca5 Refactor common macros used in tests.
Bruno Haible <bruno@clisp.org>
parents: 12489
diff changeset
29 #include "macros.h"
12185
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 int
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 main (int argc, char *argv[])
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 {
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 unsigned int c;
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 /* Verify the property in the "C" locale.
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 POSIX specifies in
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 <http://www.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 that
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 - in all locales, the blank characters include the <space> and <tab>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 characters,
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 - in the "POSIX" locale (which is usually the same as the "C" locale),
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 the blank characters include only the ASCII <space> and <tab>
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 characters. */
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 for (c = 0; c <= UCHAR_MAX; c++)
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 ASSERT (!isblank (c) == !(c == ' ' || c == '\t'));
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 ASSERT (!isblank (EOF));
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 return 0;
b66b97142d27 Tests for module 'isblank'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 }