From c9fd0f20df16b7cf1563336ca42507bee89abf35 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 21 Jun 2016 12:01:17 +0100 Subject: [Minor] Print algorithm name when testing shingles --- test/rspamd_shingles_test.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/rspamd_shingles_test.c b/test/rspamd_shingles_test.c index 971502c93..401a26309 100644 --- a/test/rspamd_shingles_test.c +++ b/test/rspamd_shingles_test.c @@ -19,6 +19,29 @@ #include "ottery.h" #include +static const gchar * +algorithm_to_string (enum rspamd_shingle_alg alg) +{ + const gchar *ret = "unknown"; + + switch (alg) { + case RSPAMD_SHINGLES_OLD: + ret = "siphash"; + break; + case RSPAMD_SHINGLES_XXHASH: + ret = "xxhash"; + break; + case RSPAMD_SHINGLES_MUMHASH: + ret = "mumhash"; + break; + case RSPAMD_SHINGLES_FAST: + ret = "fasthash"; + break; + } + + return ret; +} + static void generate_random_string (char *begin, size_t len) { @@ -103,9 +126,9 @@ test_case (gsize cnt, gsize max_len, gdouble perm_factor, res = rspamd_shingles_compare (sgl, sgl_permuted); - msg_info ("%d (%z words of %z max len, %.2f perm factor):" + msg_info ("%s (%z words of %z max len, %.2f perm factor):" " percentage of common shingles: %.3f, generate time: %.4f sec", - alg, cnt, max_len, perm_factor, res, ts2 - ts1); + algorithm_to_string (alg), cnt, max_len, perm_factor, res, ts2 - ts1); //g_assert_cmpfloat (fabs ((1.0 - res) - sqrt (perm_factor)), <=, 0.25); free_fuzzy_words (input); -- cgit v1.2.3