diff options
author | Bruno Haible <bruno@clisp.org> | 2022-09-10 20:01:24 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-09-10 20:01:24 +0200 |
commit | 8b21d104b20dfcbb5ddb8ca69fa64776487ceec6 (patch) | |
tree | e228ff91b4e79b92788bebd76a74dffa9a9d1723 /tests | |
parent | b4aa9d4076b7260cae801c726db19a4b176c5eaa (diff) | |
download | gnulib-8b21d104b20dfcbb5ddb8ca69fa64776487ceec6.tar.gz |
Reorganize C++ tests for stdbool and stdbool-c99.
* tests/test-stdbool-c++.cc: Don't include <stdbool.h> if TEST_STDBOOL_H
is not defined. Add a couple of simple tests, from test-stdbool.c.
* tests/test-stdbool-c99-c++.cc: New file.
* modules/stdbool-c99-c++-tests: New file, based on
modules/stdbool-c++-tests.
* modules/stdbool-c99-tests (Depends-on): Add stdbool-c99-c++-tests.
Remove stdbool-c++-tests.
* modules/stdbool-tests (Depends-on): Add stdbool-c++-tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-stdbool-c++.cc | 21 | ||||
-rw-r--r-- | tests/test-stdbool-c99-c++.cc | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/test-stdbool-c++.cc b/tests/test-stdbool-c++.cc index ae4f80b00f..8e208dfe23 100644 --- a/tests/test-stdbool-c++.cc +++ b/tests/test-stdbool-c++.cc @@ -19,7 +19,26 @@ #define GNULIB_NAMESPACE gnulib #include <config.h> -#include <stdbool.h> +#ifdef TEST_STDBOOL_H +# include <stdbool.h> +#endif + + +/* These tests are a subset of the C language tests in test-stdbool.c. */ + +#if false + "error: false is not 0" +#endif +#if true != 1 + "error: true is not 1" +#endif + +struct s { bool s: 1; bool t; } s; + +char a[true == 1 ? 1 : -1]; +char b[false == 0 ? 1 : -1]; +char c[(unsigned char) true == 1 ? 1 : -1]; +char d[(unsigned char) false == 0 ? 1 : -1]; int diff --git a/tests/test-stdbool-c99-c++.cc b/tests/test-stdbool-c99-c++.cc new file mode 100644 index 0000000000..eec9e3b980 --- /dev/null +++ b/tests/test-stdbool-c99-c++.cc @@ -0,0 +1,2 @@ +#define TEST_STDBOOL_H +#include "test-stdbool-c++.cc" |