Module:Sandbox/Vergir: Difference between revisionsGive feedback
Add diag entry point for count discrepancies (with help from vergir-bot LLM) |
Add diag entry point for count discrepancies (with help from vergir-bot LLM) |
||
| Line 1: | Line 1: | ||
-- Test harness for the proposed Module:GameData prop-matching change. | -- Test harness for the proposed Module:GameData prop-matching change. | ||
-- Renders with {{#invoke:Sandbox/Vergir|test}} | -- Renders with {{#invoke:Sandbox/Vergir|test}} | ||
-- Diagnostics with {{#invoke:Sandbox/Vergir|diag|TARGET|TARGET|...}} | |||
-- | -- | ||
-- Holds a copy of both the current and the proposed matching code, runs the | -- Holds a copy of both the current and the proposed matching code, runs the | ||
| Line 142: | Line 142: | ||
local cases = { | local cases = { | ||
{ target = "Type:spirit", expected = | { target = "Type:spirit", expected = 215, note = "key found at any depth" }, | ||
{ target = "Type:SPIRIT", expected = | { target = "Type:SPIRIT", expected = 215, note = "case-insensitive value" }, | ||
{ target = "Damage:spirit", expected = 0, note = "nested value must not match" }, | { target = "Damage:spirit", expected = 0, note = "nested value must not match" }, | ||
{ target = "Damage:90", expected = | { target = "Damage:90", expected = 6, note = ".Value unwrapped" }, | ||
{ target = "AbilityCharges:2", expected = | { target = "AbilityCharges:2", expected = 19, note = "number compared as string" }, | ||
{ target = "AbilityCooldown.Scale.Type", expected = 300, note = "path, no value" }, | { target = "AbilityCooldown.Scale.Type", expected = 300, note = "path, no value" }, | ||
{ target = "AbilityCooldown.Scale.Type:cooldown",expected = 299, note = "Parry scales on parry_cd" }, | { target = "AbilityCooldown.Scale.Type:cooldown",expected = 299, note = "Parry scales on parry_cd" }, | ||
| Line 243: | Line 243: | ||
return summary .. "\n" .. table.concat(out, "\n") | return summary .. "\n" .. table.concat(out, "\n") | ||
end | |||
-- Lists every ability matched by each given target, plus the dataset size. | |||
-- Used to tell a logic fault apart from the dataset having moved on. | |||
function p.diag(frame) | |||
local data = mw.loadJsonData("Data:AbilityData.json") | |||
local total = 0 | |||
for _ in pairs(data) do total = total + 1 end | |||
local out = { "Records in Data:AbilityData.json: '''" .. total .. "'''" } | |||
for i = 1, 5 do | |||
local target = frame.args[i] | |||
if target and target ~= "" then | |||
local names = select_names(data, { target }, entity_matches_new) | |||
table.insert(out, "* <code>" .. mw.text.nowiki(target) .. "</code> (" | |||
.. #names .. "): " .. table.concat(names, ", ")) | |||
end | |||
end | |||
return table.concat(out, "\n") | |||
end | end | ||
return p | return p | ||