forked from minetest-mods/MoreMesecons
Add a simple unit test for the incremental version
This commit is contained in:
parent
51febea6c3
commit
46b50003f8
@ -16,6 +16,10 @@ describe('md5', function()
|
||||
assert.equal(md5.sumhexa(''), 'd41d8cd98f00b204e9800998ecf8427e')
|
||||
assert.equal(md5.sumhexa(('1'):rep(824)), 'a126fd3611ab8d9b7e8a3384e2fa78a0')
|
||||
assert.equal(md5.sumhexa(('1'):rep(1528)), '3750b6a29d923b633e05d6ae76895664')
|
||||
local state = md5.new()
|
||||
state:update('Hello')
|
||||
state:update(', World!')
|
||||
assert.equal(md5.tohex(state:finish()), '65a8e27d8879283831b664bd8b7f0ad4')
|
||||
end)
|
||||
end)
|
||||
|
||||
@ -27,6 +31,10 @@ describe('md5', function()
|
||||
assert.equal(md5.sum(''), hex2bin 'd41d8cd98f00b204e9800998ecf8427e')
|
||||
assert.equal(md5.sum(('1'):rep(824)), hex2bin 'a126fd3611ab8d9b7e8a3384e2fa78a0')
|
||||
assert.equal(md5.sum(('1'):rep(1528)), hex2bin '3750b6a29d923b633e05d6ae76895664')
|
||||
local state = md5.new()
|
||||
state:update('Hello')
|
||||
state:update(', World!')
|
||||
assert.equal(state:finish(), hex2bin '65a8e27d8879283831b664bd8b7f0ad4')
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user