1 /* Test assert.h and static_assert.
2 Copyright 2022-2025 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 /* Written by Paul Eggert. */
21 #define STATIC_ASSERT_TESTS \
22 static_assert (2 + 2 == 4, "arithmetic does not work"); \
23 static_assert (2 + 2 == 4); \
24 static_assert (sizeof (char) == 1, "sizeof does not work"); \
25 static_assert (sizeof (char) == 1)
30 assert (char const *p
, int i
)
48 assert (f ("this should work"));
60 assert (f ("this should work"));