From 639c8e49fdf60966c5a75899efbb65084a099998 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 8 Apr 2015 13:05:55 +0100 Subject: Add AVX implementation generated by clang. --- test/lua/unit/siphash.lua | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'test/lua/unit') diff --git a/test/lua/unit/siphash.lua b/test/lua/unit/siphash.lua index 62a30b01a..1c773b45e 100644 --- a/test/lua/unit/siphash.lua +++ b/test/lua/unit/siphash.lua @@ -3,12 +3,27 @@ context("Siphash check functions", function() local ffi = require("ffi") ffi.cdef[[ - size_t siphash24_test(void); + void rspamd_cryptobox_init (void); + size_t siphash24_test(bool generic); + double rspamd_get_ticks (void); ]] - - test("Siphash test vectors", function() - local res = ffi.C.siphash24_test() + + ffi.C.rspamd_cryptobox_init() + + test("Siphash test reference vectors", function() + local t1 = ffi.C.rspamd_get_ticks() + local res = ffi.C.siphash24_test(true) + local t2 = ffi.C.rspamd_get_ticks() + + print("Refrence siphash: " .. tostring(t2 - t1) .. " sec") + assert_not_equal(res, 0) + end) + test("Siphash test optimized vectors", function() + local t1 = ffi.C.rspamd_get_ticks() + local res = ffi.C.siphash24_test(false) + local t2 = ffi.C.rspamd_get_ticks() + print("Optimized siphash: " .. tostring(t2 - t1) .. " sec") assert_not_equal(res, 0) end) end) \ No newline at end of file -- cgit v1.2.3