From d224f45cf45789eb92946c1132d9dd02b7923057 Mon Sep 17 00:00:00 2001 From: Olivier Dion Date: Mon, 19 Aug 2024 13:36:08 -0400 Subject: [PATCH] Add C++ unit test Change-Id: I79e850e40b4e7d97f859b7ada8f1f6708ca3395f Signed-off-by: Olivier Dion Signed-off-by: Mathieu Desnoyers --- tests/Makefile.am | 7 +++++++ tests/unit/test-cxx.cpp | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/unit/test-cxx.cpp diff --git a/tests/Makefile.am b/tests/Makefile.am index e92b7f4..9d8702c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -15,6 +15,7 @@ TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' \ noinst_PROGRAMS = \ regression/side-rcu-test \ unit/test \ + unit/test-cxx \ unit/demo \ unit/statedump @@ -31,6 +32,12 @@ unit_test_LDADD = \ $(top_builddir)/tests/utils/libtap.la \ $(RSEQ_LIBS) +unit_test_cxx_SOURCES = unit/test-cxx.cpp +unit_test_cxx_LDADD = \ + $(top_builddir)/src/libside.la \ + $(top_builddir)/tests/utils/libtap.la \ + $(RSEQ_LIBS) + unit_demo_SOURCES = unit/demo.c unit_demo_LDADD = \ $(top_builddir)/src/libside.la \ diff --git a/tests/unit/test-cxx.cpp b/tests/unit/test-cxx.cpp new file mode 100644 index 0000000..f911cd2 --- /dev/null +++ b/tests/unit/test-cxx.cpp @@ -0,0 +1,9 @@ +/* + * Tests from C ought to work in C++. The pragmas are for ignoring the + * narrowing of `double' literal values to `FloatN' in the tests, which emitted + * warnings. + */ +#if defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wnarrowing" +#endif +#include "test.c" -- 2.34.1