mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-13 06:33:44 +01:00
pubsub: add test for items_out in builder_finalize()
This commit is contained in:
parent
3552cd69bd
commit
d976cda49f
@ -2,6 +2,7 @@
|
|||||||
/* See LICENSE for licensing information */
|
/* See LICENSE for licensing information */
|
||||||
|
|
||||||
#define DISPATCH_PRIVATE
|
#define DISPATCH_PRIVATE
|
||||||
|
#define PUBSUB_PRIVATE
|
||||||
|
|
||||||
#include "test/test.h"
|
#include "test/test.h"
|
||||||
|
|
||||||
@ -119,13 +120,16 @@ test_pubsub_build_types_ok(void *arg)
|
|||||||
pubsub_builder_t *b = NULL;
|
pubsub_builder_t *b = NULL;
|
||||||
dispatch_t *dispatcher = NULL;
|
dispatch_t *dispatcher = NULL;
|
||||||
pubsub_connector_t *c = NULL;
|
pubsub_connector_t *c = NULL;
|
||||||
|
pubsub_items_t *items = NULL;
|
||||||
|
|
||||||
b = pubsub_builder_new();
|
b = pubsub_builder_new();
|
||||||
seed_pubsub_builder_basic(b);
|
seed_pubsub_builder_basic(b);
|
||||||
|
|
||||||
dispatcher = pubsub_builder_finalize(b, NULL);
|
dispatcher = pubsub_builder_finalize(b, &items);
|
||||||
b = NULL;
|
b = NULL;
|
||||||
tt_assert(dispatcher);
|
tt_assert(dispatcher);
|
||||||
|
tt_assert(items);
|
||||||
|
tt_int_op(smartlist_len(items->items), OP_EQ, 4);
|
||||||
|
|
||||||
tt_int_op(dispatcher->n_types, OP_GE, 2);
|
tt_int_op(dispatcher->n_types, OP_GE, 2);
|
||||||
tt_assert(dispatcher->typefns);
|
tt_assert(dispatcher->typefns);
|
||||||
@ -138,6 +142,7 @@ test_pubsub_build_types_ok(void *arg)
|
|||||||
pubsub_connector_free(c);
|
pubsub_connector_free(c);
|
||||||
pubsub_builder_free(b);
|
pubsub_builder_free(b);
|
||||||
dispatch_free(dispatcher);
|
dispatch_free(dispatcher);
|
||||||
|
pubsub_items_free(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We fail if the same type is defined in two places with different functions.
|
/* We fail if the same type is defined in two places with different functions.
|
||||||
|
Loading…
Reference in New Issue
Block a user