aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-08-25 13:14:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-08-25 13:14:46 +0100
commitd00c68bbacc7d90394dadb3090a457db3abbb4fe (patch)
tree39c061d4902adb8dd81e96eb7ee8d826a0520b33
parenta9009d7f2098b3392e8e678d1ce73fc8bcc5b1e1 (diff)
downloadrspamd-d00c68bbacc7d90394dadb3090a457db3abbb4fe.tar.gz
rspamd-d00c68bbacc7d90394dadb3090a457db3abbb4fe.zip
Improve tests.
-rw-r--r--test/rspamd_rcl_test.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/rspamd_rcl_test.c b/test/rspamd_rcl_test.c
index cd02a6e2d..fabfea29e 100644
--- a/test/rspamd_rcl_test.c
+++ b/test/rspamd_rcl_test.c
@@ -75,6 +75,8 @@ rspamd_rcl_test_func (void)
const gchar **cur;
guchar *emitted;
GError *err = NULL;
+ struct timespec start, end;
+ gdouble seconds;
cur = rcl_test_valid;
while (*cur != NULL) {
@@ -125,7 +127,21 @@ rspamd_rcl_test_func (void)
/* Load a big json */
parser = rspamd_cl_parser_new (RSPAMD_CL_FLAG_KEY_LOWERCASE);
+ clock_gettime (CLOCK_MONOTONIC, &start);
rspamd_cl_parser_add_file (parser, "./rcl_test.json", &err);
g_assert_no_error (err);
+ obj = rspamd_cl_parser_get_object (parser, &err);
+ g_assert_no_error (err);
+ clock_gettime (CLOCK_MONOTONIC, &end);
+ seconds = (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) / 1000000000.;
+ msg_info ("parsed json in %.4f seconds", seconds);
+ /* Test config emitting */
+ clock_gettime (CLOCK_MONOTONIC, &start);
+ emitted = rspamd_cl_object_emit (obj, RSPAMD_CL_EMIT_CONFIG);
+ g_assert (emitted != NULL);
+ clock_gettime (CLOCK_MONOTONIC, &end);
+ seconds = (end.tv_sec - start.tv_sec) + (end.tv_nsec - start.tv_nsec) / 1000000000.;
+ msg_info ("emitted object in %.4f seconds", seconds);
rspamd_cl_parser_free (parser);
+ rspamd_cl_obj_unref (obj);
}