mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2026-09-27 11:07:08 +07:00
add pack/unpack fuzz test
This commit is contained in:
@@ -15,4 +15,6 @@ basics.describe_fuzz 'develop.fuzzing.batch_destroy_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.explicit_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.pack_unpack_fuzz'
|
||||
print '----------------------------------------'
|
||||
basics.describe_fuzz 'develop.fuzzing.unique_fuzz'
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
local evo = require 'evolved'
|
||||
|
||||
evo.debug_mode(true)
|
||||
|
||||
---
|
||||
---
|
||||
---
|
||||
---
|
||||
---
|
||||
|
||||
for _ = 1, 1000 do
|
||||
local initial_index = math.random(1, 0xFFFFF)
|
||||
local initial_version = math.random(1, 0xFFFFF)
|
||||
|
||||
local packed_id = evo.pack(initial_index, initial_version)
|
||||
local unpacked_index, unpacked_version = evo.unpack(packed_id)
|
||||
|
||||
assert(initial_index == unpacked_index)
|
||||
assert(initial_version == unpacked_version)
|
||||
end
|
||||
Reference in New Issue
Block a user