Changeset c37c24c in mainline for uspace/lib/tbarcfg/test/tbarcfg.c


Ignore:
Timestamp:
2024-04-07T09:52:47Z (10 months ago)
Author:
Nataliia Korop <n.corop08@…>
Children:
e55d2c1
Parents:
6c1e7c0 (diff), 34aad53d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'topic/packet-capture' into topic/packet-capture-choose-nic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/tbarcfg/test/tbarcfg.c

    r6c1e7c0 rc37c24c  
    3030#include <pcut/pcut.h>
    3131#include <tbarcfg/tbarcfg.h>
     32#include <stdbool.h>
    3233#include <stdio.h>
    3334
     
    3536
    3637PCUT_TEST_SUITE(tbarcfg);
     38
     39typedef struct {
     40        bool notified;
     41} tbarcfg_test_resp_t;
     42
     43static void test_cb(void *);
    3744
    3845/** Creating, opening and closing taskbar configuration */
     
    554561}
    555562
     563/** Notifications can be delivered from tbarcfg_notify() to a listener. */
     564PCUT_TEST(notify)
     565{
     566        errno_t rc;
     567        tbarcfg_listener_t *lst;
     568        tbarcfg_test_resp_t test_resp;
     569
     570        test_resp.notified = false;
     571
     572        printf("create listener resp=%p\n", (void *)&test_resp);
     573        rc = tbarcfg_listener_create(TBARCFG_NOTIFY_DEFAULT,
     574            test_cb, &test_resp, &lst);
     575        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     576
     577        rc = tbarcfg_notify(TBARCFG_NOTIFY_DEFAULT);
     578        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     579
     580        PCUT_ASSERT_TRUE(test_resp.notified);
     581        tbarcfg_listener_destroy(lst);
     582}
     583
     584static void test_cb(void *arg)
     585{
     586        tbarcfg_test_resp_t *resp = (tbarcfg_test_resp_t *)arg;
     587
     588        printf("test_cb: executing resp=%p\n", (void *)resp);
     589        resp->notified = true;
     590}
     591
    556592PCUT_EXPORT(tbarcfg);
Note: See TracChangeset for help on using the changeset viewer.