From b8c10dac99316974d142c530356ad5cd8fdf9afa Mon Sep 17 00:00:00 2001 From: ame Date: Fri, 5 Apr 2024 22:15:55 -0500 Subject: + + final fixes --- tests/hash.lua | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'tests/hash.lua') diff --git a/tests/hash.lua b/tests/hash.lua index 23714a9..edc754b 100644 --- a/tests/hash.lua +++ b/tests/hash.lua @@ -11,6 +11,8 @@ function test(name,b,exp,oargs) local hash2 local hash3 local hash4 + local hash5 + local hash6 local add = "" if oargs == nil then hash = llib.crypto[name](b) @@ -22,8 +24,32 @@ function test(name,b,exp,oargs) if(llib.crypto[name.."_init"] ~= nil) then if(oargs == nil) then hash2 = llib.crypto[name]():update(b):final() - else + hash5 = llib.crypto[name]() + hash6 = hash5 + b; + hash5 = hash5:final() + else hash2 = llib.crypto[name](table.unpack(oargs)):update(b):final() + hash5 = llib.crypto[name](table.unpack(oargs)) + hash6 = hash5 + b; + hash5 = hash5:final() + end + + if(hash5 ~= exp) then + fail = true + functions_failed = functions_failed + 1 + llib.io.error(name.." + then final method not working, got:\n\t"..hash5.." other was:\n\t"..exp) + else + functions_working = functions_working + 1 + llib.io.log(name.." + then final method working "..hash5.." == "..exp) + end + + if(hash6 ~= exp) then + fail = true + functions_failed = functions_failed + 1 + llib.io.error(name.." + method not working, got:\n\t"..hash6.." other was:\n\t"..exp) + else + functions_working = functions_working + 1 + llib.io.log(name.." + method working "..hash6.." == "..exp) end if(oargs == nil) then @@ -85,7 +111,6 @@ function test(name,b,exp,oargs) else hashes_working=hashes_working + 1 end - end test("adler32","meow","043c01b9") -- cgit v1.2.3