diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-01-23 20:19:35 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-01-23 20:19:35 +0000 |
commit | a69bd6e3b33f4d3f72e628a39923b0bb3cd0e242 (patch) | |
tree | f1513f21602d4bebb61d1899ee19554b825f4dca | |
parent | c6db55f30e62c11f27aa2b28558f522418c033a1 (diff) |
add a buffered event test.
From libevent CVS
-rw-r--r-- | regress/lib/libevent/eventtest.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/regress/lib/libevent/eventtest.c b/regress/lib/libevent/eventtest.c index a71575b2e58..a6a3b7c8aef 100644 --- a/regress/lib/libevent/eventtest.c +++ b/regress/lib/libevent/eventtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eventtest.c,v 1.8 2005/12/25 02:51:24 brad Exp $ */ +/* $OpenBSD: eventtest.c,v 1.9 2006/01/23 20:19:34 brad Exp $ */ /* $NetBSD: eventtest.c,v 1.3 2004/08/07 21:09:47 provos Exp $ */ /* @@ -460,6 +460,21 @@ test_loopexit(void) } void +test_evbuffer(void) { + setup_test("Evbuffer: "); + + struct evbuffer *evb = evbuffer_new(); + + evbuffer_add_printf(evb, "%s/%d", "hello", 1); + + if (EVBUFFER_LENGTH(evb) == 7 && + strcmp(EVBUFFER_DATA(evb), "hello/1") == 0) + test_ok = 1; + + cleanup_test(); +} + +void readcb(struct bufferevent *bev, void *arg) { if (EVBUFFER_LENGTH(bev->input) == 8333) { @@ -687,6 +702,8 @@ main (int argc, char **argv) test_loopexit(); + test_evbuffer(); + test_bufferevent(); test_priorities(1); |