#define TEST_MAX_INT 6
static void
-evtag_int_test(void)
+evtag_int_test(void *ptr)
{
struct evbuffer *tmp = evbuffer_new();
ev_uint32_t integers[TEST_MAX_INT] = {
ev_uint64_t big_int;
int i;
+ evtag_init();
+
for (i = 0; i < TEST_MAX_INT; i++) {
int oldlen, newlen;
oldlen = EVBUFFER_LENGTH(tmp);
tt_assert((big_int / 1000000000) == integers[i]);
}
- tt_uint_op(EVBUFFER_LENGTH(tmp), ==, 0);
-
+ tt_uint_op(EVBUFFER_LENGTH(tmp), ==, 0);
end:
evbuffer_free(tmp);
}
static void
-evtag_fuzz(void)
+evtag_fuzz(void *ptr)
{
u_char buffer[4096];
struct evbuffer *tmp = evbuffer_new();
int i, j;
int not_failed = 0;
+
+ evtag_init();
+
for (j = 0; j < 100; j++) {
for (i = 0; i < sizeof(buffer); i++)
buffer[i] = rand();
}
static void
-evtag_tag_encoding(void)
+evtag_tag_encoding(void *ptr)
{
struct evbuffer *tmp = evbuffer_new();
ev_uint32_t integers[TEST_MAX_INT] = {
ev_uint32_t integer;
int i;
+ evtag_init();
+
for (i = 0; i < TEST_MAX_INT; i++) {
int oldlen, newlen;
oldlen = EVBUFFER_LENGTH(tmp);
}
tt_uint_op(EVBUFFER_LENGTH(tmp), ==, 0);
+
end:
evbuffer_free(tmp);
}
-static void
-test_evtag(void)
-{
- evtag_init();
- evtag_int_test();
- evtag_fuzz();
- evtag_tag_encoding();
- test_ok = 1;
-}
static void
test_methods(void *ptr)
#ifndef WIN32
LEGACY(fork, TT_ISOLATED),
#endif
+ END_OF_TESTCASES
+};
- LEGACY(evtag, TT_ISOLATED),
+struct testcase_t evtag_testcases[] = {
+ { "int", evtag_int_test, TT_FORK, NULL, NULL },
+ { "fuzz", evtag_fuzz, TT_FORK, NULL, NULL },
+ { "encoding", evtag_tag_encoding, TT_FORK, NULL, NULL },
- END_OF_TESTCASES
+ END_OF_TESTCASES
};
struct testcase_t signal_testcases[] = {
#include "tinytest_macros.h"
extern struct testcase_t main_testcases[];
+extern struct testcase_t evtag_testcases[];
extern struct testcase_t evbuffer_testcases[];
extern struct testcase_t bufferevent_testcases[];
extern struct testcase_t util_testcases[];
{ "bufferevent/", bufferevent_testcases },
{ "http/", http_testcases },
{ "dns/", dns_testcases },
+ { "evtag/", evtag_testcases },
{ "rpc/", rpc_testcases },
{ "thread/", thread_testcases },
#ifdef WIN32