unit tests: test wfcqueue, wfstack, lfstack empty check functions in C++
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Sep 2021 19:27:12 +0000 (15:27 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 8 Sep 2021 19:28:38 +0000 (15:28 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I16c2d51872c1007762a6b75aac7a21974b4b9c8b

tests/unit/Makefile.am
tests/unit/test_build.c

index 8e2aa8af84eed6ea858839405238b448a5610c4f..e68fefe5e6271217f0653bd207eade7a65190836 100644 (file)
@@ -105,21 +105,21 @@ test_urcu_multiflavor_single_unit_dynlink_cxx_LDADD = $(URCU_LIB) $(URCU_MB_LIB)
 
 test_build_SOURCES = \
        test_build.c
-test_build_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+test_build_LDADD = $(URCU_COMMON_LIB) $(URCU_CDS_LIB) $(TAP_LIB)
 
 test_build_cxx_SOURCES = \
        test_build_cxx.cpp
-test_build_cxx_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+test_build_cxx_LDADD = $(URCU_COMMON_LIB) $(URCU_CDS_LIB) $(TAP_LIB)
 
 test_build_dynlink_SOURCES = \
        test_build.c
 test_build_dynlink_CFLAGS = -DDYNAMIC_LINK_TEST $(AM_CFLAGS)
-test_build_dynlink_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+test_build_dynlink_LDADD = $(URCU_COMMON_LIB) $(URCU_CDS_LIB) $(TAP_LIB)
 
 test_build_dynlink_cxx_SOURCES = \
        test_build_cxx.cpp
 test_build_dynlink_cxx_CXXFLAGS = -DDYNAMIC_LINK_TEST $(AM_CXXFLAGS)
-test_build_dynlink_cxx_LDADD = $(URCU_COMMON_LIB) $(TAP_LIB)
+test_build_dynlink_cxx_LDADD = $(URCU_COMMON_LIB) $(URCU_CDS_LIB) $(TAP_LIB)
 
 all-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
index deb0a736b1e95cdb62365efba9dab046810bd9b4..64db7732d966be04f5ead8b9d741b8fe27cea85f 100644 (file)
 
 #include "tap.h"
 
+static void test_lfstack(void)
+{
+       struct cds_lfs_stack s;
+
+       cds_lfs_init(&s);
+       if (!cds_lfs_empty(&s))
+               fail("cds_lfs_empty");
+       else
+               ok(1, "cds_lfs_empty");
+}
+
+static void test_wfstack(void)
+{
+       struct cds_wfs_stack s;
+
+       cds_wfs_init(&s);
+       if (!cds_wfs_empty(&s))
+               fail("cds_lfs_empty");
+       else
+               ok(1, "cds_lfs_empty");
+}
+
+static void test_wfcqueue(void)
+{
+       struct cds_wfcq_head head;
+       struct cds_wfcq_tail tail;
+
+       cds_wfcq_init(&head, &tail);
+       if (!cds_wfcq_empty(&head, &tail))
+               fail("cds_wfcq_empty");
+       else
+               ok(1, "cds_wfcq_empty");
+}
+
 int main(void)
 {
        /* Need at least 1 test to make a valid TAP test plan. */
-       plan_tests(1);
+       plan_tests(3);
        ok(1, "dummy");
 
+       test_lfstack();
+       test_wfstack();
+       test_wfcqueue();
+
        return exit_status();
 }
This page took 0.0354 seconds and 4 git commands to generate.