This commit is contained in:
2026-11-05 09:57:11 -05:00
parent d34388bf2c
commit 89e392cc2e
81 changed files with 12410 additions and 1135 deletions
+20 -4
View File
@@ -2,6 +2,7 @@
local target=assert(arg[1],"species_effects.lua path required")
local root=target:gsub("[^/\\]+$","")
local hearth={}
hearth.lifecycle=dofile(root.."lifecycle.lua")
hearth.botany=dofile(root.."botany.lua")(hearth,{})
hearth.wiki_articles=dofile(root.."wiki_articles.lua")
local E=dofile(target)(hearth,setmetatable({}, {__index=function(_,k) error("unexpected API access: "..k) end}))
@@ -12,20 +13,21 @@ local function entry(value,title)
for _,row in ipairs(E.describe(value)) do if row.title==title then return row end end
error("missing effect "..title)
end
test("all80 identity sources are mapped without claiming unreviewed trait evidence",function()
test("all100 identity sources are mapped without claiming unreviewed trait evidence",function()
local sources=E.sources(); local total=0
for _,r in ipairs(hearth.botany.list()) do
local s=assert(sources[r.id]); total=total+1
assert(s.source_species==r.latin and s.source_url:match("^https://en%.wikipedia%.org/wiki/"))
assert(s.identity_revision==hearth.wiki_articles[r.id].revision)
assert(s.identity_revision_url==hearth.wiki_articles[r.id].revision_url)
local article=hearth.wiki_articles[r.id]
assert(s.identity_revision==(article and article.revision))
assert(s.identity_revision_url==(article and article.revision_url))
if not s.reviewed then assert(s.note:find("no species%-effect evidence reviewed")) end
for _,row in ipairs(E.describe(r)) do
assert(row.status=="simulated" or row.status=="descriptive")
assert(row.game~="" and row.source_species==r.latin and row.source_url==s.source_url)
end
end
assert(total==80)
assert(total==100)
assert(E.source("unknown")==nil and #E.describe({id="unknown",tags={engineer=true}})==0)
end)
test("reviewed mechanisms cite species and explicitly identify broader evidence",function()
@@ -86,4 +88,18 @@ test("source and description results cannot mutate the reviewed policy",function
local sources=E.sources(); sources.alder.note="wrong"
assert(E.source("alder").note~="wrong")
end)
test("effect text matches calendar policy without laundering identity references into timing evidence",function()
assert(entry("clover","nitrogenfixer").game:find("90 real calendar days",1,true))
local fungus=entry("fly_agaric","ectomycorrhiza").game
assert(fungus:find("No accelerated growth",1,true) and not fungus:find("16200",1,true))
assert(entry("birch_polypore","saprotroph").game:find("90 real days",1,true))
assert(entry("bilberry","pollinator").game:find("at most one extra berry",1,true))
for _,r in ipairs(hearth.botany.list()) do
local text=entry(r.id,"lifecycle").game
assert(text:find("source_reported, policy_fallback or UNKNOWN",1,true))
assert(text:find("unloaded time",1,true) and text:find("never authorize automatic death",1,true))
assert(not text:find("15 minutes",1,true))
end
end)
assert(passed==8)
print("LAST_HEARTH_SPECIES_EFFECTS_PASS "..passed)