From: Vsevolod Stakhov Date: Tue, 21 Jun 2016 11:01:17 +0000 (+0100) Subject: [Minor] Print algorithm name when testing shingles X-Git-Tag: 1.3.0~290 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9fd0f20df16b7cf1563336ca42507bee89abf35;p=thirdparty%2Frspamd.git [Minor] Print algorithm name when testing shingles --- diff --git a/test/rspamd_shingles_test.c b/test/rspamd_shingles_test.c index 971502c932..401a263092 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);