]> Savannah Git Hosting - gnulib.git/commitdiff
Reorganize C++ tests for stdbool and stdbool-c99.
authorBruno Haible <bruno@clisp.org>
Sat, 10 Sep 2022 18:01:24 +0000 (20:01 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 10 Sep 2022 18:01:24 +0000 (20:01 +0200)
* 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.

ChangeLog
modules/stdbool-c99-c++-tests [new file with mode: 0644]
modules/stdbool-c99-tests
modules/stdbool-tests
tests/test-stdbool-c++.cc
tests/test-stdbool-c99-c++.cc [new file with mode: 0644]

index 055523eff96779e39eadfcc4f60a48fbac2e4902..bdec7ddfa270f8518e9d4f902209490e5a3cc19e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-09-10  Bruno Haible  <bruno@clisp.org>
+
+       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.
+
 2022-09-10  Bruno Haible  <bruno@clisp.org>
 
        stdbool C++ tests: Fix for C++20.
diff --git a/modules/stdbool-c99-c++-tests b/modules/stdbool-c99-c++-tests
new file mode 100644 (file)
index 0000000..073ef89
--- /dev/null
@@ -0,0 +1,19 @@
+Files:
+tests/test-stdbool-c99-c++.cc
+tests/test-stdbool-c++.cc
+tests/test-stdbool-c++2.cc
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-stdbool-c99-c++
+check_PROGRAMS += test-stdbool-c99-c++
+test_stdbool_c99_c___SOURCES = test-stdbool-c99-c++.cc test-stdbool-c++2.cc
+endif
index 3ca0ddb217d3d73862c44297cd798bfe5bfeb543..e507f9493a3ebb3b4c9d8d6485198917c5bdbf49 100644 (file)
@@ -1,9 +1,9 @@
 Files:
-tests/test-stdbool.c
 tests/test-stdbool-c99.c
+tests/test-stdbool.c
 
 Depends-on:
-stdbool-c++-tests
+stdbool-c99-c++-tests
 
 configure.ac:
 
index 6905dfbedc6776ff2df64250fe0d73ca7515d118..0f875fbeedd8753d64bdb460cbc9ff296149ad9b 100644 (file)
@@ -2,6 +2,7 @@ Files:
 tests/test-stdbool.c
 
 Depends-on:
+stdbool-c++-tests
 
 configure.ac:
 
index ae4f80b00f6764ca5ecc2e01661cca8acdfafa33..8e208dfe238dfae05096b19a7cbf8d5c89992652 100644 (file)
 #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 (file)
index 0000000..eec9e3b
--- /dev/null
@@ -0,0 +1,2 @@
+#define TEST_STDBOOL_H
+#include "test-stdbool-c++.cc"