X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Funit%2Ftest_build.c;h=b2786c55c00253d8d51ab6e1ae8ed90329755f85;hb=c8292aa76bf23db3b6031cd49c0e6c469d0c889d;hp=deb0a736b1e95cdb62365efba9dab046810bd9b4;hpb=2875743718fb23293190b5edd0f2b530977270b1;p=userspace-rcu.git diff --git a/tests/unit/test_build.c b/tests/unit/test_build.c index deb0a73..b2786c5 100644 --- a/tests/unit/test_build.c +++ b/tests/unit/test_build.c @@ -59,11 +59,52 @@ #include "tap.h" +static void test_lfstack(void) +{ + struct cds_lfs_stack s; + + cds_lfs_init(&s); + ok(cds_lfs_empty(&s), "cds_lfs_empty"); +} + +static void test_wfstack(void) +{ + struct cds_wfs_stack s; + + cds_wfs_init(&s); + ok(cds_wfs_empty(&s), "cds_lfs_empty"); +} + +static void test_wfcqueue(void) +{ + struct cds_wfcq_head head; + struct cds_wfcq_tail tail; + + cds_wfcq_init(&head, &tail); + ok(cds_wfcq_empty(&head, &tail), "cds_wfcq_empty"); +} + +static +void test_build_cds_list_head_init(void) +{ + /* Test that the CDS_LIST_HEAD_INIT macro builds correctly. */ + struct struct_with_list { + struct cds_list_head head; + }; + + struct struct_with_list list = { + .head = CDS_LIST_HEAD_INIT(list.head), + }; +} + int main(void) { - /* Need at least 1 test to make a valid TAP test plan. */ - plan_tests(1); - ok(1, "dummy"); + plan_tests(3); + + test_lfstack(); + test_wfstack(); + test_wfcqueue(); + test_build_cds_list_head_init(); return exit_status(); }