aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-21 12:01:17 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-21 12:01:17 +0100
commitc9fd0f20df16b7cf1563336ca42507bee89abf35 (patch)
tree93ef2d877ab8fe0af999b123097bf1cbd8167d2d /test
parent87ce73befc18446364e258ebb1c3487fc4131446 (diff)
downloadrspamd-c9fd0f20df16b7cf1563336ca42507bee89abf35.tar.gz
rspamd-c9fd0f20df16b7cf1563336ca42507bee89abf35.zip
[Minor] Print algorithm name when testing shingles
Diffstat (limited to 'test')
-rw-r--r--test/rspamd_shingles_test.c27
1 files changed, 25 insertions, 2 deletions
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 <math.h>
+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);