mirror of
https://github.com/BlackMATov/evolved.lua.git
synced 2026-09-27 23:37:50 +07:00
debug mode for pack/unpack and pair/unpair
This commit is contained in:
@@ -19,15 +19,3 @@ for _ = 1, 1000 do
|
||||
assert(initial_secondary == unpacked_secondary)
|
||||
assert(0 == unpacked_options)
|
||||
end
|
||||
|
||||
for _ = 1, 1000 do
|
||||
local initial_primary = math.random(1, 2 ^ 31 - 1)
|
||||
local initial_secondary = math.random(1, 2 ^ 31 - 1)
|
||||
|
||||
local packed_id = evo.pack(initial_primary, initial_secondary)
|
||||
local unpacked_primary, unpacked_secondary, unpacked_options = evo.unpack(packed_id)
|
||||
|
||||
assert(initial_primary % 2 ^ 20 == unpacked_primary)
|
||||
assert(initial_secondary % 2 ^ 20 == unpacked_secondary)
|
||||
assert(0 == unpacked_options)
|
||||
end
|
||||
|
||||
@@ -180,9 +180,20 @@ for _ = 1, math.random(1, 100) do
|
||||
|
||||
for fragment in evo.each(entity) do
|
||||
if evo.has(fragment, evo.EXPLICIT) then
|
||||
local is_fragment_included =
|
||||
query_include_set[fragment] ~= nil or
|
||||
query_include_set[evo.pair(fragment, evo.ANY)] ~= nil
|
||||
local is_fragment_included = false
|
||||
|
||||
if not is_fragment_included then
|
||||
is_fragment_included = query_include_set[fragment] ~= nil
|
||||
end
|
||||
|
||||
if not is_fragment_included and evo.is_pair(fragment) then
|
||||
local fragment_primary = evo.unpair(fragment)
|
||||
is_fragment_included = query_include_set[evo.pair(fragment_primary, evo.ANY)] ~= nil
|
||||
end
|
||||
|
||||
if not is_fragment_included and not evo.is_pair(fragment) then
|
||||
is_fragment_included = query_include_set[evo.pair(fragment, evo.ANY)] ~= nil
|
||||
end
|
||||
|
||||
if not is_fragment_included then
|
||||
is_entity_expected = false
|
||||
|
||||
Reference in New Issue
Block a user